diff options
author | Owen Anderson <resistor@mac.com> | 2008-09-06 01:11:01 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2008-09-06 01:11:01 +0000 |
commit | d41c7160d05ac9486d3ee1e7f23d2b6459294c36 (patch) | |
tree | a5af4cc8999308b60b906e4c684c8d473cc74f3f | |
parent | 9519fb3f50fdfa49e82834fcb4fb59c6c035bea6 (diff) | |
download | bcm5719-llvm-d41c7160d05ac9486d3ee1e7f23d2b6459294c36.tar.gz bcm5719-llvm-d41c7160d05ac9486d3ee1e7f23d2b6459294c36.zip |
Fix constant pool loads, and remove broken versions of addConstantPoolReference.
llvm-svn: 55868
-rw-r--r-- | llvm/lib/Target/CellSPU/SPUInstrBuilder.h | 12 | ||||
-rw-r--r-- | llvm/lib/Target/IA64/IA64InstrBuilder.h | 12 | ||||
-rw-r--r-- | llvm/lib/Target/PowerPC/PPCInstrBuilder.h | 12 | ||||
-rw-r--r-- | llvm/lib/Target/X86/X86FastISel.cpp | 15 | ||||
-rw-r--r-- | llvm/lib/Target/X86/X86InstrBuilder.h | 4 |
5 files changed, 10 insertions, 45 deletions
diff --git a/llvm/lib/Target/CellSPU/SPUInstrBuilder.h b/llvm/lib/Target/CellSPU/SPUInstrBuilder.h index 00721d1b97b..5e268f8767c 100644 --- a/llvm/lib/Target/CellSPU/SPUInstrBuilder.h +++ b/llvm/lib/Target/CellSPU/SPUInstrBuilder.h @@ -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 diff --git a/llvm/lib/Target/IA64/IA64InstrBuilder.h b/llvm/lib/Target/IA64/IA64InstrBuilder.h index 51b3744312e..a5d4dca530f 100644 --- a/llvm/lib/Target/IA64/IA64InstrBuilder.h +++ b/llvm/lib/Target/IA64/IA64InstrBuilder.h @@ -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 diff --git a/llvm/lib/Target/PowerPC/PPCInstrBuilder.h b/llvm/lib/Target/PowerPC/PPCInstrBuilder.h index edb5103875d..1de69116cd5 100644 --- a/llvm/lib/Target/PowerPC/PPCInstrBuilder.h +++ b/llvm/lib/Target/PowerPC/PPCInstrBuilder.h @@ -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 diff --git a/llvm/lib/Target/X86/X86FastISel.cpp b/llvm/lib/Target/X86/X86FastISel.cpp index bf939ab0fb6..211afd5fc87 100644 --- a/llvm/lib/Target/X86/X86FastISel.cpp +++ b/llvm/lib/Target/X86/X86FastISel.cpp @@ -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; } diff --git a/llvm/lib/Target/X86/X86InstrBuilder.h b/llvm/lib/Target/X86/X86InstrBuilder.h index d4e10bbb50e..b5924cb7611 100644 --- a/llvm/lib/Target/X86/X86InstrBuilder.h +++ b/llvm/lib/Target/X86/X86InstrBuilder.h @@ -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); } |