1 /* Top level of GCC compilers (cc1, cc1plus, etc.)
2 Copyright (C) 1987-2013 Free Software Foundation, Inc.
4 This file is part of GCC.
6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 3, or (at your option) any later
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3. If not see
18 <http://www.gnu.org/licenses/>. */
20 /* This is the top level of cc1/c++.
21 It parses command args, opens files, invokes the various passes
22 in the proper order, and counts the time used by each.
23 Error messages and low-level interface to malloc also handled here. */
27 #include "coretypes.h"
30 #include "hash-table.h"
36 #include "insn-attr.h"
37 #include "insn-config.h"
38 #include "insn-flags.h"
39 #include "hard-reg-set.h"
46 #include "basic-block.h"
51 #include "diagnostic-core.h"
56 #include "langhooks.h"
58 #include "hosthooks.h"
62 #include "value-prof.h"
63 #include "tree-inline.h"
64 #include "tree-flow.h"
65 #include "tree-pass.h"
66 #include "tree-dump.h"
69 #include "lto-streamer.h"
71 #include "ipa-utils.h"
72 #include "tree-pretty-print.h" /* for dump_function_header */
74 #include "pass_manager.h"
78 /* This is used for debugging. It allows the current pass to printed
79 from anywhere in compilation.
80 The variable current_pass is also used for statistics and plugins. */
81 struct opt_pass
*current_pass
;
83 static void register_pass_name (struct opt_pass
*, const char *);
85 /* Most passes are single-instance (within their context) and thus don't
86 need to implement cloning, but passes that support multiple instances
87 *must* provide their own implementation of the clone method.
89 Handle this by providing a default implemenation, but make it a fatal
95 internal_error ("pass %s does not support cloning", name
);
110 opt_pass::opt_pass(const pass_data
&data
, context
*ctxt
)
114 static_pass_number(0),
121 pass_manager::execute_early_local_passes ()
123 execute_pass_list (pass_early_local_passes_1
->sub
);
127 pass_manager::execute_pass_mode_switching ()
129 return pass_mode_switching_1
->execute ();
133 /* Call from anywhere to find out what pass this is. Useful for
134 printing out debugging information deep inside an service
137 print_current_pass (FILE *file
)
140 fprintf (file
, "current pass = %s (%d)\n",
141 current_pass
->name
, current_pass
->static_pass_number
);
143 fprintf (file
, "no current pass.\n");
147 /* Call from the debugger to get the current pass name. */
151 print_current_pass (stderr
);
156 /* Global variables used to communicate with passes. */
158 bool first_pass_instance
;
161 /* This is called from various places for FUNCTION_DECL, VAR_DECL,
164 This does nothing for local (non-static) variables, unless the
165 variable is a register variable with DECL_ASSEMBLER_NAME set. In
166 that case, or if the variable is not an automatic, it sets up the
167 RTL and outputs any assembler code (label definition, storage
168 allocation and initialization).
170 DECL is the declaration. TOP_LEVEL is nonzero
171 if this declaration is not within a function. */
174 rest_of_decl_compilation (tree decl
,
178 /* We deferred calling assemble_alias so that we could collect
179 other attributes such as visibility. Emit the alias now. */
183 alias
= lookup_attribute ("alias", DECL_ATTRIBUTES (decl
));
186 alias
= TREE_VALUE (TREE_VALUE (alias
));
187 alias
= get_identifier (TREE_STRING_POINTER (alias
));
188 /* A quirk of the initial implementation of aliases required that the
189 user add "extern" to all of them. Which is silly, but now
190 historical. Do note that the symbol is in fact locally defined. */
191 DECL_EXTERNAL (decl
) = 0;
192 TREE_STATIC (decl
) = 1;
193 assemble_alias (decl
, alias
);
197 /* Can't defer this, because it needs to happen before any
198 later function definitions are processed. */
199 if (DECL_ASSEMBLER_NAME_SET_P (decl
) && DECL_REGISTER (decl
))
200 make_decl_rtl (decl
);
202 /* Forward declarations for nested functions are not "external",
203 but we need to treat them as if they were. */
204 if (TREE_STATIC (decl
) || DECL_EXTERNAL (decl
)
205 || TREE_CODE (decl
) == FUNCTION_DECL
)
207 timevar_push (TV_VARCONST
);
209 /* Don't output anything when a tentative file-scope definition
210 is seen. But at end of compilation, do output code for them.
212 We do output all variables and rely on
213 callgraph code to defer them except for forward declarations
214 (see gcc.c-torture/compile/920624-1.c) */
216 || !DECL_DEFER_OUTPUT (decl
)
217 || DECL_INITIAL (decl
))
218 && (TREE_CODE (decl
) != VAR_DECL
|| !DECL_HAS_VALUE_EXPR_P (decl
))
219 && !DECL_EXTERNAL (decl
))
221 /* When reading LTO unit, we also read varpool, so do not
223 if (in_lto_p
&& !at_end
)
225 else if (TREE_CODE (decl
) != FUNCTION_DECL
)
226 varpool_finalize_decl (decl
);
229 #ifdef ASM_FINISH_DECLARE_OBJECT
230 if (decl
== last_assemble_variable_decl
)
232 ASM_FINISH_DECLARE_OBJECT (asm_out_file
, decl
,
237 timevar_pop (TV_VARCONST
);
239 else if (TREE_CODE (decl
) == TYPE_DECL
240 /* Like in rest_of_type_compilation, avoid confusing the debug
241 information machinery when there are errors. */
244 timevar_push (TV_SYMOUT
);
245 debug_hooks
->type_decl (decl
, !top_level
);
246 timevar_pop (TV_SYMOUT
);
249 /* Let cgraph know about the existence of variables. */
250 if (in_lto_p
&& !at_end
)
252 else if (TREE_CODE (decl
) == VAR_DECL
&& !DECL_EXTERNAL (decl
)
253 && TREE_STATIC (decl
))
254 varpool_node_for_decl (decl
);
257 /* Called after finishing a record, union or enumeral type. */
260 rest_of_type_compilation (tree type
, int toplev
)
262 /* Avoid confusing the debug information machinery when there are
267 timevar_push (TV_SYMOUT
);
268 debug_hooks
->type_decl (TYPE_STUB_DECL (type
), !toplev
);
269 timevar_pop (TV_SYMOUT
);
276 finish_optimization_passes (void)
279 struct dump_file_info
*dfi
;
282 timevar_push (TV_DUMP
);
283 if (profile_arc_flag
|| flag_test_coverage
|| flag_branch_probabilities
)
285 dump_start (pass_profile_1
->static_pass_number
, NULL
);
287 dump_finish (pass_profile_1
->static_pass_number
);
292 dump_start (pass_profile_1
->static_pass_number
, NULL
);
293 print_combine_total_stats ();
294 dump_finish (pass_profile_1
->static_pass_number
);
297 /* Do whatever is necessary to finish printing the graphs. */
298 for (i
= TDI_end
; (dfi
= get_dump_file_info (i
)) != NULL
; ++i
)
299 if (dump_initialized_p (i
)
300 && (dfi
->pflags
& TDF_GRAPH
) != 0
301 && (name
= get_dump_file_name (i
)) != NULL
)
303 finish_graph_dump_file (name
);
307 timevar_pop (TV_DUMP
);
311 execute_all_early_local_passes (void)
313 /* Once this pass (and its sub-passes) are complete, all functions
314 will be in SSA form. Technically this state change is happening
315 a tad early, since the sub-passes have not yet run, but since
316 none of the sub-passes are IPA passes and do not create new
317 functions, this is ok. We're setting this value for the benefit
318 of IPA passes that follow. */
319 if (cgraph_state
< CGRAPH_STATE_IPA_SSA
)
320 cgraph_state
= CGRAPH_STATE_IPA_SSA
;
324 /* Gate: execute, or not, all of the non-trivial optimizations. */
327 gate_all_early_local_passes (void)
329 /* Don't bother doing anything if the program has errors. */
330 return (!seen_error () && !in_lto_p
);
333 struct simple_ipa_opt_pass pass_early_local_passes
=
337 "early_local_cleanups", /* name */
338 OPTGROUP_NONE
, /* optinfo_flags */
339 gate_all_early_local_passes
, /* gate */
340 execute_all_early_local_passes
, /* execute */
343 0, /* static_pass_number */
344 TV_EARLY_LOCAL
, /* tv_id */
345 0, /* properties_required */
346 0, /* properties_provided */
347 0, /* properties_destroyed */
348 0, /* todo_flags_start */
349 TODO_remove_functions
/* todo_flags_finish */
353 /* Gate: execute, or not, all of the non-trivial optimizations. */
356 gate_all_early_optimizations (void)
358 return (optimize
>= 1
359 /* Don't bother doing anything if the program has errors. */
363 static struct gimple_opt_pass pass_all_early_optimizations
=
367 "early_optimizations", /* name */
368 OPTGROUP_NONE
, /* optinfo_flags */
369 gate_all_early_optimizations
, /* gate */
373 0, /* static_pass_number */
375 0, /* properties_required */
376 0, /* properties_provided */
377 0, /* properties_destroyed */
378 0, /* todo_flags_start */
379 0 /* todo_flags_finish */
383 /* Gate: execute, or not, all of the non-trivial optimizations. */
386 gate_all_optimizations (void)
388 return optimize
>= 1 && !optimize_debug
;
391 static struct gimple_opt_pass pass_all_optimizations
=
395 "*all_optimizations", /* name */
396 OPTGROUP_NONE
, /* optinfo_flags */
397 gate_all_optimizations
, /* gate */
401 0, /* static_pass_number */
402 TV_OPTIMIZE
, /* tv_id */
403 0, /* properties_required */
404 0, /* properties_provided */
405 0, /* properties_destroyed */
406 0, /* todo_flags_start */
407 0 /* todo_flags_finish */
411 /* Gate: execute, or not, all of the non-trivial optimizations. */
414 gate_all_optimizations_g (void)
416 return optimize
>= 1 && optimize_debug
;
419 static struct gimple_opt_pass pass_all_optimizations_g
=
423 "*all_optimizations_g", /* name */
424 OPTGROUP_NONE
, /* optinfo_flags */
425 gate_all_optimizations_g
, /* gate */
429 0, /* static_pass_number */
430 TV_OPTIMIZE
, /* tv_id */
431 0, /* properties_required */
432 0, /* properties_provided */
433 0, /* properties_destroyed */
434 0, /* todo_flags_start */
435 0 /* todo_flags_finish */
440 gate_rest_of_compilation (void)
442 /* Early return if there were errors. We can run afoul of our
443 consistency checks, and there's not really much point in fixing them. */
444 return !(rtl_dump_and_exit
|| flag_syntax_only
|| seen_error ());
447 static struct rtl_opt_pass pass_rest_of_compilation
=
451 "*rest_of_compilation", /* name */
452 OPTGROUP_NONE
, /* optinfo_flags */
453 gate_rest_of_compilation
, /* gate */
457 0, /* static_pass_number */
458 TV_REST_OF_COMPILATION
, /* tv_id */
459 PROP_rtl
, /* properties_required */
460 0, /* properties_provided */
461 0, /* properties_destroyed */
462 0, /* todo_flags_start */
463 0 /* todo_flags_finish */
468 gate_postreload (void)
470 return reload_completed
;
473 static struct rtl_opt_pass pass_postreload
=
477 "*all-postreload", /* name */
478 OPTGROUP_NONE
, /* optinfo_flags */
479 gate_postreload
, /* gate */
483 0, /* static_pass_number */
484 TV_POSTRELOAD
, /* tv_id */
485 PROP_rtl
, /* properties_required */
486 0, /* properties_provided */
487 0, /* properties_destroyed */
488 0, /* todo_flags_start */
489 TODO_verify_rtl_sharing
/* todo_flags_finish */
495 /* Set the static pass number of pass PASS to ID and record that
496 in the mapping from static pass number to pass. */
500 set_pass_for_id (int id
, struct opt_pass
*pass
)
502 pass
->static_pass_number
= id
;
503 if (passes_by_id_size
<= id
)
505 passes_by_id
= XRESIZEVEC (struct opt_pass
*, passes_by_id
, id
+ 1);
506 memset (passes_by_id
+ passes_by_id_size
, 0,
507 (id
+ 1 - passes_by_id_size
) * sizeof (void *));
508 passes_by_id_size
= id
+ 1;
510 passes_by_id
[id
] = pass
;
513 /* Return the pass with the static pass number ID. */
516 pass_manager::get_pass_for_id (int id
) const
518 if (id
>= passes_by_id_size
)
520 return passes_by_id
[id
];
523 /* Iterate over the pass tree allocating dump file numbers. We want
524 to do this depth first, and independent of whether the pass is
528 register_one_dump_file (struct opt_pass
*pass
)
530 g
->get_passes ()->register_one_dump_file (pass
);
534 pass_manager::register_one_dump_file (struct opt_pass
*pass
)
536 char *dot_name
, *flag_name
, *glob_name
;
537 const char *name
, *full_name
, *prefix
;
540 int optgroup_flags
= OPTGROUP_NONE
;
542 /* See below in next_pass_1. */
544 if (pass
->static_pass_number
!= -1)
545 sprintf (num
, "%d", ((int) pass
->static_pass_number
< 0
546 ? 1 : pass
->static_pass_number
));
548 /* The name is both used to identify the pass for the purposes of plugins,
549 and to specify dump file name and option.
550 The latter two might want something short which is not quite unique; for
551 that reason, we may have a disambiguating prefix, followed by a space
552 to mark the start of the following dump file name / option string. */
553 name
= strchr (pass
->name
, ' ');
554 name
= name
? name
+ 1 : pass
->name
;
555 dot_name
= concat (".", name
, num
, NULL
);
556 if (pass
->type
== SIMPLE_IPA_PASS
|| pass
->type
== IPA_PASS
)
560 optgroup_flags
|= OPTGROUP_IPA
;
562 else if (pass
->type
== GIMPLE_PASS
)
573 flag_name
= concat (prefix
, name
, num
, NULL
);
574 glob_name
= concat (prefix
, name
, NULL
);
575 optgroup_flags
|= pass
->optinfo_flags
;
576 id
= dump_register (dot_name
, flag_name
, glob_name
, flags
, optgroup_flags
);
577 set_pass_for_id (id
, pass
);
578 full_name
= concat (prefix
, pass
->name
, num
, NULL
);
579 register_pass_name (pass
, full_name
);
580 free (CONST_CAST (char *, full_name
));
583 /* Recursive worker function for register_dump_files. */
587 register_dump_files_1 (struct opt_pass
*pass
, int properties
)
591 int new_properties
= (properties
| pass
->properties_provided
)
592 & ~pass
->properties_destroyed
;
594 if (pass
->name
&& pass
->name
[0] != '*')
595 register_one_dump_file (pass
);
598 new_properties
= register_dump_files_1 (pass
->sub
, new_properties
);
600 /* If we have a gate, combine the properties that we could have with
601 and without the pass being examined. */
603 properties
&= new_properties
;
605 properties
= new_properties
;
614 /* Register the dump files for the pass_manager starting at PASS.
615 PROPERTIES reflects the properties that are guaranteed to be available at
616 the beginning of the pipeline. */
620 register_dump_files (struct opt_pass
*pass
,int properties
)
622 pass
->properties_required
|= properties
;
623 register_dump_files_1 (pass
, properties
);
628 const char* unique_name
;
629 struct opt_pass
*pass
;
632 /* Helper for pass_registry hash table. */
634 struct pass_registry_hasher
: typed_noop_remove
<pass_registry
>
636 typedef pass_registry value_type
;
637 typedef pass_registry compare_type
;
638 static inline hashval_t
hash (const value_type
*);
639 static inline bool equal (const value_type
*, const compare_type
*);
642 /* Pass registry hash function. */
645 pass_registry_hasher::hash (const value_type
*s
)
647 return htab_hash_string (s
->unique_name
);
650 /* Hash equal function */
653 pass_registry_hasher::equal (const value_type
*s1
, const compare_type
*s2
)
655 return !strcmp (s1
->unique_name
, s2
->unique_name
);
658 static hash_table
<pass_registry_hasher
> name_to_pass_map
;
660 /* Register PASS with NAME. */
663 register_pass_name (struct opt_pass
*pass
, const char *name
)
665 struct pass_registry
**slot
;
666 struct pass_registry pr
;
668 if (!name_to_pass_map
.is_created ())
669 name_to_pass_map
.create (256);
671 pr
.unique_name
= name
;
672 slot
= name_to_pass_map
.find_slot (&pr
, INSERT
);
675 struct pass_registry
*new_pr
;
677 new_pr
= XCNEW (struct pass_registry
);
678 new_pr
->unique_name
= xstrdup (name
);
683 return; /* Ignore plugin passes. */
686 /* Map from pass id to canonicalized pass name. */
688 typedef const char *char_ptr
;
689 static vec
<char_ptr
> pass_tab
= vNULL
;
691 /* Callback function for traversing NAME_TO_PASS_MAP. */
694 passes_pass_traverse (pass_registry
**p
, void *data ATTRIBUTE_UNUSED
)
696 struct opt_pass
*pass
= (*p
)->pass
;
698 gcc_assert (pass
->static_pass_number
> 0);
699 gcc_assert (pass_tab
.exists ());
701 pass_tab
[pass
->static_pass_number
] = (*p
)->unique_name
;
706 /* The function traverses NAME_TO_PASS_MAP and creates a pass info
707 table for dumping purpose. */
710 create_pass_tab (void)
712 if (!flag_dump_passes
)
715 pass_tab
.safe_grow_cleared (g
->get_passes ()->passes_by_id_size
+ 1);
716 name_to_pass_map
.traverse
<void *, passes_pass_traverse
> (NULL
);
719 static bool override_gate_status (struct opt_pass
*, tree
, bool);
721 /* Dump the instantiated name for PASS. IS_ON indicates if PASS
722 is turned on or not. */
725 dump_one_pass (struct opt_pass
*pass
, int pass_indent
)
727 int indent
= 3 * pass_indent
;
729 bool is_on
, is_really_on
;
731 is_on
= pass
->has_gate
? pass
->gate() : true;
732 is_really_on
= override_gate_status (pass
, current_function_decl
, is_on
);
734 if (pass
->static_pass_number
<= 0)
737 pn
= pass_tab
[pass
->static_pass_number
];
739 fprintf (stderr
, "%*s%-40s%*s:%s%s\n", indent
, " ", pn
,
740 (15 - indent
< 0 ? 0 : 15 - indent
), " ",
741 is_on
? " ON" : " OFF",
742 ((!is_on
) == (!is_really_on
) ? ""
743 : (is_really_on
? " (FORCED_ON)" : " (FORCED_OFF)")));
746 /* Dump pass list PASS with indentation INDENT. */
749 dump_pass_list (struct opt_pass
*pass
, int indent
)
753 dump_one_pass (pass
, indent
);
755 dump_pass_list (pass
->sub
, indent
+ 1);
761 /* Dump all optimization passes. */
766 g
->get_passes ()->dump_passes ();
770 pass_manager::dump_passes () const
772 struct cgraph_node
*n
, *node
= NULL
;
776 FOR_EACH_FUNCTION (n
)
777 if (DECL_STRUCT_FUNCTION (n
->symbol
.decl
))
786 push_cfun (DECL_STRUCT_FUNCTION (node
->symbol
.decl
));
788 dump_pass_list (all_lowering_passes
, 1);
789 dump_pass_list (all_small_ipa_passes
, 1);
790 dump_pass_list (all_regular_ipa_passes
, 1);
791 dump_pass_list (all_lto_gen_passes
, 1);
792 dump_pass_list (all_late_ipa_passes
, 1);
793 dump_pass_list (all_passes
, 1);
799 /* Returns the pass with NAME. */
801 static struct opt_pass
*
802 get_pass_by_name (const char *name
)
804 struct pass_registry
**slot
, pr
;
806 pr
.unique_name
= name
;
807 slot
= name_to_pass_map
.find_slot (&pr
, NO_INSERT
);
812 return (*slot
)->pass
;
816 /* Range [start, last]. */
822 const char *assem_name
;
823 struct uid_range
*next
;
826 typedef struct uid_range
*uid_range_p
;
829 static vec
<uid_range_p
>
830 enabled_pass_uid_range_tab
= vNULL
;
831 static vec
<uid_range_p
>
832 disabled_pass_uid_range_tab
= vNULL
;
835 /* Parse option string for -fdisable- and -fenable-
836 The syntax of the options:
839 -fdisable-<pass_name>
841 -fenable-<pass_name>=s1:e1,s2:e2,...
842 -fdisable-<pass_name>=s1:e1,s2:e2,...
846 enable_disable_pass (const char *arg
, bool is_enable
)
848 struct opt_pass
*pass
;
849 char *range_str
, *phase_name
;
850 char *argstr
= xstrdup (arg
);
851 vec
<uid_range_p
> *tab
= 0;
853 range_str
= strchr (argstr
,'=');
864 error ("unrecognized option -fenable");
866 error ("unrecognized option -fdisable");
870 pass
= get_pass_by_name (phase_name
);
871 if (!pass
|| pass
->static_pass_number
== -1)
874 error ("unknown pass %s specified in -fenable", phase_name
);
876 error ("unknown pass %s specified in -fdisable", phase_name
);
882 tab
= &enabled_pass_uid_range_tab
;
884 tab
= &disabled_pass_uid_range_tab
;
886 if ((unsigned) pass
->static_pass_number
>= tab
->length ())
887 tab
->safe_grow_cleared (pass
->static_pass_number
+ 1);
892 uid_range_p new_range
= XCNEW (struct uid_range
);
894 new_range
->start
= 0;
895 new_range
->last
= (unsigned)-1;
897 slot
= (*tab
)[pass
->static_pass_number
];
898 new_range
->next
= slot
;
899 (*tab
)[pass
->static_pass_number
] = new_range
;
901 inform (UNKNOWN_LOCATION
, "enable pass %s for functions in the range "
902 "of [%u, %u]", phase_name
, new_range
->start
, new_range
->last
);
904 inform (UNKNOWN_LOCATION
, "disable pass %s for functions in the range "
905 "of [%u, %u]", phase_name
, new_range
->start
, new_range
->last
);
909 char *next_range
= NULL
;
910 char *one_range
= range_str
;
911 char *end_val
= NULL
;
916 uid_range_p new_range
;
917 char *invalid
= NULL
;
919 char *func_name
= NULL
;
921 next_range
= strchr (one_range
, ',');
928 end_val
= strchr (one_range
, ':');
934 start
= strtol (one_range
, &invalid
, 10);
935 if (*invalid
|| start
< 0)
937 if (end_val
|| (one_range
[0] >= '0'
938 && one_range
[0] <= '9'))
940 error ("Invalid range %s in option %s",
942 is_enable
? "-fenable" : "-fdisable");
946 func_name
= one_range
;
950 new_range
= XCNEW (struct uid_range
);
953 new_range
->start
= (unsigned) start
;
954 new_range
->last
= (unsigned) start
;
958 new_range
->start
= (unsigned) -1;
959 new_range
->last
= (unsigned) -1;
960 new_range
->assem_name
= xstrdup (func_name
);
965 long last
= strtol (end_val
, &invalid
, 10);
966 if (*invalid
|| last
< start
)
968 error ("Invalid range %s in option %s",
970 is_enable
? "-fenable" : "-fdisable");
974 new_range
= XCNEW (struct uid_range
);
975 new_range
->start
= (unsigned) start
;
976 new_range
->last
= (unsigned) last
;
979 slot
= (*tab
)[pass
->static_pass_number
];
980 new_range
->next
= slot
;
981 (*tab
)[pass
->static_pass_number
] = new_range
;
984 if (new_range
->assem_name
)
985 inform (UNKNOWN_LOCATION
,
986 "enable pass %s for function %s",
987 phase_name
, new_range
->assem_name
);
989 inform (UNKNOWN_LOCATION
,
990 "enable pass %s for functions in the range of [%u, %u]",
991 phase_name
, new_range
->start
, new_range
->last
);
995 if (new_range
->assem_name
)
996 inform (UNKNOWN_LOCATION
,
997 "disable pass %s for function %s",
998 phase_name
, new_range
->assem_name
);
1000 inform (UNKNOWN_LOCATION
,
1001 "disable pass %s for functions in the range of [%u, %u]",
1002 phase_name
, new_range
->start
, new_range
->last
);
1005 one_range
= next_range
;
1006 } while (next_range
);
1012 /* Enable pass specified by ARG. */
1015 enable_pass (const char *arg
)
1017 enable_disable_pass (arg
, true);
1020 /* Disable pass specified by ARG. */
1023 disable_pass (const char *arg
)
1025 enable_disable_pass (arg
, false);
1028 /* Returns true if PASS is explicitly enabled/disabled for FUNC. */
1031 is_pass_explicitly_enabled_or_disabled (struct opt_pass
*pass
,
1033 vec
<uid_range_p
> tab
)
1035 uid_range_p slot
, range
;
1037 const char *aname
= NULL
;
1040 || (unsigned) pass
->static_pass_number
>= tab
.length ()
1041 || pass
->static_pass_number
== -1)
1044 slot
= tab
[pass
->static_pass_number
];
1048 cgraph_uid
= func
? cgraph_get_node (func
)->uid
: 0;
1049 if (func
&& DECL_ASSEMBLER_NAME_SET_P (func
))
1050 aname
= IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (func
));
1055 if ((unsigned) cgraph_uid
>= range
->start
1056 && (unsigned) cgraph_uid
<= range
->last
)
1058 if (range
->assem_name
&& aname
1059 && !strcmp (range
->assem_name
, aname
))
1061 range
= range
->next
;
1067 /* Look at the static_pass_number and duplicate the pass
1068 if it is already added to a list. */
1070 static struct opt_pass
*
1071 make_pass_instance (struct opt_pass
*pass
, bool track_duplicates
)
1073 /* A nonzero static_pass_number indicates that the
1074 pass is already in the list. */
1075 if (pass
->static_pass_number
)
1077 struct opt_pass
*new_pass
;
1079 if (pass
->type
== GIMPLE_PASS
1080 || pass
->type
== RTL_PASS
1081 || pass
->type
== SIMPLE_IPA_PASS
)
1083 new_pass
= XNEW (struct opt_pass
);
1084 memcpy (new_pass
, pass
, sizeof (struct opt_pass
));
1086 else if (pass
->type
== IPA_PASS
)
1088 new_pass
= (struct opt_pass
*)XNEW (struct ipa_opt_pass_d
);
1089 memcpy (new_pass
, pass
, sizeof (struct ipa_opt_pass_d
));
1094 new_pass
->next
= NULL
;
1096 new_pass
->todo_flags_start
&= ~TODO_mark_first_instance
;
1098 /* Indicate to register_dump_files that this pass has duplicates,
1099 and so it should rename the dump file. The first instance will
1100 be -1, and be number of duplicates = -static_pass_number - 1.
1101 Subsequent instances will be > 0 and just the duplicate number. */
1102 if ((pass
->name
&& pass
->name
[0] != '*') || track_duplicates
)
1104 pass
->static_pass_number
-= 1;
1105 new_pass
->static_pass_number
= -pass
->static_pass_number
;
1111 pass
->todo_flags_start
|= TODO_mark_first_instance
;
1112 pass
->static_pass_number
= -1;
1114 invoke_plugin_callbacks (PLUGIN_NEW_PASS
, pass
);
1119 /* Add a pass to the pass list. Duplicate the pass if it's already
1122 static struct opt_pass
**
1123 next_pass_1 (struct opt_pass
**list
, struct opt_pass
*pass
)
1125 /* Every pass should have a name so that plugins can refer to them. */
1126 gcc_assert (pass
->name
!= NULL
);
1128 *list
= make_pass_instance (pass
, false);
1130 return &(*list
)->next
;
1133 /* List node for an inserted pass instance. We need to keep track of all
1134 the newly-added pass instances (with 'added_pass_nodes' defined below)
1135 so that we can register their dump files after pass-positioning is finished.
1136 Registering dumping files needs to be post-processed or the
1137 static_pass_number of the opt_pass object would be modified and mess up
1138 the dump file names of future pass instances to be added. */
1140 struct pass_list_node
1142 struct opt_pass
*pass
;
1143 struct pass_list_node
*next
;
1146 static struct pass_list_node
*added_pass_nodes
= NULL
;
1147 static struct pass_list_node
*prev_added_pass_node
;
1149 /* Insert the pass at the proper position. Return true if the pass
1150 is successfully added.
1152 NEW_PASS_INFO - new pass to be inserted
1153 PASS_LIST - root of the pass list to insert the new pass to */
1156 position_pass (struct register_pass_info
*new_pass_info
,
1157 struct opt_pass
**pass_list
)
1159 struct opt_pass
*pass
= *pass_list
, *prev_pass
= NULL
;
1160 bool success
= false;
1162 for ( ; pass
; prev_pass
= pass
, pass
= pass
->next
)
1164 /* Check if the current pass is of the same type as the new pass and
1165 matches the name and the instance number of the reference pass. */
1166 if (pass
->type
== new_pass_info
->pass
->type
1168 && !strcmp (pass
->name
, new_pass_info
->reference_pass_name
)
1169 && ((new_pass_info
->ref_pass_instance_number
== 0)
1170 || (new_pass_info
->ref_pass_instance_number
==
1171 pass
->static_pass_number
)
1172 || (new_pass_info
->ref_pass_instance_number
== 1
1173 && pass
->todo_flags_start
& TODO_mark_first_instance
)))
1175 struct opt_pass
*new_pass
;
1176 struct pass_list_node
*new_pass_node
;
1178 new_pass
= make_pass_instance (new_pass_info
->pass
, true);
1180 /* Insert the new pass instance based on the positioning op. */
1181 switch (new_pass_info
->pos_op
)
1183 case PASS_POS_INSERT_AFTER
:
1184 new_pass
->next
= pass
->next
;
1185 pass
->next
= new_pass
;
1187 /* Skip newly inserted pass to avoid repeated
1188 insertions in the case where the new pass and the
1189 existing one have the same name. */
1192 case PASS_POS_INSERT_BEFORE
:
1193 new_pass
->next
= pass
;
1195 prev_pass
->next
= new_pass
;
1197 *pass_list
= new_pass
;
1199 case PASS_POS_REPLACE
:
1200 new_pass
->next
= pass
->next
;
1202 prev_pass
->next
= new_pass
;
1204 *pass_list
= new_pass
;
1205 new_pass
->sub
= pass
->sub
;
1206 new_pass
->tv_id
= pass
->tv_id
;
1210 error ("invalid pass positioning operation");
1214 /* Save the newly added pass (instance) in the added_pass_nodes
1215 list so that we can register its dump file later. Note that
1216 we cannot register the dump file now because doing so will modify
1217 the static_pass_number of the opt_pass object and therefore
1218 mess up the dump file name of future instances. */
1219 new_pass_node
= XCNEW (struct pass_list_node
);
1220 new_pass_node
->pass
= new_pass
;
1221 if (!added_pass_nodes
)
1222 added_pass_nodes
= new_pass_node
;
1224 prev_added_pass_node
->next
= new_pass_node
;
1225 prev_added_pass_node
= new_pass_node
;
1230 if (pass
->sub
&& position_pass (new_pass_info
, &pass
->sub
))
1237 /* Hooks a new pass into the pass lists.
1239 PASS_INFO - pass information that specifies the opt_pass object,
1240 reference pass, instance number, and how to position
1244 register_pass (struct register_pass_info
*pass_info
)
1246 g
->get_passes ()->register_pass (pass_info
);
1251 pass_manager::register_pass (struct register_pass_info
*pass_info
)
1253 bool all_instances
, success
;
1255 /* The checks below could fail in buggy plugins. Existing GCC
1256 passes should never fail these checks, so we mention plugin in
1258 if (!pass_info
->pass
)
1259 fatal_error ("plugin cannot register a missing pass");
1261 if (!pass_info
->pass
->name
)
1262 fatal_error ("plugin cannot register an unnamed pass");
1264 if (!pass_info
->reference_pass_name
)
1266 ("plugin cannot register pass %qs without reference pass name",
1267 pass_info
->pass
->name
);
1269 /* Try to insert the new pass to the pass lists. We need to check
1270 all five lists as the reference pass could be in one (or all) of
1272 all_instances
= pass_info
->ref_pass_instance_number
== 0;
1273 success
= position_pass (pass_info
, &all_lowering_passes
);
1274 if (!success
|| all_instances
)
1275 success
|= position_pass (pass_info
, &all_small_ipa_passes
);
1276 if (!success
|| all_instances
)
1277 success
|= position_pass (pass_info
, &all_regular_ipa_passes
);
1278 if (!success
|| all_instances
)
1279 success
|= position_pass (pass_info
, &all_lto_gen_passes
);
1280 if (!success
|| all_instances
)
1281 success
|= position_pass (pass_info
, &all_late_ipa_passes
);
1282 if (!success
|| all_instances
)
1283 success
|= position_pass (pass_info
, &all_passes
);
1286 ("pass %qs not found but is referenced by new pass %qs",
1287 pass_info
->reference_pass_name
, pass_info
->pass
->name
);
1289 /* OK, we have successfully inserted the new pass. We need to register
1290 the dump files for the newly added pass and its duplicates (if any).
1291 Because the registration of plugin/backend passes happens after the
1292 command-line options are parsed, the options that specify single
1293 pass dumping (e.g. -fdump-tree-PASSNAME) cannot be used for new
1294 passes. Therefore we currently can only enable dumping of
1295 new passes when the 'dump-all' flags (e.g. -fdump-tree-all)
1296 are specified. While doing so, we also delete the pass_list_node
1297 objects created during pass positioning. */
1298 while (added_pass_nodes
)
1300 struct pass_list_node
*next_node
= added_pass_nodes
->next
;
1301 enum tree_dump_index tdi
;
1302 register_one_dump_file (added_pass_nodes
->pass
);
1303 if (added_pass_nodes
->pass
->type
== SIMPLE_IPA_PASS
1304 || added_pass_nodes
->pass
->type
== IPA_PASS
)
1306 else if (added_pass_nodes
->pass
->type
== GIMPLE_PASS
)
1310 /* Check if dump-all flag is specified. */
1311 if (get_dump_file_info (tdi
)->pstate
)
1312 get_dump_file_info (added_pass_nodes
->pass
->static_pass_number
)
1313 ->pstate
= get_dump_file_info (tdi
)->pstate
;
1314 XDELETE (added_pass_nodes
);
1315 added_pass_nodes
= next_node
;
1319 /* Construct the pass tree. The sequencing of passes is driven by
1320 the cgraph routines:
1322 finalize_compilation_unit ()
1323 for each node N in the cgraph
1324 cgraph_analyze_function (N)
1325 cgraph_lower_function (N) -> all_lowering_passes
1327 If we are optimizing, compile is then invoked:
1330 ipa_passes () -> all_small_ipa_passes
1331 -> Analysis of all_regular_ipa_passes
1332 * possible LTO streaming at copmilation time *
1333 -> Execution of all_regular_ipa_passes
1334 * possible LTO streaming at link time *
1335 -> all_late_ipa_passes
1336 expand_all_functions ()
1337 for each node N in the cgraph
1338 expand_function (N) -> Transformation of all_regular_ipa_passes
1342 pass_manager::pass_manager (context
*ctxt
)
1343 : all_passes(NULL
), all_small_ipa_passes(NULL
), all_lowering_passes(NULL
),
1344 all_regular_ipa_passes(NULL
), all_lto_gen_passes(NULL
),
1345 all_late_ipa_passes(NULL
), passes_by_id(NULL
), passes_by_id_size(0),
1348 struct opt_pass
**p
;
1350 /* Initialize the pass_lists array. */
1351 #define DEF_PASS_LIST(LIST) pass_lists[PASS_LIST_NO_##LIST] = &LIST;
1353 #undef DEF_PASS_LIST
1355 /* Build the tree of passes. */
1357 #define INSERT_PASSES_AFTER(PASS) \
1360 #define PUSH_INSERT_PASSES_WITHIN(PASS) \
1362 struct opt_pass **p = &(PASS ## _1)->sub;
1364 #define POP_INSERT_PASSES() \
1367 #define NEXT_PASS(PASS, NUM) \
1369 gcc_assert (NULL == PASS ## _ ## NUM); \
1371 PASS ## _1 = make_##PASS (ctxt_); \
1374 gcc_assert (PASS ## _1); \
1375 PASS ## _ ## NUM = PASS ## _1->clone (); \
1377 p = next_pass_1 (p, PASS ## _ ## NUM); \
1380 #define TERMINATE_PASS_LIST() \
1383 #include "pass-instances.def"
1385 #undef INSERT_PASSES_AFTER
1386 #undef PUSH_INSERT_PASSES_WITHIN
1387 #undef POP_INSERT_PASSES
1389 #undef TERMINATE_PASS_LIST
1391 /* Register the passes with the tree dump code. */
1392 register_dump_files (all_lowering_passes
, PROP_gimple_any
);
1393 register_dump_files (all_small_ipa_passes
,
1394 PROP_gimple_any
| PROP_gimple_lcf
| PROP_gimple_leh
1396 register_dump_files (all_regular_ipa_passes
,
1397 PROP_gimple_any
| PROP_gimple_lcf
| PROP_gimple_leh
1399 register_dump_files (all_lto_gen_passes
,
1400 PROP_gimple_any
| PROP_gimple_lcf
| PROP_gimple_leh
1402 register_dump_files (all_late_ipa_passes
,
1403 PROP_gimple_any
| PROP_gimple_lcf
| PROP_gimple_leh
1405 register_dump_files (all_passes
,
1406 PROP_gimple_any
| PROP_gimple_lcf
| PROP_gimple_leh
1410 /* If we are in IPA mode (i.e., current_function_decl is NULL), call
1411 function CALLBACK for every function in the call graph. Otherwise,
1412 call CALLBACK on the current function. */
1415 do_per_function (void (*callback
) (void *data
), void *data
)
1417 if (current_function_decl
)
1421 struct cgraph_node
*node
;
1422 FOR_EACH_DEFINED_FUNCTION (node
)
1423 if (node
->symbol
.analyzed
&& gimple_has_body_p (node
->symbol
.decl
)
1424 && (!node
->clone_of
|| node
->symbol
.decl
!= node
->clone_of
->symbol
.decl
))
1426 push_cfun (DECL_STRUCT_FUNCTION (node
->symbol
.decl
));
1430 free_dominance_info (CDI_DOMINATORS
);
1431 free_dominance_info (CDI_POST_DOMINATORS
);
1439 /* Because inlining might remove no-longer reachable nodes, we need to
1440 keep the array visible to garbage collector to avoid reading collected
1443 static GTY ((length ("nnodes"))) cgraph_node_ptr
*order
;
1445 /* If we are in IPA mode (i.e., current_function_decl is NULL), call
1446 function CALLBACK for every function in the call graph. Otherwise,
1447 call CALLBACK on the current function.
1448 This function is global so that plugins can use it. */
1450 do_per_function_toporder (void (*callback
) (void *data
), void *data
)
1454 if (current_function_decl
)
1458 gcc_assert (!order
);
1459 order
= ggc_alloc_vec_cgraph_node_ptr (cgraph_n_nodes
);
1460 nnodes
= ipa_reverse_postorder (order
);
1461 for (i
= nnodes
- 1; i
>= 0; i
--)
1462 order
[i
]->process
= 1;
1463 for (i
= nnodes
- 1; i
>= 0; i
--)
1465 struct cgraph_node
*node
= order
[i
];
1467 /* Allow possibly removed nodes to be garbage collected. */
1470 if (cgraph_function_with_gimple_body_p (node
))
1472 push_cfun (DECL_STRUCT_FUNCTION (node
->symbol
.decl
));
1474 free_dominance_info (CDI_DOMINATORS
);
1475 free_dominance_info (CDI_POST_DOMINATORS
);
1486 /* Helper function to perform function body dump. */
1489 execute_function_dump (void *data ATTRIBUTE_UNUSED
)
1491 if (dump_file
&& current_function_decl
)
1493 if (cfun
->curr_properties
& PROP_trees
)
1494 dump_function_to_file (current_function_decl
, dump_file
, dump_flags
);
1496 print_rtl_with_bb (dump_file
, get_insns (), dump_flags
);
1498 /* Flush the file. If verification fails, we won't be able to
1499 close the file before aborting. */
1502 if ((cfun
->curr_properties
& PROP_cfg
)
1503 && (dump_flags
& TDF_GRAPH
))
1504 print_graph_cfg (dump_file_name
, cfun
);
1508 static struct profile_record
*profile_record
;
1510 /* Do profile consistency book-keeping for the pass with static number INDEX.
1511 If SUBPASS is zero, we run _before_ the pass, and if SUBPASS is one, then
1512 we run _after_ the pass. RUN is true if the pass really runs, or FALSE
1513 if we are only book-keeping on passes that may have selectively disabled
1514 themselves on a given function. */
1516 check_profile_consistency (int index
, int subpass
, bool run
)
1518 pass_manager
*passes
= g
->get_passes ();
1521 if (!profile_record
)
1522 profile_record
= XCNEWVEC (struct profile_record
,
1523 passes
->passes_by_id_size
);
1524 gcc_assert (index
< passes
->passes_by_id_size
&& index
>= 0);
1525 gcc_assert (subpass
< 2);
1526 profile_record
[index
].run
|= run
;
1527 account_profile_record (&profile_record
[index
], subpass
);
1530 /* Output profile consistency. */
1533 dump_profile_report (void)
1535 g
->get_passes ()->dump_profile_report ();
1539 pass_manager::dump_profile_report () const
1542 int last_freq_in
= 0, last_count_in
= 0, last_freq_out
= 0, last_count_out
= 0;
1543 gcov_type last_time
= 0, last_size
= 0;
1544 double rel_time_change
, rel_size_change
;
1545 int last_reported
= 0;
1547 if (!profile_record
)
1549 fprintf (stderr
, "\nProfile consistency report:\n\n");
1550 fprintf (stderr
, "Pass name |mismatch in |mismated out|Overall\n");
1551 fprintf (stderr
, " |freq count |freq count |size time\n");
1553 for (i
= 0; i
< passes_by_id_size
; i
++)
1554 for (j
= 0 ; j
< 2; j
++)
1555 if (profile_record
[i
].run
)
1558 rel_time_change
= (profile_record
[i
].time
[j
]
1559 - (double)last_time
) * 100 / (double)last_time
;
1561 rel_time_change
= 0;
1563 rel_size_change
= (profile_record
[i
].size
[j
]
1564 - (double)last_size
) * 100 / (double)last_size
;
1566 rel_size_change
= 0;
1568 if (profile_record
[i
].num_mismatched_freq_in
[j
] != last_freq_in
1569 || profile_record
[i
].num_mismatched_freq_out
[j
] != last_freq_out
1570 || profile_record
[i
].num_mismatched_count_in
[j
] != last_count_in
1571 || profile_record
[i
].num_mismatched_count_out
[j
] != last_count_out
1572 || rel_time_change
|| rel_size_change
)
1575 fprintf (stderr
, "%-20s %s",
1576 passes_by_id
[i
]->name
,
1577 j
? "(after TODO)" : " ");
1578 if (profile_record
[i
].num_mismatched_freq_in
[j
] != last_freq_in
)
1579 fprintf (stderr
, "| %+5i",
1580 profile_record
[i
].num_mismatched_freq_in
[j
]
1583 fprintf (stderr
, "| ");
1584 if (profile_record
[i
].num_mismatched_count_in
[j
] != last_count_in
)
1585 fprintf (stderr
, " %+5i",
1586 profile_record
[i
].num_mismatched_count_in
[j
]
1589 fprintf (stderr
, " ");
1590 if (profile_record
[i
].num_mismatched_freq_out
[j
] != last_freq_out
)
1591 fprintf (stderr
, "| %+5i",
1592 profile_record
[i
].num_mismatched_freq_out
[j
]
1595 fprintf (stderr
, "| ");
1596 if (profile_record
[i
].num_mismatched_count_out
[j
] != last_count_out
)
1597 fprintf (stderr
, " %+5i",
1598 profile_record
[i
].num_mismatched_count_out
[j
]
1601 fprintf (stderr
, " ");
1603 /* Size/time units change across gimple and RTL. */
1604 if (i
== pass_expand_1
->static_pass_number
)
1605 fprintf (stderr
, "|----------");
1608 if (rel_size_change
)
1609 fprintf (stderr
, "| %+8.4f%%", rel_size_change
);
1611 fprintf (stderr
, "| ");
1612 if (rel_time_change
)
1613 fprintf (stderr
, " %+8.4f%%", rel_time_change
);
1615 fprintf (stderr
, "\n");
1616 last_freq_in
= profile_record
[i
].num_mismatched_freq_in
[j
];
1617 last_freq_out
= profile_record
[i
].num_mismatched_freq_out
[j
];
1618 last_count_in
= profile_record
[i
].num_mismatched_count_in
[j
];
1619 last_count_out
= profile_record
[i
].num_mismatched_count_out
[j
];
1621 else if (j
&& last_reported
!= i
)
1624 fprintf (stderr
, "%-20s ------------| | |\n",
1625 passes_by_id
[i
]->name
);
1627 last_time
= profile_record
[i
].time
[j
];
1628 last_size
= profile_record
[i
].size
[j
];
1632 /* Perform all TODO actions that ought to be done on each function. */
1635 execute_function_todo (void *data
)
1637 unsigned int flags
= (size_t)data
;
1638 flags
&= ~cfun
->last_verified
;
1642 /* Always cleanup the CFG before trying to update SSA. */
1643 if (flags
& TODO_cleanup_cfg
)
1645 cleanup_tree_cfg ();
1647 /* When cleanup_tree_cfg merges consecutive blocks, it may
1648 perform some simplistic propagation when removing single
1649 valued PHI nodes. This propagation may, in turn, cause the
1650 SSA form to become out-of-date (see PR 22037). So, even
1651 if the parent pass had not scheduled an SSA update, we may
1652 still need to do one. */
1653 if (!(flags
& TODO_update_ssa_any
) && need_ssa_update_p (cfun
))
1654 flags
|= TODO_update_ssa
;
1657 if (flags
& TODO_update_ssa_any
)
1659 unsigned update_flags
= flags
& TODO_update_ssa_any
;
1660 update_ssa (update_flags
);
1661 cfun
->last_verified
&= ~TODO_verify_ssa
;
1664 if (flag_tree_pta
&& (flags
& TODO_rebuild_alias
))
1665 compute_may_aliases ();
1667 if (optimize
&& (flags
& TODO_update_address_taken
))
1668 execute_update_addresses_taken ();
1670 if (flags
& TODO_remove_unused_locals
)
1671 remove_unused_locals ();
1673 if (flags
& TODO_rebuild_frequencies
)
1674 rebuild_frequencies ();
1676 if (flags
& TODO_rebuild_cgraph_edges
)
1677 rebuild_cgraph_edges ();
1679 /* If we've seen errors do not bother running any verifiers. */
1683 #if defined ENABLE_CHECKING
1684 if (flags
& TODO_verify_ssa
1685 || (current_loops
&& loops_state_satisfies_p (LOOP_CLOSED_SSA
)))
1687 verify_gimple_in_cfg (cfun
);
1690 else if (flags
& TODO_verify_stmts
)
1691 verify_gimple_in_cfg (cfun
);
1692 if (flags
& TODO_verify_flow
)
1693 verify_flow_info ();
1694 if (current_loops
&& loops_state_satisfies_p (LOOP_CLOSED_SSA
))
1695 verify_loop_closed_ssa (false);
1696 if (flags
& TODO_verify_rtl_sharing
)
1697 verify_rtl_sharing ();
1700 cfun
->last_verified
= flags
& TODO_verify_all
;
1703 /* Perform all TODO actions. */
1705 execute_todo (unsigned int flags
)
1707 #if defined ENABLE_CHECKING
1709 && need_ssa_update_p (cfun
))
1710 gcc_assert (flags
& TODO_update_ssa_any
);
1713 timevar_push (TV_TODO
);
1715 /* Inform the pass whether it is the first time it is run. */
1716 first_pass_instance
= (flags
& TODO_mark_first_instance
) != 0;
1718 statistics_fini_pass ();
1720 do_per_function (execute_function_todo
, (void *)(size_t) flags
);
1722 /* Always remove functions just as before inlining: IPA passes might be
1723 interested to see bodies of extern inline functions that are not inlined
1724 to analyze side effects. The full removal is done just at the end
1725 of IPA pass queue. */
1726 if (flags
& TODO_remove_functions
)
1729 symtab_remove_unreachable_nodes (true, dump_file
);
1732 if ((flags
& TODO_dump_symtab
) && dump_file
&& !current_function_decl
)
1735 dump_symtab (dump_file
);
1736 /* Flush the file. If verification fails, we won't be able to
1737 close the file before aborting. */
1741 /* Now that the dumping has been done, we can get rid of the optional
1743 if (flags
& TODO_df_finish
)
1744 df_finish_pass ((flags
& TODO_df_verify
) != 0);
1746 timevar_pop (TV_TODO
);
1749 /* Verify invariants that should hold between passes. This is a place
1750 to put simple sanity checks. */
1753 verify_interpass_invariants (void)
1755 gcc_checking_assert (!fold_deferring_overflow_warnings_p ());
1758 /* Clear the last verified flag. */
1761 clear_last_verified (void *data ATTRIBUTE_UNUSED
)
1763 cfun
->last_verified
= 0;
1766 /* Helper function. Verify that the properties has been turn into the
1767 properties expected by the pass. */
1769 #ifdef ENABLE_CHECKING
1771 verify_curr_properties (void *data
)
1773 unsigned int props
= (size_t)data
;
1774 gcc_assert ((cfun
->curr_properties
& props
) == props
);
1778 /* Initialize pass dump file. */
1779 /* This is non-static so that the plugins can use it. */
1782 pass_init_dump_file (struct opt_pass
*pass
)
1784 /* If a dump file name is present, open it if enabled. */
1785 if (pass
->static_pass_number
!= -1)
1787 timevar_push (TV_DUMP
);
1788 bool initializing_dump
= !dump_initialized_p (pass
->static_pass_number
);
1789 dump_file_name
= get_dump_file_name (pass
->static_pass_number
);
1790 dump_start (pass
->static_pass_number
, &dump_flags
);
1791 if (dump_file
&& current_function_decl
)
1792 dump_function_header (dump_file
, current_function_decl
, dump_flags
);
1793 if (initializing_dump
1794 && dump_file
&& (dump_flags
& TDF_GRAPH
)
1795 && cfun
&& (cfun
->curr_properties
& PROP_cfg
))
1796 clean_graph_dump_file (dump_file_name
);
1797 timevar_pop (TV_DUMP
);
1798 return initializing_dump
;
1804 /* Flush PASS dump file. */
1805 /* This is non-static so that plugins can use it. */
1808 pass_fini_dump_file (struct opt_pass
*pass
)
1810 timevar_push (TV_DUMP
);
1812 /* Flush and close dump file. */
1815 free (CONST_CAST (char *, dump_file_name
));
1816 dump_file_name
= NULL
;
1819 dump_finish (pass
->static_pass_number
);
1820 timevar_pop (TV_DUMP
);
1823 /* After executing the pass, apply expected changes to the function
1827 update_properties_after_pass (void *data
)
1829 struct opt_pass
*pass
= (struct opt_pass
*) data
;
1830 cfun
->curr_properties
= (cfun
->curr_properties
| pass
->properties_provided
)
1831 & ~pass
->properties_destroyed
;
1834 /* Execute summary generation for all of the passes in IPA_PASS. */
1837 execute_ipa_summary_passes (struct ipa_opt_pass_d
*ipa_pass
)
1841 struct opt_pass
*pass
= ipa_pass
;
1843 /* Execute all of the IPA_PASSes in the list. */
1844 if (ipa_pass
->type
== IPA_PASS
1845 && ((!pass
->has_gate
) || pass
->gate ())
1846 && ipa_pass
->generate_summary
)
1848 pass_init_dump_file (pass
);
1850 /* If a timevar is present, start it. */
1852 timevar_push (pass
->tv_id
);
1854 ipa_pass
->generate_summary ();
1858 timevar_pop (pass
->tv_id
);
1860 pass_fini_dump_file (pass
);
1862 ipa_pass
= (struct ipa_opt_pass_d
*)ipa_pass
->next
;
1866 /* Execute IPA_PASS function transform on NODE. */
1869 execute_one_ipa_transform_pass (struct cgraph_node
*node
,
1870 struct ipa_opt_pass_d
*ipa_pass
)
1872 struct opt_pass
*pass
= ipa_pass
;
1873 unsigned int todo_after
= 0;
1875 current_pass
= pass
;
1876 if (!ipa_pass
->function_transform
)
1879 /* Note that the folders should only create gimple expressions.
1880 This is a hack until the new folder is ready. */
1881 in_gimple_form
= (cfun
&& (cfun
->curr_properties
& PROP_trees
)) != 0;
1883 pass_init_dump_file (pass
);
1885 /* Run pre-pass verification. */
1886 execute_todo (ipa_pass
->function_transform_todo_flags_start
);
1888 /* If a timevar is present, start it. */
1889 if (pass
->tv_id
!= TV_NONE
)
1890 timevar_push (pass
->tv_id
);
1893 todo_after
= ipa_pass
->function_transform (node
);
1896 if (pass
->tv_id
!= TV_NONE
)
1897 timevar_pop (pass
->tv_id
);
1899 if (profile_report
&& cfun
&& (cfun
->curr_properties
& PROP_cfg
))
1900 check_profile_consistency (pass
->static_pass_number
, 0, true);
1902 /* Run post-pass cleanup and verification. */
1903 execute_todo (todo_after
);
1904 verify_interpass_invariants ();
1905 if (profile_report
&& cfun
&& (cfun
->curr_properties
& PROP_cfg
))
1906 check_profile_consistency (pass
->static_pass_number
, 1, true);
1908 do_per_function (execute_function_dump
, NULL
);
1909 pass_fini_dump_file (pass
);
1911 current_pass
= NULL
;
1913 /* Signal this is a suitable GC collection point. */
1914 if (!(todo_after
& TODO_do_not_ggc_collect
))
1918 /* For the current function, execute all ipa transforms. */
1921 execute_all_ipa_transforms (void)
1923 struct cgraph_node
*node
;
1926 node
= cgraph_get_node (current_function_decl
);
1928 if (node
->ipa_transforms_to_apply
.exists ())
1932 for (i
= 0; i
< node
->ipa_transforms_to_apply
.length (); i
++)
1933 execute_one_ipa_transform_pass (node
, node
->ipa_transforms_to_apply
[i
]);
1934 node
->ipa_transforms_to_apply
.release ();
1938 /* Callback for do_per_function to apply all IPA transforms. */
1941 apply_ipa_transforms (void *data
)
1943 struct cgraph_node
*node
= cgraph_get_node (current_function_decl
);
1944 if (!node
->global
.inlined_to
&& node
->ipa_transforms_to_apply
.exists ())
1946 *(bool *)data
= true;
1947 execute_all_ipa_transforms();
1948 rebuild_cgraph_edges ();
1952 /* Check if PASS is explicitly disabled or enabled and return
1953 the gate status. FUNC is the function to be processed, and
1954 GATE_STATUS is the gate status determined by pass manager by
1958 override_gate_status (struct opt_pass
*pass
, tree func
, bool gate_status
)
1960 bool explicitly_enabled
= false;
1961 bool explicitly_disabled
= false;
1964 = is_pass_explicitly_enabled_or_disabled (pass
, func
,
1965 enabled_pass_uid_range_tab
);
1967 = is_pass_explicitly_enabled_or_disabled (pass
, func
,
1968 disabled_pass_uid_range_tab
);
1970 gate_status
= !explicitly_disabled
&& (gate_status
|| explicitly_enabled
);
1979 execute_one_pass (struct opt_pass
*pass
)
1981 unsigned int todo_after
= 0;
1985 /* IPA passes are executed on whole program, so cfun should be NULL.
1986 Other passes need function context set. */
1987 if (pass
->type
== SIMPLE_IPA_PASS
|| pass
->type
== IPA_PASS
)
1988 gcc_assert (!cfun
&& !current_function_decl
);
1990 gcc_assert (cfun
&& current_function_decl
);
1992 current_pass
= pass
;
1994 /* Check whether gate check should be avoided.
1995 User controls the value of the gate through the parameter "gate_status". */
1996 gate_status
= pass
->has_gate
? pass
->gate() : true;
1997 gate_status
= override_gate_status (pass
, current_function_decl
, gate_status
);
1999 /* Override gate with plugin. */
2000 invoke_plugin_callbacks (PLUGIN_OVERRIDE_GATE
, &gate_status
);
2004 /* Run so passes selectively disabling themselves on a given function
2005 are not miscounted. */
2006 if (profile_report
&& cfun
&& (cfun
->curr_properties
& PROP_cfg
))
2008 check_profile_consistency (pass
->static_pass_number
, 0, false);
2009 check_profile_consistency (pass
->static_pass_number
, 1, false);
2011 current_pass
= NULL
;
2015 /* Pass execution event trigger: useful to identify passes being
2017 invoke_plugin_callbacks (PLUGIN_PASS_EXECUTION
, pass
);
2019 /* SIPLE IPA passes do not handle callgraphs with IPA transforms in it.
2020 Apply all trnasforms first. */
2021 if (pass
->type
== SIMPLE_IPA_PASS
)
2023 bool applied
= false;
2024 do_per_function (apply_ipa_transforms
, (void *)&applied
);
2026 symtab_remove_unreachable_nodes (true, dump_file
);
2027 /* Restore current_pass. */
2028 current_pass
= pass
;
2031 if (!quiet_flag
&& !cfun
)
2032 fprintf (stderr
, " <%s>", pass
->name
? pass
->name
: "");
2034 /* Note that the folders should only create gimple expressions.
2035 This is a hack until the new folder is ready. */
2036 in_gimple_form
= (cfun
&& (cfun
->curr_properties
& PROP_trees
)) != 0;
2038 pass_init_dump_file (pass
);
2040 /* Run pre-pass verification. */
2041 execute_todo (pass
->todo_flags_start
);
2043 #ifdef ENABLE_CHECKING
2044 do_per_function (verify_curr_properties
,
2045 (void *)(size_t)pass
->properties_required
);
2048 /* If a timevar is present, start it. */
2049 if (pass
->tv_id
!= TV_NONE
)
2050 timevar_push (pass
->tv_id
);
2053 if (pass
->has_execute
)
2055 todo_after
= pass
->execute ();
2056 do_per_function (clear_last_verified
, NULL
);
2060 if (pass
->tv_id
!= TV_NONE
)
2061 timevar_pop (pass
->tv_id
);
2063 do_per_function (update_properties_after_pass
, pass
);
2065 if (profile_report
&& cfun
&& (cfun
->curr_properties
& PROP_cfg
))
2066 check_profile_consistency (pass
->static_pass_number
, 0, true);
2068 /* Run post-pass cleanup and verification. */
2069 execute_todo (todo_after
| pass
->todo_flags_finish
);
2070 if (profile_report
&& cfun
&& (cfun
->curr_properties
& PROP_cfg
))
2071 check_profile_consistency (pass
->static_pass_number
, 1, true);
2073 verify_interpass_invariants ();
2074 do_per_function (execute_function_dump
, NULL
);
2075 if (pass
->type
== IPA_PASS
)
2077 struct cgraph_node
*node
;
2078 FOR_EACH_FUNCTION_WITH_GIMPLE_BODY (node
)
2079 node
->ipa_transforms_to_apply
.safe_push ((struct ipa_opt_pass_d
*)pass
);
2082 if (!current_function_decl
)
2083 cgraph_process_new_functions ();
2085 pass_fini_dump_file (pass
);
2087 if (pass
->type
!= SIMPLE_IPA_PASS
&& pass
->type
!= IPA_PASS
)
2088 gcc_assert (!(cfun
->curr_properties
& PROP_trees
)
2089 || pass
->type
!= RTL_PASS
);
2091 current_pass
= NULL
;
2093 /* Signal this is a suitable GC collection point. */
2094 if (!((todo_after
| pass
->todo_flags_finish
) & TODO_do_not_ggc_collect
))
2101 execute_pass_list (struct opt_pass
*pass
)
2105 gcc_assert (pass
->type
== GIMPLE_PASS
2106 || pass
->type
== RTL_PASS
);
2107 if (execute_one_pass (pass
) && pass
->sub
)
2108 execute_pass_list (pass
->sub
);
2114 /* Same as execute_pass_list but assume that subpasses of IPA passes
2115 are local passes. If SET is not NULL, write out summaries of only
2116 those node in SET. */
2119 ipa_write_summaries_2 (struct opt_pass
*pass
, struct lto_out_decl_state
*state
)
2123 struct ipa_opt_pass_d
*ipa_pass
= (struct ipa_opt_pass_d
*)pass
;
2124 gcc_assert (!current_function_decl
);
2126 gcc_assert (pass
->type
== SIMPLE_IPA_PASS
|| pass
->type
== IPA_PASS
);
2127 if (pass
->type
== IPA_PASS
2128 && ipa_pass
->write_summary
2129 && ((!pass
->has_gate
) || pass
->gate ()))
2131 /* If a timevar is present, start it. */
2133 timevar_push (pass
->tv_id
);
2135 pass_init_dump_file (pass
);
2137 ipa_pass
->write_summary ();
2139 pass_fini_dump_file (pass
);
2141 /* If a timevar is present, start it. */
2143 timevar_pop (pass
->tv_id
);
2146 if (pass
->sub
&& pass
->sub
->type
!= GIMPLE_PASS
)
2147 ipa_write_summaries_2 (pass
->sub
, state
);
2153 /* Helper function of ipa_write_summaries. Creates and destroys the
2154 decl state and calls ipa_write_summaries_2 for all passes that have
2155 summaries. SET is the set of nodes to be written. */
2158 ipa_write_summaries_1 (lto_symtab_encoder_t encoder
)
2160 pass_manager
*passes
= g
->get_passes ();
2161 struct lto_out_decl_state
*state
= lto_new_out_decl_state ();
2162 state
->symtab_node_encoder
= encoder
;
2164 lto_push_out_decl_state (state
);
2166 gcc_assert (!flag_wpa
);
2167 ipa_write_summaries_2 (passes
->all_regular_ipa_passes
, state
);
2168 ipa_write_summaries_2 (passes
->all_lto_gen_passes
, state
);
2170 gcc_assert (lto_get_out_decl_state () == state
);
2171 lto_pop_out_decl_state ();
2172 lto_delete_out_decl_state (state
);
2175 /* Write out summaries for all the nodes in the callgraph. */
2178 ipa_write_summaries (void)
2180 lto_symtab_encoder_t encoder
;
2182 struct varpool_node
*vnode
;
2183 struct cgraph_node
*node
;
2184 struct cgraph_node
**order
;
2186 if (!flag_generate_lto
|| seen_error ())
2189 encoder
= lto_symtab_encoder_new (false);
2191 /* Create the callgraph set in the same order used in
2192 cgraph_expand_all_functions. This mostly facilitates debugging,
2193 since it causes the gimple file to be processed in the same order
2194 as the source code. */
2195 order
= XCNEWVEC (struct cgraph_node
*, cgraph_n_nodes
);
2196 order_pos
= ipa_reverse_postorder (order
);
2197 gcc_assert (order_pos
== cgraph_n_nodes
);
2199 for (i
= order_pos
- 1; i
>= 0; i
--)
2201 struct cgraph_node
*node
= order
[i
];
2203 if (cgraph_function_with_gimple_body_p (node
))
2205 /* When streaming out references to statements as part of some IPA
2206 pass summary, the statements need to have uids assigned and the
2207 following does that for all the IPA passes here. Naturally, this
2208 ordering then matches the one IPA-passes get in their stmt_fixup
2211 push_cfun (DECL_STRUCT_FUNCTION (node
->symbol
.decl
));
2212 renumber_gimple_stmt_uids ();
2215 if (node
->symbol
.definition
)
2216 lto_set_symtab_encoder_in_partition (encoder
, (symtab_node
)node
);
2219 FOR_EACH_DEFINED_FUNCTION (node
)
2220 if (node
->symbol
.alias
)
2221 lto_set_symtab_encoder_in_partition (encoder
, (symtab_node
)node
);
2222 FOR_EACH_DEFINED_VARIABLE (vnode
)
2223 lto_set_symtab_encoder_in_partition (encoder
, (symtab_node
)vnode
);
2225 ipa_write_summaries_1 (compute_ltrans_boundary (encoder
));
2230 /* Same as execute_pass_list but assume that subpasses of IPA passes
2231 are local passes. If SET is not NULL, write out optimization summaries of
2232 only those node in SET. */
2235 ipa_write_optimization_summaries_1 (struct opt_pass
*pass
, struct lto_out_decl_state
*state
)
2239 struct ipa_opt_pass_d
*ipa_pass
= (struct ipa_opt_pass_d
*)pass
;
2240 gcc_assert (!current_function_decl
);
2242 gcc_assert (pass
->type
== SIMPLE_IPA_PASS
|| pass
->type
== IPA_PASS
);
2243 if (pass
->type
== IPA_PASS
2244 && ipa_pass
->write_optimization_summary
2245 && ((!pass
->has_gate
) || pass
->gate ()))
2247 /* If a timevar is present, start it. */
2249 timevar_push (pass
->tv_id
);
2251 pass_init_dump_file (pass
);
2253 ipa_pass
->write_optimization_summary ();
2255 pass_fini_dump_file (pass
);
2257 /* If a timevar is present, start it. */
2259 timevar_pop (pass
->tv_id
);
2262 if (pass
->sub
&& pass
->sub
->type
!= GIMPLE_PASS
)
2263 ipa_write_optimization_summaries_1 (pass
->sub
, state
);
2269 /* Write all the optimization summaries for the cgraph nodes in SET. If SET is
2270 NULL, write out all summaries of all nodes. */
2273 ipa_write_optimization_summaries (lto_symtab_encoder_t encoder
)
2275 struct lto_out_decl_state
*state
= lto_new_out_decl_state ();
2276 lto_symtab_encoder_iterator lsei
;
2277 state
->symtab_node_encoder
= encoder
;
2279 lto_push_out_decl_state (state
);
2280 for (lsei
= lsei_start_function_in_partition (encoder
);
2281 !lsei_end_p (lsei
); lsei_next_function_in_partition (&lsei
))
2283 struct cgraph_node
*node
= lsei_cgraph_node (lsei
);
2284 /* When streaming out references to statements as part of some IPA
2285 pass summary, the statements need to have uids assigned.
2287 For functions newly born at WPA stage we need to initialize
2289 if (node
->symbol
.definition
2290 && gimple_has_body_p (node
->symbol
.decl
))
2292 push_cfun (DECL_STRUCT_FUNCTION (node
->symbol
.decl
));
2293 renumber_gimple_stmt_uids ();
2298 gcc_assert (flag_wpa
);
2299 pass_manager
*passes
= g
->get_passes ();
2300 ipa_write_optimization_summaries_1 (passes
->all_regular_ipa_passes
, state
);
2301 ipa_write_optimization_summaries_1 (passes
->all_lto_gen_passes
, state
);
2303 gcc_assert (lto_get_out_decl_state () == state
);
2304 lto_pop_out_decl_state ();
2305 lto_delete_out_decl_state (state
);
2308 /* Same as execute_pass_list but assume that subpasses of IPA passes
2309 are local passes. */
2312 ipa_read_summaries_1 (struct opt_pass
*pass
)
2316 struct ipa_opt_pass_d
*ipa_pass
= (struct ipa_opt_pass_d
*) pass
;
2318 gcc_assert (!current_function_decl
);
2320 gcc_assert (pass
->type
== SIMPLE_IPA_PASS
|| pass
->type
== IPA_PASS
);
2322 if ((!pass
->has_gate
) || pass
->gate ())
2324 if (pass
->type
== IPA_PASS
&& ipa_pass
->read_summary
)
2326 /* If a timevar is present, start it. */
2328 timevar_push (pass
->tv_id
);
2330 pass_init_dump_file (pass
);
2332 ipa_pass
->read_summary ();
2334 pass_fini_dump_file (pass
);
2338 timevar_pop (pass
->tv_id
);
2341 if (pass
->sub
&& pass
->sub
->type
!= GIMPLE_PASS
)
2342 ipa_read_summaries_1 (pass
->sub
);
2349 /* Read all the summaries for all_regular_ipa_passes and all_lto_gen_passes. */
2352 ipa_read_summaries (void)
2354 pass_manager
*passes
= g
->get_passes ();
2355 ipa_read_summaries_1 (passes
->all_regular_ipa_passes
);
2356 ipa_read_summaries_1 (passes
->all_lto_gen_passes
);
2359 /* Same as execute_pass_list but assume that subpasses of IPA passes
2360 are local passes. */
2363 ipa_read_optimization_summaries_1 (struct opt_pass
*pass
)
2367 struct ipa_opt_pass_d
*ipa_pass
= (struct ipa_opt_pass_d
*) pass
;
2369 gcc_assert (!current_function_decl
);
2371 gcc_assert (pass
->type
== SIMPLE_IPA_PASS
|| pass
->type
== IPA_PASS
);
2373 if ((!pass
->has_gate
) || pass
->gate ())
2375 if (pass
->type
== IPA_PASS
&& ipa_pass
->read_optimization_summary
)
2377 /* If a timevar is present, start it. */
2379 timevar_push (pass
->tv_id
);
2381 pass_init_dump_file (pass
);
2383 ipa_pass
->read_optimization_summary ();
2385 pass_fini_dump_file (pass
);
2389 timevar_pop (pass
->tv_id
);
2392 if (pass
->sub
&& pass
->sub
->type
!= GIMPLE_PASS
)
2393 ipa_read_optimization_summaries_1 (pass
->sub
);
2399 /* Read all the summaries for all_regular_ipa_passes and all_lto_gen_passes. */
2402 ipa_read_optimization_summaries (void)
2404 pass_manager
*passes
= g
->get_passes ();
2405 ipa_read_optimization_summaries_1 (passes
->all_regular_ipa_passes
);
2406 ipa_read_optimization_summaries_1 (passes
->all_lto_gen_passes
);
2409 /* Same as execute_pass_list but assume that subpasses of IPA passes
2410 are local passes. */
2412 execute_ipa_pass_list (struct opt_pass
*pass
)
2416 gcc_assert (!current_function_decl
);
2418 gcc_assert (pass
->type
== SIMPLE_IPA_PASS
|| pass
->type
== IPA_PASS
);
2419 if (execute_one_pass (pass
) && pass
->sub
)
2421 if (pass
->sub
->type
== GIMPLE_PASS
)
2423 invoke_plugin_callbacks (PLUGIN_EARLY_GIMPLE_PASSES_START
, NULL
);
2424 do_per_function_toporder ((void (*)(void *))execute_pass_list
,
2426 invoke_plugin_callbacks (PLUGIN_EARLY_GIMPLE_PASSES_END
, NULL
);
2428 else if (pass
->sub
->type
== SIMPLE_IPA_PASS
2429 || pass
->sub
->type
== IPA_PASS
)
2430 execute_ipa_pass_list (pass
->sub
);
2434 gcc_assert (!current_function_decl
);
2435 cgraph_process_new_functions ();
2441 /* Execute stmt fixup hooks of all passes in PASS for NODE and STMTS. */
2444 execute_ipa_stmt_fixups (struct opt_pass
*pass
,
2445 struct cgraph_node
*node
, gimple
*stmts
)
2449 /* Execute all of the IPA_PASSes in the list. */
2450 if (pass
->type
== IPA_PASS
2451 && ((!pass
->has_gate
) || pass
->gate ()))
2453 struct ipa_opt_pass_d
*ipa_pass
= (struct ipa_opt_pass_d
*) pass
;
2455 if (ipa_pass
->stmt_fixup
)
2457 pass_init_dump_file (pass
);
2458 /* If a timevar is present, start it. */
2460 timevar_push (pass
->tv_id
);
2462 ipa_pass
->stmt_fixup (node
, stmts
);
2466 timevar_pop (pass
->tv_id
);
2467 pass_fini_dump_file (pass
);
2470 execute_ipa_stmt_fixups (pass
->sub
, node
, stmts
);
2476 /* Execute stmt fixup hooks of all IPA passes for NODE and STMTS. */
2479 execute_all_ipa_stmt_fixups (struct cgraph_node
*node
, gimple
*stmts
)
2481 pass_manager
*passes
= g
->get_passes ();
2482 execute_ipa_stmt_fixups (passes
->all_regular_ipa_passes
, node
, stmts
);
2486 extern void debug_properties (unsigned int);
2487 extern void dump_properties (FILE *, unsigned int);
2490 dump_properties (FILE *dump
, unsigned int props
)
2492 fprintf (dump
, "Properties:\n");
2493 if (props
& PROP_gimple_any
)
2494 fprintf (dump
, "PROP_gimple_any\n");
2495 if (props
& PROP_gimple_lcf
)
2496 fprintf (dump
, "PROP_gimple_lcf\n");
2497 if (props
& PROP_gimple_leh
)
2498 fprintf (dump
, "PROP_gimple_leh\n");
2499 if (props
& PROP_cfg
)
2500 fprintf (dump
, "PROP_cfg\n");
2501 if (props
& PROP_ssa
)
2502 fprintf (dump
, "PROP_ssa\n");
2503 if (props
& PROP_no_crit_edges
)
2504 fprintf (dump
, "PROP_no_crit_edges\n");
2505 if (props
& PROP_rtl
)
2506 fprintf (dump
, "PROP_rtl\n");
2507 if (props
& PROP_gimple_lomp
)
2508 fprintf (dump
, "PROP_gimple_lomp\n");
2509 if (props
& PROP_gimple_lcx
)
2510 fprintf (dump
, "PROP_gimple_lcx\n");
2511 if (props
& PROP_gimple_lvec
)
2512 fprintf (dump
, "PROP_gimple_lvec\n");
2513 if (props
& PROP_cfglayout
)
2514 fprintf (dump
, "PROP_cfglayout\n");
2518 debug_properties (unsigned int props
)
2520 dump_properties (stderr
, props
);
2523 /* Called by local passes to see if function is called by already processed nodes.
2524 Because we process nodes in topological order, this means that function is
2525 in recursive cycle or we introduced new direct calls. */
2527 function_called_by_processed_nodes_p (void)
2529 struct cgraph_edge
*e
;
2530 for (e
= cgraph_get_node (current_function_decl
)->callers
;
2534 if (e
->caller
->symbol
.decl
== current_function_decl
)
2536 if (!cgraph_function_with_gimple_body_p (e
->caller
))
2538 if (TREE_ASM_WRITTEN (e
->caller
->symbol
.decl
))
2540 if (!e
->caller
->process
&& !e
->caller
->global
.inlined_to
)
2545 fprintf (dump_file
, "Already processed call to:\n");
2546 dump_cgraph_node (dump_file
, e
->caller
);
2551 #include "gt-passes.h"