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
:
458 /* Check the parameters of a function call to CALL_EXPR to see if
459 there are any references in the parameters that are not allowed for
460 pure or const functions. Also check to see if this is either an
461 indirect call, a call outside the compilation unit, or has special
462 attributes that may also effect the purity. The CALL_EXPR node for
463 the entire call expression. */
466 check_call (funct_state local
, gimple call
, bool ipa
)
468 int flags
= gimple_call_flags (call
);
469 tree callee_t
= gimple_call_fndecl (call
);
470 bool possibly_throws
= stmt_could_throw_p (call
);
471 bool possibly_throws_externally
= (possibly_throws
472 && stmt_can_throw_external (call
));
477 for (i
= 0; i
< gimple_num_ops (call
); i
++)
478 if (gimple_op (call
, i
)
479 && tree_could_throw_p (gimple_op (call
, i
)))
481 if (possibly_throws
&& cfun
->can_throw_non_call_exceptions
)
484 fprintf (dump_file
, " operand can throw; looping\n");
485 local
->looping
= true;
487 if (possibly_throws_externally
)
490 fprintf (dump_file
, " operand can throw externally\n");
491 local
->can_throw
= true;
496 /* The const and pure flags are set by a variety of places in the
497 compiler (including here). If someone has already set the flags
498 for the callee, (such as for some of the builtins) we will use
499 them, otherwise we will compute our own information.
501 Const and pure functions have less clobber effects than other
502 functions so we process these first. Otherwise if it is a call
503 outside the compilation unit or an indirect call we punt. This
504 leaves local calls which will be processed by following the call
508 enum pure_const_state_e call_state
;
511 if (special_builtin_state (&call_state
, &call_looping
, callee_t
))
513 worse_state (&local
->pure_const_state
, &local
->looping
,
514 call_state
, call_looping
);
517 /* When bad things happen to bad functions, they cannot be const
519 if (setjmp_call_p (callee_t
))
522 fprintf (dump_file
, " setjmp is not const/pure\n");
523 local
->looping
= true;
524 local
->pure_const_state
= IPA_NEITHER
;
527 if (DECL_BUILT_IN_CLASS (callee_t
) == BUILT_IN_NORMAL
)
528 switch (DECL_FUNCTION_CODE (callee_t
))
530 case BUILT_IN_LONGJMP
:
531 case BUILT_IN_NONLOCAL_GOTO
:
533 fprintf (dump_file
, " longjmp and nonlocal goto is not const/pure\n");
534 local
->pure_const_state
= IPA_NEITHER
;
535 local
->looping
= true;
542 /* When not in IPA mode, we can still handle self recursion. */
544 && recursive_call_p (current_function_decl
, callee_t
))
547 fprintf (dump_file
, " Recursive call can loop.\n");
548 local
->looping
= true;
550 /* Either callee is unknown or we are doing local analysis.
551 Look to see if there are any bits available for the callee (such as by
552 declaration or because it is builtin) and process solely on the basis of
556 enum pure_const_state_e call_state
;
558 if (possibly_throws
&& cfun
->can_throw_non_call_exceptions
)
561 fprintf (dump_file
, " can throw; looping\n");
562 local
->looping
= true;
564 if (possibly_throws_externally
)
568 fprintf (dump_file
, " can throw externally to lp %i\n",
569 lookup_stmt_eh_lp (call
));
571 fprintf (dump_file
, " callee:%s\n",
572 IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (callee_t
)));
574 local
->can_throw
= true;
576 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
577 fprintf (dump_file
, " checking flags for call:");
578 state_from_flags (&call_state
, &call_looping
, flags
,
579 ((flags
& (ECF_NORETURN
| ECF_NOTHROW
))
580 == (ECF_NORETURN
| ECF_NOTHROW
))
581 || (!flag_exceptions
&& (flags
& ECF_NORETURN
)));
582 worse_state (&local
->pure_const_state
, &local
->looping
,
583 call_state
, call_looping
);
585 /* Direct functions calls are handled by IPA propagation. */
588 /* Wrapper around check_decl for loads in local more. */
591 check_load (gimple
, tree op
, tree
, void *data
)
594 check_decl ((funct_state
)data
, op
, false, false);
596 check_op ((funct_state
)data
, op
, false);
600 /* Wrapper around check_decl for stores in local more. */
603 check_store (gimple
, tree op
, tree
, void *data
)
606 check_decl ((funct_state
)data
, op
, true, false);
608 check_op ((funct_state
)data
, op
, true);
612 /* Wrapper around check_decl for loads in ipa mode. */
615 check_ipa_load (gimple
, tree op
, tree
, void *data
)
618 check_decl ((funct_state
)data
, op
, false, true);
620 check_op ((funct_state
)data
, op
, false);
624 /* Wrapper around check_decl for stores in ipa mode. */
627 check_ipa_store (gimple
, tree op
, tree
, void *data
)
630 check_decl ((funct_state
)data
, op
, true, true);
632 check_op ((funct_state
)data
, op
, true);
636 /* Look into pointer pointed to by GSIP and figure out what interesting side
639 check_stmt (gimple_stmt_iterator
*gsip
, funct_state local
, bool ipa
)
641 gimple stmt
= gsi_stmt (*gsip
);
643 if (is_gimple_debug (stmt
))
648 fprintf (dump_file
, " scanning: ");
649 print_gimple_stmt (dump_file
, stmt
, 0, 0);
652 if (gimple_has_volatile_ops (stmt
)
653 && !gimple_clobber_p (stmt
))
655 local
->pure_const_state
= IPA_NEITHER
;
657 fprintf (dump_file
, " Volatile stmt is not const/pure\n");
660 /* Look for loads and stores. */
661 walk_stmt_load_store_ops (stmt
, local
,
662 ipa
? check_ipa_load
: check_load
,
663 ipa
? check_ipa_store
: check_store
);
665 if (gimple_code (stmt
) != GIMPLE_CALL
666 && stmt_could_throw_p (stmt
))
668 if (cfun
->can_throw_non_call_exceptions
)
671 fprintf (dump_file
, " can throw; looping\n");
672 local
->looping
= true;
674 if (stmt_can_throw_external (stmt
))
677 fprintf (dump_file
, " can throw externally\n");
678 local
->can_throw
= true;
682 fprintf (dump_file
, " can throw\n");
684 switch (gimple_code (stmt
))
687 check_call (local
, stmt
, ipa
);
690 if (DECL_NONLOCAL (gimple_label_label (stmt
)))
691 /* Target of long jump. */
694 fprintf (dump_file
, " nonlocal label is not const/pure\n");
695 local
->pure_const_state
= IPA_NEITHER
;
699 if (gimple_asm_clobbers_memory_p (stmt
))
702 fprintf (dump_file
, " memory asm clobber is not const/pure\n");
703 /* Abandon all hope, ye who enter here. */
704 local
->pure_const_state
= IPA_NEITHER
;
706 if (gimple_asm_volatile_p (stmt
))
709 fprintf (dump_file
, " volatile is not const/pure\n");
710 /* Abandon all hope, ye who enter here. */
711 local
->pure_const_state
= IPA_NEITHER
;
712 local
->looping
= true;
721 /* This is the main routine for finding the reference patterns for
722 global variables within a function FN. */
725 analyze_function (struct cgraph_node
*fn
, bool ipa
)
727 tree decl
= fn
->decl
;
729 basic_block this_block
;
731 l
= XCNEW (struct funct_state_d
);
732 l
->pure_const_state
= IPA_CONST
;
733 l
->state_previously_known
= IPA_NEITHER
;
734 l
->looping_previously_known
= true;
736 l
->can_throw
= false;
737 state_from_flags (&l
->state_previously_known
, &l
->looping_previously_known
,
738 flags_from_decl_or_type (fn
->decl
),
739 fn
->cannot_return_p ());
741 if (fn
->thunk
.thunk_p
|| fn
->alias
)
743 /* Thunk gets propagated through, so nothing interesting happens. */
750 fprintf (dump_file
, "\n\n local analysis of %s\n ",
754 push_cfun (DECL_STRUCT_FUNCTION (decl
));
756 FOR_EACH_BB_FN (this_block
, cfun
)
758 gimple_stmt_iterator gsi
;
759 struct walk_stmt_info wi
;
761 memset (&wi
, 0, sizeof (wi
));
762 for (gsi
= gsi_start_bb (this_block
);
766 check_stmt (&gsi
, l
, ipa
);
767 if (l
->pure_const_state
== IPA_NEITHER
&& l
->looping
&& l
->can_throw
)
773 if (l
->pure_const_state
!= IPA_NEITHER
)
775 /* Const functions cannot have back edges (an
776 indication of possible infinite loop side
778 if (mark_dfs_back_edges ())
780 /* Preheaders are needed for SCEV to work.
781 Simple latches and recorded exits improve chances that loop will
782 proved to be finite in testcases such as in loop-15.c
784 loop_optimizer_init (LOOPS_HAVE_PREHEADERS
785 | LOOPS_HAVE_SIMPLE_LATCHES
786 | LOOPS_HAVE_RECORDED_EXITS
);
787 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
788 flow_loops_dump (dump_file
, NULL
, 0);
789 if (mark_irreducible_loops ())
792 fprintf (dump_file
, " has irreducible loops\n");
799 FOR_EACH_LOOP (loop
, 0)
800 if (!finite_loop_p (loop
))
803 fprintf (dump_file
, " can not prove finiteness of "
804 "loop %i\n", loop
->num
);
810 loop_optimizer_finalize ();
814 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
815 fprintf (dump_file
, " checking previously known:");
817 better_state (&l
->pure_const_state
, &l
->looping
,
818 l
->state_previously_known
,
819 l
->looping_previously_known
);
820 if (TREE_NOTHROW (decl
))
821 l
->can_throw
= false;
827 fprintf (dump_file
, "Function is locally looping.\n");
829 fprintf (dump_file
, "Function is locally throwing.\n");
830 if (l
->pure_const_state
== IPA_CONST
)
831 fprintf (dump_file
, "Function is locally const.\n");
832 if (l
->pure_const_state
== IPA_PURE
)
833 fprintf (dump_file
, "Function is locally pure.\n");
838 /* Called when new function is inserted to callgraph late. */
840 add_new_function (struct cgraph_node
*node
, void *data ATTRIBUTE_UNUSED
)
842 if (node
->get_availability () < AVAIL_INTERPOSABLE
)
844 /* There are some shared nodes, in particular the initializers on
845 static declarations. We do not need to scan them more than once
846 since all we would be interested in are the addressof
848 if (node
->get_availability () > AVAIL_INTERPOSABLE
)
849 set_function_state (node
, analyze_function (node
, true));
852 /* Called when new clone is inserted to callgraph late. */
855 duplicate_node_data (struct cgraph_node
*src
, struct cgraph_node
*dst
,
856 void *data ATTRIBUTE_UNUSED
)
858 if (has_function_state (src
))
860 funct_state l
= XNEW (struct funct_state_d
);
861 gcc_assert (!has_function_state (dst
));
862 memcpy (l
, get_function_state (src
), sizeof (*l
));
863 set_function_state (dst
, l
);
867 /* Called when new clone is inserted to callgraph late. */
870 remove_node_data (struct cgraph_node
*node
, void *data ATTRIBUTE_UNUSED
)
872 if (has_function_state (node
))
874 funct_state l
= get_function_state (node
);
875 if (l
!= &varying_state
)
877 set_function_state (node
, NULL
);
883 register_hooks (void)
885 static bool init_p
= false;
892 node_removal_hook_holder
=
893 symtab
->add_cgraph_removal_hook (&remove_node_data
, NULL
);
894 node_duplication_hook_holder
=
895 symtab
->add_cgraph_duplication_hook (&duplicate_node_data
, NULL
);
896 function_insertion_hook_holder
=
897 symtab
->add_cgraph_insertion_hook (&add_new_function
, NULL
);
901 /* Analyze each function in the cgraph to see if it is locally PURE or
905 pure_const_generate_summary (void)
907 struct cgraph_node
*node
;
911 /* Process all of the functions.
913 We process AVAIL_INTERPOSABLE functions. We can not use the results
914 by default, but the info can be used at LTO with -fwhole-program or
915 when function got cloned and the clone is AVAILABLE. */
917 FOR_EACH_DEFINED_FUNCTION (node
)
918 if (node
->get_availability () >= AVAIL_INTERPOSABLE
)
919 set_function_state (node
, analyze_function (node
, true));
923 /* Serialize the ipa info for lto. */
926 pure_const_write_summary (void)
928 struct cgraph_node
*node
;
929 struct lto_simple_output_block
*ob
930 = lto_create_simple_output_block (LTO_section_ipa_pure_const
);
931 unsigned int count
= 0;
932 lto_symtab_encoder_iterator lsei
;
933 lto_symtab_encoder_t encoder
;
935 encoder
= lto_get_out_decl_state ()->symtab_node_encoder
;
937 for (lsei
= lsei_start_function_in_partition (encoder
); !lsei_end_p (lsei
);
938 lsei_next_function_in_partition (&lsei
))
940 node
= lsei_cgraph_node (lsei
);
941 if (node
->definition
&& has_function_state (node
))
945 streamer_write_uhwi_stream (ob
->main_stream
, count
);
947 /* Process all of the functions. */
948 for (lsei
= lsei_start_function_in_partition (encoder
); !lsei_end_p (lsei
);
949 lsei_next_function_in_partition (&lsei
))
951 node
= lsei_cgraph_node (lsei
);
952 if (node
->definition
&& has_function_state (node
))
957 lto_symtab_encoder_t encoder
;
959 fs
= get_function_state (node
);
961 encoder
= ob
->decl_state
->symtab_node_encoder
;
962 node_ref
= lto_symtab_encoder_encode (encoder
, node
);
963 streamer_write_uhwi_stream (ob
->main_stream
, node_ref
);
965 /* Note that flags will need to be read in the opposite
966 order as we are pushing the bitflags into FLAGS. */
967 bp
= bitpack_create (ob
->main_stream
);
968 bp_pack_value (&bp
, fs
->pure_const_state
, 2);
969 bp_pack_value (&bp
, fs
->state_previously_known
, 2);
970 bp_pack_value (&bp
, fs
->looping_previously_known
, 1);
971 bp_pack_value (&bp
, fs
->looping
, 1);
972 bp_pack_value (&bp
, fs
->can_throw
, 1);
973 streamer_write_bitpack (&bp
);
977 lto_destroy_simple_output_block (ob
);
981 /* Deserialize the ipa info for lto. */
984 pure_const_read_summary (void)
986 struct lto_file_decl_data
**file_data_vec
= lto_get_file_decl_data ();
987 struct lto_file_decl_data
*file_data
;
991 while ((file_data
= file_data_vec
[j
++]))
995 struct lto_input_block
*ib
996 = lto_create_simple_input_block (file_data
,
997 LTO_section_ipa_pure_const
,
1002 unsigned int count
= streamer_read_uhwi (ib
);
1004 for (i
= 0; i
< count
; i
++)
1007 struct cgraph_node
*node
;
1008 struct bitpack_d bp
;
1010 lto_symtab_encoder_t encoder
;
1012 fs
= XCNEW (struct funct_state_d
);
1013 index
= streamer_read_uhwi (ib
);
1014 encoder
= file_data
->symtab_node_encoder
;
1015 node
= dyn_cast
<cgraph_node
*> (lto_symtab_encoder_deref (encoder
,
1017 set_function_state (node
, fs
);
1019 /* Note that the flags must be read in the opposite
1020 order in which they were written (the bitflags were
1021 pushed into FLAGS). */
1022 bp
= streamer_read_bitpack (ib
);
1023 fs
->pure_const_state
1024 = (enum pure_const_state_e
) bp_unpack_value (&bp
, 2);
1025 fs
->state_previously_known
1026 = (enum pure_const_state_e
) bp_unpack_value (&bp
, 2);
1027 fs
->looping_previously_known
= bp_unpack_value (&bp
, 1);
1028 fs
->looping
= bp_unpack_value (&bp
, 1);
1029 fs
->can_throw
= bp_unpack_value (&bp
, 1);
1032 int flags
= flags_from_decl_or_type (node
->decl
);
1033 fprintf (dump_file
, "Read info for %s/%i ",
1036 if (flags
& ECF_CONST
)
1037 fprintf (dump_file
, " const");
1038 if (flags
& ECF_PURE
)
1039 fprintf (dump_file
, " pure");
1040 if (flags
& ECF_NOTHROW
)
1041 fprintf (dump_file
, " nothrow");
1042 fprintf (dump_file
, "\n pure const state: %s\n",
1043 pure_const_names
[fs
->pure_const_state
]);
1044 fprintf (dump_file
, " previously known state: %s\n",
1045 pure_const_names
[fs
->looping_previously_known
]);
1047 fprintf (dump_file
," function is locally looping\n");
1048 if (fs
->looping_previously_known
)
1049 fprintf (dump_file
," function is previously known looping\n");
1051 fprintf (dump_file
," function is locally throwing\n");
1055 lto_destroy_simple_input_block (file_data
,
1056 LTO_section_ipa_pure_const
,
1064 ignore_edge (struct cgraph_edge
*e
)
1066 return (!e
->can_throw_external
);
1069 /* Return true if NODE is self recursive function.
1070 Indirectly recursive functions appears as non-trivial strongly
1071 connected components, so we need to care about self recursion
1075 self_recursive_p (struct cgraph_node
*node
)
1077 struct cgraph_edge
*e
;
1078 for (e
= node
->callees
; e
; e
= e
->next_callee
)
1079 if (e
->callee
->function_symbol () == node
)
1084 /* Produce transitive closure over the callgraph and compute pure/const
1088 propagate_pure_const (void)
1090 struct cgraph_node
*node
;
1091 struct cgraph_node
*w
;
1092 struct cgraph_node
**order
=
1093 XCNEWVEC (struct cgraph_node
*, symtab
->cgraph_count
);
1096 struct ipa_dfs_info
* w_info
;
1098 order_pos
= ipa_reduced_postorder (order
, true, false, NULL
);
1101 cgraph_node::dump_cgraph (dump_file
);
1102 ipa_print_order (dump_file
, "reduced", order
, order_pos
);
1105 /* Propagate the local information through the call graph to produce
1106 the global information. All the nodes within a cycle will have
1107 the same info so we collapse cycles first. Then we can do the
1108 propagation in one pass from the leaves to the roots. */
1109 for (i
= 0; i
< order_pos
; i
++ )
1111 enum pure_const_state_e pure_const_state
= IPA_CONST
;
1112 bool looping
= false;
1119 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
1120 fprintf (dump_file
, "Starting cycle\n");
1122 /* Find the worst state for any node in the cycle. */
1124 while (w
&& pure_const_state
!= IPA_NEITHER
)
1126 struct cgraph_edge
*e
;
1127 struct cgraph_edge
*ie
;
1129 struct ipa_ref
*ref
= NULL
;
1131 funct_state w_l
= get_function_state (w
);
1132 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
1133 fprintf (dump_file
, " Visiting %s/%i state:%s looping %i\n",
1136 pure_const_names
[w_l
->pure_const_state
],
1139 /* First merge in function body properties. */
1140 worse_state (&pure_const_state
, &looping
,
1141 w_l
->pure_const_state
, w_l
->looping
);
1142 if (pure_const_state
== IPA_NEITHER
)
1145 /* For overwritable nodes we can not assume anything. */
1146 if (w
->get_availability () == AVAIL_INTERPOSABLE
)
1148 worse_state (&pure_const_state
, &looping
,
1149 w_l
->state_previously_known
,
1150 w_l
->looping_previously_known
);
1151 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
1154 " Overwritable. state %s looping %i\n",
1155 pure_const_names
[w_l
->state_previously_known
],
1156 w_l
->looping_previously_known
);
1163 /* We consider recursive cycles as possibly infinite.
1164 This might be relaxed since infinite recursion leads to stack
1169 /* Now walk the edges and merge in callee properties. */
1170 for (e
= w
->callees
; e
; e
= e
->next_callee
)
1172 enum availability avail
;
1173 struct cgraph_node
*y
= e
->callee
->function_symbol (&avail
);
1174 enum pure_const_state_e edge_state
= IPA_CONST
;
1175 bool edge_looping
= false;
1177 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
1184 if (avail
> AVAIL_INTERPOSABLE
)
1186 funct_state y_l
= get_function_state (y
);
1187 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
1190 " state:%s looping:%i\n",
1191 pure_const_names
[y_l
->pure_const_state
],
1194 if (y_l
->pure_const_state
> IPA_PURE
1195 && e
->cannot_lead_to_return_p ())
1197 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
1199 " Ignoring side effects"
1200 " -> pure, looping\n");
1201 edge_state
= IPA_PURE
;
1202 edge_looping
= true;
1206 edge_state
= y_l
->pure_const_state
;
1207 edge_looping
= y_l
->looping
;
1210 else if (special_builtin_state (&edge_state
, &edge_looping
,
1214 state_from_flags (&edge_state
, &edge_looping
,
1215 flags_from_decl_or_type (y
->decl
),
1216 e
->cannot_lead_to_return_p ());
1218 /* Merge the results with what we already know. */
1219 better_state (&edge_state
, &edge_looping
,
1220 w_l
->state_previously_known
,
1221 w_l
->looping_previously_known
);
1222 worse_state (&pure_const_state
, &looping
,
1223 edge_state
, edge_looping
);
1224 if (pure_const_state
== IPA_NEITHER
)
1227 if (pure_const_state
== IPA_NEITHER
)
1230 /* Now process the indirect call. */
1231 for (ie
= w
->indirect_calls
; ie
; ie
= ie
->next_callee
)
1233 enum pure_const_state_e edge_state
= IPA_CONST
;
1234 bool edge_looping
= false;
1236 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
1237 fprintf (dump_file
, " Indirect call");
1238 state_from_flags (&edge_state
, &edge_looping
,
1239 ie
->indirect_info
->ecf_flags
,
1240 ie
->cannot_lead_to_return_p ());
1241 /* Merge the results with what we already know. */
1242 better_state (&edge_state
, &edge_looping
,
1243 w_l
->state_previously_known
,
1244 w_l
->looping_previously_known
);
1245 worse_state (&pure_const_state
, &looping
,
1246 edge_state
, edge_looping
);
1247 if (pure_const_state
== IPA_NEITHER
)
1250 if (pure_const_state
== IPA_NEITHER
)
1253 /* And finally all loads and stores. */
1254 for (i
= 0; w
->iterate_reference (i
, ref
); i
++)
1256 enum pure_const_state_e ref_state
= IPA_CONST
;
1257 bool ref_looping
= false;
1261 /* readonly reads are safe. */
1262 if (TREE_READONLY (ref
->referred
->decl
))
1264 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
1265 fprintf (dump_file
, " nonreadonly global var read\n");
1266 ref_state
= IPA_PURE
;
1269 if (ref
->cannot_lead_to_return ())
1271 ref_state
= IPA_NEITHER
;
1272 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
1273 fprintf (dump_file
, " global var write\n");
1280 better_state (&ref_state
, &ref_looping
,
1281 w_l
->state_previously_known
,
1282 w_l
->looping_previously_known
);
1283 worse_state (&pure_const_state
, &looping
,
1284 ref_state
, ref_looping
);
1285 if (pure_const_state
== IPA_NEITHER
)
1288 w_info
= (struct ipa_dfs_info
*) w
->aux
;
1289 w
= w_info
->next_cycle
;
1291 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
1292 fprintf (dump_file
, "Result %s looping %i\n",
1293 pure_const_names
[pure_const_state
],
1296 /* Copy back the region's pure_const_state which is shared by
1297 all nodes in the region. */
1301 funct_state w_l
= get_function_state (w
);
1302 enum pure_const_state_e this_state
= pure_const_state
;
1303 bool this_looping
= looping
;
1305 if (w_l
->state_previously_known
!= IPA_NEITHER
1306 && this_state
> w_l
->state_previously_known
)
1308 this_state
= w_l
->state_previously_known
;
1309 this_looping
|= w_l
->looping_previously_known
;
1311 if (!this_looping
&& self_recursive_p (w
))
1312 this_looping
= true;
1313 if (!w_l
->looping_previously_known
)
1314 this_looping
= false;
1316 /* All nodes within a cycle share the same info. */
1317 w_l
->pure_const_state
= this_state
;
1318 w_l
->looping
= this_looping
;
1320 /* Inline clones share declaration with their offline copies;
1321 do not modify their declarations since the offline copy may
1323 if (!w
->global
.inlined_to
)
1327 if (!TREE_READONLY (w
->decl
))
1329 warn_function_const (w
->decl
, !this_looping
);
1331 fprintf (dump_file
, "Function found to be %sconst: %s\n",
1332 this_looping
? "looping " : "",
1335 w
->set_const_flag (true, this_looping
);
1339 if (!DECL_PURE_P (w
->decl
))
1341 warn_function_pure (w
->decl
, !this_looping
);
1343 fprintf (dump_file
, "Function found to be %spure: %s\n",
1344 this_looping
? "looping " : "",
1347 w
->set_pure_flag (true, this_looping
);
1353 w_info
= (struct ipa_dfs_info
*) w
->aux
;
1354 w
= w_info
->next_cycle
;
1358 ipa_free_postorder_info ();
1362 /* Produce transitive closure over the callgraph and compute nothrow
1366 propagate_nothrow (void)
1368 struct cgraph_node
*node
;
1369 struct cgraph_node
*w
;
1370 struct cgraph_node
**order
=
1371 XCNEWVEC (struct cgraph_node
*, symtab
->cgraph_count
);
1374 struct ipa_dfs_info
* w_info
;
1376 order_pos
= ipa_reduced_postorder (order
, true, false, ignore_edge
);
1379 cgraph_node::dump_cgraph (dump_file
);
1380 ipa_print_order (dump_file
, "reduced for nothrow", order
, order_pos
);
1383 /* Propagate the local information through the call graph to produce
1384 the global information. All the nodes within a cycle will have
1385 the same info so we collapse cycles first. Then we can do the
1386 propagation in one pass from the leaves to the roots. */
1387 for (i
= 0; i
< order_pos
; i
++ )
1389 bool can_throw
= false;
1395 /* Find the worst state for any node in the cycle. */
1399 struct cgraph_edge
*e
, *ie
;
1400 funct_state w_l
= get_function_state (w
);
1403 || w
->get_availability () == AVAIL_INTERPOSABLE
)
1409 for (e
= w
->callees
; e
; e
= e
->next_callee
)
1411 enum availability avail
;
1412 struct cgraph_node
*y
= e
->callee
->function_symbol (&avail
);
1414 if (avail
> AVAIL_INTERPOSABLE
)
1416 funct_state y_l
= get_function_state (y
);
1420 if (y_l
->can_throw
&& !TREE_NOTHROW (w
->decl
)
1421 && e
->can_throw_external
)
1424 else if (e
->can_throw_external
&& !TREE_NOTHROW (y
->decl
))
1427 for (ie
= node
->indirect_calls
; ie
; ie
= ie
->next_callee
)
1428 if (ie
->can_throw_external
)
1433 w_info
= (struct ipa_dfs_info
*) w
->aux
;
1434 w
= w_info
->next_cycle
;
1437 /* Copy back the region's pure_const_state which is shared by
1438 all nodes in the region. */
1442 funct_state w_l
= get_function_state (w
);
1443 if (!can_throw
&& !TREE_NOTHROW (w
->decl
))
1445 /* Inline clones share declaration with their offline copies;
1446 do not modify their declarations since the offline copy may
1448 if (!w
->global
.inlined_to
)
1450 w
->set_nothrow_flag (true);
1452 fprintf (dump_file
, "Function found to be nothrow: %s\n",
1456 else if (can_throw
&& !TREE_NOTHROW (w
->decl
))
1457 w_l
->can_throw
= true;
1458 w_info
= (struct ipa_dfs_info
*) w
->aux
;
1459 w
= w_info
->next_cycle
;
1463 ipa_free_postorder_info ();
1468 /* Produce the global information by preforming a transitive closure
1469 on the local information that was produced by generate_summary. */
1474 struct cgraph_node
*node
;
1476 symtab
->remove_cgraph_insertion_hook (function_insertion_hook_holder
);
1477 symtab
->remove_cgraph_duplication_hook (node_duplication_hook_holder
);
1478 symtab
->remove_cgraph_removal_hook (node_removal_hook_holder
);
1480 /* Nothrow makes more function to not lead to return and improve
1482 propagate_nothrow ();
1483 propagate_pure_const ();
1486 FOR_EACH_FUNCTION (node
)
1487 if (has_function_state (node
))
1488 free (get_function_state (node
));
1489 funct_state_vec
.release ();
1494 gate_pure_const (void)
1496 return (flag_ipa_pure_const
1497 /* Don't bother doing anything if the program has errors. */
1503 const pass_data pass_data_ipa_pure_const
=
1505 IPA_PASS
, /* type */
1506 "pure-const", /* name */
1507 OPTGROUP_NONE
, /* optinfo_flags */
1508 TV_IPA_PURE_CONST
, /* tv_id */
1509 0, /* properties_required */
1510 0, /* properties_provided */
1511 0, /* properties_destroyed */
1512 0, /* todo_flags_start */
1513 0, /* todo_flags_finish */
1516 class pass_ipa_pure_const
: public ipa_opt_pass_d
1519 pass_ipa_pure_const (gcc::context
*ctxt
)
1520 : ipa_opt_pass_d (pass_data_ipa_pure_const
, ctxt
,
1521 pure_const_generate_summary
, /* generate_summary */
1522 pure_const_write_summary
, /* write_summary */
1523 pure_const_read_summary
, /* read_summary */
1524 NULL
, /* write_optimization_summary */
1525 NULL
, /* read_optimization_summary */
1526 NULL
, /* stmt_fixup */
1527 0, /* function_transform_todo_flags_start */
1528 NULL
, /* function_transform */
1529 NULL
) /* variable_transform */
1532 /* opt_pass methods: */
1533 virtual bool gate (function
*) { return gate_pure_const (); }
1534 virtual unsigned int execute (function
*) { return propagate (); }
1536 }; // class pass_ipa_pure_const
1541 make_pass_ipa_pure_const (gcc::context
*ctxt
)
1543 return new pass_ipa_pure_const (ctxt
);
1546 /* Return true if function should be skipped for local pure const analysis. */
1549 skip_function_for_local_pure_const (struct cgraph_node
*node
)
1551 /* Because we do not schedule pass_fixup_cfg over whole program after early optimizations
1552 we must not promote functions that are called by already processed functions. */
1554 if (function_called_by_processed_nodes_p ())
1557 fprintf (dump_file
, "Function called in recursive cycle; ignoring\n");
1560 if (node
->get_availability () <= AVAIL_INTERPOSABLE
)
1563 fprintf (dump_file
, "Function is not available or overwritable; not analyzing.\n");
1569 /* Simple local pass for pure const discovery reusing the analysis from
1570 ipa_pure_const. This pass is effective when executed together with
1571 other optimization passes in early optimization pass queue. */
1575 const pass_data pass_data_local_pure_const
=
1577 GIMPLE_PASS
, /* type */
1578 "local-pure-const", /* name */
1579 OPTGROUP_NONE
, /* optinfo_flags */
1580 TV_IPA_PURE_CONST
, /* tv_id */
1581 0, /* properties_required */
1582 0, /* properties_provided */
1583 0, /* properties_destroyed */
1584 0, /* todo_flags_start */
1585 0, /* todo_flags_finish */
1588 class pass_local_pure_const
: public gimple_opt_pass
1591 pass_local_pure_const (gcc::context
*ctxt
)
1592 : gimple_opt_pass (pass_data_local_pure_const
, ctxt
)
1595 /* opt_pass methods: */
1596 opt_pass
* clone () { return new pass_local_pure_const (m_ctxt
); }
1597 virtual bool gate (function
*) { return gate_pure_const (); }
1598 virtual unsigned int execute (function
*);
1600 }; // class pass_local_pure_const
1603 pass_local_pure_const::execute (function
*fun
)
1605 bool changed
= false;
1608 struct cgraph_node
*node
;
1610 node
= cgraph_node::get (current_function_decl
);
1611 skip
= skip_function_for_local_pure_const (node
);
1612 if (!warn_suggest_attribute_const
1613 && !warn_suggest_attribute_pure
1617 l
= analyze_function (node
, false);
1619 /* Do NORETURN discovery. */
1620 if (!skip
&& !TREE_THIS_VOLATILE (current_function_decl
)
1621 && EDGE_COUNT (EXIT_BLOCK_PTR_FOR_FN (fun
)->preds
) == 0)
1623 warn_function_noreturn (fun
->decl
);
1625 fprintf (dump_file
, "Function found to be noreturn: %s\n",
1626 current_function_name ());
1628 /* Update declaration and reduce profile to executed once. */
1629 TREE_THIS_VOLATILE (current_function_decl
) = 1;
1630 if (node
->frequency
> NODE_FREQUENCY_EXECUTED_ONCE
)
1631 node
->frequency
= NODE_FREQUENCY_EXECUTED_ONCE
;
1636 switch (l
->pure_const_state
)
1639 if (!TREE_READONLY (current_function_decl
))
1641 warn_function_const (current_function_decl
, !l
->looping
);
1644 node
->set_const_flag (true, l
->looping
);
1648 fprintf (dump_file
, "Function found to be %sconst: %s\n",
1649 l
->looping
? "looping " : "",
1650 current_function_name ());
1652 else if (DECL_LOOPING_CONST_OR_PURE_P (current_function_decl
)
1657 node
->set_const_flag (true, false);
1661 fprintf (dump_file
, "Function found to be non-looping: %s\n",
1662 current_function_name ());
1667 if (!DECL_PURE_P (current_function_decl
))
1671 node
->set_pure_flag (true, l
->looping
);
1674 warn_function_pure (current_function_decl
, !l
->looping
);
1676 fprintf (dump_file
, "Function found to be %spure: %s\n",
1677 l
->looping
? "looping " : "",
1678 current_function_name ());
1680 else if (DECL_LOOPING_CONST_OR_PURE_P (current_function_decl
)
1685 node
->set_pure_flag (true, false);
1689 fprintf (dump_file
, "Function found to be non-looping: %s\n",
1690 current_function_name ());
1697 if (!l
->can_throw
&& !TREE_NOTHROW (current_function_decl
))
1699 node
->set_nothrow_flag (true);
1702 fprintf (dump_file
, "Function found to be nothrow: %s\n",
1703 current_function_name ());
1707 return execute_fixup_cfg ();
1715 make_pass_local_pure_const (gcc::context
*ctxt
)
1717 return new pass_local_pure_const (ctxt
);
1720 /* Emit noreturn warnings. */
1724 const pass_data pass_data_warn_function_noreturn
=
1726 GIMPLE_PASS
, /* type */
1727 "*warn_function_noreturn", /* name */
1728 OPTGROUP_NONE
, /* optinfo_flags */
1729 TV_NONE
, /* tv_id */
1730 PROP_cfg
, /* properties_required */
1731 0, /* properties_provided */
1732 0, /* properties_destroyed */
1733 0, /* todo_flags_start */
1734 0, /* todo_flags_finish */
1737 class pass_warn_function_noreturn
: public gimple_opt_pass
1740 pass_warn_function_noreturn (gcc::context
*ctxt
)
1741 : gimple_opt_pass (pass_data_warn_function_noreturn
, ctxt
)
1744 /* opt_pass methods: */
1745 virtual bool gate (function
*) { return warn_suggest_attribute_noreturn
; }
1746 virtual unsigned int execute (function
*fun
)
1748 if (!TREE_THIS_VOLATILE (current_function_decl
)
1749 && EDGE_COUNT (EXIT_BLOCK_PTR_FOR_FN (fun
)->preds
) == 0)
1750 warn_function_noreturn (current_function_decl
);
1754 }; // class pass_warn_function_noreturn
1759 make_pass_warn_function_noreturn (gcc::context
*ctxt
)
1761 return new pass_warn_function_noreturn (ctxt
);