summaryrefslogtreecommitdiff
path: root/gcc/calls.c
diff options
context:
space:
mode:
authoredlinger <edlinger@138bc75d-0d04-0410-961f-82ee72b054a4>2016-07-21 19:06:02 +0000
committeredlinger <edlinger@138bc75d-0d04-0410-961f-82ee72b054a4>2016-07-21 19:06:02 +0000
commit5890598506d458bbec971978b642c77f7354c24f (patch)
treece852e8aeab3c5945be947a5e82a7a2fe2b2bca3 /gcc/calls.c
parent8aafcf7ebbe6f6e4b0883da766db97e4bb7c5adb (diff)
downloadgcc-5890598506d458bbec971978b642c77f7354c24f.tar.gz
016-07-21 Bernd Edlinger <bernd.edlinger@hotmail.de>
PR middle-end/71876 * calls.c (gimple_maybe_alloca_call_p): New function. Return true if STMT may be an alloca call. (gimple_alloca_call_p, alloca_call_p): Return only true for the builtin alloca call. * calls.h (gimple_maybe_alloca_call_p): New function. * tree-inline.c (inline_forbidden_p_stmt): Use gimple_maybe_alloca_call_p here. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@238605 138bc75d-0d04-0410-961f-82ee72b054a4
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 587969fcf01..bb954ef5b09 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;
}