diff options
author | Jim Grosbach <grosbach@apple.com> | 2009-08-17 16:41:22 +0000 |
---|---|---|
committer | Jim Grosbach <grosbach@apple.com> | 2009-08-17 16:41:22 +0000 |
commit | 8b818d7e98309125c6058c4ea72a7dc73b031db2 (patch) | |
tree | b1fdcb9eeb803162a4a2876f6ac49a5bb3f63ad7 /lib/CodeGen/AsmPrinter/DwarfException.cpp | |
parent | 2a5e23b44ddf1efde1d98bd3379489d93a90d55a (diff) |
Move the sjlj exception handling conversions to a back-end pass where they
more properly belong. This allows removing the front-end conditionalized
SJLJ code, and cleans up the generated IR considerably. All of the
infrastructure code (calling _Unwind_SjLj_Register/Unregister, etc) is
added by the SjLjEHPrepare pass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79250 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter/DwarfException.cpp')
-rw-r--r-- | lib/CodeGen/AsmPrinter/DwarfException.cpp | 39 |
1 files changed, 7 insertions, 32 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfException.cpp b/lib/CodeGen/AsmPrinter/DwarfException.cpp index 77e4ddd101..dacaf1b8fd 100644 --- a/lib/CodeGen/AsmPrinter/DwarfException.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfException.cpp @@ -364,7 +364,6 @@ ComputeActionsTable(const SmallVectorImpl<const LandingPadInfo*> &LandingPads, /// 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 @@ ComputeCallSiteTable(SmallVectorImpl<CallSiteEntry> &CallSites, // 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 @@ void DwarfException::EmitExceptionTable() { // 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 @@ void DwarfException::EmitExceptionTable() { 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 @@ void DwarfException::EmitExceptionTable() { 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 @@ void DwarfException::EmitExceptionTable() { 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"); |