[llvm-commits] [llvm] r91864 - /llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp

Chris Lattner sabre at nondot.org
Mon Dec 21 16:44:05 PST 2009


Author: lattner
Date: Mon Dec 21 18:44:05 2009
New Revision: 91864

URL: http://llvm.org/viewvc/llvm-project?rev=91864&view=rev
Log:
print pcrel immediates as signed values instead of unsigned so that we
get things like this out of the disassembler:

0x100000ecb: callq	-96

instead of:

0x100000ecb: callq	4294967200

rdar://7491123


Modified:
    llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp

Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp?rev=91864&r1=91863&r2=91864&view=diff

==============================================================================
--- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp Mon Dec 21 18:44:05 2009
@@ -45,12 +45,14 @@
 }
 
 /// print_pcrel_imm - This is used to print an immediate value that ends up
-/// being encoded as a pc-relative value.  These print slightly differently, for
-/// example, a $ is not emitted.
+/// being encoded as a pc-relative value (e.g. for jumps and calls).  These
+/// print slightly differently than normal immediates.  For example, a $ is not
+/// emitted.
 void X86ATTInstPrinter::print_pcrel_imm(const MCInst *MI, unsigned OpNo) {
   const MCOperand &Op = MI->getOperand(OpNo);
   if (Op.isImm())
-    O << Op.getImm();
+    // Print this as a signed 32-bit value.
+    O << (int)Op.getImm();
   else {
     assert(Op.isExpr() && "unknown pcrel immediate operand");
     Op.getExpr()->print(O, &MAI);





More information about the llvm-commits mailing list