From 0207efa210a8cf5c2777b9ebaf3cd0d34295afc5 Mon Sep 17 00:00:00 2001 From: Richard Kenner Date: Thu, 21 Apr 1994 19:08:53 -0400 Subject: [PATCH] (calls_function_1): A language-specific code must be assumed to call a function and also call alloca. (calls_function_1): A language-specific code must be assumed to call a function and also call alloca. Check for inlined functions that call alloca. From-SVN: r7133 --- gcc/calls.c | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/gcc/calls.c b/gcc/calls.c index 1eed04b5b01..2622b5b7f2a 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -157,27 +157,37 @@ calls_function_1 (exp, which) int which; { register int i; - int type = TREE_CODE_CLASS (TREE_CODE (exp)); - int length = tree_code_length[(int) TREE_CODE (exp)]; + enum tree_code code = TREE_CODE (exp); + int type = TREE_CODE_CLASS (code); + int length = tree_code_length[(int) code]; - /* Only expressions and references can contain calls. */ + /* If this code is langauge-specific, we don't know what it will do. */ + if ((int) code >= NUM_TREE_CODES) + return 1; + /* Only expressions and references can contain calls. */ if (type != 'e' && type != '<' && type != '1' && type != '2' && type != 'r' && type != 'b') return 0; - switch (TREE_CODE (exp)) + switch (code) { case CALL_EXPR: if (which == 0) return 1; else if (TREE_CODE (TREE_OPERAND (exp, 0)) == ADDR_EXPR && (TREE_CODE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)) - == FUNCTION_DECL) - && DECL_BUILT_IN (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)) - && (DECL_FUNCTION_CODE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)) - == BUILT_IN_ALLOCA)) - return 1; + == FUNCTION_DECL)) + { + tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0); + + if ((DECL_BUILT_IN (fndecl) + && DECL_FUNCTION_CODE (fndecl) == BUILT_IN_ALLOCA) + || (DECL_SAVED_INSNS (fndecl) + && (FUNCTION_FLAGS (DECL_SAVED_INSNS (fndecl)) + & FUNCTION_FLAGS_CALLS_ALLOCA))) + return 1; + } /* Third operand is RTL. */ length = 2; -- 2.30.2