1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 11:42:57 +01:00

Expand getVTList, getNodeValueTypes, and SelectNodeTo to handle more value types.

llvm-svn: 60381
This commit is contained in:
Bill Wendling 2008-12-01 23:28:22 +00:00
parent baf38b4f91
commit dff9b81623
2 changed files with 42 additions and 0 deletions

View File

@ -227,6 +227,7 @@ public:
SDVTList getVTList(MVT VT); SDVTList getVTList(MVT VT);
SDVTList getVTList(MVT VT1, MVT VT2); SDVTList getVTList(MVT VT1, MVT VT2);
SDVTList getVTList(MVT VT1, MVT VT2, MVT VT3); SDVTList getVTList(MVT VT1, MVT VT2, MVT VT3);
SDVTList getVTList(MVT VT1, MVT VT2, MVT VT3, MVT VT4);
SDVTList getVTList(const MVT *VTs, unsigned NumVTs); SDVTList getVTList(const MVT *VTs, unsigned NumVTs);
/// getNodeValueTypes - These are obsolete, use getVTList instead. /// getNodeValueTypes - These are obsolete, use getVTList instead.
@ -239,6 +240,9 @@ public:
const MVT *getNodeValueTypes(MVT VT1, MVT VT2, MVT VT3) { const MVT *getNodeValueTypes(MVT VT1, MVT VT2, MVT VT3) {
return getVTList(VT1, VT2, VT3).VTs; return getVTList(VT1, VT2, VT3).VTs;
} }
const MVT *getNodeValueTypes(MVT VT1, MVT VT2, MVT VT3, MVT VT4) {
return getVTList(VT1, VT2, VT3, VT4).VTs;
}
const MVT *getNodeValueTypes(const std::vector<MVT> &vtList) { const MVT *getNodeValueTypes(const std::vector<MVT> &vtList) {
return getVTList(&vtList[0], (unsigned)vtList.size()).VTs; return getVTList(&vtList[0], (unsigned)vtList.size()).VTs;
} }
@ -564,12 +568,17 @@ public:
MVT VT2, const SDValue *Ops, unsigned NumOps); MVT VT2, const SDValue *Ops, unsigned NumOps);
SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT1, SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT1,
MVT VT2, MVT VT3, const SDValue *Ops, unsigned NumOps); MVT VT2, MVT VT3, const SDValue *Ops, unsigned NumOps);
SDNode *SelectNodeTo(SDNode *N, unsigned MachineOpc, MVT VT1,
MVT VT2, MVT VT3, MVT VT4, const SDValue *Ops,
unsigned NumOps);
SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT1, SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT1,
MVT VT2, SDValue Op1); MVT VT2, SDValue Op1);
SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT1, SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT1,
MVT VT2, SDValue Op1, SDValue Op2); MVT VT2, SDValue Op1, SDValue Op2);
SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT1, SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT1,
MVT VT2, SDValue Op1, SDValue Op2, SDValue Op3); MVT VT2, SDValue Op1, SDValue Op2, SDValue Op3);
SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT1,
MVT VT2, MVT VT3, SDValue Op1, SDValue Op2, SDValue Op3);
SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, SDVTList VTs, SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, SDVTList VTs,
const SDValue *Ops, unsigned NumOps); const SDValue *Ops, unsigned NumOps);

View File

@ -3838,6 +3838,23 @@ SDVTList SelectionDAG::getVTList(MVT VT1, MVT VT2, MVT VT3) {
return Result; return Result;
} }
SDVTList SelectionDAG::getVTList(MVT VT1, MVT VT2, MVT VT3, MVT VT4) {
for (std::vector<SDVTList>::reverse_iterator I = VTList.rbegin(),
E = VTList.rend(); I != E; ++I)
if (I->NumVTs == 4 && I->VTs[0] == VT1 && I->VTs[1] == VT2 &&
I->VTs[2] == VT3 && I->VTs[3] == VT4)
return *I;
MVT *Array = Allocator.Allocate<MVT>(3);
Array[0] = VT1;
Array[1] = VT2;
Array[2] = VT3;
Array[3] = VT4;
SDVTList Result = makeVTList(Array, 4);
VTList.push_back(Result);
return Result;
}
SDVTList SelectionDAG::getVTList(const MVT *VTs, unsigned NumVTs) { SDVTList SelectionDAG::getVTList(const MVT *VTs, unsigned NumVTs) {
switch (NumVTs) { switch (NumVTs) {
case 0: assert(0 && "Cannot have nodes without results!"); case 0: assert(0 && "Cannot have nodes without results!");
@ -4075,6 +4092,13 @@ SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned MachineOpc,
return SelectNodeTo(N, MachineOpc, VTs, Ops, NumOps); return SelectNodeTo(N, MachineOpc, VTs, Ops, NumOps);
} }
SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned MachineOpc,
MVT VT1, MVT VT2, MVT VT3, MVT VT4,
const SDValue *Ops, unsigned NumOps) {
SDVTList VTs = getVTList(VT1, VT2, VT3, VT4);
return SelectNodeTo(N, MachineOpc, VTs, Ops, NumOps);
}
SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned MachineOpc, SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned MachineOpc,
MVT VT1, MVT VT2, MVT VT1, MVT VT2,
SDValue Op1) { SDValue Op1) {
@ -4100,6 +4124,15 @@ SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned MachineOpc,
return SelectNodeTo(N, MachineOpc, VTs, Ops, 3); return SelectNodeTo(N, MachineOpc, VTs, Ops, 3);
} }
SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned MachineOpc,
MVT VT1, MVT VT2, MVT VT3,
SDValue Op1, SDValue Op2,
SDValue Op3) {
SDVTList VTs = getVTList(VT1, VT2, VT3);
SDValue Ops[] = { Op1, Op2, Op3 };
return SelectNodeTo(N, MachineOpc, VTs, Ops, 3);
}
SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned MachineOpc, SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned MachineOpc,
SDVTList VTs, const SDValue *Ops, SDVTList VTs, const SDValue *Ops,
unsigned NumOps) { unsigned NumOps) {