diff options
author | Michael Matz <matz@suse.de> | 2011-04-15 19:48:25 +0000 |
---|---|---|
committer | Michael Matz <matz@gcc.gnu.org> | 2011-04-15 19:48:25 +0000 |
commit | 63d2a3533fb013061b3a20ddcc26233d6368de32 (patch) | |
tree | 2ca8a4769f794f0a8bad0116318e591f72ee7e8e /gcc/gimple.h | |
parent | dee74c343634bec2e6909f197ce0b669820acc56 (diff) | |
download | gcc-63d2a3533fb013061b3a20ddcc26233d6368de32.zip gcc-63d2a3533fb013061b3a20ddcc26233d6368de32.tar.gz gcc-63d2a3533fb013061b3a20ddcc26233d6368de32.tar.bz2 |
tree.h (ALLOCA_FOR_VAR_P): Rename to CALL_ALLOCA_FOR_VAR_P.
* 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.
From-SVN: r172516
Diffstat (limited to 'gcc/gimple.h')
-rw-r--r-- | gcc/gimple.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/gcc/gimple.h b/gcc/gimple.h index 840e149..788ffe6 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. */ |