diff options
| author | Chris Lattner <sabre@nondot.org> | 2010-04-04 20:10:41 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2010-04-04 20:10:41 +0000 |
| commit | 07c1b94faa18a955d7bf9783cdbec0b840e226d9 (patch) | |
| tree | a873132df04c209535bed54885b5d004c6f8e380 /llvm/lib/CodeGen | |
| parent | b75af3c5a928ee2b5a04be80edb91104f43283c3 (diff) | |
| download | bcm5719-llvm-07c1b94faa18a955d7bf9783cdbec0b840e226d9.tar.gz bcm5719-llvm-07c1b94faa18a955d7bf9783cdbec0b840e226d9.zip | |
simplify some code.
llvm-svn: 100350
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfException.cpp | 21 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp | 16 |
2 files changed, 16 insertions, 21 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfException.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfException.cpp index 6dad20962bf..f8e656cd9e8 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfException.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfException.cpp @@ -354,7 +354,7 @@ ComputeActionsTable(const SmallVectorImpl<const LandingPadInfo*> &LandingPads, I = LandingPads.begin(), E = LandingPads.end(); I != E; ++I) { const LandingPadInfo *LPI = *I; const std::vector<int> &TypeIds = LPI->TypeIds; - const unsigned NumShared = PrevLPI ? SharedTypeIds(LPI, PrevLPI) : 0; + unsigned NumShared = PrevLPI ? SharedTypeIds(LPI, PrevLPI) : 0; unsigned SizeSiteActions = 0; if (NumShared < TypeIds.size()) { @@ -362,7 +362,7 @@ ComputeActionsTable(const SmallVectorImpl<const LandingPadInfo*> &LandingPads, unsigned PrevAction = (unsigned)-1; if (NumShared) { - const unsigned SizePrevIds = PrevLPI->TypeIds.size(); + unsigned SizePrevIds = PrevLPI->TypeIds.size(); assert(Actions.size()); PrevAction = Actions.size() - 1; SizeAction = @@ -622,18 +622,19 @@ void DwarfException::EmitExceptionTable() { // Final tallies. // Call sites. - const unsigned SiteStartSize = SizeOfEncodedValue(dwarf::DW_EH_PE_udata4); - const unsigned SiteLengthSize = SizeOfEncodedValue(dwarf::DW_EH_PE_udata4); - const unsigned LandingPadSize = SizeOfEncodedValue(dwarf::DW_EH_PE_udata4); bool IsSJLJ = MAI->getExceptionHandlingType() == ExceptionHandling::SjLj; bool HaveTTData = IsSJLJ ? (!TypeInfos.empty() || !FilterIds.empty()) : true; + unsigned CallSiteTableLength; - if (IsSJLJ) CallSiteTableLength = 0; - else - CallSiteTableLength = CallSites.size() * - (SiteStartSize + SiteLengthSize + LandingPadSize); + else { + unsigned SiteStartSize = 4; // dwarf::DW_EH_PE_udata4 + unsigned SiteLengthSize = 4; // dwarf::DW_EH_PE_udata4 + unsigned LandingPadSize = 4; // dwarf::DW_EH_PE_udata4 + CallSiteTableLength = + CallSites.size() * (SiteStartSize + SiteLengthSize + LandingPadSize); + } for (unsigned i = 0, e = CallSites.size(); i < e; ++i) { CallSiteTableLength += MCAsmInfo::getULEB128Size(CallSites[i].Action); @@ -650,7 +651,7 @@ void DwarfException::EmitExceptionTable() { // For SjLj exceptions, if there is no TypeInfo, then we just explicitly say // that we're omitting that bit. TTypeEncoding = dwarf::DW_EH_PE_omit; - TypeFormatSize = SizeOfEncodedValue(dwarf::DW_EH_PE_absptr); + TypeFormatSize = TD->getPointerSize(); // dwarf::DW_EH_PE_absptr } else { // Okay, we have actual filters or typeinfos to emit. As such, we need to // pick a type encoding for them. We're about to emit a list of pointers to diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp index 1baa162baac..10f302647bd 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp @@ -43,18 +43,12 @@ unsigned DwarfPrinter::SizeOfEncodedValue(unsigned Encoding) const { return 0; switch (Encoding & 0x07) { - case dwarf::DW_EH_PE_absptr: - return TD->getPointerSize(); - case dwarf::DW_EH_PE_udata2: - return 2; - case dwarf::DW_EH_PE_udata4: - return 4; - case dwarf::DW_EH_PE_udata8: - return 8; + default: assert(0 && "Invalid encoded value."); + case dwarf::DW_EH_PE_absptr: return TD->getPointerSize(); + case dwarf::DW_EH_PE_udata2: return 2; + case dwarf::DW_EH_PE_udata4: return 4; + case dwarf::DW_EH_PE_udata8: return 8; } - - assert(0 && "Invalid encoded value."); - return 0; } void DwarfPrinter::EmitReference(const MCSymbol *Sym, unsigned Encoding) const { |

