Mark ChangeLog
[official-gcc.git] / gcc / cfgexpand.c
blob9cd34987fb5d5c33767e7dc0832082ac43c70972
1 /* A pass for lowering trees to RTL.
2 Copyright (C) 2004, 2005 Free Software Foundation, Inc.
4 This file is part of GCC.
6 GCC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
11 GCC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING. If not, write to
18 the Free Software Foundation, 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
21 #include "config.h"
22 #include "system.h"
23 #include "coretypes.h"
24 #include "tm.h"
25 #include "tree.h"
26 #include "rtl.h"
27 #include "tm_p.h"
28 #include "basic-block.h"
29 #include "function.h"
30 #include "expr.h"
31 #include "langhooks.h"
32 #include "tree-flow.h"
33 #include "timevar.h"
34 #include "tree-dump.h"
35 #include "tree-pass.h"
36 #include "except.h"
37 #include "flags.h"
38 #include "diagnostic.h"
39 #include "toplev.h"
41 /* Verify that there is exactly single jump instruction since last and attach
42 REG_BR_PROB note specifying probability.
43 ??? We really ought to pass the probability down to RTL expanders and let it
44 re-distribute it when the conditional expands into multiple conditionals.
45 This is however difficult to do. */
46 static void
47 add_reg_br_prob_note (FILE *dump_file, rtx last, int probability)
49 if (profile_status == PROFILE_ABSENT)
50 return;
51 for (last = NEXT_INSN (last); last && NEXT_INSN (last); last = NEXT_INSN (last))
52 if (GET_CODE (last) == JUMP_INSN)
54 /* It is common to emit condjump-around-jump sequence when we don't know
55 how to reverse the conditional. Special case this. */
56 if (!any_condjump_p (last)
57 || GET_CODE (NEXT_INSN (last)) != JUMP_INSN
58 || !simplejump_p (NEXT_INSN (last))
59 || GET_CODE (NEXT_INSN (NEXT_INSN (last))) != BARRIER
60 || GET_CODE (NEXT_INSN (NEXT_INSN (NEXT_INSN (last)))) != CODE_LABEL
61 || NEXT_INSN (NEXT_INSN (NEXT_INSN (NEXT_INSN (last)))))
62 goto failed;
63 if (find_reg_note (last, REG_BR_PROB, 0))
64 abort ();
65 REG_NOTES (last)
66 = gen_rtx_EXPR_LIST (REG_BR_PROB,
67 GEN_INT (REG_BR_PROB_BASE - probability),
68 REG_NOTES (last));
69 return;
71 if (!last || GET_CODE (last) != JUMP_INSN || !any_condjump_p (last))
72 goto failed;
73 if (find_reg_note (last, REG_BR_PROB, 0))
74 abort ();
75 REG_NOTES (last)
76 = gen_rtx_EXPR_LIST (REG_BR_PROB,
77 GEN_INT (probability), REG_NOTES (last));
78 return;
79 failed:
80 if (dump_file)
81 fprintf (dump_file, "Failed to add probability note\n");
85 #ifndef LOCAL_ALIGNMENT
86 #define LOCAL_ALIGNMENT(TYPE, ALIGNMENT) ALIGNMENT
87 #endif
89 #ifndef STACK_ALIGNMENT_NEEDED
90 #define STACK_ALIGNMENT_NEEDED 1
91 #endif
93 #ifdef FRAME_GROWS_DOWNWARD
94 # undef FRAME_GROWS_DOWNWARD
95 # define FRAME_GROWS_DOWNWARD 1
96 #else
97 # define FRAME_GROWS_DOWNWARD 0
98 #endif
101 /* This structure holds data relevant to one variable that will be
102 placed in a stack slot. */
103 struct stack_var
105 /* The Variable. */
106 tree decl;
108 /* The offset of the variable. During partitioning, this is the
109 offset relative to the partition. After partitioning, this
110 is relative to the stack frame. */
111 HOST_WIDE_INT offset;
113 /* Initially, the size of the variable. Later, the size of the partition,
114 if this variable becomes it's partition's representative. */
115 HOST_WIDE_INT size;
117 /* The *byte* alignment required for this variable. Or as, with the
118 size, the alignment for this partition. */
119 unsigned int alignb;
121 /* The partition representative. */
122 size_t representative;
124 /* The next stack variable in the partition, or EOC. */
125 size_t next;
128 #define EOC ((size_t)-1)
130 /* We have an array of such objects while deciding allocation. */
131 static struct stack_var *stack_vars;
132 static size_t stack_vars_alloc;
133 static size_t stack_vars_num;
135 /* An array of indicies such that stack_vars[stack_vars_sorted[i]].size
136 is non-decreasing. */
137 static size_t *stack_vars_sorted;
139 /* We have an interference graph between such objects. This graph
140 is lower triangular. */
141 static bool *stack_vars_conflict;
142 static size_t stack_vars_conflict_alloc;
144 /* The phase of the stack frame. This is the known misalignment of
145 virtual_stack_vars_rtx from PREFERRED_STACK_BOUNDARY. That is,
146 (frame_offset+frame_phase) % PREFERRED_STACK_BOUNDARY == 0. */
147 static int frame_phase;
150 /* Discover the byte alignment to use for DECL. Ignore alignment
151 we can't do with expected alignment of the stack boundary. */
153 static unsigned int
154 get_decl_align_unit (tree decl)
156 unsigned int align;
158 align = DECL_ALIGN (decl);
159 align = LOCAL_ALIGNMENT (TREE_TYPE (decl), align);
160 if (align > PREFERRED_STACK_BOUNDARY)
161 align = PREFERRED_STACK_BOUNDARY;
162 if (cfun->stack_alignment_needed < align)
163 cfun->stack_alignment_needed = align;
165 return align / BITS_PER_UNIT;
168 /* Allocate SIZE bytes at byte alignment ALIGN from the stack frame.
169 Return the frame offset. */
171 static HOST_WIDE_INT
172 alloc_stack_frame_space (HOST_WIDE_INT size, HOST_WIDE_INT align)
174 HOST_WIDE_INT offset, new_frame_offset;
176 new_frame_offset = frame_offset;
177 if (FRAME_GROWS_DOWNWARD)
179 new_frame_offset -= size + frame_phase;
180 new_frame_offset &= -align;
181 new_frame_offset += frame_phase;
182 offset = new_frame_offset;
184 else
186 new_frame_offset -= frame_phase;
187 new_frame_offset += align - 1;
188 new_frame_offset &= -align;
189 new_frame_offset += frame_phase;
190 offset = new_frame_offset;
191 new_frame_offset += size;
193 frame_offset = new_frame_offset;
195 return offset;
198 /* Accumulate DECL into STACK_VARS. */
200 static void
201 add_stack_var (tree decl)
203 if (stack_vars_num >= stack_vars_alloc)
205 if (stack_vars_alloc)
206 stack_vars_alloc = stack_vars_alloc * 3 / 2;
207 else
208 stack_vars_alloc = 32;
209 stack_vars
210 = XRESIZEVEC (struct stack_var, stack_vars, stack_vars_alloc);
212 stack_vars[stack_vars_num].decl = decl;
213 stack_vars[stack_vars_num].offset = 0;
214 stack_vars[stack_vars_num].size = tree_low_cst (DECL_SIZE_UNIT (decl), 1);
215 stack_vars[stack_vars_num].alignb = get_decl_align_unit (decl);
217 /* All variables are initially in their own partition. */
218 stack_vars[stack_vars_num].representative = stack_vars_num;
219 stack_vars[stack_vars_num].next = EOC;
221 /* Ensure that this decl doesn't get put onto the list twice. */
222 SET_DECL_RTL (decl, pc_rtx);
224 stack_vars_num++;
227 /* Compute the linear index of a lower-triangular coordinate (I, J). */
229 static size_t
230 triangular_index (size_t i, size_t j)
232 if (i < j)
234 size_t t;
235 t = i, i = j, j = t;
237 return (i * (i + 1)) / 2 + j;
240 /* Ensure that STACK_VARS_CONFLICT is large enough for N objects. */
242 static void
243 resize_stack_vars_conflict (size_t n)
245 size_t size = triangular_index (n-1, n-1) + 1;
247 if (size <= stack_vars_conflict_alloc)
248 return;
250 stack_vars_conflict = XRESIZEVEC (bool, stack_vars_conflict, size);
251 memset (stack_vars_conflict + stack_vars_conflict_alloc, 0,
252 (size - stack_vars_conflict_alloc) * sizeof (bool));
253 stack_vars_conflict_alloc = size;
256 /* Make the decls associated with luid's X and Y conflict. */
258 static void
259 add_stack_var_conflict (size_t x, size_t y)
261 size_t index = triangular_index (x, y);
262 gcc_assert (index < stack_vars_conflict_alloc);
263 stack_vars_conflict[index] = true;
266 /* Check whether the decls associated with luid's X and Y conflict. */
268 static bool
269 stack_var_conflict_p (size_t x, size_t y)
271 size_t index = triangular_index (x, y);
272 gcc_assert (index < stack_vars_conflict_alloc);
273 return stack_vars_conflict[index];
276 /* Returns true if TYPE is or contains a union type. */
278 static bool
279 aggregate_contains_union_type (tree type)
281 tree field;
283 if (TREE_CODE (type) == UNION_TYPE
284 || TREE_CODE (type) == QUAL_UNION_TYPE)
285 return true;
286 if (TREE_CODE (type) == ARRAY_TYPE)
287 return aggregate_contains_union_type (TREE_TYPE (type));
288 if (TREE_CODE (type) != RECORD_TYPE)
289 return false;
291 for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
292 if (TREE_CODE (field) == FIELD_DECL)
293 if (aggregate_contains_union_type (TREE_TYPE (field)))
294 return true;
296 return false;
299 /* A subroutine of expand_used_vars. If two variables X and Y have alias
300 sets that do not conflict, then do add a conflict for these variables
301 in the interference graph. We also need to make sure to add conflicts
302 for union containing structures. Else RTL alias analysis comes along
303 and due to type based aliasing rules decides that for two overlapping
304 union temporaries { short s; int i; } accesses to the same mem through
305 different types may not alias and happily reorders stores across
306 life-time boundaries of the temporaries (See PR25654).
307 We also have to mind MEM_IN_STRUCT_P and MEM_SCALAR_P. */
309 static void
310 add_alias_set_conflicts (void)
312 size_t i, j, n = stack_vars_num;
314 for (i = 0; i < n; ++i)
316 tree type_i = TREE_TYPE (stack_vars[i].decl);
317 bool aggr_i = AGGREGATE_TYPE_P (type_i);
318 bool contains_union;
320 contains_union = aggregate_contains_union_type (type_i);
321 for (j = 0; j < i; ++j)
323 tree type_j = TREE_TYPE (stack_vars[j].decl);
324 bool aggr_j = AGGREGATE_TYPE_P (type_j);
325 if (aggr_i != aggr_j
326 /* Either the objects conflict by means of type based
327 aliasing rules, or we need to add a conflict. */
328 || !objects_must_conflict_p (type_i, type_j)
329 /* In case the types do not conflict ensure that access
330 to elements will conflict. In case of unions we have
331 to be careful as type based aliasing rules may say
332 access to the same memory does not conflict. So play
333 safe and add a conflict in this case. */
334 || contains_union)
335 add_stack_var_conflict (i, j);
340 /* A subroutine of partition_stack_vars. A comparison function for qsort,
341 sorting an array of indicies by the size of the object. */
343 static int
344 stack_var_size_cmp (const void *a, const void *b)
346 HOST_WIDE_INT sa = stack_vars[*(const size_t *)a].size;
347 HOST_WIDE_INT sb = stack_vars[*(const size_t *)b].size;
349 if (sa < sb)
350 return -1;
351 if (sa > sb)
352 return 1;
353 return 0;
356 /* A subroutine of partition_stack_vars. The UNION portion of a UNION/FIND
357 partitioning algorithm. Partitions A and B are known to be non-conflicting.
358 Merge them into a single partition A.
360 At the same time, add OFFSET to all variables in partition B. At the end
361 of the partitioning process we've have a nice block easy to lay out within
362 the stack frame. */
364 static void
365 union_stack_vars (size_t a, size_t b, HOST_WIDE_INT offset)
367 size_t i, last;
369 /* Update each element of partition B with the given offset,
370 and merge them into partition A. */
371 for (last = i = b; i != EOC; last = i, i = stack_vars[i].next)
373 stack_vars[i].offset += offset;
374 stack_vars[i].representative = a;
376 stack_vars[last].next = stack_vars[a].next;
377 stack_vars[a].next = b;
379 /* Update the required alignment of partition A to account for B. */
380 if (stack_vars[a].alignb < stack_vars[b].alignb)
381 stack_vars[a].alignb = stack_vars[b].alignb;
383 /* Update the interference graph and merge the conflicts. */
384 for (last = stack_vars_num, i = 0; i < last; ++i)
385 if (stack_var_conflict_p (b, i))
386 add_stack_var_conflict (a, i);
389 /* A subroutine of expand_used_vars. Binpack the variables into
390 partitions constrained by the interference graph. The overall
391 algorithm used is as follows:
393 Sort the objects by size.
394 For each object A {
395 S = size(A)
396 O = 0
397 loop {
398 Look for the largest non-conflicting object B with size <= S.
399 UNION (A, B)
400 offset(B) = O
401 O += size(B)
402 S -= size(B)
407 static void
408 partition_stack_vars (void)
410 size_t si, sj, n = stack_vars_num;
412 stack_vars_sorted = XNEWVEC (size_t, stack_vars_num);
413 for (si = 0; si < n; ++si)
414 stack_vars_sorted[si] = si;
416 if (n == 1)
417 return;
419 qsort (stack_vars_sorted, n, sizeof (size_t), stack_var_size_cmp);
421 /* Special case: detect when all variables conflict, and thus we can't
422 do anything during the partitioning loop. It isn't uncommon (with
423 C code at least) to declare all variables at the top of the function,
424 and if we're not inlining, then all variables will be in the same scope.
425 Take advantage of very fast libc routines for this scan. */
426 gcc_assert (sizeof(bool) == sizeof(char));
427 if (memchr (stack_vars_conflict, false, stack_vars_conflict_alloc) == NULL)
428 return;
430 for (si = 0; si < n; ++si)
432 size_t i = stack_vars_sorted[si];
433 HOST_WIDE_INT isize = stack_vars[i].size;
434 HOST_WIDE_INT offset = 0;
436 for (sj = si; sj-- > 0; )
438 size_t j = stack_vars_sorted[sj];
439 HOST_WIDE_INT jsize = stack_vars[j].size;
440 unsigned int jalign = stack_vars[j].alignb;
442 /* Ignore objects that aren't partition representatives. */
443 if (stack_vars[j].representative != j)
444 continue;
446 /* Ignore objects too large for the remaining space. */
447 if (isize < jsize)
448 continue;
450 /* Ignore conflicting objects. */
451 if (stack_var_conflict_p (i, j))
452 continue;
454 /* Refine the remaining space check to include alignment. */
455 if (offset & (jalign - 1))
457 HOST_WIDE_INT toff = offset;
458 toff += jalign - 1;
459 toff &= -(HOST_WIDE_INT)jalign;
460 if (isize - (toff - offset) < jsize)
461 continue;
463 isize -= toff - offset;
464 offset = toff;
467 /* UNION the objects, placing J at OFFSET. */
468 union_stack_vars (i, j, offset);
470 isize -= jsize;
471 if (isize == 0)
472 break;
477 /* A debugging aid for expand_used_vars. Dump the generated partitions. */
479 static void
480 dump_stack_var_partition (void)
482 size_t si, i, j, n = stack_vars_num;
484 for (si = 0; si < n; ++si)
486 i = stack_vars_sorted[si];
488 /* Skip variables that aren't partition representatives, for now. */
489 if (stack_vars[i].representative != i)
490 continue;
492 fprintf (dump_file, "Partition %lu: size " HOST_WIDE_INT_PRINT_DEC
493 " align %u\n", (unsigned long) i, stack_vars[i].size,
494 stack_vars[i].alignb);
496 for (j = i; j != EOC; j = stack_vars[j].next)
498 fputc ('\t', dump_file);
499 print_generic_expr (dump_file, stack_vars[j].decl, dump_flags);
500 fprintf (dump_file, ", offset " HOST_WIDE_INT_PRINT_DEC "\n",
501 stack_vars[i].offset);
506 /* Assign rtl to DECL at frame offset OFFSET. */
508 static void
509 expand_one_stack_var_at (tree decl, HOST_WIDE_INT offset)
511 HOST_WIDE_INT align;
512 rtx x;
514 /* If this fails, we've overflowed the stack frame. Error nicely? */
515 gcc_assert (offset == trunc_int_for_mode (offset, Pmode));
517 x = plus_constant (virtual_stack_vars_rtx, offset);
518 x = gen_rtx_MEM (DECL_MODE (decl), x);
520 /* Set alignment we actually gave this decl. */
521 offset -= frame_phase;
522 align = offset & -offset;
523 align *= BITS_PER_UNIT;
524 if (align > STACK_BOUNDARY || align == 0)
525 align = STACK_BOUNDARY;
526 DECL_ALIGN (decl) = align;
527 DECL_USER_ALIGN (decl) = 0;
529 set_mem_attributes (x, decl, true);
530 SET_DECL_RTL (decl, x);
533 /* A subroutine of expand_used_vars. Give each partition representative
534 a unique location within the stack frame. Update each partition member
535 with that location. */
537 static void
538 expand_stack_vars (void)
540 size_t si, i, j, n = stack_vars_num;
542 for (si = 0; si < n; ++si)
544 HOST_WIDE_INT offset;
546 i = stack_vars_sorted[si];
548 /* Skip variables that aren't partition representatives, for now. */
549 if (stack_vars[i].representative != i)
550 continue;
552 offset = alloc_stack_frame_space (stack_vars[i].size,
553 stack_vars[i].alignb);
555 /* Create rtl for each variable based on their location within the
556 partition. */
557 for (j = i; j != EOC; j = stack_vars[j].next)
558 expand_one_stack_var_at (stack_vars[j].decl,
559 stack_vars[j].offset + offset);
563 /* A subroutine of expand_one_var. Called to immediately assign rtl
564 to a variable to be allocated in the stack frame. */
566 static void
567 expand_one_stack_var (tree var)
569 HOST_WIDE_INT size, offset, align;
571 size = tree_low_cst (DECL_SIZE_UNIT (var), 1);
572 align = get_decl_align_unit (var);
573 offset = alloc_stack_frame_space (size, align);
575 expand_one_stack_var_at (var, offset);
578 /* A subroutine of expand_one_var. Called to assign rtl
579 to a TREE_STATIC VAR_DECL. */
581 static void
582 expand_one_static_var (tree var)
584 /* If this is an inlined copy of a static local variable,
585 look up the original. */
586 var = DECL_ORIGIN (var);
588 /* If we've already processed this variable because of that, do nothing. */
589 if (TREE_ASM_WRITTEN (var))
590 return;
592 /* Give the front end a chance to do whatever. In practice, this is
593 resolving duplicate names for IMA in C. */
594 if (lang_hooks.expand_decl (var))
595 return;
597 /* Otherwise, just emit the variable. */
598 rest_of_decl_compilation (var, 0, 0);
601 /* A subroutine of expand_one_var. Called to assign rtl to a VAR_DECL
602 that will reside in a hard register. */
604 static void
605 expand_one_hard_reg_var (tree var)
607 rest_of_decl_compilation (var, 0, 0);
610 /* A subroutine of expand_one_var. Called to assign rtl to a VAR_DECL
611 that will reside in a pseudo register. */
613 static void
614 expand_one_register_var (tree var)
616 tree type = TREE_TYPE (var);
617 int unsignedp = TYPE_UNSIGNED (type);
618 enum machine_mode reg_mode
619 = promote_mode (type, DECL_MODE (var), &unsignedp, 0);
620 rtx x = gen_reg_rtx (reg_mode);
622 SET_DECL_RTL (var, x);
624 /* Note if the object is a user variable. */
625 if (!DECL_ARTIFICIAL (var))
627 mark_user_reg (x);
629 /* Trust user variables which have a pointer type to really
630 be pointers. Do not trust compiler generated temporaries
631 as our type system is totally busted as it relates to
632 pointer arithmetic which translates into lots of compiler
633 generated objects with pointer types, but which are not really
634 pointers. */
635 if (POINTER_TYPE_P (type))
636 mark_reg_pointer (x, TYPE_ALIGN (TREE_TYPE (TREE_TYPE (var))));
640 /* A subroutine of expand_one_var. Called to assign rtl to a VAR_DECL that
641 has some associated error, e.g. it's type is error-mark. We just need
642 to pick something that won't crash the rest of the compiler. */
644 static void
645 expand_one_error_var (tree var)
647 enum machine_mode mode = DECL_MODE (var);
648 rtx x;
650 if (mode == BLKmode)
651 x = gen_rtx_MEM (BLKmode, const0_rtx);
652 else if (mode == VOIDmode)
653 x = const0_rtx;
654 else
655 x = gen_reg_rtx (mode);
657 SET_DECL_RTL (var, x);
660 /* A subroutine of expand_one_var. VAR is a variable that will be
661 allocated to the local stack frame. Return true if we wish to
662 add VAR to STACK_VARS so that it will be coalesced with other
663 variables. Return false to allocate VAR immediately.
665 This function is used to reduce the number of variables considered
666 for coalescing, which reduces the size of the quadratic problem. */
668 static bool
669 defer_stack_allocation (tree var, bool toplevel)
671 /* Variables in the outermost scope automatically conflict with
672 every other variable. The only reason to want to defer them
673 at all is that, after sorting, we can more efficiently pack
674 small variables in the stack frame. Continue to defer at -O2. */
675 if (toplevel && optimize < 2)
676 return false;
678 /* Without optimization, *most* variables are allocated from the
679 stack, which makes the quadratic problem large exactly when we
680 want compilation to proceed as quickly as possible. On the
681 other hand, we don't want the function's stack frame size to
682 get completely out of hand. So we avoid adding scalars and
683 "small" aggregates to the list at all. */
684 if (optimize == 0 && tree_low_cst (DECL_SIZE_UNIT (var), 1) < 32)
685 return false;
687 return true;
690 /* A subroutine of expand_used_vars. Expand one variable according to
691 its flavor. Variables to be placed on the stack are not actually
692 expanded yet, merely recorded. */
694 static void
695 expand_one_var (tree var, bool toplevel)
697 if (TREE_CODE (var) != VAR_DECL)
698 lang_hooks.expand_decl (var);
699 else if (DECL_EXTERNAL (var))
701 else if (DECL_VALUE_EXPR (var))
703 else if (TREE_STATIC (var))
704 expand_one_static_var (var);
705 else if (DECL_RTL_SET_P (var))
707 else if (TREE_TYPE (var) == error_mark_node)
708 expand_one_error_var (var);
709 else if (DECL_HARD_REGISTER (var))
710 expand_one_hard_reg_var (var);
711 else if (use_register_for_decl (var))
712 expand_one_register_var (var);
713 else if (defer_stack_allocation (var, toplevel))
714 add_stack_var (var);
715 else
716 expand_one_stack_var (var);
719 /* A subroutine of expand_used_vars. Walk down through the BLOCK tree
720 expanding variables. Those variables that can be put into registers
721 are allocated pseudos; those that can't are put on the stack.
723 TOPLEVEL is true if this is the outermost BLOCK. */
725 static void
726 expand_used_vars_for_block (tree block, bool toplevel)
728 size_t i, j, old_sv_num, this_sv_num, new_sv_num;
729 tree t;
731 old_sv_num = toplevel ? 0 : stack_vars_num;
733 /* Expand all variables at this level. */
734 for (t = BLOCK_VARS (block); t ; t = TREE_CHAIN (t))
735 if (TREE_USED (t))
736 expand_one_var (t, toplevel);
738 this_sv_num = stack_vars_num;
740 /* Expand all variables at containing levels. */
741 for (t = BLOCK_SUBBLOCKS (block); t ; t = BLOCK_CHAIN (t))
742 expand_used_vars_for_block (t, false);
744 /* Since we do not track exact variable lifetimes (which is not even
745 possible for varibles whose address escapes), we mirror the block
746 tree in the interference graph. Here we cause all variables at this
747 level, and all sublevels, to conflict. Do make certain that a
748 variable conflicts with itself. */
749 if (old_sv_num < this_sv_num)
751 new_sv_num = stack_vars_num;
752 resize_stack_vars_conflict (new_sv_num);
754 for (i = old_sv_num; i < new_sv_num; ++i)
755 for (j = i < this_sv_num ? i+1 : this_sv_num; j-- > old_sv_num ;)
756 add_stack_var_conflict (i, j);
760 /* A subroutine of expand_used_vars. Walk down through the BLOCK tree
761 and clear TREE_USED on all local variables. */
763 static void
764 clear_tree_used (tree block)
766 tree t;
768 for (t = BLOCK_VARS (block); t ; t = TREE_CHAIN (t))
769 /* if (!TREE_STATIC (t) && !DECL_EXTERNAL (t)) */
770 TREE_USED (t) = 0;
772 for (t = BLOCK_SUBBLOCKS (block); t ; t = BLOCK_CHAIN (t))
773 clear_tree_used (t);
776 /* Expand all variables used in the function. */
778 static void
779 expand_used_vars (void)
781 tree t, outer_block = DECL_INITIAL (current_function_decl);
783 /* Compute the phase of the stack frame for this function. */
785 int align = PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT;
786 int off = STARTING_FRAME_OFFSET % align;
787 frame_phase = off ? align - off : 0;
790 /* Set TREE_USED on all variables in the unexpanded_var_list. */
791 for (t = cfun->unexpanded_var_list; t; t = TREE_CHAIN (t))
792 TREE_USED (TREE_VALUE (t)) = 1;
794 /* Clear TREE_USED on all variables associated with a block scope. */
795 clear_tree_used (outer_block);
797 /* At this point all variables on the unexpanded_var_list with TREE_USED
798 set are not associated with any block scope. Lay them out. */
799 for (t = cfun->unexpanded_var_list; t; t = TREE_CHAIN (t))
801 tree var = TREE_VALUE (t);
802 bool expand_now = false;
804 /* We didn't set a block for static or extern because it's hard
805 to tell the difference between a global variable (re)declared
806 in a local scope, and one that's really declared there to
807 begin with. And it doesn't really matter much, since we're
808 not giving them stack space. Expand them now. */
809 if (TREE_STATIC (var) || DECL_EXTERNAL (var))
810 expand_now = true;
812 /* Any variable that could have been hoisted into an SSA_NAME
813 will have been propagated anywhere the optimizers chose,
814 i.e. not confined to their original block. Allocate them
815 as if they were defined in the outermost scope. */
816 else if (is_gimple_reg (var))
817 expand_now = true;
819 /* If the variable is not associated with any block, then it
820 was created by the optimizers, and could be live anywhere
821 in the function. */
822 else if (TREE_USED (var))
823 expand_now = true;
825 /* Finally, mark all variables on the list as used. We'll use
826 this in a moment when we expand those associated with scopes. */
827 TREE_USED (var) = 1;
829 if (expand_now)
830 expand_one_var (var, true);
832 cfun->unexpanded_var_list = NULL_TREE;
834 /* At this point, all variables within the block tree with TREE_USED
835 set are actually used by the optimized function. Lay them out. */
836 expand_used_vars_for_block (outer_block, true);
838 if (stack_vars_num > 0)
840 /* Due to the way alias sets work, no variables with non-conflicting
841 alias sets may be assigned the same address. Add conflicts to
842 reflect this. */
843 add_alias_set_conflicts ();
845 /* Now that we have collected all stack variables, and have computed a
846 minimal interference graph, attempt to save some stack space. */
847 partition_stack_vars ();
848 if (dump_file)
849 dump_stack_var_partition ();
851 /* Assign rtl to each variable based on these partitions. */
852 expand_stack_vars ();
854 /* Free up stack variable graph data. */
855 XDELETEVEC (stack_vars);
856 XDELETEVEC (stack_vars_sorted);
857 XDELETEVEC (stack_vars_conflict);
858 stack_vars = NULL;
859 stack_vars_alloc = stack_vars_num = 0;
860 stack_vars_conflict = NULL;
861 stack_vars_conflict_alloc = 0;
864 /* If the target requires that FRAME_OFFSET be aligned, do it. */
865 if (STACK_ALIGNMENT_NEEDED)
867 HOST_WIDE_INT align = PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT;
868 if (!FRAME_GROWS_DOWNWARD)
869 frame_offset += align - 1;
870 frame_offset &= -align;
875 /* If we need to produce a detailed dump, print the tree representation
876 for STMT to the dump file. SINCE is the last RTX after which the RTL
877 generated for STMT should have been appended. */
879 static void
880 maybe_dump_rtl_for_tree_stmt (tree stmt, rtx since)
882 if (dump_file && (dump_flags & TDF_DETAILS))
884 fprintf (dump_file, "\n;; ");
885 print_generic_expr (dump_file, stmt, TDF_SLIM);
886 fprintf (dump_file, "\n");
888 print_rtl (dump_file, since ? NEXT_INSN (since) : since);
892 /* A subroutine of expand_gimple_basic_block. Expand one COND_EXPR.
893 Returns a new basic block if we've terminated the current basic
894 block and created a new one. */
896 static basic_block
897 expand_gimple_cond_expr (basic_block bb, tree stmt)
899 basic_block new_bb, dest;
900 edge new_edge;
901 edge true_edge;
902 edge false_edge;
903 tree pred = COND_EXPR_COND (stmt);
904 tree then_exp = COND_EXPR_THEN (stmt);
905 tree else_exp = COND_EXPR_ELSE (stmt);
906 rtx last2, last;
908 last2 = last = get_last_insn ();
910 extract_true_false_edges_from_block (bb, &true_edge, &false_edge);
911 if (EXPR_LOCUS (stmt))
913 emit_line_note (*(EXPR_LOCUS (stmt)));
914 record_block_change (TREE_BLOCK (stmt));
917 /* These flags have no purpose in RTL land. */
918 true_edge->flags &= ~EDGE_TRUE_VALUE;
919 false_edge->flags &= ~EDGE_FALSE_VALUE;
921 /* We can either have a pure conditional jump with one fallthru edge or
922 two-way jump that needs to be decomposed into two basic blocks. */
923 if (TREE_CODE (then_exp) == GOTO_EXPR && IS_EMPTY_STMT (else_exp))
925 jumpif (pred, label_rtx (GOTO_DESTINATION (then_exp)));
926 add_reg_br_prob_note (dump_file, last, true_edge->probability);
927 maybe_dump_rtl_for_tree_stmt (stmt, last);
928 if (EXPR_LOCUS (then_exp))
929 emit_line_note (*(EXPR_LOCUS (then_exp)));
930 return NULL;
932 if (TREE_CODE (else_exp) == GOTO_EXPR && IS_EMPTY_STMT (then_exp))
934 jumpifnot (pred, label_rtx (GOTO_DESTINATION (else_exp)));
935 add_reg_br_prob_note (dump_file, last, false_edge->probability);
936 maybe_dump_rtl_for_tree_stmt (stmt, last);
937 if (EXPR_LOCUS (else_exp))
938 emit_line_note (*(EXPR_LOCUS (else_exp)));
939 return NULL;
941 gcc_assert (TREE_CODE (then_exp) == GOTO_EXPR
942 && TREE_CODE (else_exp) == GOTO_EXPR);
944 jumpif (pred, label_rtx (GOTO_DESTINATION (then_exp)));
945 add_reg_br_prob_note (dump_file, last, true_edge->probability);
946 last = get_last_insn ();
947 expand_expr (else_exp, const0_rtx, VOIDmode, 0);
949 BB_END (bb) = last;
950 if (BARRIER_P (BB_END (bb)))
951 BB_END (bb) = PREV_INSN (BB_END (bb));
952 update_bb_for_insn (bb);
954 new_bb = create_basic_block (NEXT_INSN (last), get_last_insn (), bb);
955 dest = false_edge->dest;
956 redirect_edge_succ (false_edge, new_bb);
957 false_edge->flags |= EDGE_FALLTHRU;
958 new_bb->count = false_edge->count;
959 new_bb->frequency = EDGE_FREQUENCY (false_edge);
960 new_edge = make_edge (new_bb, dest, 0);
961 new_edge->probability = REG_BR_PROB_BASE;
962 new_edge->count = new_bb->count;
963 if (BARRIER_P (BB_END (new_bb)))
964 BB_END (new_bb) = PREV_INSN (BB_END (new_bb));
965 update_bb_for_insn (new_bb);
967 maybe_dump_rtl_for_tree_stmt (stmt, last2);
969 if (EXPR_LOCUS (else_exp))
970 emit_line_note (*(EXPR_LOCUS (else_exp)));
972 return new_bb;
975 /* A subroutine of expand_gimple_basic_block. Expand one CALL_EXPR
976 that has CALL_EXPR_TAILCALL set. Returns non-null if we actually
977 generated a tail call (something that might be denied by the ABI
978 rules governing the call; see calls.c).
980 Sets CAN_FALLTHRU if we generated a *conditional* tail call, and
981 can still reach the rest of BB. The case here is __builtin_sqrt,
982 where the NaN result goes through the external function (with a
983 tailcall) and the normal result happens via a sqrt instruction. */
985 static basic_block
986 expand_gimple_tailcall (basic_block bb, tree stmt, bool *can_fallthru)
988 rtx last2, last;
989 edge e;
990 edge_iterator ei;
991 int probability;
992 gcov_type count;
994 last2 = last = get_last_insn ();
996 expand_expr_stmt (stmt);
998 for (last = NEXT_INSN (last); last; last = NEXT_INSN (last))
999 if (CALL_P (last) && SIBLING_CALL_P (last))
1000 goto found;
1002 maybe_dump_rtl_for_tree_stmt (stmt, last2);
1004 *can_fallthru = true;
1005 return NULL;
1007 found:
1008 /* ??? Wouldn't it be better to just reset any pending stack adjust?
1009 Any instructions emitted here are about to be deleted. */
1010 do_pending_stack_adjust ();
1012 /* Remove any non-eh, non-abnormal edges that don't go to exit. */
1013 /* ??? I.e. the fallthrough edge. HOWEVER! If there were to be
1014 EH or abnormal edges, we shouldn't have created a tail call in
1015 the first place. So it seems to me we should just be removing
1016 all edges here, or redirecting the existing fallthru edge to
1017 the exit block. */
1019 probability = 0;
1020 count = 0;
1022 for (ei = ei_start (bb->succs); (e = ei_safe_edge (ei)); )
1024 if (!(e->flags & (EDGE_ABNORMAL | EDGE_EH)))
1026 if (e->dest != EXIT_BLOCK_PTR)
1028 e->dest->count -= e->count;
1029 e->dest->frequency -= EDGE_FREQUENCY (e);
1030 if (e->dest->count < 0)
1031 e->dest->count = 0;
1032 if (e->dest->frequency < 0)
1033 e->dest->frequency = 0;
1035 count += e->count;
1036 probability += e->probability;
1037 remove_edge (e);
1039 else
1040 ei_next (&ei);
1043 /* This is somewhat ugly: the call_expr expander often emits instructions
1044 after the sibcall (to perform the function return). These confuse the
1045 find_sub_basic_blocks code, so we need to get rid of these. */
1046 last = NEXT_INSN (last);
1047 gcc_assert (BARRIER_P (last));
1049 *can_fallthru = false;
1050 while (NEXT_INSN (last))
1052 /* For instance an sqrt builtin expander expands if with
1053 sibcall in the then and label for `else`. */
1054 if (LABEL_P (NEXT_INSN (last)))
1056 *can_fallthru = true;
1057 break;
1059 delete_insn (NEXT_INSN (last));
1062 e = make_edge (bb, EXIT_BLOCK_PTR, EDGE_ABNORMAL | EDGE_SIBCALL);
1063 e->probability += probability;
1064 e->count += count;
1065 BB_END (bb) = last;
1066 update_bb_for_insn (bb);
1068 if (NEXT_INSN (last))
1070 bb = create_basic_block (NEXT_INSN (last), get_last_insn (), bb);
1072 last = BB_END (bb);
1073 if (BARRIER_P (last))
1074 BB_END (bb) = PREV_INSN (last);
1077 maybe_dump_rtl_for_tree_stmt (stmt, last2);
1079 return bb;
1082 /* Expand basic block BB from GIMPLE trees to RTL. */
1084 static basic_block
1085 expand_gimple_basic_block (basic_block bb, FILE * dump_file)
1087 block_stmt_iterator bsi = bsi_start (bb);
1088 tree stmt = NULL;
1089 rtx note, last;
1090 edge e;
1091 edge_iterator ei;
1093 if (dump_file)
1095 fprintf (dump_file,
1096 "\n;; Generating RTL for tree basic block %d\n",
1097 bb->index);
1100 if (!bsi_end_p (bsi))
1101 stmt = bsi_stmt (bsi);
1103 if (stmt && TREE_CODE (stmt) == LABEL_EXPR)
1105 last = get_last_insn ();
1107 expand_expr_stmt (stmt);
1109 /* Java emits line number notes in the top of labels.
1110 ??? Make this go away once line number notes are obsoleted. */
1111 BB_HEAD (bb) = NEXT_INSN (last);
1112 if (NOTE_P (BB_HEAD (bb)))
1113 BB_HEAD (bb) = NEXT_INSN (BB_HEAD (bb));
1114 bsi_next (&bsi);
1115 note = emit_note_after (NOTE_INSN_BASIC_BLOCK, BB_HEAD (bb));
1117 maybe_dump_rtl_for_tree_stmt (stmt, last);
1119 else
1120 note = BB_HEAD (bb) = emit_note (NOTE_INSN_BASIC_BLOCK);
1122 NOTE_BASIC_BLOCK (note) = bb;
1124 for (ei = ei_start (bb->succs); (e = ei_safe_edge (ei)); )
1126 /* Clear EDGE_EXECUTABLE. This flag is never used in the backend. */
1127 e->flags &= ~EDGE_EXECUTABLE;
1129 /* At the moment not all abnormal edges match the RTL representation.
1130 It is safe to remove them here as find_sub_basic_blocks will
1131 rediscover them. In the future we should get this fixed properly. */
1132 if (e->flags & EDGE_ABNORMAL)
1133 remove_edge (e);
1134 else
1135 ei_next (&ei);
1138 for (; !bsi_end_p (bsi); bsi_next (&bsi))
1140 tree stmt = bsi_stmt (bsi);
1141 basic_block new_bb;
1143 if (!stmt)
1144 continue;
1146 /* Expand this statement, then evaluate the resulting RTL and
1147 fixup the CFG accordingly. */
1148 if (TREE_CODE (stmt) == COND_EXPR)
1150 new_bb = expand_gimple_cond_expr (bb, stmt);
1151 if (new_bb)
1152 return new_bb;
1154 else
1156 tree call = get_call_expr_in (stmt);
1157 if (call && CALL_EXPR_TAILCALL (call))
1159 bool can_fallthru;
1160 new_bb = expand_gimple_tailcall (bb, stmt, &can_fallthru);
1161 if (new_bb)
1163 if (can_fallthru)
1164 bb = new_bb;
1165 else
1166 return new_bb;
1169 else
1171 last = get_last_insn ();
1172 expand_expr_stmt (stmt);
1173 maybe_dump_rtl_for_tree_stmt (stmt, last);
1178 do_pending_stack_adjust ();
1180 /* Find the block tail. The last insn in the block is the insn
1181 before a barrier and/or table jump insn. */
1182 last = get_last_insn ();
1183 if (BARRIER_P (last))
1184 last = PREV_INSN (last);
1185 if (JUMP_TABLE_DATA_P (last))
1186 last = PREV_INSN (PREV_INSN (last));
1187 BB_END (bb) = last;
1189 update_bb_for_insn (bb);
1191 return bb;
1195 /* Create a basic block for initialization code. */
1197 static basic_block
1198 construct_init_block (void)
1200 basic_block init_block, first_block;
1201 edge e = NULL;
1202 int flags;
1204 /* Multiple entry points not supported yet. */
1205 gcc_assert (EDGE_COUNT (ENTRY_BLOCK_PTR->succs) == 1);
1207 e = EDGE_SUCC (ENTRY_BLOCK_PTR, 0);
1209 /* When entry edge points to first basic block, we don't need jump,
1210 otherwise we have to jump into proper target. */
1211 if (e && e->dest != ENTRY_BLOCK_PTR->next_bb)
1213 tree label = tree_block_label (e->dest);
1215 emit_jump (label_rtx (label));
1216 flags = 0;
1218 else
1219 flags = EDGE_FALLTHRU;
1221 init_block = create_basic_block (NEXT_INSN (get_insns ()),
1222 get_last_insn (),
1223 ENTRY_BLOCK_PTR);
1224 init_block->frequency = ENTRY_BLOCK_PTR->frequency;
1225 init_block->count = ENTRY_BLOCK_PTR->count;
1226 if (e)
1228 first_block = e->dest;
1229 redirect_edge_succ (e, init_block);
1230 e = make_edge (init_block, first_block, flags);
1232 else
1233 e = make_edge (init_block, EXIT_BLOCK_PTR, EDGE_FALLTHRU);
1234 e->probability = REG_BR_PROB_BASE;
1235 e->count = ENTRY_BLOCK_PTR->count;
1237 update_bb_for_insn (init_block);
1238 return init_block;
1242 /* Create a block containing landing pads and similar stuff. */
1244 static void
1245 construct_exit_block (void)
1247 rtx head = get_last_insn ();
1248 rtx end;
1249 basic_block exit_block;
1250 edge e, e2;
1251 unsigned ix;
1252 edge_iterator ei;
1254 /* Make sure the locus is set to the end of the function, so that
1255 epilogue line numbers and warnings are set properly. */
1256 #ifdef USE_MAPPED_LOCATION
1257 if (cfun->function_end_locus != UNKNOWN_LOCATION)
1258 #else
1259 if (cfun->function_end_locus.file)
1260 #endif
1261 input_location = cfun->function_end_locus;
1263 /* The following insns belong to the top scope. */
1264 record_block_change (DECL_INITIAL (current_function_decl));
1266 /* Generate rtl for function exit. */
1267 expand_function_end ();
1269 end = get_last_insn ();
1270 if (head == end)
1271 return;
1272 while (NEXT_INSN (head) && NOTE_P (NEXT_INSN (head)))
1273 head = NEXT_INSN (head);
1274 exit_block = create_basic_block (NEXT_INSN (head), end,
1275 EXIT_BLOCK_PTR->prev_bb);
1276 exit_block->frequency = EXIT_BLOCK_PTR->frequency;
1277 exit_block->count = EXIT_BLOCK_PTR->count;
1279 ix = 0;
1280 while (ix < EDGE_COUNT (EXIT_BLOCK_PTR->preds))
1282 e = EDGE_I (EXIT_BLOCK_PTR->preds, ix);
1283 if (!(e->flags & EDGE_ABNORMAL))
1284 redirect_edge_succ (e, exit_block);
1285 else
1286 ix++;
1289 e = make_edge (exit_block, EXIT_BLOCK_PTR, EDGE_FALLTHRU);
1290 e->probability = REG_BR_PROB_BASE;
1291 e->count = EXIT_BLOCK_PTR->count;
1292 FOR_EACH_EDGE (e2, ei, EXIT_BLOCK_PTR->preds)
1293 if (e2 != e)
1295 e->count -= e2->count;
1296 exit_block->count -= e2->count;
1297 exit_block->frequency -= EDGE_FREQUENCY (e2);
1299 if (e->count < 0)
1300 e->count = 0;
1301 if (exit_block->count < 0)
1302 exit_block->count = 0;
1303 if (exit_block->frequency < 0)
1304 exit_block->frequency = 0;
1305 update_bb_for_insn (exit_block);
1308 /* Helper function for discover_nonconstant_array_refs.
1309 Look for ARRAY_REF nodes with non-constant indexes and mark them
1310 addressable. */
1312 static tree
1313 discover_nonconstant_array_refs_r (tree * tp, int *walk_subtrees,
1314 void *data ATTRIBUTE_UNUSED)
1316 tree t = *tp;
1318 if (IS_TYPE_OR_DECL_P (t))
1319 *walk_subtrees = 0;
1320 else if (TREE_CODE (t) == ARRAY_REF || TREE_CODE (t) == ARRAY_RANGE_REF)
1322 while (((TREE_CODE (t) == ARRAY_REF || TREE_CODE (t) == ARRAY_RANGE_REF)
1323 && is_gimple_min_invariant (TREE_OPERAND (t, 1))
1324 && (!TREE_OPERAND (t, 2)
1325 || is_gimple_min_invariant (TREE_OPERAND (t, 2))))
1326 || (TREE_CODE (t) == COMPONENT_REF
1327 && (!TREE_OPERAND (t,2)
1328 || is_gimple_min_invariant (TREE_OPERAND (t, 2))))
1329 || TREE_CODE (t) == BIT_FIELD_REF
1330 || TREE_CODE (t) == REALPART_EXPR
1331 || TREE_CODE (t) == IMAGPART_EXPR
1332 || TREE_CODE (t) == VIEW_CONVERT_EXPR
1333 || TREE_CODE (t) == NOP_EXPR
1334 || TREE_CODE (t) == CONVERT_EXPR)
1335 t = TREE_OPERAND (t, 0);
1337 if (TREE_CODE (t) == ARRAY_REF || TREE_CODE (t) == ARRAY_RANGE_REF)
1339 t = get_base_address (t);
1340 if (t && DECL_P (t))
1341 TREE_ADDRESSABLE (t) = 1;
1344 *walk_subtrees = 0;
1347 return NULL_TREE;
1350 /* RTL expansion is not able to compile array references with variable
1351 offsets for arrays stored in single register. Discover such
1352 expressions and mark variables as addressable to avoid this
1353 scenario. */
1355 static void
1356 discover_nonconstant_array_refs (void)
1358 basic_block bb;
1359 block_stmt_iterator bsi;
1361 FOR_EACH_BB (bb)
1363 for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
1364 walk_tree (bsi_stmt_ptr (bsi), discover_nonconstant_array_refs_r,
1365 NULL , NULL);
1369 /* Translate the intermediate representation contained in the CFG
1370 from GIMPLE trees to RTL.
1372 We do conversion per basic block and preserve/update the tree CFG.
1373 This implies we have to do some magic as the CFG can simultaneously
1374 consist of basic blocks containing RTL and GIMPLE trees. This can
1375 confuse the CFG hooks, so be careful to not manipulate CFG during
1376 the expansion. */
1378 static void
1379 tree_expand_cfg (void)
1381 basic_block bb, init_block;
1382 sbitmap blocks;
1384 /* Some backends want to know that we are expanding to RTL. */
1385 currently_expanding_to_rtl = 1;
1387 /* Prepare the rtl middle end to start recording block changes. */
1388 reset_block_changes ();
1390 /* Mark arrays indexed with non-constant indices with TREE_ADDRESSABLE. */
1391 discover_nonconstant_array_refs ();
1393 /* Expand the variables recorded during gimple lowering. */
1394 expand_used_vars ();
1396 /* Set up parameters and prepare for return, for the function. */
1397 expand_function_start (current_function_decl);
1399 /* If this function is `main', emit a call to `__main'
1400 to run global initializers, etc. */
1401 if (DECL_NAME (current_function_decl)
1402 && MAIN_NAME_P (DECL_NAME (current_function_decl))
1403 && DECL_FILE_SCOPE_P (current_function_decl))
1404 expand_main_function ();
1406 /* Register rtl specific functions for cfg. */
1407 rtl_register_cfg_hooks ();
1409 init_block = construct_init_block ();
1411 FOR_BB_BETWEEN (bb, init_block->next_bb, EXIT_BLOCK_PTR, next_bb)
1412 bb = expand_gimple_basic_block (bb, dump_file);
1414 construct_exit_block ();
1416 /* We're done expanding trees to RTL. */
1417 currently_expanding_to_rtl = 0;
1419 /* Convert tree EH labels to RTL EH labels, and clean out any unreachable
1420 EH regions. */
1421 convert_from_eh_region_ranges ();
1423 rebuild_jump_labels (get_insns ());
1424 find_exception_handler_labels ();
1426 blocks = sbitmap_alloc (last_basic_block);
1427 sbitmap_ones (blocks);
1428 find_many_sub_basic_blocks (blocks);
1429 purge_all_dead_edges (0);
1430 sbitmap_free (blocks);
1432 compact_blocks ();
1433 #ifdef ENABLE_CHECKING
1434 verify_flow_info();
1435 #endif
1437 /* There's no need to defer outputting this function any more; we
1438 know we want to output it. */
1439 DECL_DEFER_OUTPUT (current_function_decl) = 0;
1441 /* Now that we're done expanding trees to RTL, we shouldn't have any
1442 more CONCATs anywhere. */
1443 generating_concat_p = 0;
1445 finalize_block_changes ();
1447 if (dump_file)
1449 fprintf (dump_file,
1450 "\n\n;;\n;; Full RTL generated for this function:\n;;\n");
1451 /* And the pass manager will dump RTL for us. */
1455 struct tree_opt_pass pass_expand =
1457 "expand", /* name */
1458 NULL, /* gate */
1459 tree_expand_cfg, /* execute */
1460 NULL, /* sub */
1461 NULL, /* next */
1462 0, /* static_pass_number */
1463 TV_EXPAND, /* tv_id */
1464 /* ??? If TER is enabled, we actually receive GENERIC. */
1465 PROP_gimple_leh | PROP_cfg, /* properties_required */
1466 PROP_rtl, /* properties_provided */
1467 PROP_gimple_leh, /* properties_destroyed */
1468 0, /* todo_flags_start */
1469 0, /* todo_flags_finish */
1470 'r' /* letter */