aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-07-10 00:29:18 +0000
committerChris Lattner <sabre@nondot.org>2005-07-10 00:29:18 +0000
commit9fadb4c1c0a6d223aa468f9f72f8c2562dc66839 (patch)
tree48af1069d3858defa9aa70f7f205f8c27ee2ebae /lib
parentf7db8c69a12582c7d1ff7c5f25c948dca2dbf7dc (diff)
downloadexternal_llvm-9fadb4c1c0a6d223aa468f9f72f8c2562dc66839.zip
external_llvm-9fadb4c1c0a6d223aa468f9f72f8c2562dc66839.tar.gz
external_llvm-9fadb4c1c0a6d223aa468f9f72f8c2562dc66839.tar.bz2
Change TRUNCSTORE to use a VTSDNode operand instead of being an MVTSTDNode
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22366 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/SelectionDAG/LegalizeDAG.cpp7
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAG.cpp77
-rw-r--r--lib/Target/Alpha/AlphaISelPattern.cpp10
-rw-r--r--lib/Target/IA64/IA64ISelPattern.cpp2
-rw-r--r--lib/Target/PowerPC/PPC64ISelPattern.cpp2
-rw-r--r--lib/Target/PowerPC/PPCISelPattern.cpp2
-rw-r--r--lib/Target/Sparc/SparcV8ISelPattern.cpp2
-rw-r--r--lib/Target/SparcV8/SparcV8ISelPattern.cpp2
-rw-r--r--lib/Target/X86/X86ISelPattern.cpp9
9 files changed, 53 insertions, 60 deletions
diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index c6fc076..c42c0e0 100644
--- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -679,7 +679,7 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
Tmp3 = PromoteOp(Node->getOperand(1));
Result = DAG.getNode(ISD::TRUNCSTORE, MVT::Other, Tmp1, Tmp3, Tmp2,
Node->getOperand(3),
- Node->getOperand(1).getValueType());
+ DAG.getValueType(Node->getOperand(1).getValueType()));
break;
case Expand:
@@ -718,8 +718,7 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
if (Tmp1 != Node->getOperand(0) || Tmp2 != Node->getOperand(1) ||
Tmp3 != Node->getOperand(2))
Result = DAG.getNode(ISD::TRUNCSTORE, MVT::Other, Tmp1, Tmp2, Tmp3,
- Node->getOperand(3),
- cast<MVTSDNode>(Node)->getExtraValueType());
+ Node->getOperand(3), Node->getOperand(4));
break;
case Promote:
case Expand:
@@ -1482,7 +1481,7 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
SDOperand StackSlot = DAG.getFrameIndex(SSFI, TLI.getPointerTy());
Result = DAG.getNode(ISD::TRUNCSTORE, MVT::Other, DAG.getEntryNode(),
Node->getOperand(0), StackSlot,
- DAG.getSrcValue(NULL), ExtraVT);
+ DAG.getSrcValue(NULL), DAG.getValueType(ExtraVT));
Result = DAG.getNode(ISD::EXTLOAD, Node->getValueType(0),
Result, StackSlot, DAG.getSrcValue(NULL), ExtraVT);
} else {
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 9cf6e0f..8ae96f8 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -235,7 +235,6 @@ void SelectionDAG::DeleteNodeIfDead(SDNode *N, void *NodeSet) {
cast<SetCCSDNode>(N)->getCondition(),
N->getValueType(0))));
break;
- case ISD::TRUNCSTORE:
case ISD::EXTLOAD:
case ISD::SEXTLOAD:
case ISD::ZEXTLOAD: {
@@ -1465,6 +1464,20 @@ SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT,
return getNode(Opcode, VT, Ops);
}
+SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT,
+ SDOperand N1, SDOperand N2, SDOperand N3,
+ SDOperand N4, SDOperand N5) {
+ std::vector<SDOperand> Ops;
+ Ops.reserve(5);
+ Ops.push_back(N1);
+ Ops.push_back(N2);
+ Ops.push_back(N3);
+ Ops.push_back(N4);
+ Ops.push_back(N5);
+ return getNode(Opcode, VT, Ops);
+}
+
+
SDOperand SelectionDAG::getSrcValue(const Value *V, int Offset) {
assert((!V || isa<PointerType>(V->getType())) &&
"SrcValue is not a pointer?");
@@ -1496,6 +1509,27 @@ SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT,
else // Unconditional branch to false dest.
return getNode(ISD::BR, MVT::Other, Ops[0], Ops[3]);
break;
+
+ case ISD::TRUNCSTORE: {
+ assert(Ops.size() == 5 && "TRUNCSTORE takes 5 operands!");
+ MVT::ValueType EVT = cast<VTSDNode>(Ops[4])->getVT();
+#if 0 // FIXME: If the target supports EVT natively, convert to a truncate/store
+ // If this is a truncating store of a constant, convert to the desired type
+ // and store it instead.
+ if (isa<Constant>(Ops[0])) {
+ SDOperand Op = getNode(ISD::TRUNCATE, EVT, N1);
+ if (isa<Constant>(Op))
+ N1 = Op;
+ }
+ // Also for ConstantFP?
+#endif
+ if (Ops[0].getValueType() == EVT) // Normal store?
+ return getNode(ISD::STORE, VT, Ops[0], Ops[1], Ops[2], Ops[3]);
+ assert(Ops[1].getValueType() > EVT && "Not a truncation?");
+ assert(MVT::isInteger(Ops[1].getValueType()) == MVT::isInteger(EVT) &&
+ "Can't do FP-INT conversion!");
+ break;
+ }
}
// Memoize nodes.
@@ -1596,47 +1630,6 @@ SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT,SDOperand N1,
return SDOperand(N, 0);
}
-SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT,SDOperand N1,
- SDOperand N2, SDOperand N3, SDOperand N4,
- MVT::ValueType EVT) {
- switch (Opcode) {
- default: assert(0 && "Bad opcode for this accessor!");
- case ISD::TRUNCSTORE:
-#if 0 // FIXME: If the target supports EVT natively, convert to a truncate/store
- // If this is a truncating store of a constant, convert to the desired type
- // and store it instead.
- if (isa<Constant>(N1)) {
- SDOperand Op = getNode(ISD::TRUNCATE, EVT, N1);
- if (isa<Constant>(Op))
- N1 = Op;
- }
- // Also for ConstantFP?
-#endif
- if (N1.getValueType() == EVT) // Normal store?
- return getNode(ISD::STORE, VT, N1, N2, N3, N4);
- assert(N2.getValueType() > EVT && "Not a truncation?");
- assert(MVT::isInteger(N2.getValueType()) == MVT::isInteger(EVT) &&
- "Can't do FP-INT conversion!");
- break;
- }
-
- EVTStruct NN;
- NN.Opcode = Opcode;
- NN.VT = VT;
- NN.EVT = EVT;
- NN.Ops.push_back(N1);
- NN.Ops.push_back(N2);
- NN.Ops.push_back(N3);
- NN.Ops.push_back(N4);
-
- SDNode *&N = MVTSDNodes[NN];
- if (N) return SDOperand(N, 0);
- N = new MVTSDNode(Opcode, VT, N1, N2, N3, N4, EVT);
- AllNodes.push_back(N);
- return SDOperand(N, 0);
-}
-
-
/// hasNUsesOfValue - Return true if there are exactly NUSES uses of the
/// indicated value. This method ignores uses of other values defined by this
/// operation.
diff --git a/lib/Target/Alpha/AlphaISelPattern.cpp b/lib/Target/Alpha/AlphaISelPattern.cpp
index 3225963..aeb15a0 100644
--- a/lib/Target/Alpha/AlphaISelPattern.cpp
+++ b/lib/Target/Alpha/AlphaISelPattern.cpp
@@ -419,7 +419,7 @@ SDOperand AlphaTargetLowering::LowerVAStart(SDOperand Chain, SDOperand VAListP,
DAG.getConstant(8, MVT::i64));
return DAG.getNode(ISD::TRUNCSTORE, MVT::Other, S1,
DAG.getConstant(VarArgsOffset, MVT::i64), SA2,
- DAG.getSrcValue(VAListV, 8), MVT::i32);
+ DAG.getSrcValue(VAListV, 8), DAG.getValueType(MVT::i32));
}
std::pair<SDOperand,SDOperand> AlphaTargetLowering::
@@ -457,7 +457,8 @@ LowerVAArg(SDOperand Chain, SDOperand VAListP, Value *VAListV,
DAG.getConstant(8, MVT::i64));
SDOperand Update = DAG.getNode(ISD::TRUNCSTORE, MVT::Other,
Result.getValue(1), NewOffset,
- Tmp, DAG.getSrcValue(VAListV, 8), MVT::i32);
+ Tmp, DAG.getSrcValue(VAListV, 8),
+ DAG.getValueType(MVT::i32));
Result = DAG.getNode(ISD::TRUNCATE, getValueType(ArgTy), Result);
return std::make_pair(Result, Update);
@@ -478,7 +479,8 @@ LowerVACopy(SDOperand Chain, SDOperand SrcP, Value *SrcV, SDOperand DestP,
SDOperand NPD = DAG.getNode(ISD::ADD, MVT::i64, DestP,
DAG.getConstant(8, MVT::i64));
return DAG.getNode(ISD::TRUNCSTORE, MVT::Other, Val.getValue(1),
- Val, NPD, DAG.getSrcValue(DestV, 8), MVT::i32);
+ Val, NPD, DAG.getSrcValue(DestV, 8),
+ DAG.getValueType(MVT::i32));
}
namespace {
@@ -2283,7 +2285,7 @@ void AlphaISel::Select(SDOperand N) {
case MVT::f32: Opc = Alpha::STS; break;
}
} else { //ISD::TRUNCSTORE
- switch(cast<MVTSDNode>(Node)->getExtraValueType()) {
+ switch(cast<VTSDNode>(Node->getOperand(4))->getVT()) {
default: assert(0 && "unknown Type in store");
case MVT::i1: //FIXME: DAG does not promote this load
case MVT::i8: Opc = Alpha::STB; break;
diff --git a/lib/Target/IA64/IA64ISelPattern.cpp b/lib/Target/IA64/IA64ISelPattern.cpp
index a93e2ea..3b3f90a 100644
--- a/lib/Target/IA64/IA64ISelPattern.cpp
+++ b/lib/Target/IA64/IA64ISelPattern.cpp
@@ -2361,7 +2361,7 @@ void ISel::Select(SDOperand N) {
case MVT::f64: Opc = IA64::STF8; break;
}
} else { // truncstore
- switch(cast<MVTSDNode>(Node)->getExtraValueType()) {
+ switch(cast<VTSDNode>(Node->getOperand(4))->getVT()) {
default: assert(0 && "unknown type in truncstore");
case MVT::i1: Opc = IA64::ST1; isBool=true; break;
//FIXME: DAG does not promote this load?
diff --git a/lib/Target/PowerPC/PPC64ISelPattern.cpp b/lib/Target/PowerPC/PPC64ISelPattern.cpp
index 6761ab1..1fca339 100644
--- a/lib/Target/PowerPC/PPC64ISelPattern.cpp
+++ b/lib/Target/PowerPC/PPC64ISelPattern.cpp
@@ -1593,7 +1593,7 @@ void ISel::Select(SDOperand N) {
case MVT::f32: Opc = PPC::STFS; break;
}
} else { //ISD::TRUNCSTORE
- switch(cast<MVTSDNode>(Node)->getExtraValueType()) {
+ switch(cast<VTSDNode>(Node->getOperand(4))->getVT()) {
default: assert(0 && "unknown Type in store");
case MVT::i1: //FIXME: DAG does not promote this load
case MVT::i8: Opc= PPC::STB; break;
diff --git a/lib/Target/PowerPC/PPCISelPattern.cpp b/lib/Target/PowerPC/PPCISelPattern.cpp
index b29b11f..f5a09a7 100644
--- a/lib/Target/PowerPC/PPCISelPattern.cpp
+++ b/lib/Target/PowerPC/PPCISelPattern.cpp
@@ -2530,7 +2530,7 @@ void ISel::Select(SDOperand N) {
case MVT::f32: Opc = PPC::STFS; break;
}
} else { //ISD::TRUNCSTORE
- switch(cast<MVTSDNode>(Node)->getExtraValueType()) {
+ switch(cast<VTSDNode>(Node->getOperand(4))->getVT()) {
default: assert(0 && "unknown Type in store");
case MVT::i1:
case MVT::i8: Opc = PPC::STB; break;
diff --git a/lib/Target/Sparc/SparcV8ISelPattern.cpp b/lib/Target/Sparc/SparcV8ISelPattern.cpp
index e19e14c..c2740e3 100644
--- a/lib/Target/Sparc/SparcV8ISelPattern.cpp
+++ b/lib/Target/Sparc/SparcV8ISelPattern.cpp
@@ -489,7 +489,7 @@ void ISel::Select(SDOperand N) {
Tmp2 = SelectExpr(Address);
unsigned VT = opcode == ISD::STORE ?
- Value.getValueType() : cast<MVTSDNode>(Node)->getExtraValueType();
+ Value.getValueType() : cast<VTSDNode>(Node->getOperand(4))->getVT();
switch(VT) {
default: assert(0 && "unknown Type in store");
case MVT::f64: Opc = V8::STDFrr; break;
diff --git a/lib/Target/SparcV8/SparcV8ISelPattern.cpp b/lib/Target/SparcV8/SparcV8ISelPattern.cpp
index e19e14c..c2740e3 100644
--- a/lib/Target/SparcV8/SparcV8ISelPattern.cpp
+++ b/lib/Target/SparcV8/SparcV8ISelPattern.cpp
@@ -489,7 +489,7 @@ void ISel::Select(SDOperand N) {
Tmp2 = SelectExpr(Address);
unsigned VT = opcode == ISD::STORE ?
- Value.getValueType() : cast<MVTSDNode>(Node)->getExtraValueType();
+ Value.getValueType() : cast<VTSDNode>(Node->getOperand(4))->getVT();
switch(VT) {
default: assert(0 && "unknown Type in store");
case MVT::f64: Opc = V8::STDFrr; break;
diff --git a/lib/Target/X86/X86ISelPattern.cpp b/lib/Target/X86/X86ISelPattern.cpp
index d7a1c4d..af75bdc 100644
--- a/lib/Target/X86/X86ISelPattern.cpp
+++ b/lib/Target/X86/X86ISelPattern.cpp
@@ -4009,7 +4009,7 @@ static SDOperand GetAdjustedArgumentStores(SDOperand Chain, int Offset,
StoreVT = Chain.getOperand(1).getValueType();
break;
case ISD::TRUNCSTORE: // FLOAT store
- StoreVT = cast<MVTSDNode>(Chain)->getExtraValueType();
+ StoreVT = cast<VTSDNode>(Chain.getOperand(4))->getVT();
break;
}
@@ -4043,7 +4043,7 @@ static SDOperand GetAdjustedArgumentStores(SDOperand Chain, int Offset,
FIN);
assert(Chain.getOpcode() == ISD::TRUNCSTORE);
return DAG.getNode(ISD::TRUNCSTORE, MVT::Other, InChain, Chain.getOperand(1),
- FIN, DAG.getSrcValue(NULL), StoreVT);
+ FIN, DAG.getSrcValue(NULL), DAG.getValueType(StoreVT));
}
@@ -4366,10 +4366,9 @@ void ISel::Select(SDOperand N) {
SelectExpr(N.getValue(0));
return;
- case ISD::TRUNCSTORE: { // truncstore chain, val, ptr :storety
- // On X86, we can represent all types except for Bool and Float natively.
+ case ISD::TRUNCSTORE: { // truncstore chain, val, ptr, SRCVALUE, storety
X86AddressMode AM;
- MVT::ValueType StoredTy = cast<MVTSDNode>(Node)->getExtraValueType();
+ MVT::ValueType StoredTy = cast<VTSDNode>(N.getOperand(4))->getVT();
assert((StoredTy == MVT::i1 || StoredTy == MVT::f32 ||
StoredTy == MVT::i16 /*FIXME: THIS IS JUST FOR TESTING!*/)
&& "Unsupported TRUNCSTORE for this target!");