summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-02-09 02:23:13 +0000
committerChris Lattner <sabre@nondot.org>2006-02-09 02:23:13 +0000
commit4576bb74d55284eeec7ab84529794fc76894e225 (patch)
tree8e199d41518399e8a08daaea6068256d57d39926 /llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp
parent832d78d981eacb6bd96e2eb21bf8efa91b8d36e9 (diff)
downloadbcm5719-llvm-4576bb74d55284eeec7ab84529794fc76894e225.tar.gz
bcm5719-llvm-4576bb74d55284eeec7ab84529794fc76894e225.zip
Make MachineConstantPool entries alignments explicit
llvm-svn: 26071
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp
index 15748705690..ff4ae335f2d 100644
--- a/llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp
@@ -23,6 +23,7 @@
#include "llvm/Target/TargetInstrItineraries.h"
#include "llvm/Target/TargetLowering.h"
#include "llvm/Support/Debug.h"
+#include "llvm/Constant.h"
#include <iostream>
using namespace llvm;
@@ -194,8 +195,17 @@ void ScheduleDAG::EmitNode(NodeInfo *NI) {
MI->addFrameIndexOperand(FI->getIndex());
} else if (ConstantPoolSDNode *CP =
dyn_cast<ConstantPoolSDNode>(Node->getOperand(i))) {
- unsigned Idx = ConstPool->getConstantPoolIndex(CP->get(),
- CP->getAlignment());
+ unsigned Align = CP->getAlignment();
+ // MachineConstantPool wants an explicit alignment.
+ if (Align == 0) {
+ if (CP->get()->getType() == Type::DoubleTy)
+ Align = 3; // always 8-byte align doubles.
+ else
+ Align = TM.getTargetData()
+ .getTypeAlignmentShift(CP->get()->getType());
+ }
+
+ unsigned Idx = ConstPool->getConstantPoolIndex(CP->get(), Align);
MI->addConstantPoolIndexOperand(Idx);
} else if (ExternalSymbolSDNode *ES =
dyn_cast<ExternalSymbolSDNode>(Node->getOperand(i))) {
OpenPOWER on IntegriCloud