1 /* Callgraph based analysis of static variables.
2 Copyright (C) 2004-2014 Free Software Foundation, Inc.
3 Contributed by Kenneth Zadeck <zadeck@naturalbridge.com>
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 3, or (at your option) any later
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
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/>. */
21 /* This file marks functions as being either const (TREE_READONLY) or
22 pure (DECL_PURE_P). It can also set a variant of these that
23 are allowed to loop indefinitely (DECL_LOOPING_CONST_PURE_P).
25 This must be run after inlining decisions have been made since
26 otherwise, the local sets will not contain information that is
27 consistent with post inlined state. The global sets are not prone
28 to this problem since they are by definition transitive. */
30 /* The code in this module is called by the ipa pass manager. It
31 should be one of the later passes since it's information is used by
32 the rest of the compilation. */
36 #include "coretypes.h"
39 #include "print-tree.h"
41 #include "basic-block.h"
42 #include "tree-ssa-alias.h"
43 #include "internal-fn.h"
45 #include "gimple-expr.h"
48 #include "gimple-iterator.h"
49 #include "gimple-walk.h"
51 #include "tree-ssa-loop-niter.h"
52 #include "tree-inline.h"
53 #include "tree-pass.h"
54 #include "langhooks.h"
55 #include "ipa-utils.h"
57 #include "diagnostic.h"
58 #include "gimple-pretty-print.h"
59 #include "langhooks.h"
61 #include "lto-streamer.h"
62 #include "data-streamer.h"
63 #include "tree-streamer.h"
65 #include "tree-scalar-evolution.h"
70 /* Lattice values for const and pure functions. Everything starts out
71 being const, then may drop to pure and then neither depending on
73 enum pure_const_state_e
80 const char *pure_const_names
[3] = {"const", "pure", "neither"};
82 /* Holder for the const_state. There is one of these per function
87 enum pure_const_state_e pure_const_state
;
88 /* What user set here; we can be always sure about this. */
89 enum pure_const_state_e state_previously_known
;
90 bool looping_previously_known
;
92 /* True if the function could possibly infinite loop. There are a
93 lot of ways that this could be determined. We are pretty
94 conservative here. While it is possible to cse pure and const
95 calls, it is not legal to have dce get rid of the call if there
96 is a possibility that the call could infinite loop since this is
97 a behavioral change. */
103 /* State used when we know nothing about function. */
104 static struct funct_state_d varying_state
105 = { IPA_NEITHER
, IPA_NEITHER
, true, true, true };
108 typedef struct funct_state_d
* funct_state
;
110 /* The storage of the funct_state is abstracted because there is the
111 possibility that it may be desirable to move this to the cgraph
114 /* Array, indexed by cgraph node uid, of function states. */
116 static vec
<funct_state
> funct_state_vec
;
118 /* Holders of ipa cgraph hooks: */
119 static struct cgraph_node_hook_list
*function_insertion_hook_holder
;
120 static struct cgraph_2node_hook_list
*node_duplication_hook_holder
;
121 static struct cgraph_node_hook_list
*node_removal_hook_holder
;
123 /* Try to guess if function body will always be visible to compiler
124 when compiling the call and whether compiler will be able
125 to propagate the information by itself. */
128 function_always_visible_to_compiler_p (tree decl
)
130 return (!TREE_PUBLIC (decl
) || DECL_DECLARED_INLINE_P (decl
));
133 /* Emit suggestion about attribute ATTRIB_NAME for DECL. KNOWN_FINITE
134 is true if the function is known to be finite. The diagnostic is
135 controlled by OPTION. WARNED_ABOUT is a hash_set<tree> unique for
136 OPTION, this function may initialize it and it is always returned
139 static hash_set
<tree
> *
140 suggest_attribute (int option
, tree decl
, bool known_finite
,
141 hash_set
<tree
> *warned_about
,
142 const char * attrib_name
)
144 if (!option_enabled (option
, &global_options
))
146 if (TREE_THIS_VOLATILE (decl
)
147 || (known_finite
&& function_always_visible_to_compiler_p (decl
)))
151 warned_about
= new hash_set
<tree
>;
152 if (warned_about
->contains (decl
))
154 warned_about
->add (decl
);
155 warning_at (DECL_SOURCE_LOCATION (decl
),
158 ? _("function might be candidate for attribute %<%s%>")
159 : _("function might be candidate for attribute %<%s%>"
160 " if it is known to return normally"), attrib_name
);
164 /* Emit suggestion about __attribute_((pure)) for DECL. KNOWN_FINITE
165 is true if the function is known to be finite. */
168 warn_function_pure (tree decl
, bool known_finite
)
170 static hash_set
<tree
> *warned_about
;
173 = suggest_attribute (OPT_Wsuggest_attribute_pure
, decl
,
174 known_finite
, warned_about
, "pure");
177 /* Emit suggestion about __attribute_((const)) for DECL. KNOWN_FINITE
178 is true if the function is known to be finite. */
181 warn_function_const (tree decl
, bool known_finite
)
183 static hash_set
<tree
> *warned_about
;
185 = suggest_attribute (OPT_Wsuggest_attribute_const
, decl
,
186 known_finite
, warned_about
, "const");
190 warn_function_noreturn (tree decl
)
192 static hash_set
<tree
> *warned_about
;
193 if (!lang_hooks
.missing_noreturn_ok_p (decl
)
194 && targetm
.warn_func_return (decl
))
196 = suggest_attribute (OPT_Wsuggest_attribute_noreturn
, decl
,
197 true, warned_about
, "noreturn");
200 /* Return true if we have a function state for NODE. */
203 has_function_state (struct cgraph_node
*node
)
205 if (!funct_state_vec
.exists ()
206 || funct_state_vec
.length () <= (unsigned int)node
->uid
)
208 return funct_state_vec
[node
->uid
] != NULL
;
211 /* Return the function state from NODE. */
213 static inline funct_state
214 get_function_state (struct cgraph_node
*node
)
216 if (!funct_state_vec
.exists ()
217 || funct_state_vec
.length () <= (unsigned int)node
->uid
218 || !funct_state_vec
[node
->uid
])
219 /* We might want to put correct previously_known state into varying. */
220 return &varying_state
;
221 return funct_state_vec
[node
->uid
];
224 /* Set the function state S for NODE. */
227 set_function_state (struct cgraph_node
*node
, funct_state s
)
229 if (!funct_state_vec
.exists ()
230 || funct_state_vec
.length () <= (unsigned int)node
->uid
)
231 funct_state_vec
.safe_grow_cleared (node
->uid
+ 1);
232 funct_state_vec
[node
->uid
] = s
;
235 /* Check to see if the use (or definition when CHECKING_WRITE is true)
236 variable T is legal in a function that is either pure or const. */
239 check_decl (funct_state local
,
240 tree t
, bool checking_write
, bool ipa
)
242 /* Do not want to do anything with volatile except mark any
243 function that uses one to be not const or pure. */
244 if (TREE_THIS_VOLATILE (t
))
246 local
->pure_const_state
= IPA_NEITHER
;
248 fprintf (dump_file
, " Volatile operand is not const/pure");
252 /* Do not care about a local automatic that is not static. */
253 if (!TREE_STATIC (t
) && !DECL_EXTERNAL (t
))
256 /* If the variable has the "used" attribute, treat it as if it had a
257 been touched by the devil. */
258 if (DECL_PRESERVE_P (t
))
260 local
->pure_const_state
= IPA_NEITHER
;
262 fprintf (dump_file
, " Used static/global variable is not const/pure\n");
266 /* In IPA mode we are not interested in checking actual loads and stores;
267 they will be processed at propagation time using ipa_ref. */
271 /* Since we have dealt with the locals and params cases above, if we
272 are CHECKING_WRITE, this cannot be a pure or constant
276 local
->pure_const_state
= IPA_NEITHER
;
278 fprintf (dump_file
, " static/global memory write is not const/pure\n");
282 if (DECL_EXTERNAL (t
) || TREE_PUBLIC (t
))
284 /* Readonly reads are safe. */
285 if (TREE_READONLY (t
) && !TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (t
)))
286 return; /* Read of a constant, do not change the function state. */
290 fprintf (dump_file
, " global memory read is not const\n");
291 /* Just a regular read. */
292 if (local
->pure_const_state
== IPA_CONST
)
293 local
->pure_const_state
= IPA_PURE
;
298 /* Compilation level statics can be read if they are readonly
300 if (TREE_READONLY (t
))
304 fprintf (dump_file
, " static memory read is not const\n");
305 /* Just a regular read. */
306 if (local
->pure_const_state
== IPA_CONST
)
307 local
->pure_const_state
= IPA_PURE
;
312 /* Check to see if the use (or definition when CHECKING_WRITE is true)
313 variable T is legal in a function that is either pure or const. */
316 check_op (funct_state local
, tree t
, bool checking_write
)
318 t
= get_base_address (t
);
319 if (t
&& TREE_THIS_VOLATILE (t
))
321 local
->pure_const_state
= IPA_NEITHER
;
323 fprintf (dump_file
, " Volatile indirect ref is not const/pure\n");
327 && (INDIRECT_REF_P (t
) || TREE_CODE (t
) == MEM_REF
)
328 && TREE_CODE (TREE_OPERAND (t
, 0)) == SSA_NAME
329 && !ptr_deref_may_alias_global_p (TREE_OPERAND (t
, 0)))
332 fprintf (dump_file
, " Indirect ref to local memory is OK\n");
335 else if (checking_write
)
337 local
->pure_const_state
= IPA_NEITHER
;
339 fprintf (dump_file
, " Indirect ref write is not const/pure\n");
345 fprintf (dump_file
, " Indirect ref read is not const\n");
346 if (local
->pure_const_state
== IPA_CONST
)
347 local
->pure_const_state
= IPA_PURE
;
351 /* compute state based on ECF FLAGS and store to STATE and LOOPING. */
354 state_from_flags (enum pure_const_state_e
*state
, bool *looping
,
355 int flags
, bool cannot_lead_to_return
)
358 if (flags
& ECF_LOOPING_CONST_OR_PURE
)
361 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
362 fprintf (dump_file
, " looping");
364 if (flags
& ECF_CONST
)
367 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
368 fprintf (dump_file
, " const\n");
370 else if (flags
& ECF_PURE
)
373 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
374 fprintf (dump_file
, " pure\n");
376 else if (cannot_lead_to_return
)
380 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
381 fprintf (dump_file
, " ignoring side effects->pure looping\n");
385 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
386 fprintf (dump_file
, " neither\n");
387 *state
= IPA_NEITHER
;
392 /* Merge STATE and STATE2 and LOOPING and LOOPING2 and store
393 into STATE and LOOPING better of the two variants.
394 Be sure to merge looping correctly. IPA_NEITHER functions
395 have looping 0 even if they don't have to return. */
398 better_state (enum pure_const_state_e
*state
, bool *looping
,
399 enum pure_const_state_e state2
, bool looping2
)
403 if (*state
== IPA_NEITHER
)
406 *looping
= MIN (*looping
, looping2
);
409 else if (state2
!= IPA_NEITHER
)
410 *looping
= MIN (*looping
, looping2
);
413 /* Merge STATE and STATE2 and LOOPING and LOOPING2 and store
414 into STATE and LOOPING worse of the two variants. */
417 worse_state (enum pure_const_state_e
*state
, bool *looping
,
418 enum pure_const_state_e state2
, bool looping2
)
420 *state
= MAX (*state
, state2
);
421 *looping
= MAX (*looping
, looping2
);
424 /* Recognize special cases of builtins that are by themselves not pure or const
425 but function using them is. */
427 special_builtin_state (enum pure_const_state_e
*state
, bool *looping
,
430 if (DECL_BUILT_IN_CLASS (callee
) == BUILT_IN_NORMAL
)
431 switch (DECL_FUNCTION_CODE (callee
))
433 case BUILT_IN_RETURN
:
434 case BUILT_IN_UNREACHABLE
:
435 case BUILT_IN_ALLOCA
:
436 case BUILT_IN_ALLOCA_WITH_ALIGN
:
437 case BUILT_IN_STACK_SAVE
:
438 case BUILT_IN_STACK_RESTORE
:
439 case BUILT_IN_EH_POINTER
:
440 case BUILT_IN_EH_FILTER
:
441 case BUILT_IN_UNWIND_RESUME
:
442 case BUILT_IN_CXA_END_CLEANUP
:
443 case BUILT_IN_EH_COPY_VALUES
:
444 case BUILT_IN_FRAME_ADDRESS
:
446 case BUILT_IN_APPLY_ARGS
:
450 case BUILT_IN_PREFETCH
:
460 /* Check the parameters of a function call to CALL_EXPR to see if
461 there are any references in the parameters that are not allowed for
462 pure or const functions. Also check to see if this is either an
463 indirect call, a call outside the compilation unit, or has special
464 attributes that may also effect the purity. The CALL_EXPR node for
465 the entire call expression. */
468 check_call (funct_state local
, gimple call
, bool ipa
)
470 int flags
= gimple_call_flags (call
);
471 tree callee_t
= gimple_call_fndecl (call
);
472 bool possibly_throws
= stmt_could_throw_p (call
);
473 bool possibly_throws_externally
= (possibly_throws
474 && stmt_can_throw_external (call
));
479 for (i
= 0; i
< gimple_num_ops (call
); i
++)
480 if (gimple_op (call
, i
)
481 && tree_could_throw_p (gimple_op (call
, i
)))
483 if (possibly_throws
&& cfun
->can_throw_non_call_exceptions
)
486 fprintf (dump_file
, " operand can throw; looping\n");
487 local
->looping
= true;
489 if (possibly_throws_externally
)
492 fprintf (dump_file
, " operand can throw externally\n");
493 local
->can_throw
= true;
498 /* The const and pure flags are set by a variety of places in the
499 compiler (including here). If someone has already set the flags
500 for the callee, (such as for some of the builtins) we will use
501 them, otherwise we will compute our own information.
503 Const and pure functions have less clobber effects than other
504 functions so we process these first. Otherwise if it is a call
505 outside the compilation unit or an indirect call we punt. This
506 leaves local calls which will be processed by following the call
510 enum pure_const_state_e call_state
;
513 if (special_builtin_state (&call_state
, &call_looping
, callee_t
))
515 worse_state (&local
->pure_const_state
, &local
->looping
,
516 call_state
, call_looping
);
519 /* When bad things happen to bad functions, they cannot be const
521 if (setjmp_call_p (callee_t
))
524 fprintf (dump_file
, " setjmp is not const/pure\n");
525 local
->looping
= true;
526 local
->pure_const_state
= IPA_NEITHER
;
529 if (DECL_BUILT_IN_CLASS (callee_t
) == BUILT_IN_NORMAL
)
530 switch (DECL_FUNCTION_CODE (callee_t
))
532 case BUILT_IN_LONGJMP
:
533 case BUILT_IN_NONLOCAL_GOTO
:
535 fprintf (dump_file
, " longjmp and nonlocal goto is not const/pure\n");
536 local
->pure_const_state
= IPA_NEITHER
;
537 local
->looping
= true;
544 /* When not in IPA mode, we can still handle self recursion. */
546 && recursive_call_p (current_function_decl
, callee_t
))
549 fprintf (dump_file
, " Recursive call can loop.\n");
550 local
->looping
= true;
552 /* Either callee is unknown or we are doing local analysis.
553 Look to see if there are any bits available for the callee (such as by
554 declaration or because it is builtin) and process solely on the basis of
558 enum pure_const_state_e call_state
;
560 if (possibly_throws
&& cfun
->can_throw_non_call_exceptions
)
563 fprintf (dump_file
, " can throw; looping\n");
564 local
->looping
= true;
566 if (possibly_throws_externally
)
570 fprintf (dump_file
, " can throw externally to lp %i\n",
571 lookup_stmt_eh_lp (call
));
573 fprintf (dump_file
, " callee:%s\n",
574 IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (callee_t
)));
576 local
->can_throw
= true;
578 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
579 fprintf (dump_file
, " checking flags for call:");
580 state_from_flags (&call_state
, &call_looping
, flags
,
581 ((flags
& (ECF_NORETURN
| ECF_NOTHROW
))
582 == (ECF_NORETURN
| ECF_NOTHROW
))
583 || (!flag_exceptions
&& (flags
& ECF_NORETURN
)));
584 worse_state (&local
->pure_const_state
, &local
->looping
,
585 call_state
, call_looping
);
587 /* Direct functions calls are handled by IPA propagation. */
590 /* Wrapper around check_decl for loads in local more. */
593 check_load (gimple
, tree op
, tree
, void *data
)
596 check_decl ((funct_state
)data
, op
, false, false);
598 check_op ((funct_state
)data
, op
, false);
602 /* Wrapper around check_decl for stores in local more. */
605 check_store (gimple
, tree op
, tree
, void *data
)
608 check_decl ((funct_state
)data
, op
, true, false);
610 check_op ((funct_state
)data
, op
, true);
614 /* Wrapper around check_decl for loads in ipa mode. */
617 check_ipa_load (gimple
, tree op
, tree
, void *data
)
620 check_decl ((funct_state
)data
, op
, false, true);
622 check_op ((funct_state
)data
, op
, false);
626 /* Wrapper around check_decl for stores in ipa mode. */
629 check_ipa_store (gimple
, tree op
, tree
, void *data
)
632 check_decl ((funct_state
)data
, op
, true, true);
634 check_op ((funct_state
)data
, op
, true);
638 /* Look into pointer pointed to by GSIP and figure out what interesting side
641 check_stmt (gimple_stmt_iterator
*gsip
, funct_state local
, bool ipa
)
643 gimple stmt
= gsi_stmt (*gsip
);
645 if (is_gimple_debug (stmt
))
650 fprintf (dump_file
, " scanning: ");
651 print_gimple_stmt (dump_file
, stmt
, 0, 0);
654 if (gimple_has_volatile_ops (stmt
)
655 && !gimple_clobber_p (stmt
))
657 local
->pure_const_state
= IPA_NEITHER
;
659 fprintf (dump_file
, " Volatile stmt is not const/pure\n");
662 /* Look for loads and stores. */
663 walk_stmt_load_store_ops (stmt
, local
,
664 ipa
? check_ipa_load
: check_load
,
665 ipa
? check_ipa_store
: check_store
);
667 if (gimple_code (stmt
) != GIMPLE_CALL
668 && stmt_could_throw_p (stmt
))
670 if (cfun
->can_throw_non_call_exceptions
)
673 fprintf (dump_file
, " can throw; looping\n");
674 local
->looping
= true;
676 if (stmt_can_throw_external (stmt
))
679 fprintf (dump_file
, " can throw externally\n");
680 local
->can_throw
= true;
684 fprintf (dump_file
, " can throw\n");
686 switch (gimple_code (stmt
))
689 check_call (local
, stmt
, ipa
);
692 if (DECL_NONLOCAL (gimple_label_label (stmt
)))
693 /* Target of long jump. */
696 fprintf (dump_file
, " nonlocal label is not const/pure\n");
697 local
->pure_const_state
= IPA_NEITHER
;
701 if (gimple_asm_clobbers_memory_p (stmt
))
704 fprintf (dump_file
, " memory asm clobber is not const/pure\n");
705 /* Abandon all hope, ye who enter here. */
706 local
->pure_const_state
= IPA_NEITHER
;
708 if (gimple_asm_volatile_p (stmt
))
711 fprintf (dump_file
, " volatile is not const/pure\n");
712 /* Abandon all hope, ye who enter here. */
713 local
->pure_const_state
= IPA_NEITHER
;
714 local
->looping
= true;
723 /* This is the main routine for finding the reference patterns for
724 global variables within a function FN. */
727 analyze_function (struct cgraph_node
*fn
, bool ipa
)
729 tree decl
= fn
->decl
;
731 basic_block this_block
;
733 l
= XCNEW (struct funct_state_d
);
734 l
->pure_const_state
= IPA_CONST
;
735 l
->state_previously_known
= IPA_NEITHER
;
736 l
->looping_previously_known
= true;
738 l
->can_throw
= false;
739 state_from_flags (&l
->state_previously_known
, &l
->looping_previously_known
,
740 flags_from_decl_or_type (fn
->decl
),
741 fn
->cannot_return_p ());
743 if (fn
->thunk
.thunk_p
|| fn
->alias
)
745 /* Thunk gets propagated through, so nothing interesting happens. */
752 fprintf (dump_file
, "\n\n local analysis of %s\n ",
756 push_cfun (DECL_STRUCT_FUNCTION (decl
));
758 FOR_EACH_BB_FN (this_block
, cfun
)
760 gimple_stmt_iterator gsi
;
761 struct walk_stmt_info wi
;
763 memset (&wi
, 0, sizeof (wi
));
764 for (gsi
= gsi_start_bb (this_block
);
768 check_stmt (&gsi
, l
, ipa
);
769 if (l
->pure_const_state
== IPA_NEITHER
&& l
->looping
&& l
->can_throw
)
775 if (l
->pure_const_state
!= IPA_NEITHER
)
777 /* Const functions cannot have back edges (an
778 indication of possible infinite loop side
780 if (mark_dfs_back_edges ())
782 /* Preheaders are needed for SCEV to work.
783 Simple latches and recorded exits improve chances that loop will
784 proved to be finite in testcases such as in loop-15.c
786 loop_optimizer_init (LOOPS_HAVE_PREHEADERS
787 | LOOPS_HAVE_SIMPLE_LATCHES
788 | LOOPS_HAVE_RECORDED_EXITS
);
789 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
790 flow_loops_dump (dump_file
, NULL
, 0);
791 if (mark_irreducible_loops ())
794 fprintf (dump_file
, " has irreducible loops\n");
801 FOR_EACH_LOOP (loop
, 0)
802 if (!finite_loop_p (loop
))
805 fprintf (dump_file
, " can not prove finiteness of "
806 "loop %i\n", loop
->num
);
812 loop_optimizer_finalize ();
816 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
817 fprintf (dump_file
, " checking previously known:");
819 better_state (&l
->pure_const_state
, &l
->looping
,
820 l
->state_previously_known
,
821 l
->looping_previously_known
);
822 if (TREE_NOTHROW (decl
))
823 l
->can_throw
= false;
829 fprintf (dump_file
, "Function is locally looping.\n");
831 fprintf (dump_file
, "Function is locally throwing.\n");
832 if (l
->pure_const_state
== IPA_CONST
)
833 fprintf (dump_file
, "Function is locally const.\n");
834 if (l
->pure_const_state
== IPA_PURE
)
835 fprintf (dump_file
, "Function is locally pure.\n");
840 /* Called when new function is inserted to callgraph late. */
842 add_new_function (struct cgraph_node
*node
, void *data ATTRIBUTE_UNUSED
)
844 if (node
->get_availability () < AVAIL_INTERPOSABLE
)
846 /* There are some shared nodes, in particular the initializers on
847 static declarations. We do not need to scan them more than once
848 since all we would be interested in are the addressof
850 if (node
->get_availability () > AVAIL_INTERPOSABLE
)
851 set_function_state (node
, analyze_function (node
, true));
854 /* Called when new clone is inserted to callgraph late. */
857 duplicate_node_data (struct cgraph_node
*src
, struct cgraph_node
*dst
,
858 void *data ATTRIBUTE_UNUSED
)
860 if (has_function_state (src
))
862 funct_state l
= XNEW (struct funct_state_d
);
863 gcc_assert (!has_function_state (dst
));
864 memcpy (l
, get_function_state (src
), sizeof (*l
));
865 set_function_state (dst
, l
);
869 /* Called when new clone is inserted to callgraph late. */
872 remove_node_data (struct cgraph_node
*node
, void *data ATTRIBUTE_UNUSED
)
874 if (has_function_state (node
))
876 funct_state l
= get_function_state (node
);
877 if (l
!= &varying_state
)
879 set_function_state (node
, NULL
);
885 register_hooks (void)
887 static bool init_p
= false;
894 node_removal_hook_holder
=
895 symtab
->add_cgraph_removal_hook (&remove_node_data
, NULL
);
896 node_duplication_hook_holder
=
897 symtab
->add_cgraph_duplication_hook (&duplicate_node_data
, NULL
);
898 function_insertion_hook_holder
=
899 symtab
->add_cgraph_insertion_hook (&add_new_function
, NULL
);
903 /* Analyze each function in the cgraph to see if it is locally PURE or
907 pure_const_generate_summary (void)
909 struct cgraph_node
*node
;
913 /* Process all of the functions.
915 We process AVAIL_INTERPOSABLE functions. We can not use the results
916 by default, but the info can be used at LTO with -fwhole-program or
917 when function got cloned and the clone is AVAILABLE. */
919 FOR_EACH_DEFINED_FUNCTION (node
)
920 if (node
->get_availability () >= AVAIL_INTERPOSABLE
)
921 set_function_state (node
, analyze_function (node
, true));
925 /* Serialize the ipa info for lto. */
928 pure_const_write_summary (void)
930 struct cgraph_node
*node
;
931 struct lto_simple_output_block
*ob
932 = lto_create_simple_output_block (LTO_section_ipa_pure_const
);
933 unsigned int count
= 0;
934 lto_symtab_encoder_iterator lsei
;
935 lto_symtab_encoder_t encoder
;
937 encoder
= lto_get_out_decl_state ()->symtab_node_encoder
;
939 for (lsei
= lsei_start_function_in_partition (encoder
); !lsei_end_p (lsei
);
940 lsei_next_function_in_partition (&lsei
))
942 node
= lsei_cgraph_node (lsei
);
943 if (node
->definition
&& has_function_state (node
))
947 streamer_write_uhwi_stream (ob
->main_stream
, count
);
949 /* Process all of the functions. */
950 for (lsei
= lsei_start_function_in_partition (encoder
); !lsei_end_p (lsei
);
951 lsei_next_function_in_partition (&lsei
))
953 node
= lsei_cgraph_node (lsei
);
954 if (node
->definition
&& has_function_state (node
))
959 lto_symtab_encoder_t encoder
;
961 fs
= get_function_state (node
);
963 encoder
= ob
->decl_state
->symtab_node_encoder
;
964 node_ref
= lto_symtab_encoder_encode (encoder
, node
);
965 streamer_write_uhwi_stream (ob
->main_stream
, node_ref
);
967 /* Note that flags will need to be read in the opposite
968 order as we are pushing the bitflags into FLAGS. */
969 bp
= bitpack_create (ob
->main_stream
);
970 bp_pack_value (&bp
, fs
->pure_const_state
, 2);
971 bp_pack_value (&bp
, fs
->state_previously_known
, 2);
972 bp_pack_value (&bp
, fs
->looping_previously_known
, 1);
973 bp_pack_value (&bp
, fs
->looping
, 1);
974 bp_pack_value (&bp
, fs
->can_throw
, 1);
975 streamer_write_bitpack (&bp
);
979 lto_destroy_simple_output_block (ob
);
983 /* Deserialize the ipa info for lto. */
986 pure_const_read_summary (void)
988 struct lto_file_decl_data
**file_data_vec
= lto_get_file_decl_data ();
989 struct lto_file_decl_data
*file_data
;
993 while ((file_data
= file_data_vec
[j
++]))
997 struct lto_input_block
*ib
998 = lto_create_simple_input_block (file_data
,
999 LTO_section_ipa_pure_const
,
1004 unsigned int count
= streamer_read_uhwi (ib
);
1006 for (i
= 0; i
< count
; i
++)
1009 struct cgraph_node
*node
;
1010 struct bitpack_d bp
;
1012 lto_symtab_encoder_t encoder
;
1014 fs
= XCNEW (struct funct_state_d
);
1015 index
= streamer_read_uhwi (ib
);
1016 encoder
= file_data
->symtab_node_encoder
;
1017 node
= dyn_cast
<cgraph_node
*> (lto_symtab_encoder_deref (encoder
,
1019 set_function_state (node
, fs
);
1021 /* Note that the flags must be read in the opposite
1022 order in which they were written (the bitflags were
1023 pushed into FLAGS). */
1024 bp
= streamer_read_bitpack (ib
);
1025 fs
->pure_const_state
1026 = (enum pure_const_state_e
) bp_unpack_value (&bp
, 2);
1027 fs
->state_previously_known
1028 = (enum pure_const_state_e
) bp_unpack_value (&bp
, 2);
1029 fs
->looping_previously_known
= bp_unpack_value (&bp
, 1);
1030 fs
->looping
= bp_unpack_value (&bp
, 1);
1031 fs
->can_throw
= bp_unpack_value (&bp
, 1);
1034 int flags
= flags_from_decl_or_type (node
->decl
);
1035 fprintf (dump_file
, "Read info for %s/%i ",
1038 if (flags
& ECF_CONST
)
1039 fprintf (dump_file
, " const");
1040 if (flags
& ECF_PURE
)
1041 fprintf (dump_file
, " pure");
1042 if (flags
& ECF_NOTHROW
)
1043 fprintf (dump_file
, " nothrow");
1044 fprintf (dump_file
, "\n pure const state: %s\n",
1045 pure_const_names
[fs
->pure_const_state
]);
1046 fprintf (dump_file
, " previously known state: %s\n",
1047 pure_const_names
[fs
->looping_previously_known
]);
1049 fprintf (dump_file
," function is locally looping\n");
1050 if (fs
->looping_previously_known
)
1051 fprintf (dump_file
," function is previously known looping\n");
1053 fprintf (dump_file
," function is locally throwing\n");
1057 lto_destroy_simple_input_block (file_data
,
1058 LTO_section_ipa_pure_const
,
1066 ignore_edge (struct cgraph_edge
*e
)
1068 return (!e
->can_throw_external
);
1071 /* Return true if NODE is self recursive function.
1072 Indirectly recursive functions appears as non-trivial strongly
1073 connected components, so we need to care about self recursion
1077 self_recursive_p (struct cgraph_node
*node
)
1079 struct cgraph_edge
*e
;
1080 for (e
= node
->callees
; e
; e
= e
->next_callee
)
1081 if (e
->callee
->function_symbol () == node
)
1086 /* Produce transitive closure over the callgraph and compute pure/const
1090 propagate_pure_const (void)
1092 struct cgraph_node
*node
;
1093 struct cgraph_node
*w
;
1094 struct cgraph_node
**order
=
1095 XCNEWVEC (struct cgraph_node
*, symtab
->cgraph_count
);
1098 struct ipa_dfs_info
* w_info
;
1100 order_pos
= ipa_reduced_postorder (order
, true, false, NULL
);
1103 cgraph_node::dump_cgraph (dump_file
);
1104 ipa_print_order (dump_file
, "reduced", order
, order_pos
);
1107 /* Propagate the local information through the call graph to produce
1108 the global information. All the nodes within a cycle will have
1109 the same info so we collapse cycles first. Then we can do the
1110 propagation in one pass from the leaves to the roots. */
1111 for (i
= 0; i
< order_pos
; i
++ )
1113 enum pure_const_state_e pure_const_state
= IPA_CONST
;
1114 bool looping
= false;
1121 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
1122 fprintf (dump_file
, "Starting cycle\n");
1124 /* Find the worst state for any node in the cycle. */
1126 while (w
&& pure_const_state
!= IPA_NEITHER
)
1128 struct cgraph_edge
*e
;
1129 struct cgraph_edge
*ie
;
1131 struct ipa_ref
*ref
= NULL
;
1133 funct_state w_l
= get_function_state (w
);
1134 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
1135 fprintf (dump_file
, " Visiting %s/%i state:%s looping %i\n",
1138 pure_const_names
[w_l
->pure_const_state
],
1141 /* First merge in function body properties. */
1142 worse_state (&pure_const_state
, &looping
,
1143 w_l
->pure_const_state
, w_l
->looping
);
1144 if (pure_const_state
== IPA_NEITHER
)
1147 /* For overwritable nodes we can not assume anything. */
1148 if (w
->get_availability () == AVAIL_INTERPOSABLE
)
1150 worse_state (&pure_const_state
, &looping
,
1151 w_l
->state_previously_known
,
1152 w_l
->looping_previously_known
);
1153 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
1156 " Overwritable. state %s looping %i\n",
1157 pure_const_names
[w_l
->state_previously_known
],
1158 w_l
->looping_previously_known
);
1165 /* We consider recursive cycles as possibly infinite.
1166 This might be relaxed since infinite recursion leads to stack
1171 /* Now walk the edges and merge in callee properties. */
1172 for (e
= w
->callees
; e
; e
= e
->next_callee
)
1174 enum availability avail
;
1175 struct cgraph_node
*y
= e
->callee
->function_symbol (&avail
);
1176 enum pure_const_state_e edge_state
= IPA_CONST
;
1177 bool edge_looping
= false;
1179 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
1186 if (avail
> AVAIL_INTERPOSABLE
)
1188 funct_state y_l
= get_function_state (y
);
1189 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
1192 " state:%s looping:%i\n",
1193 pure_const_names
[y_l
->pure_const_state
],
1196 if (y_l
->pure_const_state
> IPA_PURE
1197 && e
->cannot_lead_to_return_p ())
1199 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
1201 " Ignoring side effects"
1202 " -> pure, looping\n");
1203 edge_state
= IPA_PURE
;
1204 edge_looping
= true;
1208 edge_state
= y_l
->pure_const_state
;
1209 edge_looping
= y_l
->looping
;
1212 else if (special_builtin_state (&edge_state
, &edge_looping
,
1216 state_from_flags (&edge_state
, &edge_looping
,
1217 flags_from_decl_or_type (y
->decl
),
1218 e
->cannot_lead_to_return_p ());
1220 /* Merge the results with what we already know. */
1221 better_state (&edge_state
, &edge_looping
,
1222 w_l
->state_previously_known
,
1223 w_l
->looping_previously_known
);
1224 worse_state (&pure_const_state
, &looping
,
1225 edge_state
, edge_looping
);
1226 if (pure_const_state
== IPA_NEITHER
)
1229 if (pure_const_state
== IPA_NEITHER
)
1232 /* Now process the indirect call. */
1233 for (ie
= w
->indirect_calls
; ie
; ie
= ie
->next_callee
)
1235 enum pure_const_state_e edge_state
= IPA_CONST
;
1236 bool edge_looping
= false;
1238 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
1239 fprintf (dump_file
, " Indirect call");
1240 state_from_flags (&edge_state
, &edge_looping
,
1241 ie
->indirect_info
->ecf_flags
,
1242 ie
->cannot_lead_to_return_p ());
1243 /* Merge the results with what we already know. */
1244 better_state (&edge_state
, &edge_looping
,
1245 w_l
->state_previously_known
,
1246 w_l
->looping_previously_known
);
1247 worse_state (&pure_const_state
, &looping
,
1248 edge_state
, edge_looping
);
1249 if (pure_const_state
== IPA_NEITHER
)
1252 if (pure_const_state
== IPA_NEITHER
)
1255 /* And finally all loads and stores. */
1256 for (i
= 0; w
->iterate_reference (i
, ref
); i
++)
1258 enum pure_const_state_e ref_state
= IPA_CONST
;
1259 bool ref_looping
= false;
1263 /* readonly reads are safe. */
1264 if (TREE_READONLY (ref
->referred
->decl
))
1266 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
1267 fprintf (dump_file
, " nonreadonly global var read\n");
1268 ref_state
= IPA_PURE
;
1271 if (ref
->cannot_lead_to_return ())
1273 ref_state
= IPA_NEITHER
;
1274 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
1275 fprintf (dump_file
, " global var write\n");
1282 better_state (&ref_state
, &ref_looping
,
1283 w_l
->state_previously_known
,
1284 w_l
->looping_previously_known
);
1285 worse_state (&pure_const_state
, &looping
,
1286 ref_state
, ref_looping
);
1287 if (pure_const_state
== IPA_NEITHER
)
1290 w_info
= (struct ipa_dfs_info
*) w
->aux
;
1291 w
= w_info
->next_cycle
;
1293 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
1294 fprintf (dump_file
, "Result %s looping %i\n",
1295 pure_const_names
[pure_const_state
],
1298 /* Copy back the region's pure_const_state which is shared by
1299 all nodes in the region. */
1303 funct_state w_l
= get_function_state (w
);
1304 enum pure_const_state_e this_state
= pure_const_state
;
1305 bool this_looping
= looping
;
1307 if (w_l
->state_previously_known
!= IPA_NEITHER
1308 && this_state
> w_l
->state_previously_known
)
1310 this_state
= w_l
->state_previously_known
;
1311 this_looping
|= w_l
->looping_previously_known
;
1313 if (!this_looping
&& self_recursive_p (w
))
1314 this_looping
= true;
1315 if (!w_l
->looping_previously_known
)
1316 this_looping
= false;
1318 /* All nodes within a cycle share the same info. */
1319 w_l
->pure_const_state
= this_state
;
1320 w_l
->looping
= this_looping
;
1322 /* Inline clones share declaration with their offline copies;
1323 do not modify their declarations since the offline copy may
1325 if (!w
->global
.inlined_to
)
1329 if (!TREE_READONLY (w
->decl
))
1331 warn_function_const (w
->decl
, !this_looping
);
1333 fprintf (dump_file
, "Function found to be %sconst: %s\n",
1334 this_looping
? "looping " : "",
1337 w
->set_const_flag (true, this_looping
);
1341 if (!DECL_PURE_P (w
->decl
))
1343 warn_function_pure (w
->decl
, !this_looping
);
1345 fprintf (dump_file
, "Function found to be %spure: %s\n",
1346 this_looping
? "looping " : "",
1349 w
->set_pure_flag (true, this_looping
);
1355 w_info
= (struct ipa_dfs_info
*) w
->aux
;
1356 w
= w_info
->next_cycle
;
1360 ipa_free_postorder_info ();
1364 /* Produce transitive closure over the callgraph and compute nothrow
1368 propagate_nothrow (void)
1370 struct cgraph_node
*node
;
1371 struct cgraph_node
*w
;
1372 struct cgraph_node
**order
=
1373 XCNEWVEC (struct cgraph_node
*, symtab
->cgraph_count
);
1376 struct ipa_dfs_info
* w_info
;
1378 order_pos
= ipa_reduced_postorder (order
, true, false, ignore_edge
);
1381 cgraph_node::dump_cgraph (dump_file
);
1382 ipa_print_order (dump_file
, "reduced for nothrow", order
, order_pos
);
1385 /* Propagate the local information through the call graph to produce
1386 the global information. All the nodes within a cycle will have
1387 the same info so we collapse cycles first. Then we can do the
1388 propagation in one pass from the leaves to the roots. */
1389 for (i
= 0; i
< order_pos
; i
++ )
1391 bool can_throw
= false;
1397 /* Find the worst state for any node in the cycle. */
1401 struct cgraph_edge
*e
, *ie
;
1402 funct_state w_l
= get_function_state (w
);
1405 || w
->get_availability () == AVAIL_INTERPOSABLE
)
1411 for (e
= w
->callees
; e
; e
= e
->next_callee
)
1413 enum availability avail
;
1414 struct cgraph_node
*y
= e
->callee
->function_symbol (&avail
);
1416 if (avail
> AVAIL_INTERPOSABLE
)
1418 funct_state y_l
= get_function_state (y
);
1422 if (y_l
->can_throw
&& !TREE_NOTHROW (w
->decl
)
1423 && e
->can_throw_external
)
1426 else if (e
->can_throw_external
&& !TREE_NOTHROW (y
->decl
))
1429 for (ie
= node
->indirect_calls
; ie
; ie
= ie
->next_callee
)
1430 if (ie
->can_throw_external
)
1435 w_info
= (struct ipa_dfs_info
*) w
->aux
;
1436 w
= w_info
->next_cycle
;
1439 /* Copy back the region's pure_const_state which is shared by
1440 all nodes in the region. */
1444 funct_state w_l
= get_function_state (w
);
1445 if (!can_throw
&& !TREE_NOTHROW (w
->decl
))
1447 /* Inline clones share declaration with their offline copies;
1448 do not modify their declarations since the offline copy may
1450 if (!w
->global
.inlined_to
)
1452 w
->set_nothrow_flag (true);
1454 fprintf (dump_file
, "Function found to be nothrow: %s\n",
1458 else if (can_throw
&& !TREE_NOTHROW (w
->decl
))
1459 w_l
->can_throw
= true;
1460 w_info
= (struct ipa_dfs_info
*) w
->aux
;
1461 w
= w_info
->next_cycle
;
1465 ipa_free_postorder_info ();
1470 /* Produce the global information by preforming a transitive closure
1471 on the local information that was produced by generate_summary. */
1476 struct cgraph_node
*node
;
1478 symtab
->remove_cgraph_insertion_hook (function_insertion_hook_holder
);
1479 symtab
->remove_cgraph_duplication_hook (node_duplication_hook_holder
);
1480 symtab
->remove_cgraph_removal_hook (node_removal_hook_holder
);
1482 /* Nothrow makes more function to not lead to return and improve
1484 propagate_nothrow ();
1485 propagate_pure_const ();
1488 FOR_EACH_FUNCTION (node
)
1489 if (has_function_state (node
))
1490 free (get_function_state (node
));
1491 funct_state_vec
.release ();
1496 gate_pure_const (void)
1498 return (flag_ipa_pure_const
1499 /* Don't bother doing anything if the program has errors. */
1505 const pass_data pass_data_ipa_pure_const
=
1507 IPA_PASS
, /* type */
1508 "pure-const", /* name */
1509 OPTGROUP_NONE
, /* optinfo_flags */
1510 TV_IPA_PURE_CONST
, /* tv_id */
1511 0, /* properties_required */
1512 0, /* properties_provided */
1513 0, /* properties_destroyed */
1514 0, /* todo_flags_start */
1515 0, /* todo_flags_finish */
1518 class pass_ipa_pure_const
: public ipa_opt_pass_d
1521 pass_ipa_pure_const (gcc::context
*ctxt
)
1522 : ipa_opt_pass_d (pass_data_ipa_pure_const
, ctxt
,
1523 pure_const_generate_summary
, /* generate_summary */
1524 pure_const_write_summary
, /* write_summary */
1525 pure_const_read_summary
, /* read_summary */
1526 NULL
, /* write_optimization_summary */
1527 NULL
, /* read_optimization_summary */
1528 NULL
, /* stmt_fixup */
1529 0, /* function_transform_todo_flags_start */
1530 NULL
, /* function_transform */
1531 NULL
) /* variable_transform */
1534 /* opt_pass methods: */
1535 virtual bool gate (function
*) { return gate_pure_const (); }
1536 virtual unsigned int execute (function
*) { return propagate (); }
1538 }; // class pass_ipa_pure_const
1543 make_pass_ipa_pure_const (gcc::context
*ctxt
)
1545 return new pass_ipa_pure_const (ctxt
);
1548 /* Return true if function should be skipped for local pure const analysis. */
1551 skip_function_for_local_pure_const (struct cgraph_node
*node
)
1553 /* Because we do not schedule pass_fixup_cfg over whole program after early optimizations
1554 we must not promote functions that are called by already processed functions. */
1556 if (function_called_by_processed_nodes_p ())
1559 fprintf (dump_file
, "Function called in recursive cycle; ignoring\n");
1562 if (node
->get_availability () <= AVAIL_INTERPOSABLE
)
1565 fprintf (dump_file
, "Function is not available or overwritable; not analyzing.\n");
1571 /* Simple local pass for pure const discovery reusing the analysis from
1572 ipa_pure_const. This pass is effective when executed together with
1573 other optimization passes in early optimization pass queue. */
1577 const pass_data pass_data_local_pure_const
=
1579 GIMPLE_PASS
, /* type */
1580 "local-pure-const", /* name */
1581 OPTGROUP_NONE
, /* optinfo_flags */
1582 TV_IPA_PURE_CONST
, /* tv_id */
1583 0, /* properties_required */
1584 0, /* properties_provided */
1585 0, /* properties_destroyed */
1586 0, /* todo_flags_start */
1587 0, /* todo_flags_finish */
1590 class pass_local_pure_const
: public gimple_opt_pass
1593 pass_local_pure_const (gcc::context
*ctxt
)
1594 : gimple_opt_pass (pass_data_local_pure_const
, ctxt
)
1597 /* opt_pass methods: */
1598 opt_pass
* clone () { return new pass_local_pure_const (m_ctxt
); }
1599 virtual bool gate (function
*) { return gate_pure_const (); }
1600 virtual unsigned int execute (function
*);
1602 }; // class pass_local_pure_const
1605 pass_local_pure_const::execute (function
*fun
)
1607 bool changed
= false;
1610 struct cgraph_node
*node
;
1612 node
= cgraph_node::get (current_function_decl
);
1613 skip
= skip_function_for_local_pure_const (node
);
1614 if (!warn_suggest_attribute_const
1615 && !warn_suggest_attribute_pure
1619 l
= analyze_function (node
, false);
1621 /* Do NORETURN discovery. */
1622 if (!skip
&& !TREE_THIS_VOLATILE (current_function_decl
)
1623 && EDGE_COUNT (EXIT_BLOCK_PTR_FOR_FN (fun
)->preds
) == 0)
1625 warn_function_noreturn (fun
->decl
);
1627 fprintf (dump_file
, "Function found to be noreturn: %s\n",
1628 current_function_name ());
1630 /* Update declaration and reduce profile to executed once. */
1631 TREE_THIS_VOLATILE (current_function_decl
) = 1;
1632 if (node
->frequency
> NODE_FREQUENCY_EXECUTED_ONCE
)
1633 node
->frequency
= NODE_FREQUENCY_EXECUTED_ONCE
;
1638 switch (l
->pure_const_state
)
1641 if (!TREE_READONLY (current_function_decl
))
1643 warn_function_const (current_function_decl
, !l
->looping
);
1646 node
->set_const_flag (true, l
->looping
);
1650 fprintf (dump_file
, "Function found to be %sconst: %s\n",
1651 l
->looping
? "looping " : "",
1652 current_function_name ());
1654 else if (DECL_LOOPING_CONST_OR_PURE_P (current_function_decl
)
1659 node
->set_const_flag (true, false);
1663 fprintf (dump_file
, "Function found to be non-looping: %s\n",
1664 current_function_name ());
1669 if (!DECL_PURE_P (current_function_decl
))
1673 node
->set_pure_flag (true, l
->looping
);
1676 warn_function_pure (current_function_decl
, !l
->looping
);
1678 fprintf (dump_file
, "Function found to be %spure: %s\n",
1679 l
->looping
? "looping " : "",
1680 current_function_name ());
1682 else if (DECL_LOOPING_CONST_OR_PURE_P (current_function_decl
)
1687 node
->set_pure_flag (true, false);
1691 fprintf (dump_file
, "Function found to be non-looping: %s\n",
1692 current_function_name ());
1699 if (!l
->can_throw
&& !TREE_NOTHROW (current_function_decl
))
1701 node
->set_nothrow_flag (true);
1704 fprintf (dump_file
, "Function found to be nothrow: %s\n",
1705 current_function_name ());
1709 return execute_fixup_cfg ();
1717 make_pass_local_pure_const (gcc::context
*ctxt
)
1719 return new pass_local_pure_const (ctxt
);
1722 /* Emit noreturn warnings. */
1726 const pass_data pass_data_warn_function_noreturn
=
1728 GIMPLE_PASS
, /* type */
1729 "*warn_function_noreturn", /* name */
1730 OPTGROUP_NONE
, /* optinfo_flags */
1731 TV_NONE
, /* tv_id */
1732 PROP_cfg
, /* properties_required */
1733 0, /* properties_provided */
1734 0, /* properties_destroyed */
1735 0, /* todo_flags_start */
1736 0, /* todo_flags_finish */
1739 class pass_warn_function_noreturn
: public gimple_opt_pass
1742 pass_warn_function_noreturn (gcc::context
*ctxt
)
1743 : gimple_opt_pass (pass_data_warn_function_noreturn
, ctxt
)
1746 /* opt_pass methods: */
1747 virtual bool gate (function
*) { return warn_suggest_attribute_noreturn
; }
1748 virtual unsigned int execute (function
*fun
)
1750 if (!TREE_THIS_VOLATILE (current_function_decl
)
1751 && EDGE_COUNT (EXIT_BLOCK_PTR_FOR_FN (fun
)->preds
) == 0)
1752 warn_function_noreturn (current_function_decl
);
1756 }; // class pass_warn_function_noreturn
1761 make_pass_warn_function_noreturn (gcc::context
*ctxt
)
1763 return new pass_warn_function_noreturn (ctxt
);