mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
Fix CodeGen for different size address space GEPs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193111 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1513,7 +1513,7 @@ static const MCExpr *lowerConstant(const Constant *CV, AsmPrinter &AP) {
|
||||
case Instruction::GetElementPtr: {
|
||||
const DataLayout &DL = *AP.TM.getDataLayout();
|
||||
// Generate a symbolic expression for the byte address
|
||||
APInt OffsetAI(DL.getPointerSizeInBits(), 0);
|
||||
APInt OffsetAI(DL.getPointerTypeSizeInBits(CE->getType()), 0);
|
||||
cast<GEPOperator>(CE)->accumulateConstantOffset(DL, OffsetAI);
|
||||
|
||||
const MCExpr *Base = lowerConstant(CE->getOperand(0), AP);
|
||||
@@ -1539,7 +1539,7 @@ static const MCExpr *lowerConstant(const Constant *CV, AsmPrinter &AP) {
|
||||
// Handle casts to pointers by changing them into casts to the appropriate
|
||||
// integer type. This promotes constant folding and simplifies this code.
|
||||
Constant *Op = CE->getOperand(0);
|
||||
Op = ConstantExpr::getIntegerCast(Op, DL.getIntPtrType(CV->getContext()),
|
||||
Op = ConstantExpr::getIntegerCast(Op, DL.getIntPtrType(CV->getType()),
|
||||
false/*ZExt*/);
|
||||
return lowerConstant(Op, AP);
|
||||
}
|
||||
|
Reference in New Issue
Block a user