[llvm] r226019 - Emit the Itanium LSDA for unknown EH personalities on Win64

Reid Kleckner reid at kleckner.net
Wed Jan 14 10:50:10 PST 2015


Author: rnk
Date: Wed Jan 14 12:50:10 2015
New Revision: 226019

URL: http://llvm.org/viewvc/llvm-project?rev=226019&view=rev
Log:
Emit the Itanium LSDA for unknown EH personalities on Win64

This fixes lots of generic CodeGen tests that use __gcc_personality_v0.
This suggests that using ExceptionHandling::MSVC was a mistake, and we
should instead classify each function by personality function. This
would, for example, allow us to LTO a binary containing uses of SEH and
Itanium EH.

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/Win64Exception.cpp
    llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/Win64Exception.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/Win64Exception.cpp?rev=226019&r1=226018&r2=226019&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/Win64Exception.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/Win64Exception.cpp Wed Jan 14 12:50:10 2015
@@ -103,18 +103,13 @@ void Win64Exception::endFunction(const M
     // Emit an UNWIND_INFO struct describing the prologue.
     Asm->OutStreamer.EmitWinEHHandlerData();
 
-    // Emit either MSVC-compatible tables or the usual Itanium-style LSDA after
-    // the UNWIND_INFO struct.
-    if (Asm->MAI->getExceptionHandlingType() == ExceptionHandling::MSVC) {
-      const Function *Per = MMI->getPersonalities()[MMI->getPersonalityIndex()];
-      if (Per->getName() == "__C_specific_handler")
-        emitCSpecificHandlerTable();
-      else
-        report_fatal_error(Twine("unexpected personality function: ") +
-                           Per->getName());
-    } else {
+    // Emit the tables appropriate to the personality function in use. If we
+    // don't recognize the personality, assume it uses an Itanium-style LSDA.
+    const Function *Per = MMI->getPersonalities()[MMI->getPersonalityIndex()];
+    if (Per->getName() == "__C_specific_handler")
+      emitCSpecificHandlerTable();
+    else
       emitExceptionTable();
-    }
 
     Asm->OutStreamer.PopSection();
   }

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=226019&r1=226018&r2=226019&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Jan 14 12:50:10 2015
@@ -941,6 +941,10 @@ void SelectionDAGISel::PrepareEHLandingP
         *MBB, MBB->begin(), SDB->getCurDebugLoc(), TII->get(TargetOpcode::PHI),
         FuncInfo->ExceptionSelectorVirtReg);
     for (unsigned I = 0, E = LPadInst->getNumClauses(); I != E; ++I) {
+      // Skip filter clauses, we can't implement them yet.
+      if (LPadInst->isFilter(I))
+        continue;
+
       MachineBasicBlock *ClauseBB = MF->CreateMachineBasicBlock(LLVMBB);
       MF->insert(MBB, ClauseBB);
 





More information about the llvm-commits mailing list