[llvm-commits] [llvm] r132302 - /llvm/trunk/lib/CodeGen/AsmPrinter/Win64Exception.cpp

Charles Davis cdavis at mines.edu
Sun May 29 17:13:35 PDT 2011


Author: cdavis
Date: Sun May 29 19:13:34 2011
New Revision: 132302

URL: http://llvm.org/viewvc/llvm-project?rev=132302&view=rev
Log:
Emit the handler's data area. For GCC-style exceptions under Win64, the
handler's data area starts with a 4-byte reference to the personality
function, followed by the DWARF LSDA.

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

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/Win64Exception.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/Win64Exception.cpp?rev=132302&r1=132301&r2=132302&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/Win64Exception.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/Win64Exception.cpp Sun May 29 19:13:34 2011
@@ -83,6 +83,9 @@
   MCSymbol *GCCHandlerSym =
     Asm->GetExternalSymbolSymbol("_GCC_specific_handler");
   Asm->OutStreamer.EmitWin64EHHandler(GCCHandlerSym, true, true);
+
+  Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("eh_func_begin",
+                                                Asm->getFunctionNumber()));
 }
 
 /// EndFunction - Gather and emit post-function exception information.
@@ -91,5 +94,23 @@
   if (!shouldEmitPersonality && !shouldEmitMoves)
     return;
 
+  Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("eh_func_end",
+                                                Asm->getFunctionNumber()));
+
+  // Map all labels and get rid of any dead landing pads.
+  MMI->TidyLandingPads();
+
+  if (shouldEmitPersonality) {
+    const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering();
+    const Function *Per = MMI->getPersonalities()[MMI->getPersonalityIndex()];
+    const MCSymbol *Sym = TLOF.getCFIPersonalitySymbol(Per, Asm->Mang, MMI);
+
+    Asm->OutStreamer.PushSection();
+    Asm->OutStreamer.EmitWin64EHHandlerData();
+    Asm->OutStreamer.EmitValue(MCSymbolRefExpr::Create(Sym, Asm->OutContext),
+                               4);
+    EmitExceptionTable();
+    Asm->OutStreamer.PopSection();
+  }
   Asm->OutStreamer.EmitWin64EHEndProc();
 }





More information about the llvm-commits mailing list