summaryrefslogtreecommitdiff
path: root/gcc/gimple.h
diff options
context:
space:
mode:
authormatz <matz@138bc75d-0d04-0410-961f-82ee72b054a4>2011-04-15 19:48:25 +0000
committermatz <matz@138bc75d-0d04-0410-961f-82ee72b054a4>2011-04-15 19:48:25 +0000
commita882d7542a089444463b027d8ba1254057dddbeb (patch)
tree2ca8a4769f794f0a8bad0116318e591f72ee7e8e /gcc/gimple.h
parentb3b1665ebe9eca60ccb240224cc4784bef3bcf99 (diff)
downloadgcc-a882d7542a089444463b027d8ba1254057dddbeb.tar.gz
* tree.h (ALLOCA_FOR_VAR_P): Rename to CALL_ALLOCA_FOR_VAR_P.
* builtins.c (expand_builtin): Use CALL_ALLOCA_FOR_VAR_P. * function.c (gimplify_parameters): Ditto. * gimplify.c (gimplify_vla_decl): Ditto. * gimple.h (enum gf_mask): Add GF_CALL_ALLOCA_FOR_VAR. (gimple_call_set_alloca_for_var): New inline function. (gimple_call_alloca_for_var_p): Ditto. * gimple.c (gimple_build_call_from_tree): Remember CALL_ALLOCA_FOR_VAR_P state. * cfgexpand.c (expand_call_stmt): Restore CALL_ALLOCA_FOR_VAR_P state. * tree-inline.c (inline_forbidden_p_stmt): Don't reject alloca calls if they were for VLA objects. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@172516 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gimple.h')
-rw-r--r--gcc/gimple.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 840e149fde8..788ffe6d487 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -102,6 +102,7 @@ enum gf_mask {
GF_CALL_TAILCALL = 1 << 3,
GF_CALL_VA_ARG_PACK = 1 << 4,
GF_CALL_NOTHROW = 1 << 5,
+ GF_CALL_ALLOCA_FOR_VAR = 1 << 6,
GF_OMP_PARALLEL_COMBINED = 1 << 0,
/* True on an GIMPLE_OMP_RETURN statement if the return does not require
@@ -2330,6 +2331,29 @@ gimple_call_nothrow_p (gimple s)
return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
}
+/* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
+ is known to be emitted for VLA objects. Those are wrapped by
+ stack_save/stack_restore calls and hence can't lead to unbounded
+ stack growth even when they occur in loops. */
+
+static inline void
+gimple_call_set_alloca_for_var (gimple s, bool for_var)
+{
+ GIMPLE_CHECK (s, GIMPLE_CALL);
+ if (for_var)
+ s->gsbase.subcode |= GF_CALL_ALLOCA_FOR_VAR;
+ else
+ s->gsbase.subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
+}
+
+/* Return true of S is a call to builtin_alloca emitted for VLA objects. */
+
+static inline bool
+gimple_call_alloca_for_var_p (gimple s)
+{
+ GIMPLE_CHECK (s, GIMPLE_CALL);
+ return (s->gsbase.subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
+}
/* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */