]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
(calls_function_1): A language-specific code must be assumed to call a function and...
authorRichard Kenner <kenner@gcc.gnu.org>
Thu, 21 Apr 1994 23:08:53 +0000 (19:08 -0400)
committerRichard Kenner <kenner@gcc.gnu.org>
Thu, 21 Apr 1994 23:08:53 +0000 (19:08 -0400)
(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

index 1eed04b5b0186eff79952546c60601c9b873d619..2622b5b7f2aba3fc21c7ef527d8aa5c765e9f196 100644 (file)
@@ -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;