[llvm-commits] [llvm-gcc-4.2] r57527 - /llvm-gcc-4.2/trunk/gcc/except.c

Dan Gohman gohman at apple.com
Tue Oct 14 14:52:37 PDT 2008


Author: djg
Date: Tue Oct 14 16:52:37 2008
New Revision: 57527

URL: http://llvm.org/viewvc/llvm-project?rev=57527&view=rev
Log:
Fix the generated declaration of _Unwind_Resume and friends to not
use '...' in its argument list. This allows fast-isel to codegen it,
and it avoids the need for %al to be set to 0 on x86-64.

Modified:
    llvm-gcc-4.2/trunk/gcc/except.c

Modified: llvm-gcc-4.2/trunk/gcc/except.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/except.c?rev=57527&r1=57526&r2=57527&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/except.c (original)
+++ llvm-gcc-4.2/trunk/gcc/except.c Tue Oct 14 16:52:37 2008
@@ -4079,13 +4079,25 @@
   /* The default c++ routines aren't actually c++ specific, so use those.  */
   /* LLVM LOCAL begin */
 #ifdef ENABLE_LLVM
-  llvm_unwind_resume_libfunc = llvm_init_one_libfunc ( USING_SJLJ_EXCEPTIONS ?
-                                               "_Unwind_SjLj_Resume"
+  /* Create the decl with build_decl instead of using llvm_init_one_libfunc
+     so that we can specify an argument type instead of just using '...'.
+     '...' is functionally correct, but more work for codegen to handle,
+     and even requires additional instructions on some targets. */
+  const char *name = USING_SJLJ_EXCEPTIONS ?
+                       "_Unwind_SjLj_Resume"
 #ifdef LLVM_STACKSENSITIVE_UNWIND_RESUME
-                                               : "_Unwind_Resume_or_Rethrow");
+                       : "_Unwind_Resume_or_Rethrow";
 #else
-                                               : "_Unwind_Resume");
+                       : "_Unwind_Resume";
 #endif
+  tree decl = build_decl (FUNCTION_DECL, get_identifier (name),
+                          build_function_type (void_type_node,
+                                               tree_cons (0, ptr_type_node,
+                                                          void_list_node)));
+  DECL_ARTIFICIAL (decl) = 1;
+  DECL_EXTERNAL (decl) = 1;
+  TREE_PUBLIC (decl) = 1;
+  llvm_unwind_resume_libfunc = decl;
 #else
   unwind_resume_libfunc =
     init_one_libfunc ( USING_SJLJ_EXCEPTIONS ? "_Unwind_SjLj_Resume"





More information about the llvm-commits mailing list