[llvm-branch-commits] [llvm-branch] r79268 - in /llvm/branches/Apple/Leela: include/llvm/CodeGen/Passes.h lib/CodeGen/AsmPrinter/DwarfException.cpp lib/CodeGen/AsmPrinter/DwarfException.h lib/CodeGen/LLVMTargetMachine.cpp lib/CodeGen/SjLjEHPrepare.cpp

Bill Wendling isanbard at gmail.com
Mon Aug 17 11:55:15 PDT 2009


Author: void
Date: Mon Aug 17 13:55:15 2009
New Revision: 79268

URL: http://llvm.org/viewvc/llvm-project?rev=79268&view=rev
Log:
$ svn merge -c 79250 https://llvm.org/svn/llvm-project/llvm/trunk
--- Merging r79250 into '.':
U    include/llvm/CodeGen/Passes.h
A    lib/CodeGen/SjLjEHPrepare.cpp
U    lib/CodeGen/LLVMTargetMachine.cpp
U    lib/CodeGen/AsmPrinter/DwarfException.cpp
U    lib/CodeGen/AsmPrinter/DwarfException.h


Added:
    llvm/branches/Apple/Leela/lib/CodeGen/SjLjEHPrepare.cpp
      - copied unchanged from r79250, llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp
Modified:
    llvm/branches/Apple/Leela/include/llvm/CodeGen/Passes.h
    llvm/branches/Apple/Leela/lib/CodeGen/AsmPrinter/DwarfException.cpp
    llvm/branches/Apple/Leela/lib/CodeGen/AsmPrinter/DwarfException.h
    llvm/branches/Apple/Leela/lib/CodeGen/LLVMTargetMachine.cpp

Modified: llvm/branches/Apple/Leela/include/llvm/CodeGen/Passes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/CodeGen/Passes.h?rev=79268&r1=79267&r2=79268&view=diff

==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/CodeGen/Passes.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/CodeGen/Passes.h Mon Aug 17 13:55:15 2009
@@ -193,6 +193,10 @@
   /// adapted to code generation.  Required if using dwarf exception handling.
   FunctionPass *createDwarfEHPass(const TargetLowering *tli, bool fast);
 
+  /// createSjLjEHPass - This pass adapts exception handling code to use
+  /// the GCC-style builtin setjmp/longjmp (sjlj) to handling EH control flow.
+  FunctionPass *createSjLjEHPass(const TargetLowering *tli);
+
 } // End llvm namespace
 
 #endif

Modified: llvm/branches/Apple/Leela/lib/CodeGen/AsmPrinter/DwarfException.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=79268&r1=79267&r2=79268&view=diff

==============================================================================
--- llvm/branches/Apple/Leela/lib/CodeGen/AsmPrinter/DwarfException.cpp (original)
+++ llvm/branches/Apple/Leela/lib/CodeGen/AsmPrinter/DwarfException.cpp Mon Aug 17 13:55:15 2009
@@ -364,7 +364,6 @@
 /// try-range address.
 void DwarfException::
 ComputeCallSiteTable(SmallVectorImpl<CallSiteEntry> &CallSites,
-                     std::map<unsigned,CallSiteEntry*> &CallSiteIndexMap,
                      const RangeMapType &PadMap,
                      const SmallVectorImpl<const LandingPadInfo *> &LandingPads,
                      const SmallVectorImpl<unsigned> &FirstActions) {
@@ -438,12 +437,6 @@
 
         // Otherwise, create a new call-site.
         CallSites.push_back(Site);
-        // For SjLj handling, map the call site entry to its index
-        if (TAI->getExceptionHandlingType() == ExceptionHandling::SjLj) {
-          unsigned Index =
-            MF->getLandingPadCallSiteIndex(LandingPad->LandingPadBlock);
-          CallSiteIndexMap[Index] = &CallSites.back();
-        }
         PreviousIsInvoke = true;
       } else {
         // Create a gap.
@@ -520,9 +513,7 @@
 
   // Compute the call-site table.
   SmallVector<CallSiteEntry, 64> CallSites;
-  std::map<unsigned,CallSiteEntry*> CallSiteIndexMap;
-  ComputeCallSiteTable(CallSites, CallSiteIndexMap, PadMap,
-                       LandingPads, FirstActions);
+  ComputeCallSiteTable(CallSites, PadMap, LandingPads, FirstActions);
 
   // Final tallies.
 
@@ -537,8 +528,7 @@
 
 
   if (TAI->getExceptionHandlingType() == ExceptionHandling::SjLj) {
-    SizeSites = (MF->getMaxCallSiteIndex() - CallSites.size()) *
-      TargetAsmInfo::getULEB128Size(0) * 2;
+    SizeSites = 0;
   } else
     SizeSites = CallSites.size() *
       (SiteStartSize + SiteLengthSize + LandingPadSize);
@@ -546,7 +536,6 @@
     SizeSites += TargetAsmInfo::getULEB128Size(CallSites[i].Action);
     if (TAI->getExceptionHandlingType() == ExceptionHandling::SjLj)
       SizeSites += TargetAsmInfo::getULEB128Size(i);
-      // FIXME: 'i' above should be the landing pad index
   }
   // Type infos.
   const unsigned TypeInfoSize = TD->getPointerSize(); // DW_EH_PE_absptr
