[llvm-branch-commits] [llvm-gcc-branch] r113530 - in /llvm-gcc-4.2/branches/release_28: ./ gcc/llvm-convert.cpp gcc/llvm-internal.h

Bill Wendling isanbard at gmail.com
Thu Sep 9 13:10:39 PDT 2010


Author: void
Date: Thu Sep  9 15:10:39 2010
New Revision: 113530

URL: http://llvm.org/viewvc/llvm-project?rev=113530&view=rev
Log:
Approved by Duncan:

$ svn merge -c 113357 https://llvm.org/svn/llvm-project/llvm-gcc-4.2/trunk
--- Merging r113357 into '.':
U    gcc/llvm-convert.cpp
U    gcc/llvm-internal.h
$ svn merge -c 113361 https://llvm.org/svn/llvm-project/llvm-gcc-4.2/trunk
--- Merging r113361 into '.':
G    gcc/llvm-convert.cpp


Modified:
    llvm-gcc-4.2/branches/release_28/   (props changed)
    llvm-gcc-4.2/branches/release_28/gcc/llvm-convert.cpp
    llvm-gcc-4.2/branches/release_28/gcc/llvm-internal.h

Propchange: llvm-gcc-4.2/branches/release_28/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Sep  9 15:10:39 2010
@@ -1 +1 @@
-/llvm-gcc-4.2/trunk:113070,113107
+/llvm-gcc-4.2/trunk:113070,113107,113357,113361

Modified: llvm-gcc-4.2/branches/release_28/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/release_28/gcc/llvm-convert.cpp?rev=113530&r1=113529&r2=113530&view=diff
==============================================================================
--- llvm-gcc-4.2/branches/release_28/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/branches/release_28/gcc/llvm-convert.cpp Thu Sep  9 15:10:39 2010
@@ -188,6 +188,7 @@
   GreatestAlignment = TheTarget->getFrameInfo()->getStackAlignment();
   SeenVLA = NULL;
 
+  CatchAll = 0;
   ExceptionValue = 0;
   ExceptionSelectorValue = 0;
   FuncEHException = 0;
@@ -2151,6 +2152,24 @@
                                               Intrinsic::eh_selector);
   FuncEHGetTypeID = Intrinsic::getDeclaration(TheModule,
                                               Intrinsic::eh_typeid_for);
+
+  CatchAll = TheModule->getGlobalVariable("llvm.eh.catch.all.value");
+  if (!CatchAll && lang_eh_catch_all) {
+    Constant *Init = 0;
+    tree catch_all_type = lang_eh_catch_all();
+    if (catch_all_type == NULL_TREE)
+      // Use a C++ style null catch-all object.
+      Init = Constant::getNullValue(Type::getInt8PtrTy(Context));
+    else
+      // This language has a type that catches all others.
+      Init = cast<Constant>(Emit(catch_all_type, 0));
+
+    CatchAll = new GlobalVariable(*TheModule, Init->getType(), true,
+                                  GlobalVariable::LinkOnceAnyLinkage,
+                                  Init, "llvm.eh.catch.all.value");
+    CatchAll->setSection("llvm.metadata");
+    AttributeUsedGlobals.insert(CatchAll);
+  }
 }
 
 /// getPostPad - Return the post landing pad for the given exception handling
@@ -2204,7 +2223,6 @@
 
     bool HasCleanup = false;
     bool HasCatchAll = false;
-    static GlobalVariable *CatchAll = 0;
 
     for (std::vector<struct eh_region *>::iterator I = Handlers.begin(),
          E = Handlers.end(); I != E; ++I) {
@@ -2231,17 +2249,8 @@
         tree TypeList = get_eh_type_list(region);
 
         if (!TypeList) {
-          // Catch-all - push a null pointer.
-          if (!CatchAll) {
-            Constant *Init =
-              Constant::getNullValue(Type::getInt8PtrTy(Context));
-
-            CatchAll = new GlobalVariable(*TheModule, Init->getType(), true,
-                                          GlobalVariable::LinkOnceAnyLinkage,
-                                          Init, "llvm.eh.catch.all.value");
-            CatchAll->setSection("llvm.metadata");
-          }
-
+          // Catch-all - push the catch-all object.
+          assert(CatchAll && "Language did not define lang_eh_catch_all?");
           Args.push_back(CatchAll);
           HasCatchAll = true;
         } else {
@@ -2268,23 +2277,7 @@
           // 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.
-
-          if (!CatchAll) {
-            Constant *Init = 0;
-            tree catch_all_type = lang_eh_catch_all();
-            if (catch_all_type == NULL_TREE)
-              // Use a C++ style null catch-all object.
-              Init = Constant::getNullValue(Type::getInt8PtrTy(Context));
-            else
-              // This language has a type that catches all others.
-              Init = cast<Constant>(Emit(catch_all_type, 0));
-
-            CatchAll = new GlobalVariable(*TheModule, Init->getType(), true,
-                                          GlobalVariable::LinkOnceAnyLinkage,
-                                          Init, "llvm.eh.catch.all.value");
-            CatchAll->setSection("llvm.metadata");
-          }
-
+          assert(CatchAll && "Language did not define lang_eh_catch_all?");
           Args.push_back(CatchAll);
         }
       }

Modified: llvm-gcc-4.2/branches/release_28/gcc/llvm-internal.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/release_28/gcc/llvm-internal.h?rev=113530&r1=113529&r2=113530&view=diff
==============================================================================
--- llvm-gcc-4.2/branches/release_28/gcc/llvm-internal.h (original)
+++ llvm-gcc-4.2/branches/release_28/gcc/llvm-internal.h Thu Sep  9 15:10:39 2010
@@ -320,6 +320,9 @@
   /// PostPads - The post landing pad for a given EH region.
   IndexedMap<BasicBlock *> PostPads;
 
+  /// CatchAll - Language specific catch-all object.
+  GlobalVariable *CatchAll;
+
   /// ExceptionValue - Is the local to receive the current exception.
   Value *ExceptionValue;
 





More information about the llvm-branch-commits mailing list