diff options
| author | Rafael Espindola <rafael.espindola@gmail.com> | 2018-02-09 17:13:37 +0000 | 
|---|---|---|
| committer | Rafael Espindola <rafael.espindola@gmail.com> | 2018-02-09 17:13:37 +0000 | 
| commit | c052fa0bd384f52bcf4c5ddb510b9b0939183edc (patch) | |
| tree | 3833c7d5ae10a242dba38d7a0dccbe4635fbe1de /llvm/lib/CodeGen | |
| parent | d09b416943fec535f73950b0954e0fcd17719a75 (diff) | |
| download | bcm5719-llvm-c052fa0bd384f52bcf4c5ddb510b9b0939183edc.tar.gz bcm5719-llvm-c052fa0bd384f52bcf4c5ddb510b9b0939183edc.zip | |
Emit smaller exception tables for non-SJLJ mode.
* Use uleb128 for code offsets in the LSDA call site table.
* Omit the TTBase offset if the type table is empty.
This change can reduce the size of the DWARF/Itanium LSDA by about half.
Patch by Ryan Prichard!
llvm-svn: 324750
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp | 19 | 
1 files changed, 11 insertions, 8 deletions
| diff --git a/llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp b/llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp index d9db7832faa..094e4c9e19c 100644 --- a/llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp @@ -374,15 +374,17 @@ void EHStreamer::emitExceptionTable() {    computeCallSiteTable(CallSites, LandingPads, FirstActions);    bool IsSJLJ = Asm->MAI->getExceptionHandlingType() == ExceptionHandling::SjLj; -  bool HaveTTData = IsSJLJ ? (!TypeInfos.empty() || !FilterIds.empty()) : true; +  unsigned CallSiteEncoding = +      IsSJLJ ? dwarf::DW_EH_PE_udata4 : dwarf::DW_EH_PE_uleb128; +  bool HaveTTData = !TypeInfos.empty() || !FilterIds.empty();    // Type infos.    MCSection *LSDASection = Asm->getObjFileLowering().getLSDASection();    unsigned TTypeEncoding;    if (!HaveTTData) { -    // For SjLj exceptions, if there is no TypeInfo, then we just explicitly say -    // that we're omitting that bit. +    // If there is no TypeInfo, then we just explicitly say that we're omitting +    // that bit.      TTypeEncoding = dwarf::DW_EH_PE_omit;    } else {      // Okay, we have actual filters or typeinfos to emit.  As such, we need to @@ -450,7 +452,7 @@ void EHStreamer::emitExceptionTable() {    // Emit the landing pad call site table.    MCSymbol *CstBeginLabel = Asm->createTempSymbol("cst_begin");    MCSymbol *CstEndLabel = Asm->createTempSymbol("cst_end"); -  Asm->EmitEncodingByte(dwarf::DW_EH_PE_udata4, "Call site"); +  Asm->EmitEncodingByte(CallSiteEncoding, "Call site");    Asm->EmitLabelDifferenceAsULEB128(CstEndLabel, CstBeginLabel);    Asm->OutStreamer->EmitLabel(CstBeginLabel); @@ -518,23 +520,24 @@ void EHStreamer::emitExceptionTable() {        // Offset of the call site relative to the start of the procedure.        if (VerboseAsm)          Asm->OutStreamer->AddComment(">> Call Site " + Twine(++Entry) + " <<"); -      Asm->EmitLabelDifference(BeginLabel, EHFuncBeginSym, 4); +      Asm->EmitLabelDifferenceAsULEB128(BeginLabel, EHFuncBeginSym);        if (VerboseAsm)          Asm->OutStreamer->AddComment(Twine("  Call between ") +                                       BeginLabel->getName() + " and " +                                       EndLabel->getName()); -      Asm->EmitLabelDifference(EndLabel, BeginLabel, 4); +      Asm->EmitLabelDifferenceAsULEB128(EndLabel, BeginLabel);        // Offset of the landing pad relative to the start of the procedure.        if (!S.LPad) {          if (VerboseAsm)            Asm->OutStreamer->AddComment("    has no landing pad"); -        Asm->OutStreamer->EmitIntValue(0, 4/*size*/); +        Asm->EmitULEB128(0);        } else {          if (VerboseAsm)            Asm->OutStreamer->AddComment(Twine("    jumps to ") +                                         S.LPad->LandingPadLabel->getName()); -        Asm->EmitLabelDifference(S.LPad->LandingPadLabel, EHFuncBeginSym, 4); +        Asm->EmitLabelDifferenceAsULEB128(S.LPad->LandingPadLabel, +                                          EHFuncBeginSym);        }        // Offset of the first associated action record, relative to the start of | 

