diff options
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp | 13 | ||||
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp | 15 |
2 files changed, 20 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp index 0edf9051d34..7b3fe05db76 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp @@ -48,12 +48,19 @@ void AsmPrinter::EmitSLEB128(int64_t Value, const char *Desc) const { } /// EmitULEB128 - emit the specified unsigned leb128 value. -void AsmPrinter::EmitULEB128(uint64_t Value, const char *Desc, - unsigned PadTo) const { +void AsmPrinter::EmitPaddedULEB128(uint64_t Value, unsigned PadTo, + const char *Desc) const { if (isVerbose() && Desc) OutStreamer->AddComment(Desc); - OutStreamer->EmitULEB128IntValue(Value, PadTo); + OutStreamer->EmitPaddedULEB128IntValue(Value, PadTo); +} + +void AsmPrinter::EmitULEB128(uint64_t Value, const char *Desc) const { + if (isVerbose() && Desc) + OutStreamer->AddComment(Desc); + + OutStreamer->EmitULEB128IntValue(Value); } static const char *DecodeDWARFEncoding(unsigned Encoding) { diff --git a/llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp b/llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp index e14d5be1177..8767da76ff9 100644 --- a/llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp @@ -478,13 +478,14 @@ void EHStreamer::emitExceptionTable() { sizeof(int8_t) + // TType format (HaveTTData ? TTypeBaseOffsetSize : 0) + // TType base offset size TTypeBaseOffset; // TType base offset - unsigned SizeAlign = (4 - TotalSize) & 3; + unsigned PadBytes = (4 - TotalSize) & 3; if (HaveTTData) { // Account for any extra padding that will be added to the call site table // length. - Asm->EmitULEB128(TTypeBaseOffset, "@TType base offset", SizeAlign); - SizeAlign = 0; + Asm->EmitPaddedULEB128(TTypeBaseOffset, TTypeBaseOffsetSize + PadBytes, + "@TType base offset"); + PadBytes = 0; } bool VerboseAsm = Asm->OutStreamer->isVerboseAsm(); @@ -494,7 +495,9 @@ void EHStreamer::emitExceptionTable() { Asm->EmitEncodingByte(dwarf::DW_EH_PE_udata4, "Call site"); // Add extra padding if it wasn't added to the TType base offset. - Asm->EmitULEB128(CallSiteTableLength, "Call site table length", SizeAlign); + Asm->EmitPaddedULEB128(CallSiteTableLength, + CallSiteTableLengthSize + PadBytes, + "Call site table length"); // Emit the landing pad site information. unsigned idx = 0; @@ -547,7 +550,9 @@ void EHStreamer::emitExceptionTable() { Asm->EmitEncodingByte(dwarf::DW_EH_PE_udata4, "Call site"); // Add extra padding if it wasn't added to the TType base offset. - Asm->EmitULEB128(CallSiteTableLength, "Call site table length", SizeAlign); + Asm->EmitPaddedULEB128(CallSiteTableLength, + CallSiteTableLengthSize + PadBytes, + "Call site table length"); unsigned Entry = 0; for (SmallVectorImpl<CallSiteEntry>::const_iterator |