mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-17 05:29:24 +00:00
Fix constant pool loads, and remove broken versions of addConstantPoolReference.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55868 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
99d6dca2f8
commit
3b217c6f5c
@ -38,18 +38,6 @@ addFrameReference(const MachineInstrBuilder &MIB, int FI, int Offset = 0,
|
||||
return MIB.addFrameIndex(FI).addImm(Offset);
|
||||
}
|
||||
|
||||
/// addConstantPoolReference - This function is used to add a reference to the
|
||||
/// base of a constant value spilled to the per-function constant pool. The
|
||||
/// reference has base register ConstantPoolIndex offset which is retained until
|
||||
/// either machine code emission or assembly output. This allows an optional
|
||||
/// offset to be added as well.
|
||||
///
|
||||
inline const MachineInstrBuilder&
|
||||
addConstantPoolReference(const MachineInstrBuilder &MIB, unsigned CPI,
|
||||
int Offset = 0) {
|
||||
return MIB.addImm(Offset).addConstantPoolIndex(CPI);
|
||||
}
|
||||
|
||||
} // End llvm namespace
|
||||
|
||||
#endif
|
||||
|
@ -34,18 +34,6 @@ addFrameReference(const MachineInstrBuilder &MIB, int FI, int Offset = 0,
|
||||
return MIB.addFrameIndex(FI).addImm(Offset);
|
||||
}
|
||||
|
||||
/// addConstantPoolReference - This function is used to add a reference to the
|
||||
/// base of a constant value spilled to the per-function constant pool. The
|
||||
/// reference has base register ConstantPoolIndex offset which is retained until
|
||||
/// either machine code emission or assembly output. This allows an optional
|
||||
/// offset to be added as well.
|
||||
///
|
||||
inline const MachineInstrBuilder&
|
||||
addConstantPoolReference(const MachineInstrBuilder &MIB, unsigned CPI,
|
||||
int Offset = 0) {
|
||||
return MIB.addImm(Offset).addConstantPoolIndex(CPI);
|
||||
}
|
||||
|
||||
} // End llvm namespace
|
||||
|
||||
#endif
|
||||
|
@ -38,18 +38,6 @@ addFrameReference(const MachineInstrBuilder &MIB, int FI, int Offset = 0,
|
||||
return MIB.addFrameIndex(FI).addImm(Offset);
|
||||
}
|
||||
|
||||
/// addConstantPoolReference - This function is used to add a reference to the
|
||||
/// base of a constant value spilled to the per-function constant pool. The
|
||||
/// reference has base register ConstantPoolIndex offset which is retained until
|
||||
/// either machine code emission or assembly output. This allows an optional
|
||||
/// offset to be added as well.
|
||||
///
|
||||
inline const MachineInstrBuilder&
|
||||
addConstantPoolReference(const MachineInstrBuilder &MIB, unsigned CPI,
|
||||
int Offset = 0) {
|
||||
return MIB.addImm(Offset).addConstantPoolIndex(CPI);
|
||||
}
|
||||
|
||||
} // End llvm namespace
|
||||
|
||||
#endif
|
||||
|
@ -585,10 +585,6 @@ X86FastISel::TargetSelectInstruction(Instruction *I) {
|
||||
|
||||
unsigned X86FastISel::TargetMaterializeConstant(Constant *C,
|
||||
MachineConstantPool* MCP) {
|
||||
unsigned CPLoad = getRegForValue(C);
|
||||
if (CPLoad != 0)
|
||||
return CPLoad;
|
||||
|
||||
// Can't handle PIC-mode yet.
|
||||
if (TM.getRelocationModel() == Reloc::PIC_)
|
||||
return 0;
|
||||
@ -662,10 +658,17 @@ unsigned X86FastISel::TargetMaterializeConstant(Constant *C,
|
||||
return 0;
|
||||
}
|
||||
|
||||
// MachineConstantPool wants an explicit alignment.
|
||||
unsigned Align =
|
||||
TM.getTargetData()->getPreferredTypeAlignmentShift(C->getType());
|
||||
if (Align == 0) {
|
||||
// Alignment of vector types. FIXME!
|
||||
Align = TM.getTargetData()->getABITypeSize(C->getType());
|
||||
Align = Log2_64(Align);
|
||||
}
|
||||
|
||||
unsigned MCPOffset = MCP->getConstantPoolIndex(C, 0);
|
||||
unsigned MCPOffset = MCP->getConstantPoolIndex(C, Align);
|
||||
addConstantPoolReference(BuildMI(MBB, TII.get(Opc), ResultReg), MCPOffset);
|
||||
UpdateValueMap(C, ResultReg);
|
||||
return ResultReg;
|
||||
}
|
||||
|
||||
|
@ -119,9 +119,7 @@ addFrameReference(const MachineInstrBuilder &MIB, int FI, int Offset = 0) {
|
||||
/// offset to be added as well.
|
||||
///
|
||||
inline const MachineInstrBuilder &
|
||||
addConstantPoolReference(const MachineInstrBuilder &MIB, unsigned CPI,
|
||||
int Offset = 0) {
|
||||
assert(Offset == 0 && "Non-zero offsets not supported!");
|
||||
addConstantPoolReference(const MachineInstrBuilder &MIB, unsigned CPI) {
|
||||
return MIB.addReg(0).addImm(1).addReg(0).addConstantPoolIndex(CPI);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user