mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-18 12:29:21 +00:00
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20183 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
eb28797506
commit
27e192196f
@ -78,10 +78,14 @@ void AsmPrinter::emitConstantValueOnly(const Constant *CV) {
|
|||||||
// generate a symbolic expression for the byte address
|
// generate a symbolic expression for the byte address
|
||||||
const Constant *ptrVal = CE->getOperand(0);
|
const Constant *ptrVal = CE->getOperand(0);
|
||||||
std::vector<Value*> idxVec(CE->op_begin()+1, CE->op_end());
|
std::vector<Value*> idxVec(CE->op_begin()+1, CE->op_end());
|
||||||
if (uint64_t Offset = TD.getIndexedOffset(ptrVal->getType(), idxVec)) {
|
if (int64_t Offset = TD.getIndexedOffset(ptrVal->getType(), idxVec)) {
|
||||||
O << "(";
|
if (Offset)
|
||||||
|
O << "(";
|
||||||
emitConstantValueOnly(ptrVal);
|
emitConstantValueOnly(ptrVal);
|
||||||
O << ") + " << Offset;
|
if (Offset > 0)
|
||||||
|
O << ") + " << Offset;
|
||||||
|
else if (Offset < 0)
|
||||||
|
O << ") - " << -Offset;
|
||||||
} else {
|
} else {
|
||||||
emitConstantValueOnly(ptrVal);
|
emitConstantValueOnly(ptrVal);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user