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:
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:
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 {
cast<SetCCSDNode>(N)->getCondition(),
N->getValueType(0))));
break;
- case ISD::TRUNCSTORE:
case ISD::EXTLOAD:
case ISD::SEXTLOAD:
case ISD::ZEXTLOAD: {
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?");
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.
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.
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::
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);
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 {
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;
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?
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;
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;
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;
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;
StoreVT = Chain.getOperand(1).getValueType();
break;
case ISD::TRUNCSTORE: // FLOAT store
- StoreVT = cast<MVTSDNode>(Chain)->getExtraValueType();
+ StoreVT = cast<VTSDNode>(Chain.getOperand(4))->getVT();
break;
}
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));
}
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!");