[llvm-commits] [llvm] r58963 - /llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp

Chris Lattner sabre at nondot.org
Sun Nov 9 20:35:25 PST 2008


Author: lattner
Date: Sun Nov  9 22:35:24 2008
New Revision: 58963

URL: http://llvm.org/viewvc/llvm-project?rev=58963&view=rev
Log:
eliminate a couple more uses of utohexstr.

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=58963&r1=58962&r2=58963&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Sun Nov  9 22:35:24 2008
@@ -532,11 +532,12 @@
 /// PrintULEB128 - Print a series of hexidecimal values (separated by commas)
 /// representing an unsigned leb128 value.
 void AsmPrinter::PrintULEB128(unsigned Value) const {
+  char Buffer[20];
   do {
-    unsigned Byte = Value & 0x7f;
+    unsigned char Byte = static_cast<unsigned char>(Value & 0x7f);
     Value >>= 7;
     if (Value) Byte |= 0x80;
-    O << "0x" <<  utohexstr(Byte);
+    O << "0x" << utohex_buffer(Byte, Buffer+20);
     if (Value) O << ", ";
   } while (Value);
 }
@@ -546,13 +547,14 @@
 void AsmPrinter::PrintSLEB128(int Value) const {
   int Sign = Value >> (8 * sizeof(Value) - 1);
   bool IsMore;
+  char Buffer[20];
 
   do {
-    unsigned Byte = Value & 0x7f;
+    unsigned char Byte = static_cast<unsigned char>(Value & 0x7f);
     Value >>= 7;
     IsMore = Value != Sign || ((Byte ^ Sign) & 0x40) != 0;
     if (IsMore) Byte |= 0x80;
-    O << "0x" << utohexstr(Byte);
+    O << "0x" << utohex_buffer(Byte, Buffer+20);
     if (IsMore) O << ", ";
   } while (IsMore);
 }
@@ -565,7 +567,6 @@
 ///
 void AsmPrinter::PrintHex(int Value) const { 
   char Buffer[20];
-  
   O << "0x" << utohex_buffer(static_cast<unsigned>(Value), Buffer+20);
 }
 
@@ -749,7 +750,10 @@
 
   unsigned FillValue = TAI->getTextAlignFillValue();
   UseFillExpr &= IsInTextSection && FillValue;
-  if (UseFillExpr) O << ",0x" << utohexstr(FillValue);
+  if (UseFillExpr) {
+    O << ',';
+    PrintHex(FillValue);
+  }
   O << '\n';
 }
 





More information about the llvm-commits mailing list