[llvm-branch-commits] [llvm-gcc-branch] r81887 - in /llvm-gcc-4.2/branches/Apple/Bender-SWB/gcc: except.c llvm-convert.cpp

Bill Wendling isanbard at gmail.com
Tue Sep 15 11:31:10 PDT 2009


Author: void
Date: Tue Sep 15 13:31:10 2009
New Revision: 81887

URL: http://llvm.org/viewvc/llvm-project?rev=81887&view=rev
Log:
--- Reverse-merging r81440 into '.':
U    gcc/llvm-convert.cpp
U    gcc/except.c

Revert the test of Eric's patch.

Modified:
    llvm-gcc-4.2/branches/Apple/Bender-SWB/gcc/except.c
    llvm-gcc-4.2/branches/Apple/Bender-SWB/gcc/llvm-convert.cpp

Modified: llvm-gcc-4.2/branches/Apple/Bender-SWB/gcc/except.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Bender-SWB/gcc/except.c?rev=81887&r1=81886&r2=81887&view=diff

==============================================================================
--- llvm-gcc-4.2/branches/Apple/Bender-SWB/gcc/except.c (original)
+++ llvm-gcc-4.2/branches/Apple/Bender-SWB/gcc/except.c Tue Sep 15 13:31:10 2009
@@ -4085,7 +4085,11 @@
      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";
+#else
                        : "_Unwind_Resume";
+#endif
   tree decl = build_decl (FUNCTION_DECL, get_identifier (name),
                           build_function_type_list (void_type_node,
                                                     ptr_type_node, NULL_TREE));

Modified: llvm-gcc-4.2/branches/Apple/Bender-SWB/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Bender-SWB/gcc/llvm-convert.cpp?rev=81887&r1=81886&r2=81887&view=diff

==============================================================================
--- llvm-gcc-4.2/branches/Apple/Bender-SWB/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/branches/Apple/Bender-SWB/gcc/llvm-convert.cpp Tue Sep 15 13:31:10 2009
@@ -1905,10 +1905,30 @@
             Args.push_back(Emit(TType, 0));
           }
         }
+      }
+    }
+
+    if (can_throw_external_1(i, false)) {
+      // Some exceptions from this region may not be caught by any handler.
+      // Since invokes are required to branch to the unwind label no matter
+      // what exception is being unwound, append a catch-all.
+
+      // The representation of a catch-all is language specific.
+      Value *Catch_All;
+      if (!lang_eh_catch_all) {
+        // Use a "cleanup" - this should be good enough for most languages.
+        Catch_All = ConstantInt::get(Type::Int32Ty, 0);
       } else {
-	// Cleanup region.
-	Args.push_back(ConstantInt::get(Type::Int32Ty, 0));
+        tree catch_all_type = lang_eh_catch_all();
+        if (catch_all_type == NULL_TREE)
+          // Use a C++ style null catch-all object.
+          Catch_All =
+            Constant::getNullValue(PointerType::getUnqual(Type::Int8Ty));
+        else
+          // This language has a type that catches all others.
+          Catch_All = Emit(catch_all_type, 0);
       }
+      Args.push_back(Catch_All);
     }
 
     // Emit the selector call.
@@ -2043,7 +2063,11 @@
   if (UnwindBB) {
     CreateExceptionValues();
     EmitBlock(UnwindBB);
-    Builder.CreateUnwind();
+    // Fetch and store exception handler.
+    Value *Arg = Builder.CreateLoad(ExceptionValue, "eh_ptr");
+    assert(llvm_unwind_resume_libfunc && "no unwind resume function!");
+    Builder.CreateCall(DECL_LLVM(llvm_unwind_resume_libfunc), Arg);
+    Builder.CreateUnreachable();
   }
 }
 





More information about the llvm-branch-commits mailing list