summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/Win64Exception.cpp
diff options
context:
space:
mode:
authorCharles Davis <cdavis@mines.edu>2011-05-30 00:13:34 +0000
committerCharles Davis <cdavis@mines.edu>2011-05-30 00:13:34 +0000
commita575226fd8a3b63b37739bc2425a28905f3bd72f (patch)
tree20f42311c5db884ab80ec6ce639eeec6037f10c4 /llvm/lib/CodeGen/AsmPrinter/Win64Exception.cpp
parent15184db09217553490750c5cbd03498fd38b0ac6 (diff)
downloadbcm5719-llvm-a575226fd8a3b63b37739bc2425a28905f3bd72f.tar.gz
bcm5719-llvm-a575226fd8a3b63b37739bc2425a28905f3bd72f.zip
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. llvm-svn: 132302
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/Win64Exception.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/Win64Exception.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/Win64Exception.cpp b/llvm/lib/CodeGen/AsmPrinter/Win64Exception.cpp
index 8ef4587836f..c2ad5eba3b3 100644
--- a/llvm/lib/CodeGen/AsmPrinter/Win64Exception.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/Win64Exception.cpp
@@ -83,6 +83,9 @@ void Win64Exception::BeginFunction(const MachineFunction *MF) {
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 @@ void Win64Exception::EndFunction() {
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();
}
OpenPOWER on IntegriCloud