aboutsummaryrefslogtreecommitdiff
path: root/gcc/calls.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/calls.c')
-rw-r--r--gcc/calls.c42
1 files changed, 37 insertions, 5 deletions
diff --git a/gcc/calls.c b/gcc/calls.c
index 587969f..bb954ef 100644
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -617,10 +617,10 @@ setjmp_call_p (const_tree fndecl)
}
-/* Return true if STMT is an alloca call. */
+/* Return true if STMT may be an alloca call. */
bool
-gimple_alloca_call_p (const gimple *stmt)
+gimple_maybe_alloca_call_p (const gimple *stmt)
{
tree fndecl;
@@ -634,7 +634,31 @@ gimple_alloca_call_p (const gimple *stmt)
return false;
}
-/* Return true when exp contains alloca call. */
+/* Return true if STMT is a builtin alloca call. */
+
+bool
+gimple_alloca_call_p (const gimple *stmt)
+{
+ tree fndecl;
+
+ if (!is_gimple_call (stmt))
+ return false;
+
+ fndecl = gimple_call_fndecl (stmt);
+ if (fndecl && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL)
+ switch (DECL_FUNCTION_CODE (fndecl))
+ {
+ case BUILT_IN_ALLOCA:
+ case BUILT_IN_ALLOCA_WITH_ALIGN:
+ return true;
+ default:
+ break;
+ }
+
+ return false;
+}
+
+/* Return true when exp contains a builtin alloca call. */
bool
alloca_call_p (const_tree exp)
@@ -642,8 +666,16 @@ alloca_call_p (const_tree exp)
tree fndecl;
if (TREE_CODE (exp) == CALL_EXPR
&& (fndecl = get_callee_fndecl (exp))
- && (special_function_p (fndecl, 0) & ECF_MAY_BE_ALLOCA))
- return true;
+ && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL)
+ switch (DECL_FUNCTION_CODE (fndecl))
+ {
+ case BUILT_IN_ALLOCA:
+ case BUILT_IN_ALLOCA_WITH_ALIGN:
+ return true;
+ default:
+ break;
+ }
+
return false;
}