[llvm-commits] [llvm] r94250 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h lib/CodeGen/AsmPrinter/AsmPrinter.cpp lib/CodeGen/AsmPrinter/DIE.cpp lib/CodeGen/AsmPrinter/DIE.h lib/CodeGen/AsmPrinter/DwarfDebug.cpp lib/CodeGen/AsmPrinter/DwarfException.cpp lib/CodeGen/AsmPrinter/DwarfPrinter.cpp lib/CodeGen/AsmPrinter/DwarfPrinter.h

Jim Grosbach grosbach at apple.com
Fri Jan 22 17:17:07 PST 2010


Excellent! Thank you. Output is looking much nicer now, and this makes the implementation nicer, too.

-j
On Jan 22, 2010, at 3:18 PM, Chris Lattner wrote:

> Author: lattner
> Date: Fri Jan 22 17:18:42 2010
> New Revision: 94250
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=94250&view=rev
> Log:
> move uleb printing from asmprinter to dwarfprinter, mcize,
> cleanup and eliminate a bunch more uses of "EOL".
> 
> Modified:
>    llvm/trunk/include/llvm/CodeGen/AsmPrinter.h
>    llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
>    llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp
>    llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h
>    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
>    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp
>    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp
>    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h
> 
> Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=94250&r1=94249&r2=94250&view=diff
> 
> ==============================================================================
> --- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original)
> +++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Fri Jan 22 17:18:42 2010
> @@ -246,13 +246,6 @@
> 
>   public:
>     //===------------------------------------------------------------------===//
> -    /// LEB 128 number encoding.
> -
> -    /// PrintULEB128 - Print a series of hexidecimal values(separated by commas)
> -    /// representing an unsigned leb128 value.
> -    void PrintULEB128(unsigned Value) const;
> -
> -    //===------------------------------------------------------------------===//
>     // Emission and print routines
>     //
> 
> @@ -260,10 +253,6 @@
>     /// then it will be printed first.  Comments should not contain '\n'.
>     void EOL(const Twine &Comment) const;
> 
> -    /// EmitULEB128Bytes - Emit an assembler byte data directive to compose an
> -    /// unsigned leb128 value.
> -    void EmitULEB128Bytes(unsigned Value) const;
> -    
>     /// EmitInt8 - Emit a byte directive and value.
>     ///
>     void EmitInt8(int Value) const;
> 
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=94250&r1=94249&r2=94250&view=diff
> 
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Fri Jan 22 17:18:42 2010
> @@ -655,24 +655,6 @@
>     }
> }
> 
> -
> -//===----------------------------------------------------------------------===//
> -/// LEB 128 number encoding.
> -
> -/// PrintULEB128 - Print a series of hexadecimal values (separated by commas)
> -/// representing an unsigned leb128 value.
> -void AsmPrinter::PrintULEB128(unsigned Value) const {
> -  do {
> -    unsigned char Byte = static_cast<unsigned char>(Value & 0x7f);
> -    Value >>= 7;
> -    if (Value) Byte |= 0x80;
> -    O << "0x";
> -    O.write_hex(Byte);
> -    if (Value) O << ", ";
> -  } while (Value);
> -}
> -
> -
> //===--------------------------------------------------------------------===//
> // Emission and print routines
> //
> @@ -687,17 +669,6 @@
>   O << '\n';
> }
> 
> -/// EmitULEB128Bytes - Emit an assembler byte data directive to compose an
> -/// unsigned leb128 value.
> -void AsmPrinter::EmitULEB128Bytes(unsigned Value) const {
> -  if (MAI->hasLEB128()) {
> -    O << "\t.uleb128\t" << Value;
> -  } else {
> -    O << MAI->getData8bitsDirective();
> -    PrintULEB128(Value);
> -  }
> -}
> -
> /// EmitInt8 - Emit a byte directive and value.
> ///
> void AsmPrinter::EmitInt8(int Value) const {
> 
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp?rev=94250&r1=94249&r2=94250&view=diff
> 
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp Fri Jan 22 17:18:42 2010
> @@ -53,31 +53,33 @@
> 
> /// Emit - Print the abbreviation using the specified asm printer.
> ///
> -void DIEAbbrev::Emit(const AsmPrinter *Asm) const {
> +void DIEAbbrev::Emit(const DwarfPrinter *DP) const {
>   // Emit its Dwarf tag type.
> -  Asm->EmitULEB128Bytes(Tag);
> -  Asm->EOL(dwarf::TagString(Tag));
> +  // FIXME: Doing work even in non-asm-verbose runs.
> +  DP->EmitULEB128(Tag, dwarf::TagString(Tag));
> 
>   // Emit whether it has children DIEs.
> -  Asm->EmitULEB128Bytes(ChildrenFlag);
> -  Asm->EOL(dwarf::ChildrenString(ChildrenFlag));
> +  // FIXME: Doing work even in non-asm-verbose runs.
> +  DP->EmitULEB128(ChildrenFlag, dwarf::ChildrenString(ChildrenFlag));
> 
>   // For each attribute description.
>   for (unsigned i = 0, N = Data.size(); i < N; ++i) {
>     const DIEAbbrevData &AttrData = Data[i];
> 
>     // Emit attribute type.
> -    Asm->EmitULEB128Bytes(AttrData.getAttribute());
> -    Asm->EOL(dwarf::AttributeString(AttrData.getAttribute()));
> +    // FIXME: Doing work even in non-asm-verbose runs.
> +    DP->EmitULEB128(AttrData.getAttribute(),
> +                    dwarf::AttributeString(AttrData.getAttribute()));
> 
>     // Emit form type.
> -    Asm->EmitULEB128Bytes(AttrData.getForm());
> -    Asm->EOL(dwarf::FormEncodingString(AttrData.getForm()));
> +    // FIXME: Doing work even in non-asm-verbose runs.
> +    DP->EmitULEB128(AttrData.getForm(),
> +                    dwarf::FormEncodingString(AttrData.getForm()));
>   }
> 
>   // Mark end of abbreviation.
> -  Asm->EmitULEB128Bytes(0); Asm->EOL("EOM(1)");
> -  Asm->EmitULEB128Bytes(0); Asm->EOL("EOM(2)");
> +  DP->EmitULEB128(0, "EOM(1)");
> +  DP->EmitULEB128(0, "EOM(2)");
> }
> 
> #ifndef NDEBUG
> @@ -199,7 +201,7 @@
>   case dwarf::DW_FORM_data4: Size = 4; break;
>   case dwarf::DW_FORM_ref8:  // Fall thru
>   case dwarf::DW_FORM_data8: Size = 8; break;
> -  case dwarf::DW_FORM_udata: Asm->EmitULEB128Bytes(Integer); return;
> +  case dwarf::DW_FORM_udata: D->EmitULEB128(Integer); return;
>   case dwarf::DW_FORM_sdata: D->EmitSLEB128(Integer, ""); return;
>   default: llvm_unreachable("DIE Value form not supported yet");
>   }
> @@ -395,7 +397,7 @@
>   case dwarf::DW_FORM_block1: Asm->EmitInt8(Size);         break;
>   case dwarf::DW_FORM_block2: Asm->EmitInt16(Size);        break;
>   case dwarf::DW_FORM_block4: Asm->EmitInt32(Size);        break;
> -  case dwarf::DW_FORM_block:  Asm->EmitULEB128Bytes(Size); break;
> +  case dwarf::DW_FORM_block:  D->EmitULEB128(Size); break;
>   default: llvm_unreachable("Improper form for block");         break;
>   }
> 
> 
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h?rev=94250&r1=94249&r2=94250&view=diff
> 
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h Fri Jan 22 17:18:42 2010
> @@ -101,7 +101,7 @@
> 
>     /// Emit - Print the abbreviation using the specified asm printer.
>     ///
> -    void Emit(const AsmPrinter *Asm) const;
> +    void Emit(const DwarfPrinter *Asm) const;
> 
> #ifndef NDEBUG
>     void print(raw_ostream &O);
> 
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=94250&r1=94249&r2=94250&view=diff
> 
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Fri Jan 22 17:18:42 2010
> @@ -2350,12 +2350,12 @@
>   Asm->O << '\n';
> 
>   // Emit the code (index) for the abbreviation.
> -  Asm->EmitULEB128Bytes(AbbrevNumber);
> -
> -  Asm->EOL("Abbrev [" + Twine(AbbrevNumber) + "] 0x" +
> -           Twine::utohexstr(Die->getOffset()) + ":0x" +
> -           Twine::utohexstr(Die->getSize()) + " " +
> -           dwarf::TagString(Abbrev->getTag()));
> +  if (Asm->VerboseAsm)
> +    Asm->OutStreamer.AddComment("Abbrev [" + Twine(AbbrevNumber) + "] 0x" +
> +                                Twine::utohexstr(Die->getOffset()) + ":0x" +
> +                                Twine::utohexstr(Die->getSize()) + " " +
> +                                dwarf::TagString(Abbrev->getTag()));
> +  EmitULEB128(AbbrevNumber);
> 
>   SmallVector<DIEValue*, 32> &Values = Die->getValues();
>   const SmallVector<DIEAbbrevData, 8> &AbbrevData = Abbrev->getData();
> @@ -2448,16 +2448,15 @@
>       const DIEAbbrev *Abbrev = Abbreviations[i];
> 
>       // Emit the abbrevations code (base 1 index.)
> -      Asm->EmitULEB128Bytes(Abbrev->getNumber());
> -      Asm->EOL("Abbreviation Code");
> +      EmitULEB128(Abbrev->getNumber(), "Abbreviation Code");
> 
>       // Emit the abbreviations data.
> -      Abbrev->Emit(Asm);
> +      Abbrev->Emit(this);
>       Asm->O << '\n';
>     }
> 
>     // Mark end of abbreviations.
> -    Asm->EmitULEB128Bytes(0); Asm->EOL("EOM(3)");
> +    EmitULEB128(0, "EOM(3)");
> 
>     EmitLabel("abbrev_end", 0);
>     Asm->O << '\n';
> @@ -2476,10 +2475,8 @@
> 
>   // Mark end of matrix.
>   Asm->EmitInt8(0); Asm->EOL("DW_LNE_end_sequence");
> -  Asm->EmitULEB128Bytes(1);
> -  Asm->O << '\n';
>   Asm->EmitInt8(1);
> -  Asm->O << '\n';
> +  Asm->EmitInt8(1);
> }
> 
> /// emitDebugLines - Emit source line information.
> @@ -2545,12 +2542,9 @@
>     std::pair<unsigned, unsigned> Id = getSourceDirectoryAndFileIds(SI);
>     Asm->EmitString(getSourceFileName(Id.second));
>     Asm->EOL("Source");
> -    Asm->EmitULEB128Bytes(Id.first);
> -    Asm->EOL("Directory #");
> -    Asm->EmitULEB128Bytes(0);
> -    Asm->EOL("Mod date");
> -    Asm->EmitULEB128Bytes(0);
> -    Asm->EOL("File size");
> +    EmitULEB128(Id.first, "Directory #");
> +    EmitULEB128(0, "Mod date");
> +    EmitULEB128(0, "File size");
>   }
> 
>   Asm->EmitInt8(0); Asm->EOL("End of files");
> @@ -2604,7 +2598,7 @@
>       if (Source != LineInfo.getSourceID()) {
>         Source = LineInfo.getSourceID();
>         Asm->EmitInt8(dwarf::DW_LNS_set_file); Asm->EOL("DW_LNS_set_file");
> -        Asm->EmitULEB128Bytes(Source); Asm->EOL("New Source");
> +        EmitULEB128(Source, "New Source");
>       }
> 
>       // If change of line.
> @@ -2673,8 +2667,7 @@
>   Asm->EOL("CIE Version");
>   Asm->EmitString("");
>   Asm->EOL("CIE Augmentation");
> -  Asm->EmitULEB128Bytes(1);
> -  Asm->EOL("CIE Code Alignment Factor");
> +  EmitULEB128(1, "CIE Code Alignment Factor");
>   EmitSLEB128(stackGrowth, "CIE Data Alignment Factor");
>   Asm->EmitInt8(RI->getDwarfRegNum(RI->getRARegister(), false));
>   Asm->EOL("CIE RA Column");
> @@ -2941,7 +2934,7 @@
>     EmitSectionOffset("string", "section_str",
>                       StringPool.idFor(Name), false, true);
>     Asm->EOL("Function name");
> -    Asm->EmitULEB128Bytes(Labels.size()); Asm->EOL("Inline count");
> +    EmitULEB128(Labels.size(), "Inline count");
> 
>     for (SmallVector<InlineInfoLabels, 4>::iterator LI = Labels.begin(),
>            LE = Labels.end(); LI != LE; ++LI) {
> 
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=94250&r1=94249&r2=94250&view=diff
> 
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Fri Jan 22 17:18:42 2010
> @@ -175,15 +175,12 @@
>   Asm->EOL("CIE Augmentation");
> 
>   // Round out reader.
> -  Asm->EmitULEB128Bytes(1);
> -  Asm->EOL("CIE Code Alignment Factor");
> +  EmitULEB128(1, "CIE Code Alignment Factor");
>   EmitSLEB128(stackGrowth, "CIE Data Alignment Factor");
>   Asm->EmitInt8(RI->getDwarfRegNum(RI->getRARegister(), true));
>   Asm->EOL("CIE Return Address Column");
> 
> -  Asm->EmitULEB128Bytes(AugmentationSize);
> -  Asm->EOL("Augmentation Size");
> -
> +  EmitULEB128(AugmentationSize, "Augmentation Size");
>   EmitEncodingByte(PerEncoding, "Personality");
> 
>   // If there is a personality, we need to indicate the function's location.
> @@ -277,16 +274,14 @@
>     if (MMI->getPersonalities()[0] != NULL) {
> 
>       if (Asm->TM.getLSDAEncoding() != DwarfLSDAEncoding::EightByte) {
> -        Asm->EmitULEB128Bytes(4);
> -        Asm->EOL("Augmentation size");
> +        EmitULEB128(4, "Augmentation size");
> 
>         if (EHFrameInfo.hasLandingPads)
>           EmitReference("exception", EHFrameInfo.Number, true, true);
>         else
>           Asm->OutStreamer.EmitIntValue(0, 4/*size*/, 0/*addrspace*/);
>       } else {
> -        Asm->EmitULEB128Bytes(TD->getPointerSize());
> -        Asm->EOL("Augmentation size");
> +        EmitULEB128(TD->getPointerSize(), "Augmentation size");
> 
>         if (EHFrameInfo.hasLandingPads) {
>           EmitReference("exception", EHFrameInfo.Number, true, false);
> @@ -298,8 +293,7 @@
> 
>       Asm->EOL("Language Specific Data Area");
>     } else {
> -      Asm->EmitULEB128Bytes(0);
> -      Asm->EOL("Augmentation size");
> +      EmitULEB128(0, "Augmentation size");
>     }
> 
>     // Indicate locations of function specific callee saved registers in frame.
> @@ -782,16 +776,13 @@
>   EmitEncodingByte(dwarf::DW_EH_PE_omit, "@LPStart");
>   EmitEncodingByte(TTypeFormat, "@TType");
> 
> -  if (HaveTTData) {
> -    Asm->EmitULEB128Bytes(TyOffset);
> -    Asm->EOL("@TType base offset");
> -  }
> +  if (HaveTTData)
> +    EmitULEB128(TyOffset, "@TType base offset");
> 
>   // SjLj Exception handling
>   if (IsSJLJ) {
>     EmitEncodingByte(dwarf::DW_EH_PE_udata4, "Call site");
> -    Asm->EmitULEB128Bytes(SizeSites);
> -    Asm->EOL("Call site table length");
> +    EmitULEB128(SizeSites, "Call site table length");
> 
>     // Emit the landing pad site information.
>     unsigned idx = 0;
> @@ -801,14 +792,12 @@
> 
>       // Offset of the landing pad, counted in 16-byte bundles relative to the
>       // @LPStart address.
> -      Asm->EmitULEB128Bytes(idx);
> -      Asm->EOL("Landing pad");
> +      EmitULEB128(idx, "Landing pad");
> 
>       // Offset of the first associated action record, relative to the start of
>       // the action table. This value is biased by 1 (1 indicates the start of
>       // the action table), and 0 indicates that there are no actions.
> -      Asm->EmitULEB128Bytes(S.Action);
> -      Asm->EOL("Action");
> +      EmitULEB128(S.Action, "Action");
>     }
>   } else {
>     // DWARF Exception handling
> @@ -834,8 +823,7 @@
> 
>     // Emit the landing pad call site table.
>     EmitEncodingByte(dwarf::DW_EH_PE_udata4, "Call site");
> -    Asm->EmitULEB128Bytes(SizeSites);
> -    Asm->EOL("Call site table size");
> +    EmitULEB128(SizeSites, "Call site table size");
> 
>     for (SmallVectorImpl<CallSiteEntry>::const_iterator
>          I = CallSites.begin(), E = CallSites.end(); I != E; ++I) {
> @@ -879,8 +867,7 @@
>       // Offset of the first associated action record, relative to the start of
>       // the action table. This value is biased by 1 (1 indicates the start of
>       // the action table), and 0 indicates that there are no actions.
> -      Asm->EmitULEB128Bytes(S.Action);
> -      Asm->EOL("Action");
> +      EmitULEB128(S.Action, "Action");
>     }
>   }
> 
> @@ -921,11 +908,7 @@
>   for (std::vector<unsigned>::const_iterator
>          I = FilterIds.begin(), E = FilterIds.end(); I < E; ++I) {
>     unsigned TypeID = *I;
> -    Asm->EmitULEB128Bytes(TypeID);
> -    if (TypeID != 0)
> -      Asm->EOL("Exception specification");
> -    else
> -      Asm->O << '\n';
> +    EmitULEB128(TypeID, TypeID != 0 ? "Exception specification" : 0);
>   }
> 
>   Asm->EmitAlignment(2, 0, 0, false);
> 
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp?rev=94250&r1=94249&r2=94250&view=diff
> 
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp Fri Jan 22 17:18:42 2010
> @@ -85,9 +85,18 @@
>   Asm->OutStreamer.EmitIntValue(Val, 1, 0/*addrspace*/);
> }
> 
> -/// PrintSLEB128 - Print a series of hexadecimal values (separated by commas)
> -/// representing a signed leb128 value.
> -static void PrintSLEB128(MCStreamer &O, int Value) {
> +/// EmitSLEB128 - emit the specified signed leb128 value.
> +void DwarfPrinter::EmitSLEB128(int Value, const char *Desc) const {
> +  if (Asm->VerboseAsm && Desc)
> +    Asm->OutStreamer.AddComment(Desc);
> +    
> +  if (MAI->hasLEB128()) {
> +    O << "\t.sleb128\t" << Value;
> +    Asm->OutStreamer.AddBlankLine();
> +    return;
> +  }
> +
> +  // If we don't have .sleb128, emit as .bytes.
>   int Sign = Value >> (8 * sizeof(Value) - 1);
>   bool IsMore;
> 
> @@ -97,25 +106,31 @@
>     IsMore = Value != Sign || ((Byte ^ Sign) & 0x40) != 0;
>     if (IsMore) Byte |= 0x80;
> 
> -    O.EmitIntValue(Byte, 1, /*addrspace*/0);
> +    Asm->OutStreamer.EmitIntValue(Byte, 1, /*addrspace*/0);
>   } while (IsMore);
> }
> 
> -/// EmitSLEB128 - print the specified signed leb128 value.
> -void DwarfPrinter::EmitSLEB128(int Value, const char *Desc) const {
> +/// EmitULEB128 - emit the specified signed leb128 value.
> +void DwarfPrinter::EmitULEB128(unsigned Value, const char *Desc) const {
>   if (Asm->VerboseAsm && Desc)
>     Asm->OutStreamer.AddComment(Desc);
> -    
> + 
>   if (MAI->hasLEB128()) {
> -    O << "\t.sleb128\t" << Value;
> +    O << "\t.uleb128\t" << Value;
>     Asm->OutStreamer.AddBlankLine();
> -  } else {
> -    PrintSLEB128(Asm->OutStreamer, Value);
> +    return;
>   }
> +  
> +  // If we don't have .uleb128, emit as .bytes.
> +  do {
> +    unsigned char Byte = static_cast<unsigned char>(Value & 0x7f);
> +    Value >>= 7;
> +    if (Value) Byte |= 0x80;
> +    Asm->OutStreamer.EmitIntValue(Byte, 1, /*addrspace*/0);
> +  } while (Value);
> }
> 
> 
> -
> /// PrintLabelName - Print label name in form used by Dwarf writer.
> ///
> void DwarfPrinter::PrintLabelName(const char *Tag, unsigned Number) const {
> @@ -267,14 +282,11 @@
>         } else {
>           Asm->EmitInt8(dwarf::DW_CFA_def_cfa);
>           Asm->EOL("DW_CFA_def_cfa");
> -          Asm->EmitULEB128Bytes(RI->getDwarfRegNum(Src.getReg(), isEH));
> -          Asm->EOL("Register");
> +          EmitULEB128(RI->getDwarfRegNum(Src.getReg(), isEH), "Register");
>         }
> 
>         int Offset = -Src.getOffset();
> -
> -        Asm->EmitULEB128Bytes(Offset);
> -        Asm->EOL("Offset");
> +        EmitULEB128(Offset, "Offset");
>       } else {
>         llvm_unreachable("Machine move not supported yet.");
>       }
> @@ -283,8 +295,7 @@
>       if (Dst.isReg()) {
>         Asm->EmitInt8(dwarf::DW_CFA_def_cfa_register);
>         Asm->EOL("DW_CFA_def_cfa_register");
> -        Asm->EmitULEB128Bytes(RI->getDwarfRegNum(Dst.getReg(), isEH));
> -        Asm->EOL("Register");
> +        EmitULEB128(RI->getDwarfRegNum(Dst.getReg(), isEH), "Register");
>       } else {
>         llvm_unreachable("Machine move not supported yet.");
>       }
> @@ -295,21 +306,17 @@
>       if (Offset < 0) {
>         Asm->EmitInt8(dwarf::DW_CFA_offset_extended_sf);
>         Asm->EOL("DW_CFA_offset_extended_sf");
> -        Asm->EmitULEB128Bytes(Reg);
> -        Asm->EOL("Reg");
> +        EmitULEB128(Reg, "Reg");
>         EmitSLEB128(Offset, "Offset");
>       } else if (Reg < 64) {
>         Asm->EmitInt8(dwarf::DW_CFA_offset + Reg);
>         Asm->EOL("DW_CFA_offset + Reg (" + Twine(Reg) + ")");
> -        Asm->EmitULEB128Bytes(Offset);
> -        Asm->EOL("Offset");
> +        EmitULEB128(Offset, "Offset");
>       } else {
>         Asm->EmitInt8(dwarf::DW_CFA_offset_extended);
>         Asm->EOL("DW_CFA_offset_extended");
> -        Asm->EmitULEB128Bytes(Reg);
> -        Asm->EOL("Reg");
> -        Asm->EmitULEB128Bytes(Offset);
> -        Asm->EOL("Offset");
> +        EmitULEB128(Reg, "Reg");
> +        EmitULEB128(Offset, "Offset");
>       }
>     }
>   }
> 
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h?rev=94250&r1=94249&r2=94250&view=diff
> 
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h Fri Jan 22 17:18:42 2010
> @@ -91,9 +91,12 @@
>   /// specifying (e.g. "LSDA").
>   void EmitEncodingByte(unsigned Val, const char *Desc);
> 
> -  /// EmitSLEB128 - print the specified signed leb128 value.
> +  /// EmitSLEB128 - emit the specified signed leb128 value.
>   void EmitSLEB128(int Value, const char *Desc) const;
> -  
> +
> +  /// EmitULEB128 - emit the specified unsigned leb128 value.
> +  void EmitULEB128(unsigned Value, const char *Desc = 0) const;
> +
> 
>   /// PrintLabelName - Print label name in form used by Dwarf writer.
>   ///
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits





More information about the llvm-commits mailing list