[llvm-commits] CVS: llvm/lib/CodeGen/AsmPrinter.cpp
Chris Lattner
lattner at cs.uiuc.edu
Mon Feb 14 13:40:41 PST 2005
Changes in directory llvm/lib/CodeGen:
AsmPrinter.cpp updated: 1.14 -> 1.15
---
Log message:
Print GEP offsets as signed values instead of unsigned values. On X86, this
prints:
getelementptr (int* %A, int -1)
as: "(A) - 4" instead of "(A) + 18446744073709551612", which makes the
assembler much happier.
This fixes test/Regression/CodeGen/X86/2005-02-14-IllegalAssembler.ll,
and Benchmarks/Prolangs-C/cdecl with LLC on X86.
---
Diffs of the changes: (+7 -3)
AsmPrinter.cpp | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
Index: llvm/lib/CodeGen/AsmPrinter.cpp
diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.14 llvm/lib/CodeGen/AsmPrinter.cpp:1.15
--- llvm/lib/CodeGen/AsmPrinter.cpp:1.14 Fri Feb 4 07:47:16 2005
+++ llvm/lib/CodeGen/AsmPrinter.cpp Mon Feb 14 15:40:26 2005
@@ -78,10 +78,14 @@
// generate a symbolic expression for the byte address
const Constant *ptrVal = CE->getOperand(0);
std::vector<Value*> idxVec(CE->op_begin()+1, CE->op_end());
- if (uint64_t Offset = TD.getIndexedOffset(ptrVal->getType(), idxVec)) {
- O << "(";
+ if (int64_t Offset = TD.getIndexedOffset(ptrVal->getType(), idxVec)) {
+ if (Offset)
+ O << "(";
emitConstantValueOnly(ptrVal);
- O << ") + " << Offset;
+ if (Offset > 0)
+ O << ") + " << Offset;
+ else if (Offset < 0)
+ O << ") - " << -Offset;
} else {
emitConstantValueOnly(ptrVal);
}
More information about the llvm-commits
mailing list