diff options
author | Evan Cheng <evan.cheng@apple.com> | 2006-09-12 21:00:35 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2006-09-12 21:00:35 +0000 |
commit | d6594ae54cfde4db4d30272192645c0a45fb9902 (patch) | |
tree | 7b89d2a0c89f9fc9bdb58acad508acd59cf3702d /lib/CodeGen/SelectionDAG/ScheduleDAG.cpp | |
parent | cd5731d98b15c9de236bd0dd6c9c57d9bcecbceb (diff) |
Added support for machine specific constantpool values. These are useful for
representing expressions that can only be resolved at link time, etc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30278 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/ScheduleDAG.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/ScheduleDAG.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp b/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp index 71f2bce118..947504af2a 100644 --- a/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp +++ b/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp @@ -324,22 +324,26 @@ void ScheduleDAG::AddOperand(MachineInstr *MI, SDOperand Op, dyn_cast<ConstantPoolSDNode>(Op)) { int Offset = CP->getOffset(); unsigned Align = CP->getAlignment(); + const Type *Type = CP->getType(); // MachineConstantPool wants an explicit alignment. if (Align == 0) { - if (CP->get()->getType() == Type::DoubleTy) + if (Type == Type::DoubleTy) Align = 3; // always 8-byte align doubles. else { - Align = TM.getTargetData() - ->getTypeAlignmentShift(CP->get()->getType()); + Align = TM.getTargetData()->getTypeAlignmentShift(Type); if (Align == 0) { // Alignment of packed types. FIXME! - Align = TM.getTargetData()->getTypeSize(CP->get()->getType()); + Align = TM.getTargetData()->getTypeSize(Type); Align = Log2_64(Align); } } } - unsigned Idx = ConstPool->getConstantPoolIndex(CP->get(), Align); + unsigned Idx; + if (CP->isMachineConstantPoolEntry()) + Idx = ConstPool->getConstantPoolIndex(CP->getMachineCPVal(), Align); + else + Idx = ConstPool->getConstantPoolIndex(CP->getConstVal(), Align); MI->addConstantPoolIndexOperand(Idx, Offset); } else if (ExternalSymbolSDNode *ES = dyn_cast<ExternalSymbolSDNode>(Op)) { |