aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/X86/X86FastISel.cpp
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2008-09-06 01:11:01 +0000
committerOwen Anderson <resistor@mac.com>2008-09-06 01:11:01 +0000
commit3b217c6f5c21a5f16670b14e3beeaff5ee74df1c (patch)
treea5f4f018f23e1f64359fc4ad38f1304932f5e528 /lib/Target/X86/X86FastISel.cpp
parent99d6dca2f8b58c835996431cc5277dcedcf4e0a4 (diff)
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
Diffstat (limited to 'lib/Target/X86/X86FastISel.cpp')
-rw-r--r--lib/Target/X86/X86FastISel.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/Target/X86/X86FastISel.cpp b/lib/Target/X86/X86FastISel.cpp
index bf939ab0fb..211afd5fc8 100644
--- a/lib/Target/X86/X86FastISel.cpp
+++ b/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;
}