mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-01 00:17:01 +00:00
--- Merging r128100 into '.':
U lib/Target/ARM/ARMFastISel.cpp git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_29@128101 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -667,24 +667,29 @@ bool ARMFastISel::ARMComputeAddress(const Value *Obj, Address &Addr) {
|
|||||||
TmpOffset += SL->getElementOffset(Idx);
|
TmpOffset += SL->getElementOffset(Idx);
|
||||||
} else {
|
} else {
|
||||||
uint64_t S = TD.getTypeAllocSize(GTI.getIndexedType());
|
uint64_t S = TD.getTypeAllocSize(GTI.getIndexedType());
|
||||||
SmallVector<const Value *, 4> Worklist;
|
for (;;) {
|
||||||
Worklist.push_back(Op);
|
|
||||||
do {
|
|
||||||
Op = Worklist.pop_back_val();
|
|
||||||
if (const ConstantInt *CI = dyn_cast<ConstantInt>(Op)) {
|
if (const ConstantInt *CI = dyn_cast<ConstantInt>(Op)) {
|
||||||
// Constant-offset addressing.
|
// Constant-offset addressing.
|
||||||
TmpOffset += CI->getSExtValue() * S;
|
TmpOffset += CI->getSExtValue() * S;
|
||||||
} else if (isa<AddOperator>(Op) &&
|
break;
|
||||||
|
}
|
||||||
|
if (isa<AddOperator>(Op) &&
|
||||||
|
(!isa<Instruction>(Op) ||
|
||||||
|
FuncInfo.MBBMap[cast<Instruction>(Op)->getParent()]
|
||||||
|
== FuncInfo.MBB) &&
|
||||||
isa<ConstantInt>(cast<AddOperator>(Op)->getOperand(1))) {
|
isa<ConstantInt>(cast<AddOperator>(Op)->getOperand(1))) {
|
||||||
// An add with a constant operand. Fold the constant.
|
// An add (in the same block) with a constant operand. Fold the
|
||||||
|
// constant.
|
||||||
ConstantInt *CI =
|
ConstantInt *CI =
|
||||||
cast<ConstantInt>(cast<AddOperator>(Op)->getOperand(1));
|
cast<ConstantInt>(cast<AddOperator>(Op)->getOperand(1));
|
||||||
TmpOffset += CI->getSExtValue() * S;
|
TmpOffset += CI->getSExtValue() * S;
|
||||||
// Add the other operand back to the work list.
|
// Iterate on the other operand.
|
||||||
Worklist.push_back(cast<AddOperator>(Op)->getOperand(0));
|
Op = cast<AddOperator>(Op)->getOperand(0);
|
||||||
} else
|
continue;
|
||||||
|
}
|
||||||
|
// Unsupported
|
||||||
goto unsupported_gep;
|
goto unsupported_gep;
|
||||||
} while (!Worklist.empty());
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user