1 /* Liveness for SSA trees.
2 Copyright (C) 2003, 2004 Free Software Foundation, Inc.
3 Contributed by Andrew MacLeod <amacleod@redhat.com>
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
12 GCC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING. If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
24 #include "coretypes.h"
28 #include "basic-block.h"
30 #include "diagnostic.h"
32 #include "tree-flow.h"
33 #include "tree-gimple.h"
34 #include "tree-inline.h"
38 #include "tree-dump.h"
39 #include "tree-ssa-live.h"
42 static void live_worklist (tree_live_info_p
, varray_type
, int);
43 static tree_live_info_p
new_tree_live_info (var_map
);
44 static inline void set_if_valid (var_map
, bitmap
, tree
);
45 static inline void add_livein_if_notdef (tree_live_info_p
, bitmap
,
47 static inline void register_ssa_partition (var_map
, tree
, bool);
48 static inline void add_conflicts_if_valid (tpa_p
, conflict_graph
,
49 var_map
, bitmap
, tree
);
50 static partition_pair_p
find_partition_pair (coalesce_list_p
, int, int, bool);
52 /* This is where the mapping from SSA version number to real storage variable
55 All SSA versions of the same variable may not ultimately be mapped back to
56 the same real variable. In that instance, we need to detect the live
57 range overlap, and give one of the variable new storage. The vector
58 'partition_to_var' tracks which partition maps to which variable.
60 Given a VAR, it is sometimes desirable to know which partition that VAR
61 represents. There is an additional field in the variable annotation to
62 track that information. */
64 /* Create a variable partition map of SIZE, initialize and return it. */
67 init_var_map (int size
)
71 map
= (var_map
) xmalloc (sizeof (struct _var_map
));
72 map
->var_partition
= partition_new (size
);
74 = (tree
*)xmalloc (size
* sizeof (tree
));
75 memset (map
->partition_to_var
, 0, size
* sizeof (tree
));
77 map
->partition_to_compact
= NULL
;
78 map
->compact_to_partition
= NULL
;
79 map
->num_partitions
= size
;
80 map
->partition_size
= size
;
81 map
->ref_count
= NULL
;
86 /* Free memory associated with MAP. */
89 delete_var_map (var_map map
)
91 free (map
->partition_to_var
);
92 partition_delete (map
->var_partition
);
93 if (map
->partition_to_compact
)
94 free (map
->partition_to_compact
);
95 if (map
->compact_to_partition
)
96 free (map
->compact_to_partition
);
98 free (map
->ref_count
);
103 /* This function will combine the partitions in MAP for VAR1 and VAR2. It
104 Returns the partition which represents the new partition. If the two
105 partitions cannot be combined, NO_PARTITION is returned. */
108 var_union (var_map map
, tree var1
, tree var2
)
111 tree root_var
= NULL_TREE
;
112 tree other_var
= NULL_TREE
;
114 /* This is independent of partition_to_compact. If partition_to_compact is
115 on, then whichever one of these partitions is absorbed will never have a
116 dereference into the partition_to_compact array any more. */
118 if (TREE_CODE (var1
) == SSA_NAME
)
119 p1
= partition_find (map
->var_partition
, SSA_NAME_VERSION (var1
));
122 p1
= var_to_partition (map
, var1
);
123 if (map
->compact_to_partition
)
124 p1
= map
->compact_to_partition
[p1
];
128 if (TREE_CODE (var2
) == SSA_NAME
)
129 p2
= partition_find (map
->var_partition
, SSA_NAME_VERSION (var2
));
132 p2
= var_to_partition (map
, var2
);
133 if (map
->compact_to_partition
)
134 p2
= map
->compact_to_partition
[p2
];
136 /* If there is no root_var set, or it's not a user variable, set the
137 root_var to this one. */
138 if (!root_var
|| (DECL_P (root_var
) && DECL_IGNORED_P (root_var
)))
140 other_var
= root_var
;
147 gcc_assert (p1
!= NO_PARTITION
);
148 gcc_assert (p2
!= NO_PARTITION
);
153 p3
= partition_union (map
->var_partition
, p1
, p2
);
155 if (map
->partition_to_compact
)
156 p3
= map
->partition_to_compact
[p3
];
159 change_partition_var (map
, root_var
, p3
);
161 change_partition_var (map
, other_var
, p3
);
167 /* Compress the partition numbers in MAP such that they fall in the range
168 0..(num_partitions-1) instead of wherever they turned out during
169 the partitioning exercise. This removes any references to unused
170 partitions, thereby allowing bitmaps and other vectors to be much
171 denser. Compression type is controlled by FLAGS.
173 This is implemented such that compaction doesn't affect partitioning.
174 Ie., once partitions are created and possibly merged, running one
175 or more different kind of compaction will not affect the partitions
176 themselves. Their index might change, but all the same variables will
177 still be members of the same partition group. This allows work on reduced
178 sets, and no loss of information when a larger set is later desired.
180 In particular, coalescing can work on partitions which have 2 or more
181 definitions, and then 'recompact' later to include all the single
182 definitions for assignment to program variables. */
185 compact_var_map (var_map map
, int flags
)
188 int x
, limit
, count
, tmp
, root
, root_i
;
190 root_var_p rv
= NULL
;
192 limit
= map
->partition_size
;
193 used
= sbitmap_alloc (limit
);
196 /* Already compressed? Abandon the old one. */
197 if (map
->partition_to_compact
)
199 free (map
->partition_to_compact
);
200 map
->partition_to_compact
= NULL
;
202 if (map
->compact_to_partition
)
204 free (map
->compact_to_partition
);
205 map
->compact_to_partition
= NULL
;
208 map
->num_partitions
= map
->partition_size
;
210 if (flags
& VARMAP_NO_SINGLE_DEFS
)
211 rv
= root_var_init (map
);
213 map
->partition_to_compact
= (int *)xmalloc (limit
* sizeof (int));
214 memset (map
->partition_to_compact
, 0xff, (limit
* sizeof (int)));
216 /* Find out which partitions are actually referenced. */
218 for (x
= 0; x
< limit
; x
++)
220 tmp
= partition_find (map
->var_partition
, x
);
221 if (!TEST_BIT (used
, tmp
) && map
->partition_to_var
[tmp
] != NULL_TREE
)
223 /* It is referenced, check to see if there is more than one version
224 in the root_var table, if one is available. */
227 root
= root_var_find (rv
, tmp
);
228 root_i
= root_var_first_partition (rv
, root
);
229 /* If there is only one, don't include this in the compaction. */
230 if (root_var_next_partition (rv
, root_i
) == ROOT_VAR_NONE
)
238 /* Build a compacted partitioning. */
241 map
->compact_to_partition
= (int *)xmalloc (count
* sizeof (int));
243 /* SSA renaming begins at 1, so skip 0 when compacting. */
244 EXECUTE_IF_SET_IN_SBITMAP (used
, 1, x
,
246 map
->partition_to_compact
[x
] = count
;
247 map
->compact_to_partition
[count
] = x
;
248 var
= map
->partition_to_var
[x
];
249 if (TREE_CODE (var
) != SSA_NAME
)
250 change_partition_var (map
, var
, count
);
256 free (map
->partition_to_compact
);
257 map
->partition_to_compact
= NULL
;
260 map
->num_partitions
= count
;
263 root_var_delete (rv
);
268 /* This function is used to change the representative variable in MAP for VAR's
269 partition from an SSA_NAME variable to a regular variable. This allows
270 partitions to be mapped back to real variables. */
273 change_partition_var (var_map map
, tree var
, int part
)
277 gcc_assert (TREE_CODE (var
) != SSA_NAME
);
280 ann
->out_of_ssa_tag
= 1;
281 VAR_ANN_PARTITION (ann
) = part
;
282 if (map
->compact_to_partition
)
283 map
->partition_to_var
[map
->compact_to_partition
[part
]] = var
;
287 /* Helper function for mark_all_vars_used, called via walk_tree. */
290 mark_all_vars_used_1 (tree
*tp
, int *walk_subtrees
,
291 void *data ATTRIBUTE_UNUSED
)
295 /* Only need to mark VAR_DECLS; parameters and return results are not
296 eliminated as unused. */
297 if (TREE_CODE (t
) == VAR_DECL
)
300 if (IS_TYPE_OR_DECL_P (t
))
306 /* Mark all VAR_DECLS under *EXPR_P as used, so that they won't be
307 eliminated during the tree->rtl conversion process. */
310 mark_all_vars_used (tree
*expr_p
)
312 walk_tree (expr_p
, mark_all_vars_used_1
, NULL
, NULL
);
315 /* This function looks through the program and uses FLAGS to determine what
316 SSA versioned variables are given entries in a new partition table. This
317 new partition map is returned. */
320 create_ssa_var_map (int flags
)
322 block_stmt_iterator bsi
;
329 #ifdef ENABLE_CHECKING
330 sbitmap used_in_real_ops
;
331 sbitmap used_in_virtual_ops
;
334 map
= init_var_map (num_ssa_names
+ 1);
336 #ifdef ENABLE_CHECKING
337 used_in_real_ops
= sbitmap_alloc (num_referenced_vars
);
338 sbitmap_zero (used_in_real_ops
);
340 used_in_virtual_ops
= sbitmap_alloc (num_referenced_vars
);
341 sbitmap_zero (used_in_virtual_ops
);
344 if (flags
& SSA_VAR_MAP_REF_COUNT
)
347 = (int *)xmalloc (((num_ssa_names
+ 1) * sizeof (int)));
348 memset (map
->ref_count
, 0, (num_ssa_names
+ 1) * sizeof (int));
354 for (phi
= phi_nodes (bb
); phi
; phi
= PHI_CHAIN (phi
))
357 register_ssa_partition (map
, PHI_RESULT (phi
), false);
358 for (i
= 0; i
< PHI_NUM_ARGS (phi
); i
++)
360 arg
= PHI_ARG_DEF (phi
, i
);
361 if (TREE_CODE (arg
) == SSA_NAME
)
362 register_ssa_partition (map
, arg
, true);
364 mark_all_vars_used (&PHI_ARG_DEF_TREE (phi
, i
));
368 for (bsi
= bsi_start (bb
); !bsi_end_p (bsi
); bsi_next (&bsi
))
370 stmt
= bsi_stmt (bsi
);
371 get_stmt_operands (stmt
);
372 ann
= stmt_ann (stmt
);
374 /* Register USE and DEF operands in each statement. */
375 FOR_EACH_SSA_TREE_OPERAND (use
, stmt
, iter
, SSA_OP_USE
)
377 register_ssa_partition (map
, use
, true);
379 #ifdef ENABLE_CHECKING
380 SET_BIT (used_in_real_ops
, var_ann (SSA_NAME_VAR (use
))->uid
);
384 FOR_EACH_SSA_TREE_OPERAND (dest
, stmt
, iter
, SSA_OP_DEF
)
386 register_ssa_partition (map
, dest
, false);
388 #ifdef ENABLE_CHECKING
389 SET_BIT (used_in_real_ops
, var_ann (SSA_NAME_VAR (dest
))->uid
);
393 #ifdef ENABLE_CHECKING
394 /* Validate that virtual ops don't get used in funny ways. */
395 FOR_EACH_SSA_TREE_OPERAND (use
, stmt
, iter
,
396 SSA_OP_VIRTUAL_USES
| SSA_OP_VMUSTDEF
)
398 SET_BIT (used_in_virtual_ops
, var_ann (SSA_NAME_VAR (use
))->uid
);
401 #endif /* ENABLE_CHECKING */
403 mark_all_vars_used (bsi_stmt_ptr (bsi
));
407 #if defined ENABLE_CHECKING
410 sbitmap both
= sbitmap_alloc (num_referenced_vars
);
411 sbitmap_a_and_b (both
, used_in_real_ops
, used_in_virtual_ops
);
412 if (sbitmap_first_set_bit (both
) >= 0)
414 EXECUTE_IF_SET_IN_SBITMAP (both
, 0, i
,
415 fprintf (stderr
, "Variable %s used in real and virtual operands\n",
416 get_name (referenced_var (i
))));
417 internal_error ("SSA corruption");
420 sbitmap_free (used_in_real_ops
);
421 sbitmap_free (used_in_virtual_ops
);
430 /* Allocate and return a new live range information object base on MAP. */
432 static tree_live_info_p
433 new_tree_live_info (var_map map
)
435 tree_live_info_p live
;
438 live
= (tree_live_info_p
) xmalloc (sizeof (struct tree_live_info_d
));
440 live
->num_blocks
= last_basic_block
;
442 live
->global
= BITMAP_XMALLOC ();
444 live
->livein
= (bitmap
*)xmalloc (num_var_partitions (map
) * sizeof (bitmap
));
445 for (x
= 0; x
< num_var_partitions (map
); x
++)
446 live
->livein
[x
] = BITMAP_XMALLOC ();
448 /* liveout is deferred until it is actually requested. */
449 live
->liveout
= NULL
;
454 /* Free storage for live range info object LIVE. */
457 delete_tree_live_info (tree_live_info_p live
)
462 for (x
= live
->num_blocks
- 1; x
>= 0; x
--)
463 BITMAP_XFREE (live
->liveout
[x
]);
464 free (live
->liveout
);
468 for (x
= num_var_partitions (live
->map
) - 1; x
>= 0; x
--)
469 BITMAP_XFREE (live
->livein
[x
]);
473 BITMAP_XFREE (live
->global
);
479 /* Using LIVE, fill in all the live-on-entry blocks between the defs and uses
480 for partition I. STACK is a varray used for temporary memory which is
481 passed in rather than being allocated on every call. */
484 live_worklist (tree_live_info_p live
, varray_type stack
, int i
)
488 basic_block def_bb
= NULL
;
490 var_map map
= live
->map
;
494 var
= partition_to_var (map
, i
);
495 if (SSA_NAME_DEF_STMT (var
))
496 def_bb
= bb_for_stmt (SSA_NAME_DEF_STMT (var
));
498 EXECUTE_IF_SET_IN_BITMAP (live
->livein
[i
], 0, b
, bi
)
500 VARRAY_PUSH_INT (stack
, b
);
503 while (VARRAY_ACTIVE_SIZE (stack
) > 0)
505 b
= VARRAY_TOP_INT (stack
);
508 FOR_EACH_EDGE (e
, ei
, BASIC_BLOCK (b
)->preds
)
509 if (e
->src
!= ENTRY_BLOCK_PTR
)
511 /* Its not live on entry to the block its defined in. */
512 if (e
->src
== def_bb
)
514 if (!bitmap_bit_p (live
->livein
[i
], e
->src
->index
))
516 bitmap_set_bit (live
->livein
[i
], e
->src
->index
);
517 VARRAY_PUSH_INT (stack
, e
->src
->index
);
524 /* If VAR is in a partition of MAP, set the bit for that partition in VEC. */
527 set_if_valid (var_map map
, bitmap vec
, tree var
)
529 int p
= var_to_partition (map
, var
);
530 if (p
!= NO_PARTITION
)
531 bitmap_set_bit (vec
, p
);
535 /* If VAR is in a partition and it isn't defined in DEF_VEC, set the livein and
536 global bit for it in the LIVE object. BB is the block being processed. */
539 add_livein_if_notdef (tree_live_info_p live
, bitmap def_vec
,
540 tree var
, basic_block bb
)
542 int p
= var_to_partition (live
->map
, var
);
543 if (p
== NO_PARTITION
|| bb
== ENTRY_BLOCK_PTR
)
545 if (!bitmap_bit_p (def_vec
, p
))
547 bitmap_set_bit (live
->livein
[p
], bb
->index
);
548 bitmap_set_bit (live
->global
, p
);
553 /* Given partition map MAP, calculate all the live on entry bitmaps for
554 each basic block. Return a live info object. */
557 calculate_live_on_entry (var_map map
)
559 tree_live_info_p live
;
567 block_stmt_iterator bsi
;
571 #ifdef ENABLE_CHECKING
576 saw_def
= BITMAP_XMALLOC ();
578 live
= new_tree_live_info (map
);
582 bitmap_clear (saw_def
);
584 for (phi
= phi_nodes (bb
); phi
; phi
= PHI_CHAIN (phi
))
586 for (i
= 0; i
< (unsigned)PHI_NUM_ARGS (phi
); i
++)
588 var
= PHI_ARG_DEF (phi
, i
);
589 if (!phi_ssa_name_p (var
))
591 stmt
= SSA_NAME_DEF_STMT (var
);
592 e
= EDGE_PRED (bb
, i
);
594 /* Any uses in PHIs which either don't have def's or are not
595 defined in the block from which the def comes, will be live
596 on entry to that block. */
597 if (!stmt
|| e
->src
!= bb_for_stmt (stmt
))
598 add_livein_if_notdef (live
, saw_def
, var
, e
->src
);
602 /* Don't mark PHI results as defined until all the PHI nodes have
603 been processed. If the PHI sequence is:
606 The a_3 referred to in b_3's PHI node is the one incoming on the
607 edge, *not* the PHI node just seen. */
609 for (phi
= phi_nodes (bb
); phi
; phi
= PHI_CHAIN (phi
))
611 var
= PHI_RESULT (phi
);
612 set_if_valid (map
, saw_def
, var
);
615 for (bsi
= bsi_start (bb
); !bsi_end_p (bsi
); bsi_next (&bsi
))
617 stmt
= bsi_stmt (bsi
);
618 get_stmt_operands (stmt
);
619 ann
= stmt_ann (stmt
);
621 FOR_EACH_SSA_TREE_OPERAND (op
, stmt
, iter
, SSA_OP_USE
)
623 add_livein_if_notdef (live
, saw_def
, op
, bb
);
626 FOR_EACH_SSA_TREE_OPERAND (op
, stmt
, iter
, SSA_OP_DEF
)
628 set_if_valid (map
, saw_def
, op
);
633 VARRAY_INT_INIT (stack
, last_basic_block
, "stack");
634 EXECUTE_IF_SET_IN_BITMAP (live
->global
, 0, i
, bi
)
636 live_worklist (live
, stack
, i
);
639 #ifdef ENABLE_CHECKING
640 /* Check for live on entry partitions and report those with a DEF in
641 the program. This will typically mean an optimization has done
644 bb
= ENTRY_BLOCK_PTR
;
646 FOR_EACH_EDGE (e
, ei
, bb
->succs
)
648 int entry_block
= e
->dest
->index
;
649 if (e
->dest
== EXIT_BLOCK_PTR
)
651 for (i
= 0; i
< (unsigned)num_var_partitions (map
); i
++)
655 var
= partition_to_var (map
, i
);
656 stmt
= SSA_NAME_DEF_STMT (var
);
657 tmp
= bb_for_stmt (stmt
);
658 d
= default_def (SSA_NAME_VAR (var
));
660 if (bitmap_bit_p (live_entry_blocks (live
, i
), entry_block
))
662 if (!IS_EMPTY_STMT (stmt
))
665 print_generic_expr (stderr
, var
, TDF_SLIM
);
666 fprintf (stderr
, " is defined ");
668 fprintf (stderr
, " in BB%d, ", tmp
->index
);
669 fprintf (stderr
, "by:\n");
670 print_generic_expr (stderr
, stmt
, TDF_SLIM
);
671 fprintf (stderr
, "\nIt is also live-on-entry to entry BB %d",
673 fprintf (stderr
, " So it appears to have multiple defs.\n");
680 print_generic_expr (stderr
, var
, TDF_SLIM
);
681 fprintf (stderr
, " is live-on-entry to BB%d ",entry_block
);
684 fprintf (stderr
, " but is not the default def of ");
685 print_generic_expr (stderr
, d
, TDF_SLIM
);
686 fprintf (stderr
, "\n");
689 fprintf (stderr
, " and there is no default def.\n");
696 /* The only way this var shouldn't be marked live on entry is
697 if it occurs in a PHI argument of the block. */
699 for (phi
= phi_nodes (e
->dest
);
701 phi
= PHI_CHAIN (phi
))
703 for (z
= 0; z
< PHI_NUM_ARGS (phi
); z
++)
704 if (var
== PHI_ARG_DEF (phi
, z
))
713 print_generic_expr (stderr
, var
, TDF_SLIM
);
714 fprintf (stderr
, " is not marked live-on-entry to entry BB%d ",
716 fprintf (stderr
, "but it is a default def so it should be.\n");
720 gcc_assert (num
<= 0);
723 BITMAP_XFREE (saw_def
);
729 /* Calculate the live on exit vectors based on the entry info in LIVEINFO. */
732 calculate_live_on_exit (tree_live_info_p liveinfo
)
741 var_map map
= liveinfo
->map
;
743 on_exit
= (bitmap
*)xmalloc (last_basic_block
* sizeof (bitmap
));
744 for (x
= 0; x
< (unsigned)last_basic_block
; x
++)
745 on_exit
[x
] = BITMAP_XMALLOC ();
747 /* Set all the live-on-exit bits for uses in PHIs. */
750 for (phi
= phi_nodes (bb
); phi
; phi
= PHI_CHAIN (phi
))
751 for (i
= 0; i
< (unsigned)PHI_NUM_ARGS (phi
); i
++)
753 t
= PHI_ARG_DEF (phi
, i
);
754 e
= PHI_ARG_EDGE (phi
, i
);
755 if (!phi_ssa_name_p (t
) || e
->src
== ENTRY_BLOCK_PTR
)
757 set_if_valid (map
, on_exit
[e
->src
->index
], t
);
761 /* Set live on exit for all predecessors of live on entry's. */
762 for (i
= 0; i
< num_var_partitions (map
); i
++)
766 on_entry
= live_entry_blocks (liveinfo
, i
);
767 EXECUTE_IF_SET_IN_BITMAP (on_entry
, 0, b
, bi
)
770 FOR_EACH_EDGE (e
, ei
, BASIC_BLOCK (b
)->preds
)
771 if (e
->src
!= ENTRY_BLOCK_PTR
)
772 bitmap_set_bit (on_exit
[e
->src
->index
], i
);
776 liveinfo
->liveout
= on_exit
;
780 /* Initialize a tree_partition_associator object using MAP. */
783 tpa_init (var_map map
)
786 int num_partitions
= num_var_partitions (map
);
789 if (num_partitions
== 0)
792 tpa
= (tpa_p
) xmalloc (sizeof (struct tree_partition_associator_d
));
794 tpa
->uncompressed_num
= -1;
796 tpa
->next_partition
= (int *)xmalloc (num_partitions
* sizeof (int));
797 memset (tpa
->next_partition
, TPA_NONE
, num_partitions
* sizeof (int));
799 tpa
->partition_to_tree_map
= (int *)xmalloc (num_partitions
* sizeof (int));
800 memset (tpa
->partition_to_tree_map
, TPA_NONE
, num_partitions
* sizeof (int));
802 x
= MAX (40, (num_partitions
/ 20));
803 VARRAY_TREE_INIT (tpa
->trees
, x
, "trees");
804 VARRAY_INT_INIT (tpa
->first_partition
, x
, "first_partition");
811 /* Remove PARTITION_INDEX from TREE_INDEX's list in the tpa structure TPA. */
814 tpa_remove_partition (tpa_p tpa
, int tree_index
, int partition_index
)
818 i
= tpa_first_partition (tpa
, tree_index
);
819 if (i
== partition_index
)
821 VARRAY_INT (tpa
->first_partition
, tree_index
) = tpa
->next_partition
[i
];
825 for ( ; i
!= TPA_NONE
; i
= tpa_next_partition (tpa
, i
))
827 if (tpa
->next_partition
[i
] == partition_index
)
829 tpa
->next_partition
[i
] = tpa
->next_partition
[partition_index
];
837 /* Free the memory used by tree_partition_associator object TPA. */
840 tpa_delete (tpa_p tpa
)
845 free (tpa
->partition_to_tree_map
);
846 free (tpa
->next_partition
);
851 /* This function will remove any tree entries from TPA which have only a single
852 element. This will help keep the size of the conflict graph down. The
853 function returns the number of remaining tree lists. */
856 tpa_compact (tpa_p tpa
)
858 int last
, x
, y
, first
, swap_i
;
861 /* Find the last list which has more than 1 partition. */
862 for (last
= tpa
->num_trees
- 1; last
> 0; last
--)
864 first
= tpa_first_partition (tpa
, last
);
865 if (tpa_next_partition (tpa
, first
) != NO_PARTITION
)
872 first
= tpa_first_partition (tpa
, x
);
874 /* If there is not more than one partition, swap with the current end
876 if (tpa_next_partition (tpa
, first
) == NO_PARTITION
)
878 swap_t
= VARRAY_TREE (tpa
->trees
, last
);
879 swap_i
= VARRAY_INT (tpa
->first_partition
, last
);
881 /* Update the last entry. Since it is known to only have one
882 partition, there is nothing else to update. */
883 VARRAY_TREE (tpa
->trees
, last
) = VARRAY_TREE (tpa
->trees
, x
);
884 VARRAY_INT (tpa
->first_partition
, last
)
885 = VARRAY_INT (tpa
->first_partition
, x
);
886 tpa
->partition_to_tree_map
[tpa_first_partition (tpa
, last
)] = last
;
888 /* Since this list is known to have more than one partition, update
889 the list owner entries. */
890 VARRAY_TREE (tpa
->trees
, x
) = swap_t
;
891 VARRAY_INT (tpa
->first_partition
, x
) = swap_i
;
892 for (y
= tpa_first_partition (tpa
, x
);
894 y
= tpa_next_partition (tpa
, y
))
895 tpa
->partition_to_tree_map
[y
] = x
;
897 /* Ensure last is a list with more than one partition. */
899 for (; last
> x
; last
--)
901 first
= tpa_first_partition (tpa
, last
);
902 if (tpa_next_partition (tpa
, first
) != NO_PARTITION
)
909 first
= tpa_first_partition (tpa
, x
);
910 if (tpa_next_partition (tpa
, first
) != NO_PARTITION
)
912 tpa
->uncompressed_num
= tpa
->num_trees
;
918 /* Initialize a root_var object with SSA partitions from MAP which are based
919 on each root variable. */
922 root_var_init (var_map map
)
925 int num_partitions
= num_var_partitions (map
);
935 seen
= sbitmap_alloc (num_partitions
);
938 /* Start at the end and work towards the front. This will provide a list
939 that is ordered from smallest to largest. */
940 for (x
= num_partitions
- 1; x
>= 0; x
--)
942 t
= partition_to_var (map
, x
);
944 /* The var map may not be compacted yet, so check for NULL. */
948 p
= var_to_partition (map
, t
);
950 gcc_assert (p
!= NO_PARTITION
);
952 /* Make sure we only put coalesced partitions into the list once. */
953 if (TEST_BIT (seen
, p
))
956 if (TREE_CODE (t
) == SSA_NAME
)
957 t
= SSA_NAME_VAR (t
);
959 if (ann
->root_var_processed
)
961 rv
->next_partition
[p
] = VARRAY_INT (rv
->first_partition
,
962 VAR_ANN_ROOT_INDEX (ann
));
963 VARRAY_INT (rv
->first_partition
, VAR_ANN_ROOT_INDEX (ann
)) = p
;
967 ann
->root_var_processed
= 1;
968 VAR_ANN_ROOT_INDEX (ann
) = rv
->num_trees
++;
969 VARRAY_PUSH_TREE (rv
->trees
, t
);
970 VARRAY_PUSH_INT (rv
->first_partition
, p
);
972 rv
->partition_to_tree_map
[p
] = VAR_ANN_ROOT_INDEX (ann
);
975 /* Reset the out_of_ssa_tag flag on each variable for later use. */
976 for (x
= 0; x
< rv
->num_trees
; x
++)
978 t
= VARRAY_TREE (rv
->trees
, x
);
979 var_ann (t
)->root_var_processed
= 0;
987 /* Initialize a type_var structure which associates all the partitions in MAP
988 of the same type to the type node's index. Volatiles are ignored. */
991 type_var_init (var_map map
)
995 int num_partitions
= num_var_partitions (map
);
999 seen
= sbitmap_alloc (num_partitions
);
1000 sbitmap_zero (seen
);
1002 tv
= tpa_init (map
);
1006 for (x
= num_partitions
- 1; x
>= 0; x
--)
1008 t
= partition_to_var (map
, x
);
1010 /* Disallow coalescing of these types of variables. */
1012 || TREE_THIS_VOLATILE (t
)
1013 || TREE_CODE (t
) == RESULT_DECL
1014 || TREE_CODE (t
) == PARM_DECL
1016 && (DECL_REGISTER (t
)
1017 || !DECL_IGNORED_P (t
)
1018 || DECL_RTL_SET_P (t
))))
1021 p
= var_to_partition (map
, t
);
1023 gcc_assert (p
!= NO_PARTITION
);
1025 /* If partitions have been coalesced, only add the representative
1026 for the partition to the list once. */
1027 if (TEST_BIT (seen
, p
))
1032 /* Find the list for this type. */
1033 for (y
= 0; y
< tv
->num_trees
; y
++)
1034 if (t
== VARRAY_TREE (tv
->trees
, y
))
1036 if (y
== tv
->num_trees
)
1039 VARRAY_PUSH_TREE (tv
->trees
, t
);
1040 VARRAY_PUSH_INT (tv
->first_partition
, p
);
1044 tv
->next_partition
[p
] = VARRAY_INT (tv
->first_partition
, y
);
1045 VARRAY_INT (tv
->first_partition
, y
) = p
;
1047 tv
->partition_to_tree_map
[p
] = y
;
1049 sbitmap_free (seen
);
1054 /* Create a new coalesce list object from MAP and return it. */
1057 create_coalesce_list (var_map map
)
1059 coalesce_list_p list
;
1061 list
= (coalesce_list_p
) xmalloc (sizeof (struct coalesce_list_d
));
1064 list
->add_mode
= true;
1065 list
->list
= (partition_pair_p
*) xcalloc (num_var_partitions (map
),
1066 sizeof (struct partition_pair_d
));
1071 /* Delete coalesce list CL. */
1074 delete_coalesce_list (coalesce_list_p cl
)
1081 /* Find a matching coalesce pair object in CL for partitions P1 and P2. If
1082 one isn't found, return NULL if CREATE is false, otherwise create a new
1083 coalesce pair object and return it. */
1085 static partition_pair_p
1086 find_partition_pair (coalesce_list_p cl
, int p1
, int p2
, bool create
)
1088 partition_pair_p node
, tmp
;
1091 /* Normalize so that p1 is the smaller value. */
1101 /* The list is sorted such that if we find a value greater than p2,
1102 p2 is not in the list. */
1103 for (node
= cl
->list
[p1
]; node
; node
= node
->next
)
1105 if (node
->second_partition
== p2
)
1108 if (node
->second_partition
> p2
)
1116 node
= (partition_pair_p
) xmalloc (sizeof (struct partition_pair_d
));
1117 node
->first_partition
= p1
;
1118 node
->second_partition
= p2
;
1123 node
->next
= tmp
->next
;
1128 /* This is now the first node in the list. */
1129 node
->next
= cl
->list
[p1
];
1130 cl
->list
[p1
] = node
;
1137 /* Add a potential coalesce between P1 and P2 in CL with a cost of VALUE. */
1140 add_coalesce (coalesce_list_p cl
, int p1
, int p2
, int value
)
1142 partition_pair_p node
;
1144 gcc_assert (cl
->add_mode
);
1149 node
= find_partition_pair (cl
, p1
, p2
, true);
1151 node
->cost
+= value
;
1155 /* Comparison function to allow qsort to sort P1 and P2 in descending order. */
1158 int compare_pairs (const void *p1
, const void *p2
)
1160 return (*(partition_pair_p
*)p2
)->cost
- (*(partition_pair_p
*)p1
)->cost
;
1164 /* Prepare CL for removal of preferred pairs. When finished, list element
1165 0 has all the coalesce pairs, sorted in order from most important coalesce
1166 to least important. */
1169 sort_coalesce_list (coalesce_list_p cl
)
1171 unsigned x
, num
, count
;
1172 partition_pair_p chain
, p
;
1173 partition_pair_p
*list
;
1175 gcc_assert (cl
->add_mode
);
1177 cl
->add_mode
= false;
1179 /* Compact the array of lists to a single list, and count the elements. */
1182 for (x
= 0; x
< num_var_partitions (cl
->map
); x
++)
1183 if (cl
->list
[x
] != NULL
)
1185 for (p
= cl
->list
[x
]; p
->next
!= NULL
; p
= p
->next
)
1189 chain
= cl
->list
[x
];
1193 /* Only call qsort if there are more than 2 items. */
1196 list
= xmalloc (sizeof (partition_pair_p
) * num
);
1198 for (p
= chain
; p
!= NULL
; p
= p
->next
)
1201 gcc_assert (count
== num
);
1203 qsort (list
, count
, sizeof (partition_pair_p
), compare_pairs
);
1206 for (x
= 1; x
< num
; x
++)
1212 cl
->list
[0] = list
[0];
1217 cl
->list
[0] = chain
;
1220 /* Simply swap the two elements if they are in the wrong order. */
1221 if (chain
->cost
< chain
->next
->cost
)
1223 cl
->list
[0] = chain
->next
;
1224 cl
->list
[0]->next
= chain
;
1232 /* Retrieve the best remaining pair to coalesce from CL. Returns the 2
1233 partitions via P1 and P2. Their calculated cost is returned by the function.
1234 NO_BEST_COALESCE is returned if the coalesce list is empty. */
1237 pop_best_coalesce (coalesce_list_p cl
, int *p1
, int *p2
)
1239 partition_pair_p node
;
1242 gcc_assert (!cl
->add_mode
);
1246 return NO_BEST_COALESCE
;
1248 cl
->list
[0] = node
->next
;
1250 *p1
= node
->first_partition
;
1251 *p2
= node
->second_partition
;
1259 /* If variable VAR is in a partition in MAP, add a conflict in GRAPH between
1260 VAR and any other live partitions in VEC which are associated via TPA.
1261 Reset the live bit in VEC. */
1264 add_conflicts_if_valid (tpa_p tpa
, conflict_graph graph
,
1265 var_map map
, bitmap vec
, tree var
)
1268 p
= var_to_partition (map
, var
);
1269 if (p
!= NO_PARTITION
)
1271 bitmap_clear_bit (vec
, p
);
1272 first
= tpa_find_tree (tpa
, p
);
1273 /* If find returns nothing, this object isn't interesting. */
1274 if (first
== TPA_NONE
)
1276 /* Only add interferences between objects in the same list. */
1277 for (y
= tpa_first_partition (tpa
, first
);
1279 y
= tpa_next_partition (tpa
, y
))
1281 if (bitmap_bit_p (vec
, y
))
1282 conflict_graph_add (graph
, p
, y
);
1288 /* Return a conflict graph for the information contained in LIVE_INFO. Only
1289 conflicts between items in the same TPA list are added. If optional
1290 coalesce list CL is passed in, any copies encountered are added. */
1293 build_tree_conflict_graph (tree_live_info_p liveinfo
, tpa_p tpa
,
1296 conflict_graph graph
;
1301 varray_type partition_link
, tpa_to_clear
, tpa_nodes
;
1306 map
= live_var_map (liveinfo
);
1307 graph
= conflict_graph_new (num_var_partitions (map
));
1309 if (tpa_num_trees (tpa
) == 0)
1312 live
= BITMAP_XMALLOC ();
1314 VARRAY_INT_INIT (partition_link
, num_var_partitions (map
) + 1, "part_link");
1315 VARRAY_INT_INIT (tpa_nodes
, tpa_num_trees (tpa
), "tpa nodes");
1316 VARRAY_INT_INIT (tpa_to_clear
, 50, "tpa to clear");
1320 block_stmt_iterator bsi
;
1323 /* Start with live on exit temporaries. */
1324 bitmap_copy (live
, live_on_exit (liveinfo
, bb
));
1326 for (bsi
= bsi_last (bb
); !bsi_end_p (bsi
); bsi_prev (&bsi
))
1328 bool is_a_copy
= false;
1329 tree stmt
= bsi_stmt (bsi
);
1332 get_stmt_operands (stmt
);
1333 ann
= stmt_ann (stmt
);
1335 /* A copy between 2 partitions does not introduce an interference
1336 by itself. If they did, you would never be able to coalesce
1337 two things which are copied. If the two variables really do
1338 conflict, they will conflict elsewhere in the program.
1340 This is handled specially here since we may also be interested
1341 in copies between real variables and SSA_NAME variables. We may
1342 be interested in trying to coalesce SSA_NAME variables with
1343 root variables in some cases. */
1345 if (TREE_CODE (stmt
) == MODIFY_EXPR
)
1347 tree lhs
= TREE_OPERAND (stmt
, 0);
1348 tree rhs
= TREE_OPERAND (stmt
, 1);
1352 if (DECL_P (lhs
) || TREE_CODE (lhs
) == SSA_NAME
)
1353 p1
= var_to_partition (map
, lhs
);
1357 if (DECL_P (rhs
) || TREE_CODE (rhs
) == SSA_NAME
)
1358 p2
= var_to_partition (map
, rhs
);
1362 if (p1
!= NO_PARTITION
&& p2
!= NO_PARTITION
)
1365 bit
= bitmap_bit_p (live
, p2
);
1366 /* If the RHS is live, make it not live while we add
1367 the conflicts, then make it live again. */
1369 bitmap_clear_bit (live
, p2
);
1370 add_conflicts_if_valid (tpa
, graph
, map
, live
, lhs
);
1372 bitmap_set_bit (live
, p2
);
1374 add_coalesce (cl
, p1
, p2
, 1);
1375 set_if_valid (map
, live
, rhs
);
1382 FOR_EACH_SSA_TREE_OPERAND (var
, stmt
, iter
, SSA_OP_DEF
)
1384 add_conflicts_if_valid (tpa
, graph
, map
, live
, var
);
1387 FOR_EACH_SSA_TREE_OPERAND (var
, stmt
, iter
, SSA_OP_USE
)
1389 set_if_valid (map
, live
, var
);
1394 /* If result of a PHI is unused, then the loops over the statements
1395 will not record any conflicts. However, since the PHI node is
1396 going to be translated out of SSA form we must record a conflict
1397 between the result of the PHI and any variables with are live.
1398 Otherwise the out-of-ssa translation may create incorrect code. */
1399 for (phi
= phi_nodes (bb
); phi
; phi
= PHI_CHAIN (phi
))
1401 tree result
= PHI_RESULT (phi
);
1402 int p
= var_to_partition (map
, result
);
1404 if (p
!= NO_PARTITION
&& ! bitmap_bit_p (live
, p
))
1405 add_conflicts_if_valid (tpa
, graph
, map
, live
, result
);
1408 /* Anything which is still live at this point interferes.
1409 In order to implement this efficiently, only conflicts between
1410 partitions which have the same TPA root need be added.
1411 TPA roots which have been seen are tracked in 'tpa_nodes'. A nonzero
1412 entry points to an index into 'partition_link', which then indexes
1413 into itself forming a linked list of partitions sharing a tpa root
1414 which have been seen as live up to this point. Since partitions start
1415 at index zero, all entries in partition_link are (partition + 1).
1417 Conflicts are added between the current partition and any already seen.
1418 tpa_clear contains all the tpa_roots processed, and these are the only
1419 entries which need to be zero'd out for a clean restart. */
1421 EXECUTE_IF_SET_IN_BITMAP (live
, 0, x
, bi
)
1423 i
= tpa_find_tree (tpa
, x
);
1424 if (i
!= (unsigned)TPA_NONE
)
1426 int start
= VARRAY_INT (tpa_nodes
, i
);
1427 /* If start is 0, a new root reference list is being started.
1428 Register it to be cleared. */
1430 VARRAY_PUSH_INT (tpa_to_clear
, i
);
1432 /* Add interferences to other tpa members seen. */
1433 for (y
= start
; y
!= 0; y
= VARRAY_INT (partition_link
, y
))
1434 conflict_graph_add (graph
, x
, y
- 1);
1435 VARRAY_INT (tpa_nodes
, i
) = x
+ 1;
1436 VARRAY_INT (partition_link
, x
+ 1) = start
;
1440 /* Now clear the used tpa root references. */
1441 for (l
= 0; l
< VARRAY_ACTIVE_SIZE (tpa_to_clear
); l
++)
1442 VARRAY_INT (tpa_nodes
, VARRAY_INT (tpa_to_clear
, l
)) = 0;
1443 VARRAY_POP_ALL (tpa_to_clear
);
1446 BITMAP_XFREE (live
);
1451 /* This routine will attempt to coalesce the elements in TPA subject to the
1452 conflicts found in GRAPH. If optional coalesce_list CL is provided,
1453 only coalesces specified within the coalesce list are attempted. Otherwise
1454 an attempt is made to coalesce as many partitions within each TPA grouping
1455 as possible. If DEBUG is provided, debug output will be sent there. */
1458 coalesce_tpa_members (tpa_p tpa
, conflict_graph graph
, var_map map
,
1459 coalesce_list_p cl
, FILE *debug
)
1464 /* Attempt to coalesce any items in a coalesce list. */
1467 while (pop_best_coalesce (cl
, &x
, &y
) != NO_BEST_COALESCE
)
1471 fprintf (debug
, "Coalesce list: (%d)", x
);
1472 print_generic_expr (debug
, partition_to_var (map
, x
), TDF_SLIM
);
1473 fprintf (debug
, " & (%d)", y
);
1474 print_generic_expr (debug
, partition_to_var (map
, y
), TDF_SLIM
);
1477 w
= tpa_find_tree (tpa
, x
);
1478 z
= tpa_find_tree (tpa
, y
);
1479 if (w
!= z
|| w
== TPA_NONE
|| z
== TPA_NONE
)
1484 fprintf (debug
, ": Fail, Non-matching TPA's\n");
1486 fprintf (debug
, ": Fail %d non TPA.\n", x
);
1488 fprintf (debug
, ": Fail %d non TPA.\n", y
);
1492 var
= partition_to_var (map
, x
);
1493 tmp
= partition_to_var (map
, y
);
1494 x
= var_to_partition (map
, var
);
1495 y
= var_to_partition (map
, tmp
);
1497 fprintf (debug
, " [map: %d, %d] ", x
, y
);
1501 fprintf (debug
, ": Already Coalesced.\n");
1504 if (!conflict_graph_conflict_p (graph
, x
, y
))
1506 z
= var_union (map
, var
, tmp
);
1507 if (z
== NO_PARTITION
)
1510 fprintf (debug
, ": Unable to perform partition union.\n");
1514 /* z is the new combined partition. We need to remove the other
1515 partition from the list. Set x to be that other partition. */
1518 conflict_graph_merge_regs (graph
, x
, y
);
1519 w
= tpa_find_tree (tpa
, y
);
1520 tpa_remove_partition (tpa
, w
, y
);
1524 conflict_graph_merge_regs (graph
, y
, x
);
1525 w
= tpa_find_tree (tpa
, x
);
1526 tpa_remove_partition (tpa
, w
, x
);
1530 fprintf (debug
, ": Success -> %d\n", z
);
1534 fprintf (debug
, ": Fail due to conflict\n");
1536 /* If using a coalesce list, don't try to coalesce anything else. */
1540 for (x
= 0; x
< tpa_num_trees (tpa
); x
++)
1542 while (tpa_first_partition (tpa
, x
) != TPA_NONE
)
1545 /* Coalesce first partition with anything that doesn't conflict. */
1546 y
= tpa_first_partition (tpa
, x
);
1547 tpa_remove_partition (tpa
, x
, y
);
1549 var
= partition_to_var (map
, y
);
1550 /* p1 is the partition representative to which y belongs. */
1551 p1
= var_to_partition (map
, var
);
1553 for (z
= tpa_next_partition (tpa
, y
);
1555 z
= tpa_next_partition (tpa
, z
))
1557 tmp
= partition_to_var (map
, z
);
1558 /* p2 is the partition representative to which z belongs. */
1559 p2
= var_to_partition (map
, tmp
);
1562 fprintf (debug
, "Coalesce : ");
1563 print_generic_expr (debug
, var
, TDF_SLIM
);
1564 fprintf (debug
, " &");
1565 print_generic_expr (debug
, tmp
, TDF_SLIM
);
1566 fprintf (debug
, " (%d ,%d)", p1
, p2
);
1569 /* If partitions are already merged, don't check for conflict. */
1572 tpa_remove_partition (tpa
, x
, z
);
1574 fprintf (debug
, ": Already coalesced\n");
1577 if (!conflict_graph_conflict_p (graph
, p1
, p2
))
1580 if (tpa_find_tree (tpa
, y
) == TPA_NONE
1581 || tpa_find_tree (tpa
, z
) == TPA_NONE
)
1584 fprintf (debug
, ": Fail non-TPA member\n");
1587 if ((v
= var_union (map
, var
, tmp
)) == NO_PARTITION
)
1590 fprintf (debug
, ": Fail cannot combine partitions\n");
1594 tpa_remove_partition (tpa
, x
, z
);
1596 conflict_graph_merge_regs (graph
, v
, z
);
1599 /* Update the first partition's representative. */
1600 conflict_graph_merge_regs (graph
, v
, y
);
1604 /* The root variable of the partition may be changed
1606 var
= partition_to_var (map
, p1
);
1609 fprintf (debug
, ": Success -> %d\n", v
);
1613 fprintf (debug
, ": Fail, Conflict\n");
1620 /* Send debug info for coalesce list CL to file F. */
1623 dump_coalesce_list (FILE *f
, coalesce_list_p cl
)
1625 partition_pair_p node
;
1631 fprintf (f
, "Coalesce List:\n");
1632 num
= num_var_partitions (cl
->map
);
1633 for (x
= 0; x
< num
; x
++)
1639 print_generic_expr (f
, partition_to_var (cl
->map
, x
), TDF_SLIM
);
1640 fprintf (f
, "] - ");
1641 for ( ; node
; node
= node
->next
)
1643 var
= partition_to_var (cl
->map
, node
->second_partition
);
1644 print_generic_expr (f
, var
, TDF_SLIM
);
1645 fprintf (f
, "(%1d), ", node
->cost
);
1653 fprintf (f
, "Sorted Coalesce list:\n");
1654 for (node
= cl
->list
[0]; node
; node
= node
->next
)
1656 fprintf (f
, "(%d) ", node
->cost
);
1657 var
= partition_to_var (cl
->map
, node
->first_partition
);
1658 print_generic_expr (f
, var
, TDF_SLIM
);
1660 var
= partition_to_var (cl
->map
, node
->second_partition
);
1661 print_generic_expr (f
, var
, TDF_SLIM
);
1668 /* Output tree_partition_associator object TPA to file F.. */
1671 tpa_dump (FILE *f
, tpa_p tpa
)
1678 for (x
= 0; x
< tpa_num_trees (tpa
); x
++)
1680 print_generic_expr (f
, tpa_tree (tpa
, x
), TDF_SLIM
);
1681 fprintf (f
, " : (");
1682 for (i
= tpa_first_partition (tpa
, x
);
1684 i
= tpa_next_partition (tpa
, i
))
1686 fprintf (f
, "(%d)",i
);
1687 print_generic_expr (f
, partition_to_var (tpa
->map
, i
), TDF_SLIM
);
1690 #ifdef ENABLE_CHECKING
1691 if (tpa_find_tree (tpa
, i
) != x
)
1692 fprintf (f
, "**find tree incorrectly set** ");
1702 /* Output partition map MAP to file F. */
1705 dump_var_map (FILE *f
, var_map map
)
1711 fprintf (f
, "\nPartition map \n\n");
1713 for (x
= 0; x
< map
->num_partitions
; x
++)
1715 if (map
->compact_to_partition
!= NULL
)
1716 p
= map
->compact_to_partition
[x
];
1720 if (map
->partition_to_var
[p
] == NULL_TREE
)
1724 for (y
= 1; y
< num_ssa_names
; y
++)
1726 p
= partition_find (map
->var_partition
, y
);
1727 if (map
->partition_to_compact
)
1728 p
= map
->partition_to_compact
[p
];
1733 fprintf(f
, "Partition %d (", x
);
1734 print_generic_expr (f
, partition_to_var (map
, p
), TDF_SLIM
);
1737 fprintf (f
, "%d ", y
);
1747 /* Output live range info LIVE to file F, controlled by FLAG. */
1750 dump_live_info (FILE *f
, tree_live_info_p live
, int flag
)
1754 var_map map
= live
->map
;
1757 if ((flag
& LIVEDUMP_ENTRY
) && live
->livein
)
1761 fprintf (f
, "\nLive on entry to BB%d : ", bb
->index
);
1762 for (i
= 0; i
< num_var_partitions (map
); i
++)
1764 if (bitmap_bit_p (live_entry_blocks (live
, i
), bb
->index
))
1766 print_generic_expr (f
, partition_to_var (map
, i
), TDF_SLIM
);
1774 if ((flag
& LIVEDUMP_EXIT
) && live
->liveout
)
1778 fprintf (f
, "\nLive on exit from BB%d : ", bb
->index
);
1779 EXECUTE_IF_SET_IN_BITMAP (live
->liveout
[bb
->index
], 0, i
, bi
)
1781 print_generic_expr (f
, partition_to_var (map
, i
), TDF_SLIM
);
1789 #ifdef ENABLE_CHECKING
1791 register_ssa_partition_check (tree ssa_var
)
1793 gcc_assert (TREE_CODE (ssa_var
) == SSA_NAME
);
1794 if (!is_gimple_reg (SSA_NAME_VAR (ssa_var
)))
1796 fprintf (stderr
, "Illegally registering a virtual SSA name :");
1797 print_generic_expr (stderr
, ssa_var
, TDF_SLIM
);
1798 fprintf (stderr
, " in the SSA->Normal phase.\n");
1799 internal_error ("SSA corruption");