mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-04-04 10:30:01 +00:00
Fix PR4466 by making fastisel set operand flags correctly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74366 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
5b93ea1ca3
commit
89da699092
@ -1493,15 +1493,22 @@ unsigned X86FastISel::TargetMaterializeConstant(Constant *C) {
|
||||
|
||||
// x86-32 PIC requires a PIC base register for constant pools.
|
||||
unsigned PICBase = 0;
|
||||
if (TM.getRelocationModel() == Reloc::PIC_ &&
|
||||
!Subtarget->is64Bit())
|
||||
PICBase = getInstrInfo()->getGlobalBaseReg(&MF);
|
||||
unsigned char OpFlag = 0;
|
||||
if (TM.getRelocationModel() == Reloc::PIC_) {
|
||||
if (Subtarget->isPICStyleStub()) {
|
||||
OpFlag = X86II::MO_PIC_BASE_OFFSET;
|
||||
PICBase = getInstrInfo()->getGlobalBaseReg(&MF);
|
||||
} else if (Subtarget->isPICStyleGOT()) {
|
||||
OpFlag = X86II::MO_GOTOFF;
|
||||
PICBase = getInstrInfo()->getGlobalBaseReg(&MF);
|
||||
}
|
||||
}
|
||||
|
||||
// Create the load from the constant pool.
|
||||
unsigned MCPOffset = MCP.getConstantPoolIndex(C, Align);
|
||||
unsigned ResultReg = createResultReg(RC);
|
||||
addConstantPoolReference(BuildMI(MBB, DL, TII.get(Opc), ResultReg), MCPOffset,
|
||||
PICBase);
|
||||
addConstantPoolReference(BuildMI(MBB, DL, TII.get(Opc), ResultReg),
|
||||
MCPOffset, PICBase, OpFlag);
|
||||
|
||||
return ResultReg;
|
||||
}
|
||||
|
@ -157,10 +157,10 @@ addFrameReference(const MachineInstrBuilder &MIB, int FI, int Offset = 0) {
|
||||
///
|
||||
inline const MachineInstrBuilder &
|
||||
addConstantPoolReference(const MachineInstrBuilder &MIB, unsigned CPI,
|
||||
unsigned GlobalBaseReg = 0) {
|
||||
unsigned GlobalBaseReg, unsigned char OpFlags) {
|
||||
//FIXME: factor this
|
||||
return MIB.addReg(GlobalBaseReg).addImm(1).addReg(0)
|
||||
.addConstantPoolIndex(CPI).addReg(0);
|
||||
.addConstantPoolIndex(CPI, 0, OpFlags).addReg(0);
|
||||
}
|
||||
|
||||
} // End llvm namespace
|
||||
|
Loading…
x
Reference in New Issue
Block a user