@@ -655,25 +644,11 @@
     assert(MF->getCallSiteCount() == CallSites.size());
 
     // Emit the landing pad site information.
-    // SjLj handling assigned the call site indices in the front end, so
-    // we need to make sure the table here lines up with that. That's pretty
-    // horrible, and should be fixed ASAP to do that stuff in the back end
-    // instead.
-    std::map<unsigned, CallSiteEntry*>::const_iterator I, E;
-    I = CallSiteIndexMap.begin();
-    E = CallSiteIndexMap.end();
-    for (unsigned CurrIdx = 1; I != E; ++I) {
-      // paranoia.
-      assert(CurrIdx <= I->first);
-      // Fill in any gaps in the table
-      while (CurrIdx++ < I->first) {
-        Asm->EmitULEB128Bytes(0);
-        Asm->EOL("Filler landing pad");
-        Asm->EmitULEB128Bytes(0);
-        Asm->EOL("Filler action");
-      }
-      const CallSiteEntry &S = *(I->second);
-      Asm->EmitULEB128Bytes(I->first - 1);
+    unsigned idx = 0;
+    for (SmallVectorImpl<CallSiteEntry>::const_iterator
+         I = CallSites.begin(), E = CallSites.end(); I != E; ++I, ++idx) {
+      const CallSiteEntry &S = *I;
+      Asm->EmitULEB128Bytes(idx);
       Asm->EOL("Landing pad");
       Asm->EmitULEB128Bytes(S.Action);
       Asm->EOL("Action");

Modified: llvm/branches/Apple/Leela/lib/CodeGen/AsmPrinter/DwarfException.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/CodeGen/AsmPrinter/DwarfException.h?rev=79268&r1=79267&r2=79268&view=diff

==============================================================================
--- llvm/branches/Apple/Leela/lib/CodeGen/AsmPrinter/DwarfException.h (original)
+++ llvm/branches/Apple/Leela/lib/CodeGen/AsmPrinter/DwarfException.h Mon Aug 17 13:55:15 2009
@@ -155,7 +155,6 @@
   /// of any entry - they form gaps in the table.  Entries must be ordered by
   /// try-range address.
   void ComputeCallSiteTable(SmallVectorImpl<CallSiteEntry> &CallSites,
-                            std::map<unsigned,CallSiteEntry*> &CallSiteIndexMap,
                             const RangeMapType &PadMap,
                             const SmallVectorImpl<const LandingPadInfo *> &LPs,
                             const SmallVectorImpl<unsigned> &FirstActions);

Modified: llvm/branches/Apple/Leela/lib/CodeGen/LLVMTargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/CodeGen/LLVMTargetMachine.cpp?rev=79268&r1=79267&r2=79268&view=diff

==============================================================================
--- llvm/branches/Apple/Leela/lib/CodeGen/LLVMTargetMachine.cpp (original)
+++ llvm/branches/Apple/Leela/lib/CodeGen/LLVMTargetMachine.cpp Mon Aug 17 13:55:15 2009
@@ -239,8 +239,11 @@
   // handle.
   switch (getTargetAsmInfo()->getExceptionHandlingType())
   {
-  // SjLj piggy-backs on dwarf for this bit
   case ExceptionHandling::SjLj:
+    // SjLj piggy-backs on dwarf for this bit. The cleanups done apply to both
+    PM.add(createDwarfEHPass(getTargetLowering(), OptLevel==CodeGenOpt::None));
+    PM.add(createSjLjEHPass(getTargetLowering()));
+    break;
   case ExceptionHandling::Dwarf:
     PM.add(createDwarfEHPass(getTargetLowering(), OptLevel==CodeGenOpt::None));
     break;





More information about the llvm-branch-commits mailing list