summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-08-26 17:15:30 +0000
committerChris Lattner <sabre@nondot.org>2005-08-26 17:15:30 +0000
commitc30405e0ee1bdc26fbc8cbf63595f1bef1a2e347 (patch)
tree08a745b3b08cb5d08407c1dc97d70745f8548f79 /llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
parent7bbdae53d6a751e5c5bde99972c93f2f1e7d2822 (diff)
downloadbcm5719-llvm-c30405e0ee1bdc26fbc8cbf63595f1bef1a2e347.tar.gz
bcm5719-llvm-c30405e0ee1bdc26fbc8cbf63595f1bef1a2e347.zip
Change ConstantPoolSDNode to actually hold the Constant itself instead of
putting it into the constant pool. This allows the isel machinery to create constants that it will end up deciding are not needed, without them ending up in the resultant function constant pool. llvm-svn: 23081
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp23
1 files changed, 11 insertions, 12 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 2bcbd9857d0..25fba29845e 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -265,10 +265,10 @@ void SelectionDAG::RemoveNodeFromCSEMaps(SDNode *N) {
TargetFrameIndices.erase(cast<FrameIndexSDNode>(N)->getIndex());
break;
case ISD::ConstantPool:
- ConstantPoolIndices.erase(cast<ConstantPoolSDNode>(N)->getIndex());
+ ConstantPoolIndices.erase(cast<ConstantPoolSDNode>(N)->get());
break;
case ISD::TargetConstantPool:
- TargetConstantPoolIndices.erase(cast<ConstantPoolSDNode>(N)->getIndex());
+ TargetConstantPoolIndices.erase(cast<ConstantPoolSDNode>(N)->get());
break;
case ISD::BasicBlock:
BBNodes.erase(cast<BasicBlockSDNode>(N)->getBasicBlock());
@@ -452,19 +452,18 @@ SDOperand SelectionDAG::getTargetFrameIndex(int FI, MVT::ValueType VT) {
return SDOperand(N, 0);
}
-SDOperand SelectionDAG::getConstantPool(unsigned CPIdx, MVT::ValueType VT) {
- SDNode *N = ConstantPoolIndices[CPIdx];
+SDOperand SelectionDAG::getConstantPool(Constant *C, MVT::ValueType VT) {
+ SDNode *&N = ConstantPoolIndices[C];
if (N) return SDOperand(N, 0);
- N = new ConstantPoolSDNode(CPIdx, VT, false);
+ N = new ConstantPoolSDNode(C, VT, false);
AllNodes.push_back(N);
return SDOperand(N, 0);
}
-SDOperand SelectionDAG::getTargetConstantPool(unsigned CPIdx,
- MVT::ValueType VT) {
- SDNode *N = TargetConstantPoolIndices[CPIdx];
+SDOperand SelectionDAG::getTargetConstantPool(Constant *C, MVT::ValueType VT) {
+ SDNode *&N = TargetConstantPoolIndices[C];
if (N) return SDOperand(N, 0);
- N = new ConstantPoolSDNode(CPIdx, VT, true);
+ N = new ConstantPoolSDNode(C, VT, true);
AllNodes.push_back(N);
return SDOperand(N, 0);
}
@@ -2134,8 +2133,8 @@ const char *SDNode::getOperationName(const SelectionDAG *G) const {
case ISD::BasicBlock: return "BasicBlock";
case ISD::Register: return "Register";
case ISD::ExternalSymbol: return "ExternalSymbol";
- case ISD::ConstantPool: return "ConstantPoolIndex";
- case ISD::TargetConstantPool: return "TargetConstantPoolIndex";
+ case ISD::ConstantPool: return "ConstantPool";
+ case ISD::TargetConstantPool: return "TargetConstantPool";
case ISD::CopyToReg: return "CopyToReg";
case ISD::CopyFromReg: return "CopyFromReg";
case ISD::ImplicitDef: return "ImplicitDef";
@@ -2287,7 +2286,7 @@ void SDNode::dump(const SelectionDAG *G) const {
} else if (const FrameIndexSDNode *FIDN = dyn_cast<FrameIndexSDNode>(this)) {
std::cerr << "<" << FIDN->getIndex() << ">";
} else if (const ConstantPoolSDNode *CP = dyn_cast<ConstantPoolSDNode>(this)){
- std::cerr << "<" << CP->getIndex() << ">";
+ std::cerr << "<" << *CP->get() << ">";
} else if (const BasicBlockSDNode *BBDN = dyn_cast<BasicBlockSDNode>(this)) {
std::cerr << "<";
const Value *LBB = (const Value*)BBDN->getBasicBlock()->getBasicBlock();
OpenPOWER on IntegriCloud