aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2007-10-17 13:49:58 +0000
committerDuncan Sands <baldrick@free.fr>2007-10-17 13:49:58 +0000
commitf411b83c8c6853c2a922b692e782566353153f08 (patch)
tree3793516c2009fa295c5fb2c1a1894cdfe38c72b5 /lib/CodeGen/SelectionDAG/SelectionDAG.cpp
parentafc407ea5196b6ce638c25bd21569270504bb604 (diff)
Return Expand from getOperationAction for all extended
types. This is needed for SIGN_EXTEND_INREG at least. It is not clear if this is correct for other operations. On the other hand, for the various load/store actions it seems to correct to return the type action, as is currently done. Also, it seems that SelectionDAG::getValueType can be called for extended value types; introduce a map for holding these, since we don't really want to extend the vector to be 2^32 pointers long! Generalize DAGTypeLegalizer::PromoteResult_TRUNCATE and DAGTypeLegalizer::PromoteResult_INT_EXTEND to handle the various funky possibilities that apints introduce, for example that you can promote to a type that needs to be expanded. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43071 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAG.cpp27
1 files changed, 17 insertions, 10 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index b0c949e30e..e6ce2eb995 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -527,10 +527,16 @@ void SelectionDAG::RemoveNodeFromCSEMaps(SDNode *N) {
Erased =
TargetExternalSymbols.erase(cast<ExternalSymbolSDNode>(N)->getSymbol());
break;
- case ISD::VALUETYPE:
- Erased = ValueTypeNodes[cast<VTSDNode>(N)->getVT()] != 0;
- ValueTypeNodes[cast<VTSDNode>(N)->getVT()] = 0;
+ case ISD::VALUETYPE: {
+ MVT::ValueType VT = cast<VTSDNode>(N)->getVT();
+ if (MVT::isExtendedVT(VT)) {
+ Erased = ExtendedValueTypeNodes.erase(VT);
+ } else {
+ Erased = ValueTypeNodes[VT] != 0;
+ ValueTypeNodes[VT] = 0;
+ }
break;
+ }
default:
// Remove it from the CSE Map.
Erased = CSEMap.RemoveNode(N);
@@ -847,15 +853,16 @@ SDOperand SelectionDAG::getBasicBlock(MachineBasicBlock *MBB) {
}
SDOperand SelectionDAG::getValueType(MVT::ValueType VT) {
- assert(!MVT::isExtendedVT(VT) && "Expecting a simple value type!");
- if ((unsigned)VT >= ValueTypeNodes.size())
+ if (!MVT::isExtendedVT(VT) && (unsigned)VT >= ValueTypeNodes.size())
ValueTypeNodes.resize(VT+1);
- if (ValueTypeNodes[VT] == 0) {
- ValueTypeNodes[VT] = new VTSDNode(VT);
- AllNodes.push_back(ValueTypeNodes[VT]);
- }
- return SDOperand(ValueTypeNodes[VT], 0);
+ SDNode *&N = MVT::isExtendedVT(VT) ?
+ ExtendedValueTypeNodes[VT] : ValueTypeNodes[VT];
+
+ if (N) return SDOperand(N, 0);
+ N = new VTSDNode(VT);
+ AllNodes.push_back(N);
+ return SDOperand(N, 0);
}
SDOperand SelectionDAG::getExternalSymbol(const char *Sym, MVT::ValueType VT) {