tree-ssa.h: Don't include gimple-low.h...
[gcc.git] / gcc / tree-ssa-live.c
1 /* Liveness for SSA trees.
2 Copyright (C) 2003-2013 Free Software Foundation, Inc.
3 Contributed by Andrew MacLeod <amacleod@redhat.com>
4
5 This file is part of GCC.
6
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 3, or (at your option)
10 any later version.
11
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.
16
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
20
21 #include "config.h"
22 #include "system.h"
23 #include "coretypes.h"
24 #include "hash-table.h"
25 #include "tm.h"
26 #include "tree.h"
27 #include "gimple-pretty-print.h"
28 #include "bitmap.h"
29 #include "sbitmap.h"
30 #include "tree-ssa.h"
31 #include "timevar.h"
32 #include "dumpfile.h"
33 #include "tree-ssa-live.h"
34 #include "diagnostic-core.h"
35 #include "debug.h"
36 #include "flags.h"
37 #include "gimple.h"
38
39 #ifdef ENABLE_CHECKING
40 static void verify_live_on_entry (tree_live_info_p);
41 #endif
42
43
44 /* VARMAP maintains a mapping from SSA version number to real variables.
45
46 All SSA_NAMES are divided into partitions. Initially each ssa_name is the
47 only member of it's own partition. Coalescing will attempt to group any
48 ssa_names which occur in a copy or in a PHI node into the same partition.
49
50 At the end of out-of-ssa, each partition becomes a "real" variable and is
51 rewritten as a compiler variable.
52
53 The var_map data structure is used to manage these partitions. It allows
54 partitions to be combined, and determines which partition belongs to what
55 ssa_name or variable, and vice versa. */
56
57
58 /* Hashtable helpers. */
59
60 struct tree_int_map_hasher : typed_noop_remove <tree_int_map>
61 {
62 typedef tree_int_map value_type;
63 typedef tree_int_map compare_type;
64 static inline hashval_t hash (const value_type *);
65 static inline bool equal (const value_type *, const compare_type *);
66 };
67
68 inline hashval_t
69 tree_int_map_hasher::hash (const value_type *v)
70 {
71 return tree_map_base_hash (v);
72 }
73
74 inline bool
75 tree_int_map_hasher::equal (const value_type *v, const compare_type *c)
76 {
77 return tree_int_map_eq (v, c);
78 }
79
80
81 /* This routine will initialize the basevar fields of MAP. */
82
83 static void
84 var_map_base_init (var_map map)
85 {
86 int x, num_part;
87 tree var;
88 hash_table <tree_int_map_hasher> tree_to_index;
89 struct tree_int_map *m, *mapstorage;
90
91 num_part = num_var_partitions (map);
92 tree_to_index.create (num_part);
93 /* We can have at most num_part entries in the hash tables, so it's
94 enough to allocate so many map elements once, saving some malloc
95 calls. */
96 mapstorage = m = XNEWVEC (struct tree_int_map, num_part);
97
98 /* If a base table already exists, clear it, otherwise create it. */
99 free (map->partition_to_base_index);
100 map->partition_to_base_index = (int *) xmalloc (sizeof (int) * num_part);
101
102 /* Build the base variable list, and point partitions at their bases. */
103 for (x = 0; x < num_part; x++)
104 {
105 struct tree_int_map **slot;
106 unsigned baseindex;
107 var = partition_to_var (map, x);
108 if (SSA_NAME_VAR (var)
109 && (!VAR_P (SSA_NAME_VAR (var))
110 || !DECL_IGNORED_P (SSA_NAME_VAR (var))))
111 m->base.from = SSA_NAME_VAR (var);
112 else
113 /* This restricts what anonymous SSA names we can coalesce
114 as it restricts the sets we compute conflicts for.
115 Using TREE_TYPE to generate sets is the easies as
116 type equivalency also holds for SSA names with the same
117 underlying decl.
118
119 Check gimple_can_coalesce_p when changing this code. */
120 m->base.from = (TYPE_CANONICAL (TREE_TYPE (var))
121 ? TYPE_CANONICAL (TREE_TYPE (var))
122 : TREE_TYPE (var));
123 /* If base variable hasn't been seen, set it up. */
124 slot = tree_to_index.find_slot (m, INSERT);
125 if (!*slot)
126 {
127 baseindex = m - mapstorage;
128 m->to = baseindex;
129 *slot = m;
130 m++;
131 }
132 else
133 baseindex = (*slot)->to;
134 map->partition_to_base_index[x] = baseindex;
135 }
136
137 map->num_basevars = m - mapstorage;
138
139 free (mapstorage);
140 tree_to_index. dispose ();
141 }
142
143
144 /* Remove the base table in MAP. */
145
146 static void
147 var_map_base_fini (var_map map)
148 {
149 /* Free the basevar info if it is present. */
150 if (map->partition_to_base_index != NULL)
151 {
152 free (map->partition_to_base_index);
153 map->partition_to_base_index = NULL;
154 map->num_basevars = 0;
155 }
156 }
157 /* Create a variable partition map of SIZE, initialize and return it. */
158
159 var_map
160 init_var_map (int size)
161 {
162 var_map map;
163
164 map = (var_map) xmalloc (sizeof (struct _var_map));
165 map->var_partition = partition_new (size);
166
167 map->partition_to_view = NULL;
168 map->view_to_partition = NULL;
169 map->num_partitions = size;
170 map->partition_size = size;
171 map->num_basevars = 0;
172 map->partition_to_base_index = NULL;
173 return map;
174 }
175
176
177 /* Free memory associated with MAP. */
178
179 void
180 delete_var_map (var_map map)
181 {
182 var_map_base_fini (map);
183 partition_delete (map->var_partition);
184 free (map->partition_to_view);
185 free (map->view_to_partition);
186 free (map);
187 }
188
189
190 /* This function will combine the partitions in MAP for VAR1 and VAR2. It
191 Returns the partition which represents the new partition. If the two
192 partitions cannot be combined, NO_PARTITION is returned. */
193
194 int
195 var_union (var_map map, tree var1, tree var2)
196 {
197 int p1, p2, p3;
198
199 gcc_assert (TREE_CODE (var1) == SSA_NAME);
200 gcc_assert (TREE_CODE (var2) == SSA_NAME);
201
202 /* This is independent of partition_to_view. If partition_to_view is
203 on, then whichever one of these partitions is absorbed will never have a
204 dereference into the partition_to_view array any more. */
205
206 p1 = partition_find (map->var_partition, SSA_NAME_VERSION (var1));
207 p2 = partition_find (map->var_partition, SSA_NAME_VERSION (var2));
208
209 gcc_assert (p1 != NO_PARTITION);
210 gcc_assert (p2 != NO_PARTITION);
211
212 if (p1 == p2)
213 p3 = p1;
214 else
215 p3 = partition_union (map->var_partition, p1, p2);
216
217 if (map->partition_to_view)
218 p3 = map->partition_to_view[p3];
219
220 return p3;
221 }
222
223
224 /* Compress the partition numbers in MAP such that they fall in the range
225 0..(num_partitions-1) instead of wherever they turned out during
226 the partitioning exercise. This removes any references to unused
227 partitions, thereby allowing bitmaps and other vectors to be much
228 denser.
229
230 This is implemented such that compaction doesn't affect partitioning.
231 Ie., once partitions are created and possibly merged, running one
232 or more different kind of compaction will not affect the partitions
233 themselves. Their index might change, but all the same variables will
234 still be members of the same partition group. This allows work on reduced
235 sets, and no loss of information when a larger set is later desired.
236
237 In particular, coalescing can work on partitions which have 2 or more
238 definitions, and then 'recompact' later to include all the single
239 definitions for assignment to program variables. */
240
241
242 /* Set MAP back to the initial state of having no partition view. Return a
243 bitmap which has a bit set for each partition number which is in use in the
244 varmap. */
245
246 static bitmap
247 partition_view_init (var_map map)
248 {
249 bitmap used;
250 int tmp;
251 unsigned int x;
252
253 used = BITMAP_ALLOC (NULL);
254
255 /* Already in a view? Abandon the old one. */
256 if (map->partition_to_view)
257 {
258 free (map->partition_to_view);
259 map->partition_to_view = NULL;
260 }
261 if (map->view_to_partition)
262 {
263 free (map->view_to_partition);
264 map->view_to_partition = NULL;
265 }
266
267 /* Find out which partitions are actually referenced. */
268 for (x = 0; x < map->partition_size; x++)
269 {
270 tmp = partition_find (map->var_partition, x);
271 if (ssa_name (tmp) != NULL_TREE && !virtual_operand_p (ssa_name (tmp))
272 && (!has_zero_uses (ssa_name (tmp))
273 || !SSA_NAME_IS_DEFAULT_DEF (ssa_name (tmp))))
274 bitmap_set_bit (used, tmp);
275 }
276
277 map->num_partitions = map->partition_size;
278 return used;
279 }
280
281
282 /* This routine will finalize the view data for MAP based on the partitions
283 set in SELECTED. This is either the same bitmap returned from
284 partition_view_init, or a trimmed down version if some of those partitions
285 were not desired in this view. SELECTED is freed before returning. */
286
287 static void
288 partition_view_fini (var_map map, bitmap selected)
289 {
290 bitmap_iterator bi;
291 unsigned count, i, x, limit;
292
293 gcc_assert (selected);
294
295 count = bitmap_count_bits (selected);
296 limit = map->partition_size;
297
298 /* If its a one-to-one ratio, we don't need any view compaction. */
299 if (count < limit)
300 {
301 map->partition_to_view = (int *)xmalloc (limit * sizeof (int));
302 memset (map->partition_to_view, 0xff, (limit * sizeof (int)));
303 map->view_to_partition = (int *)xmalloc (count * sizeof (int));
304
305 i = 0;
306 /* Give each selected partition an index. */
307 EXECUTE_IF_SET_IN_BITMAP (selected, 0, x, bi)
308 {
309 map->partition_to_view[x] = i;
310 map->view_to_partition[i] = x;
311 i++;
312 }
313 gcc_assert (i == count);
314 map->num_partitions = i;
315 }
316
317 BITMAP_FREE (selected);
318 }
319
320
321 /* Create a partition view which includes all the used partitions in MAP. If
322 WANT_BASES is true, create the base variable map as well. */
323
324 void
325 partition_view_normal (var_map map, bool want_bases)
326 {
327 bitmap used;
328
329 used = partition_view_init (map);
330 partition_view_fini (map, used);
331
332 if (want_bases)
333 var_map_base_init (map);
334 else
335 var_map_base_fini (map);
336 }
337
338
339 /* Create a partition view in MAP which includes just partitions which occur in
340 the bitmap ONLY. If WANT_BASES is true, create the base variable map
341 as well. */
342
343 void
344 partition_view_bitmap (var_map map, bitmap only, bool want_bases)
345 {
346 bitmap used;
347 bitmap new_partitions = BITMAP_ALLOC (NULL);
348 unsigned x, p;
349 bitmap_iterator bi;
350
351 used = partition_view_init (map);
352 EXECUTE_IF_SET_IN_BITMAP (only, 0, x, bi)
353 {
354 p = partition_find (map->var_partition, x);
355 gcc_assert (bitmap_bit_p (used, p));
356 bitmap_set_bit (new_partitions, p);
357 }
358 partition_view_fini (map, new_partitions);
359
360 if (want_bases)
361 var_map_base_init (map);
362 else
363 var_map_base_fini (map);
364 }
365
366
367 static bitmap usedvars;
368
369 /* Mark VAR as used, so that it'll be preserved during rtl expansion.
370 Returns true if VAR wasn't marked before. */
371
372 static inline bool
373 set_is_used (tree var)
374 {
375 return bitmap_set_bit (usedvars, DECL_UID (var));
376 }
377
378 /* Return true if VAR is marked as used. */
379
380 static inline bool
381 is_used_p (tree var)
382 {
383 return bitmap_bit_p (usedvars, DECL_UID (var));
384 }
385
386 static inline void mark_all_vars_used (tree *);
387
388 /* Helper function for mark_all_vars_used, called via walk_tree. */
389
390 static tree
391 mark_all_vars_used_1 (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED)
392 {
393 tree t = *tp;
394 enum tree_code_class c = TREE_CODE_CLASS (TREE_CODE (t));
395 tree b;
396
397 if (TREE_CODE (t) == SSA_NAME)
398 {
399 *walk_subtrees = 0;
400 t = SSA_NAME_VAR (t);
401 if (!t)
402 return NULL;
403 }
404
405 if (IS_EXPR_CODE_CLASS (c)
406 && (b = TREE_BLOCK (t)) != NULL)
407 TREE_USED (b) = true;
408
409 /* Ignore TMR_OFFSET and TMR_STEP for TARGET_MEM_REFS, as those
410 fields do not contain vars. */
411 if (TREE_CODE (t) == TARGET_MEM_REF)
412 {
413 mark_all_vars_used (&TMR_BASE (t));
414 mark_all_vars_used (&TMR_INDEX (t));
415 mark_all_vars_used (&TMR_INDEX2 (t));
416 *walk_subtrees = 0;
417 return NULL;
418 }
419
420 /* Only need to mark VAR_DECLS; parameters and return results are not
421 eliminated as unused. */
422 if (TREE_CODE (t) == VAR_DECL)
423 {
424 /* When a global var becomes used for the first time also walk its
425 initializer (non global ones don't have any). */
426 if (set_is_used (t) && is_global_var (t))
427 mark_all_vars_used (&DECL_INITIAL (t));
428 }
429 /* remove_unused_scope_block_p requires information about labels
430 which are not DECL_IGNORED_P to tell if they might be used in the IL. */
431 else if (TREE_CODE (t) == LABEL_DECL)
432 /* Although the TREE_USED values that the frontend uses would be
433 acceptable (albeit slightly over-conservative) for our purposes,
434 init_vars_expansion clears TREE_USED for LABEL_DECLs too, so we
435 must re-compute it here. */
436 TREE_USED (t) = 1;
437
438 if (IS_TYPE_OR_DECL_P (t))
439 *walk_subtrees = 0;
440
441 return NULL;
442 }
443
444 /* Mark the scope block SCOPE and its subblocks unused when they can be
445 possibly eliminated if dead. */
446
447 static void
448 mark_scope_block_unused (tree scope)
449 {
450 tree t;
451 TREE_USED (scope) = false;
452 if (!(*debug_hooks->ignore_block) (scope))
453 TREE_USED (scope) = true;
454 for (t = BLOCK_SUBBLOCKS (scope); t ; t = BLOCK_CHAIN (t))
455 mark_scope_block_unused (t);
456 }
457
458 /* Look if the block is dead (by possibly eliminating its dead subblocks)
459 and return true if so.
460 Block is declared dead if:
461 1) No statements are associated with it.
462 2) Declares no live variables
463 3) All subblocks are dead
464 or there is precisely one subblocks and the block
465 has same abstract origin as outer block and declares
466 no variables, so it is pure wrapper.
467 When we are not outputting full debug info, we also eliminate dead variables
468 out of scope blocks to let them to be recycled by GGC and to save copying work
469 done by the inliner. */
470
471 static bool
472 remove_unused_scope_block_p (tree scope)
473 {
474 tree *t, *next;
475 bool unused = !TREE_USED (scope);
476 int nsubblocks = 0;
477
478 for (t = &BLOCK_VARS (scope); *t; t = next)
479 {
480 next = &DECL_CHAIN (*t);
481
482 /* Debug info of nested function refers to the block of the
483 function. We might stil call it even if all statements
484 of function it was nested into was elliminated.
485
486 TODO: We can actually look into cgraph to see if function
487 will be output to file. */
488 if (TREE_CODE (*t) == FUNCTION_DECL)
489 unused = false;
490
491 /* If a decl has a value expr, we need to instantiate it
492 regardless of debug info generation, to avoid codegen
493 differences in memory overlap tests. update_equiv_regs() may
494 indirectly call validate_equiv_mem() to test whether a
495 SET_DEST overlaps with others, and if the value expr changes
496 by virtual register instantiation, we may get end up with
497 different results. */
498 else if (TREE_CODE (*t) == VAR_DECL && DECL_HAS_VALUE_EXPR_P (*t))
499 unused = false;
500
501 /* Remove everything we don't generate debug info for. */
502 else if (DECL_IGNORED_P (*t))
503 {
504 *t = DECL_CHAIN (*t);
505 next = t;
506 }
507
508 /* When we are outputting debug info, we usually want to output
509 info about optimized-out variables in the scope blocks.
510 Exception are the scope blocks not containing any instructions
511 at all so user can't get into the scopes at first place. */
512 else if (is_used_p (*t))
513 unused = false;
514 else if (TREE_CODE (*t) == LABEL_DECL && TREE_USED (*t))
515 /* For labels that are still used in the IL, the decision to
516 preserve them must not depend DEBUG_INFO_LEVEL, otherwise we
517 risk having different ordering in debug vs. non-debug builds
518 during inlining or versioning.
519 A label appearing here (we have already checked DECL_IGNORED_P)
520 should not be used in the IL unless it has been explicitly used
521 before, so we use TREE_USED as an approximation. */
522 /* In principle, we should do the same here as for the debug case
523 below, however, when debugging, there might be additional nested
524 levels that keep an upper level with a label live, so we have to
525 force this block to be considered used, too. */
526 unused = false;
527
528 /* When we are not doing full debug info, we however can keep around
529 only the used variables for cfgexpand's memory packing saving quite
530 a lot of memory.
531
532 For sake of -g3, we keep around those vars but we don't count this as
533 use of block, so innermost block with no used vars and no instructions
534 can be considered dead. We only want to keep around blocks user can
535 breakpoint into and ask about value of optimized out variables.
536
537 Similarly we need to keep around types at least until all
538 variables of all nested blocks are gone. We track no
539 information on whether given type is used or not, so we have
540 to keep them even when not emitting debug information,
541 otherwise we may end up remapping variables and their (local)
542 types in different orders depending on whether debug
543 information is being generated. */
544
545 else if (TREE_CODE (*t) == TYPE_DECL
546 || debug_info_level == DINFO_LEVEL_NORMAL
547 || debug_info_level == DINFO_LEVEL_VERBOSE)
548 ;
549 else
550 {
551 *t = DECL_CHAIN (*t);
552 next = t;
553 }
554 }
555
556 for (t = &BLOCK_SUBBLOCKS (scope); *t ;)
557 if (remove_unused_scope_block_p (*t))
558 {
559 if (BLOCK_SUBBLOCKS (*t))
560 {
561 tree next = BLOCK_CHAIN (*t);
562 tree supercontext = BLOCK_SUPERCONTEXT (*t);
563
564 *t = BLOCK_SUBBLOCKS (*t);
565 while (BLOCK_CHAIN (*t))
566 {
567 BLOCK_SUPERCONTEXT (*t) = supercontext;
568 t = &BLOCK_CHAIN (*t);
569 }
570 BLOCK_CHAIN (*t) = next;
571 BLOCK_SUPERCONTEXT (*t) = supercontext;
572 t = &BLOCK_CHAIN (*t);
573 nsubblocks ++;
574 }
575 else
576 *t = BLOCK_CHAIN (*t);
577 }
578 else
579 {
580 t = &BLOCK_CHAIN (*t);
581 nsubblocks ++;
582 }
583
584
585 if (!unused)
586 ;
587 /* Outer scope is always used. */
588 else if (!BLOCK_SUPERCONTEXT (scope)
589 || TREE_CODE (BLOCK_SUPERCONTEXT (scope)) == FUNCTION_DECL)
590 unused = false;
591 /* Innermost blocks with no live variables nor statements can be always
592 eliminated. */
593 else if (!nsubblocks)
594 ;
595 /* For terse debug info we can eliminate info on unused variables. */
596 else if (debug_info_level == DINFO_LEVEL_NONE
597 || debug_info_level == DINFO_LEVEL_TERSE)
598 {
599 /* Even for -g0/-g1 don't prune outer scopes from artificial
600 functions, otherwise diagnostics using tree_nonartificial_location
601 will not be emitted properly. */
602 if (inlined_function_outer_scope_p (scope))
603 {
604 tree ao = scope;
605
606 while (ao
607 && TREE_CODE (ao) == BLOCK
608 && BLOCK_ABSTRACT_ORIGIN (ao) != ao)
609 ao = BLOCK_ABSTRACT_ORIGIN (ao);
610 if (ao
611 && TREE_CODE (ao) == FUNCTION_DECL
612 && DECL_DECLARED_INLINE_P (ao)
613 && lookup_attribute ("artificial", DECL_ATTRIBUTES (ao)))
614 unused = false;
615 }
616 }
617 else if (BLOCK_VARS (scope) || BLOCK_NUM_NONLOCALIZED_VARS (scope))
618 unused = false;
619 /* See if this block is important for representation of inlined function.
620 Inlined functions are always represented by block with
621 block_ultimate_origin being set to FUNCTION_DECL and DECL_SOURCE_LOCATION
622 set... */
623 else if (inlined_function_outer_scope_p (scope))
624 unused = false;
625 else
626 /* Verfify that only blocks with source location set
627 are entry points to the inlined functions. */
628 gcc_assert (LOCATION_LOCUS (BLOCK_SOURCE_LOCATION (scope))
629 == UNKNOWN_LOCATION);
630
631 TREE_USED (scope) = !unused;
632 return unused;
633 }
634
635 /* Mark all VAR_DECLS under *EXPR_P as used, so that they won't be
636 eliminated during the tree->rtl conversion process. */
637
638 static inline void
639 mark_all_vars_used (tree *expr_p)
640 {
641 walk_tree (expr_p, mark_all_vars_used_1, NULL, NULL);
642 }
643
644 /* Helper function for clear_unused_block_pointer, called via walk_tree. */
645
646 static tree
647 clear_unused_block_pointer_1 (tree *tp, int *, void *)
648 {
649 if (EXPR_P (*tp) && TREE_BLOCK (*tp)
650 && !TREE_USED (TREE_BLOCK (*tp)))
651 TREE_SET_BLOCK (*tp, NULL);
652 return NULL_TREE;
653 }
654
655 /* Set all block pointer in debug or clobber stmt to NULL if the block
656 is unused, so that they will not be streamed out. */
657
658 static void
659 clear_unused_block_pointer (void)
660 {
661 basic_block bb;
662 gimple_stmt_iterator gsi;
663
664 FOR_EACH_BB (bb)
665 for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
666 {
667 unsigned i;
668 tree b;
669 gimple stmt = gsi_stmt (gsi);
670
671 if (!is_gimple_debug (stmt) && !gimple_clobber_p (stmt))
672 continue;
673 b = gimple_block (stmt);
674 if (b && !TREE_USED (b))
675 gimple_set_block (stmt, NULL);
676 for (i = 0; i < gimple_num_ops (stmt); i++)
677 walk_tree (gimple_op_ptr (stmt, i), clear_unused_block_pointer_1,
678 NULL, NULL);
679 }
680 }
681
682 /* Dump scope blocks starting at SCOPE to FILE. INDENT is the
683 indentation level and FLAGS is as in print_generic_expr. */
684
685 static void
686 dump_scope_block (FILE *file, int indent, tree scope, int flags)
687 {
688 tree var, t;
689 unsigned int i;
690
691 fprintf (file, "\n%*s{ Scope block #%i%s%s",indent, "" , BLOCK_NUMBER (scope),
692 TREE_USED (scope) ? "" : " (unused)",
693 BLOCK_ABSTRACT (scope) ? " (abstract)": "");
694 if (LOCATION_LOCUS (BLOCK_SOURCE_LOCATION (scope)) != UNKNOWN_LOCATION)
695 {
696 expanded_location s = expand_location (BLOCK_SOURCE_LOCATION (scope));
697 fprintf (file, " %s:%i", s.file, s.line);
698 }
699 if (BLOCK_ABSTRACT_ORIGIN (scope))
700 {
701 tree origin = block_ultimate_origin (scope);
702 if (origin)
703 {
704 fprintf (file, " Originating from :");
705 if (DECL_P (origin))
706 print_generic_decl (file, origin, flags);
707 else
708 fprintf (file, "#%i", BLOCK_NUMBER (origin));
709 }
710 }
711 fprintf (file, " \n");
712 for (var = BLOCK_VARS (scope); var; var = DECL_CHAIN (var))
713 {
714 fprintf (file, "%*s", indent, "");
715 print_generic_decl (file, var, flags);
716 fprintf (file, "\n");
717 }
718 for (i = 0; i < BLOCK_NUM_NONLOCALIZED_VARS (scope); i++)
719 {
720 fprintf (file, "%*s",indent, "");
721 print_generic_decl (file, BLOCK_NONLOCALIZED_VAR (scope, i),
722 flags);
723 fprintf (file, " (nonlocalized)\n");
724 }
725 for (t = BLOCK_SUBBLOCKS (scope); t ; t = BLOCK_CHAIN (t))
726 dump_scope_block (file, indent + 2, t, flags);
727 fprintf (file, "\n%*s}\n",indent, "");
728 }
729
730 /* Dump the tree of lexical scopes starting at SCOPE to stderr. FLAGS
731 is as in print_generic_expr. */
732
733 DEBUG_FUNCTION void
734 debug_scope_block (tree scope, int flags)
735 {
736 dump_scope_block (stderr, 0, scope, flags);
737 }
738
739
740 /* Dump the tree of lexical scopes of current_function_decl to FILE.
741 FLAGS is as in print_generic_expr. */
742
743 void
744 dump_scope_blocks (FILE *file, int flags)
745 {
746 dump_scope_block (file, 0, DECL_INITIAL (current_function_decl), flags);
747 }
748
749
750 /* Dump the tree of lexical scopes of current_function_decl to stderr.
751 FLAGS is as in print_generic_expr. */
752
753 DEBUG_FUNCTION void
754 debug_scope_blocks (int flags)
755 {
756 dump_scope_blocks (stderr, flags);
757 }
758
759 /* Remove local variables that are not referenced in the IL. */
760
761 void
762 remove_unused_locals (void)
763 {
764 basic_block bb;
765 tree var;
766 unsigned srcidx, dstidx, num;
767 bool have_local_clobbers = false;
768
769 /* Removing declarations from lexical blocks when not optimizing is
770 not only a waste of time, it actually causes differences in stack
771 layout. */
772 if (!optimize)
773 return;
774
775 timevar_push (TV_REMOVE_UNUSED);
776
777 mark_scope_block_unused (DECL_INITIAL (current_function_decl));
778
779 usedvars = BITMAP_ALLOC (NULL);
780
781 /* Walk the CFG marking all referenced symbols. */
782 FOR_EACH_BB (bb)
783 {
784 gimple_stmt_iterator gsi;
785 size_t i;
786 edge_iterator ei;
787 edge e;
788
789 /* Walk the statements. */
790 for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
791 {
792 gimple stmt = gsi_stmt (gsi);
793 tree b = gimple_block (stmt);
794
795 if (is_gimple_debug (stmt))
796 continue;
797
798 if (gimple_clobber_p (stmt))
799 {
800 have_local_clobbers = true;
801 continue;
802 }
803
804 if (b)
805 TREE_USED (b) = true;
806
807 for (i = 0; i < gimple_num_ops (stmt); i++)
808 mark_all_vars_used (gimple_op_ptr (gsi_stmt (gsi), i));
809 }
810
811 for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
812 {
813 use_operand_p arg_p;
814 ssa_op_iter i;
815 tree def;
816 gimple phi = gsi_stmt (gsi);
817
818 if (virtual_operand_p (gimple_phi_result (phi)))
819 continue;
820
821 def = gimple_phi_result (phi);
822 mark_all_vars_used (&def);
823
824 FOR_EACH_PHI_ARG (arg_p, phi, i, SSA_OP_ALL_USES)
825 {
826 tree arg = USE_FROM_PTR (arg_p);
827 int index = PHI_ARG_INDEX_FROM_USE (arg_p);
828 tree block =
829 LOCATION_BLOCK (gimple_phi_arg_location (phi, index));
830 if (block != NULL)
831 TREE_USED (block) = true;
832 mark_all_vars_used (&arg);
833 }
834 }
835
836 FOR_EACH_EDGE (e, ei, bb->succs)
837 if (LOCATION_BLOCK (e->goto_locus) != NULL)
838 TREE_USED (LOCATION_BLOCK (e->goto_locus)) = true;
839 }
840
841 /* We do a two-pass approach about the out-of-scope clobbers. We want
842 to remove them if they are the only references to a local variable,
843 but we want to retain them when there's any other. So the first pass
844 ignores them, and the second pass (if there were any) tries to remove
845 them. */
846 if (have_local_clobbers)
847 FOR_EACH_BB (bb)
848 {
849 gimple_stmt_iterator gsi;
850
851 for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi);)
852 {
853 gimple stmt = gsi_stmt (gsi);
854 tree b = gimple_block (stmt);
855
856 if (gimple_clobber_p (stmt))
857 {
858 tree lhs = gimple_assign_lhs (stmt);
859 tree base = get_base_address (lhs);
860 /* Remove clobbers referencing unused vars, or clobbers
861 with MEM_REF lhs referencing uninitialized pointers. */
862 if ((TREE_CODE (base) == VAR_DECL && !is_used_p (base))
863 || (TREE_CODE (lhs) == MEM_REF
864 && TREE_CODE (TREE_OPERAND (lhs, 0)) == SSA_NAME
865 && SSA_NAME_IS_DEFAULT_DEF (TREE_OPERAND (lhs, 0))
866 && (TREE_CODE (SSA_NAME_VAR (TREE_OPERAND (lhs, 0)))
867 != PARM_DECL)))
868 {
869 unlink_stmt_vdef (stmt);
870 gsi_remove (&gsi, true);
871 release_defs (stmt);
872 continue;
873 }
874 if (b)
875 TREE_USED (b) = true;
876 }
877 gsi_next (&gsi);
878 }
879 }
880
881 cfun->has_local_explicit_reg_vars = false;
882
883 /* Remove unmarked local and global vars from local_decls. */
884 num = vec_safe_length (cfun->local_decls);
885 for (srcidx = 0, dstidx = 0; srcidx < num; srcidx++)
886 {
887 var = (*cfun->local_decls)[srcidx];
888 if (TREE_CODE (var) == VAR_DECL)
889 {
890 if (!is_used_p (var))
891 {
892 tree def;
893 if (cfun->nonlocal_goto_save_area
894 && TREE_OPERAND (cfun->nonlocal_goto_save_area, 0) == var)
895 cfun->nonlocal_goto_save_area = NULL;
896 /* Release any default def associated with var. */
897 if ((def = ssa_default_def (cfun, var)) != NULL_TREE)
898 {
899 set_ssa_default_def (cfun, var, NULL_TREE);
900 release_ssa_name (def);
901 }
902 continue;
903 }
904 }
905 if (TREE_CODE (var) == VAR_DECL
906 && DECL_HARD_REGISTER (var)
907 && !is_global_var (var))
908 cfun->has_local_explicit_reg_vars = true;
909
910 if (srcidx != dstidx)
911 (*cfun->local_decls)[dstidx] = var;
912 dstidx++;
913 }
914 if (dstidx != num)
915 {
916 statistics_counter_event (cfun, "unused VAR_DECLs removed", num - dstidx);
917 cfun->local_decls->truncate (dstidx);
918 }
919
920 remove_unused_scope_block_p (DECL_INITIAL (current_function_decl));
921 clear_unused_block_pointer ();
922
923 BITMAP_FREE (usedvars);
924
925 if (dump_file && (dump_flags & TDF_DETAILS))
926 {
927 fprintf (dump_file, "Scope blocks after cleanups:\n");
928 dump_scope_blocks (dump_file, dump_flags);
929 }
930
931 timevar_pop (TV_REMOVE_UNUSED);
932 }
933
934 /* Obstack for globale liveness info bitmaps. We don't want to put these
935 on the default obstack because these bitmaps can grow quite large and
936 we'll hold on to all that memory until the end of the compiler run.
937 As a bonus, delete_tree_live_info can destroy all the bitmaps by just
938 releasing the whole obstack. */
939 static bitmap_obstack liveness_bitmap_obstack;
940
941 /* Allocate and return a new live range information object base on MAP. */
942
943 static tree_live_info_p
944 new_tree_live_info (var_map map)
945 {
946 tree_live_info_p live;
947 basic_block bb;
948
949 live = XNEW (struct tree_live_info_d);
950 live->map = map;
951 live->num_blocks = last_basic_block;
952
953 live->livein = XNEWVEC (bitmap_head, last_basic_block);
954 FOR_EACH_BB (bb)
955 bitmap_initialize (&live->livein[bb->index], &liveness_bitmap_obstack);
956
957 live->liveout = XNEWVEC (bitmap_head, last_basic_block);
958 FOR_EACH_BB (bb)
959 bitmap_initialize (&live->liveout[bb->index], &liveness_bitmap_obstack);
960
961 live->work_stack = XNEWVEC (int, last_basic_block);
962 live->stack_top = live->work_stack;
963
964 live->global = BITMAP_ALLOC (&liveness_bitmap_obstack);
965 return live;
966 }
967
968
969 /* Free storage for live range info object LIVE. */
970
971 void
972 delete_tree_live_info (tree_live_info_p live)
973 {
974 bitmap_obstack_release (&liveness_bitmap_obstack);
975 free (live->work_stack);
976 free (live->liveout);
977 free (live->livein);
978 free (live);
979 }
980
981
982 /* Visit basic block BB and propagate any required live on entry bits from
983 LIVE into the predecessors. VISITED is the bitmap of visited blocks.
984 TMP is a temporary work bitmap which is passed in to avoid reallocating
985 it each time. */
986
987 static void
988 loe_visit_block (tree_live_info_p live, basic_block bb, sbitmap visited,
989 bitmap tmp)
990 {
991 edge e;
992 bool change;
993 edge_iterator ei;
994 basic_block pred_bb;
995 bitmap loe;
996
997 gcc_checking_assert (!bitmap_bit_p (visited, bb->index));
998 bitmap_set_bit (visited, bb->index);
999
1000 loe = live_on_entry (live, bb);
1001
1002 FOR_EACH_EDGE (e, ei, bb->preds)
1003 {
1004 pred_bb = e->src;
1005 if (pred_bb == ENTRY_BLOCK_PTR)
1006 continue;
1007 /* TMP is variables live-on-entry from BB that aren't defined in the
1008 predecessor block. This should be the live on entry vars to pred.
1009 Note that liveout is the DEFs in a block while live on entry is
1010 being calculated. */
1011 bitmap_and_compl (tmp, loe, &live->liveout[pred_bb->index]);
1012
1013 /* Add these bits to live-on-entry for the pred. if there are any
1014 changes, and pred_bb has been visited already, add it to the
1015 revisit stack. */
1016 change = bitmap_ior_into (live_on_entry (live, pred_bb), tmp);
1017 if (bitmap_bit_p (visited, pred_bb->index) && change)
1018 {
1019 bitmap_clear_bit (visited, pred_bb->index);
1020 *(live->stack_top)++ = pred_bb->index;
1021 }
1022 }
1023 }
1024
1025
1026 /* Using LIVE, fill in all the live-on-entry blocks between the defs and uses
1027 of all the variables. */
1028
1029 static void
1030 live_worklist (tree_live_info_p live)
1031 {
1032 unsigned b;
1033 basic_block bb;
1034 sbitmap visited = sbitmap_alloc (last_basic_block + 1);
1035 bitmap tmp = BITMAP_ALLOC (&liveness_bitmap_obstack);
1036
1037 bitmap_clear (visited);
1038
1039 /* Visit all the blocks in reverse order and propagate live on entry values
1040 into the predecessors blocks. */
1041 FOR_EACH_BB_REVERSE (bb)
1042 loe_visit_block (live, bb, visited, tmp);
1043
1044 /* Process any blocks which require further iteration. */
1045 while (live->stack_top != live->work_stack)
1046 {
1047 b = *--(live->stack_top);
1048 loe_visit_block (live, BASIC_BLOCK (b), visited, tmp);
1049 }
1050
1051 BITMAP_FREE (tmp);
1052 sbitmap_free (visited);
1053 }
1054
1055
1056 /* Calculate the initial live on entry vector for SSA_NAME using immediate_use
1057 links. Set the live on entry fields in LIVE. Def's are marked temporarily
1058 in the liveout vector. */
1059
1060 static void
1061 set_var_live_on_entry (tree ssa_name, tree_live_info_p live)
1062 {
1063 int p;
1064 gimple stmt;
1065 use_operand_p use;
1066 basic_block def_bb = NULL;
1067 imm_use_iterator imm_iter;
1068 bool global = false;
1069
1070 p = var_to_partition (live->map, ssa_name);
1071 if (p == NO_PARTITION)
1072 return;
1073
1074 stmt = SSA_NAME_DEF_STMT (ssa_name);
1075 if (stmt)
1076 {
1077 def_bb = gimple_bb (stmt);
1078 /* Mark defs in liveout bitmap temporarily. */
1079 if (def_bb)
1080 bitmap_set_bit (&live->liveout[def_bb->index], p);
1081 }
1082 else
1083 def_bb = ENTRY_BLOCK_PTR;
1084
1085 /* Visit each use of SSA_NAME and if it isn't in the same block as the def,
1086 add it to the list of live on entry blocks. */
1087 FOR_EACH_IMM_USE_FAST (use, imm_iter, ssa_name)
1088 {
1089 gimple use_stmt = USE_STMT (use);
1090 basic_block add_block = NULL;
1091
1092 if (gimple_code (use_stmt) == GIMPLE_PHI)
1093 {
1094 /* Uses in PHI's are considered to be live at exit of the SRC block
1095 as this is where a copy would be inserted. Check to see if it is
1096 defined in that block, or whether its live on entry. */
1097 int index = PHI_ARG_INDEX_FROM_USE (use);
1098 edge e = gimple_phi_arg_edge (use_stmt, index);
1099 if (e->src != ENTRY_BLOCK_PTR)
1100 {
1101 if (e->src != def_bb)
1102 add_block = e->src;
1103 }
1104 }
1105 else if (is_gimple_debug (use_stmt))
1106 continue;
1107 else
1108 {
1109 /* If its not defined in this block, its live on entry. */
1110 basic_block use_bb = gimple_bb (use_stmt);
1111 if (use_bb != def_bb)
1112 add_block = use_bb;
1113 }
1114
1115 /* If there was a live on entry use, set the bit. */
1116 if (add_block)
1117 {
1118 global = true;
1119 bitmap_set_bit (&live->livein[add_block->index], p);
1120 }
1121 }
1122
1123 /* If SSA_NAME is live on entry to at least one block, fill in all the live
1124 on entry blocks between the def and all the uses. */
1125 if (global)
1126 bitmap_set_bit (live->global, p);
1127 }
1128
1129
1130 /* Calculate the live on exit vectors based on the entry info in LIVEINFO. */
1131
1132 void
1133 calculate_live_on_exit (tree_live_info_p liveinfo)
1134 {
1135 basic_block bb;
1136 edge e;
1137 edge_iterator ei;
1138
1139 /* live on entry calculations used liveout vectors for defs, clear them. */
1140 FOR_EACH_BB (bb)
1141 bitmap_clear (&liveinfo->liveout[bb->index]);
1142
1143 /* Set all the live-on-exit bits for uses in PHIs. */
1144 FOR_EACH_BB (bb)
1145 {
1146 gimple_stmt_iterator gsi;
1147 size_t i;
1148
1149 /* Mark the PHI arguments which are live on exit to the pred block. */
1150 for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
1151 {
1152 gimple phi = gsi_stmt (gsi);
1153 for (i = 0; i < gimple_phi_num_args (phi); i++)
1154 {
1155 tree t = PHI_ARG_DEF (phi, i);
1156 int p;
1157
1158 if (TREE_CODE (t) != SSA_NAME)
1159 continue;
1160
1161 p = var_to_partition (liveinfo->map, t);
1162 if (p == NO_PARTITION)
1163 continue;
1164 e = gimple_phi_arg_edge (phi, i);
1165 if (e->src != ENTRY_BLOCK_PTR)
1166 bitmap_set_bit (&liveinfo->liveout[e->src->index], p);
1167 }
1168 }
1169
1170 /* Add each successors live on entry to this bock live on exit. */
1171 FOR_EACH_EDGE (e, ei, bb->succs)
1172 if (e->dest != EXIT_BLOCK_PTR)
1173 bitmap_ior_into (&liveinfo->liveout[bb->index],
1174 live_on_entry (liveinfo, e->dest));
1175 }
1176 }
1177
1178
1179 /* Given partition map MAP, calculate all the live on entry bitmaps for
1180 each partition. Return a new live info object. */
1181
1182 tree_live_info_p
1183 calculate_live_ranges (var_map map)
1184 {
1185 tree var;
1186 unsigned i;
1187 tree_live_info_p live;
1188
1189 bitmap_obstack_initialize (&liveness_bitmap_obstack);
1190 live = new_tree_live_info (map);
1191 for (i = 0; i < num_var_partitions (map); i++)
1192 {
1193 var = partition_to_var (map, i);
1194 if (var != NULL_TREE)
1195 set_var_live_on_entry (var, live);
1196 }
1197
1198 live_worklist (live);
1199
1200 #ifdef ENABLE_CHECKING
1201 verify_live_on_entry (live);
1202 #endif
1203
1204 calculate_live_on_exit (live);
1205 return live;
1206 }
1207
1208
1209 /* Output partition map MAP to file F. */
1210
1211 void
1212 dump_var_map (FILE *f, var_map map)
1213 {
1214 int t;
1215 unsigned x, y;
1216 int p;
1217
1218 fprintf (f, "\nPartition map \n\n");
1219
1220 for (x = 0; x < map->num_partitions; x++)
1221 {
1222 if (map->view_to_partition != NULL)
1223 p = map->view_to_partition[x];
1224 else
1225 p = x;
1226
1227 if (ssa_name (p) == NULL_TREE
1228 || virtual_operand_p (ssa_name (p)))
1229 continue;
1230
1231 t = 0;
1232 for (y = 1; y < num_ssa_names; y++)
1233 {
1234 p = partition_find (map->var_partition, y);
1235 if (map->partition_to_view)
1236 p = map->partition_to_view[p];
1237 if (p == (int)x)
1238 {
1239 if (t++ == 0)
1240 {
1241 fprintf (f, "Partition %d (", x);
1242 print_generic_expr (f, partition_to_var (map, p), TDF_SLIM);
1243 fprintf (f, " - ");
1244 }
1245 fprintf (f, "%d ", y);
1246 }
1247 }
1248 if (t != 0)
1249 fprintf (f, ")\n");
1250 }
1251 fprintf (f, "\n");
1252 }
1253
1254
1255 /* Generic dump for the above. */
1256
1257 DEBUG_FUNCTION void
1258 debug (_var_map &ref)
1259 {
1260 dump_var_map (stderr, &ref);
1261 }
1262
1263 DEBUG_FUNCTION void
1264 debug (_var_map *ptr)
1265 {
1266 if (ptr)
1267 debug (*ptr);
1268 else
1269 fprintf (stderr, "<nil>\n");
1270 }
1271
1272
1273 /* Output live range info LIVE to file F, controlled by FLAG. */
1274
1275 void
1276 dump_live_info (FILE *f, tree_live_info_p live, int flag)
1277 {
1278 basic_block bb;
1279 unsigned i;
1280 var_map map = live->map;
1281 bitmap_iterator bi;
1282
1283 if ((flag & LIVEDUMP_ENTRY) && live->livein)
1284 {
1285 FOR_EACH_BB (bb)
1286 {
1287 fprintf (f, "\nLive on entry to BB%d : ", bb->index);
1288 EXECUTE_IF_SET_IN_BITMAP (&live->livein[bb->index], 0, i, bi)
1289 {
1290 print_generic_expr (f, partition_to_var (map, i), TDF_SLIM);
1291 fprintf (f, " ");
1292 }
1293 fprintf (f, "\n");
1294 }
1295 }
1296
1297 if ((flag & LIVEDUMP_EXIT) && live->liveout)
1298 {
1299 FOR_EACH_BB (bb)
1300 {
1301 fprintf (f, "\nLive on exit from BB%d : ", bb->index);
1302 EXECUTE_IF_SET_IN_BITMAP (&live->liveout[bb->index], 0, i, bi)
1303 {
1304 print_generic_expr (f, partition_to_var (map, i), TDF_SLIM);
1305 fprintf (f, " ");
1306 }
1307 fprintf (f, "\n");
1308 }
1309 }
1310 }
1311
1312
1313 /* Generic dump for the above. */
1314
1315 DEBUG_FUNCTION void
1316 debug (tree_live_info_d &ref)
1317 {
1318 dump_live_info (stderr, &ref, 0);
1319 }
1320
1321 DEBUG_FUNCTION void
1322 debug (tree_live_info_d *ptr)
1323 {
1324 if (ptr)
1325 debug (*ptr);
1326 else
1327 fprintf (stderr, "<nil>\n");
1328 }
1329
1330
1331 #ifdef ENABLE_CHECKING
1332 /* Verify that SSA_VAR is a non-virtual SSA_NAME. */
1333
1334 void
1335 register_ssa_partition_check (tree ssa_var)
1336 {
1337 gcc_assert (TREE_CODE (ssa_var) == SSA_NAME);
1338 if (virtual_operand_p (ssa_var))
1339 {
1340 fprintf (stderr, "Illegally registering a virtual SSA name :");
1341 print_generic_expr (stderr, ssa_var, TDF_SLIM);
1342 fprintf (stderr, " in the SSA->Normal phase.\n");
1343 internal_error ("SSA corruption");
1344 }
1345 }
1346
1347
1348 /* Verify that the info in LIVE matches the current cfg. */
1349
1350 static void
1351 verify_live_on_entry (tree_live_info_p live)
1352 {
1353 unsigned i;
1354 tree var;
1355 gimple stmt;
1356 basic_block bb;
1357 edge e;
1358 int num;
1359 edge_iterator ei;
1360 var_map map = live->map;
1361
1362 /* Check for live on entry partitions and report those with a DEF in
1363 the program. This will typically mean an optimization has done
1364 something wrong. */
1365 bb = ENTRY_BLOCK_PTR;
1366 num = 0;
1367 FOR_EACH_EDGE (e, ei, bb->succs)
1368 {
1369 int entry_block = e->dest->index;
1370 if (e->dest == EXIT_BLOCK_PTR)
1371 continue;
1372 for (i = 0; i < (unsigned)num_var_partitions (map); i++)
1373 {
1374 basic_block tmp;
1375 tree d = NULL_TREE;
1376 bitmap loe;
1377 var = partition_to_var (map, i);
1378 stmt = SSA_NAME_DEF_STMT (var);
1379 tmp = gimple_bb (stmt);
1380 if (SSA_NAME_VAR (var))
1381 d = ssa_default_def (cfun, SSA_NAME_VAR (var));
1382
1383 loe = live_on_entry (live, e->dest);
1384 if (loe && bitmap_bit_p (loe, i))
1385 {
1386 if (!gimple_nop_p (stmt))
1387 {
1388 num++;
1389 print_generic_expr (stderr, var, TDF_SLIM);
1390 fprintf (stderr, " is defined ");
1391 if (tmp)
1392 fprintf (stderr, " in BB%d, ", tmp->index);
1393 fprintf (stderr, "by:\n");
1394 print_gimple_stmt (stderr, stmt, 0, TDF_SLIM);
1395 fprintf (stderr, "\nIt is also live-on-entry to entry BB %d",
1396 entry_block);
1397 fprintf (stderr, " So it appears to have multiple defs.\n");
1398 }
1399 else
1400 {
1401 if (d != var)
1402 {
1403 num++;
1404 print_generic_expr (stderr, var, TDF_SLIM);
1405 fprintf (stderr, " is live-on-entry to BB%d ",
1406 entry_block);
1407 if (d)
1408 {
1409 fprintf (stderr, " but is not the default def of ");
1410 print_generic_expr (stderr, d, TDF_SLIM);
1411 fprintf (stderr, "\n");
1412 }
1413 else
1414 fprintf (stderr, " and there is no default def.\n");
1415 }
1416 }
1417 }
1418 else
1419 if (d == var)
1420 {
1421 /* The only way this var shouldn't be marked live on entry is
1422 if it occurs in a PHI argument of the block. */
1423 size_t z;
1424 bool ok = false;
1425 gimple_stmt_iterator gsi;
1426 for (gsi = gsi_start_phis (e->dest);
1427 !gsi_end_p (gsi) && !ok;
1428 gsi_next (&gsi))
1429 {
1430 gimple phi = gsi_stmt (gsi);
1431 for (z = 0; z < gimple_phi_num_args (phi); z++)
1432 if (var == gimple_phi_arg_def (phi, z))
1433 {
1434 ok = true;
1435 break;
1436 }
1437 }
1438 if (ok)
1439 continue;
1440 num++;
1441 print_generic_expr (stderr, var, TDF_SLIM);
1442 fprintf (stderr, " is not marked live-on-entry to entry BB%d ",
1443 entry_block);
1444 fprintf (stderr, "but it is a default def so it should be.\n");
1445 }
1446 }
1447 }
1448 gcc_assert (num <= 0);
1449 }
1450 #endif