Make getMachineNode return a MachineSDNode* instead of a generic SDNode*

since it won't do any folding. This will help avoid some inconvenient
casting.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83698 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dan Gohman 2009-10-10 01:29:16 +00:00
parent 4e6f7a0179
commit c81b783e27
2 changed files with 71 additions and 59 deletions

View File

@ -672,35 +672,36 @@ public:
/// Note that getMachineNode returns the resultant node. If there is already /// Note that getMachineNode returns the resultant node. If there is already
/// a node of the specified opcode and operands, it returns that node instead /// a node of the specified opcode and operands, it returns that node instead
/// of the current one. /// of the current one.
SDNode *getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT); MachineSDNode *getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT);
SDNode *getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT, SDValue Op1); MachineSDNode *getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT,
SDNode *getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT, SDValue Op1, SDValue Op1);
SDValue Op2); MachineSDNode *getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT,
SDNode *getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT, SDValue Op1, SDValue Op2);
MachineSDNode *getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT,
SDValue Op1, SDValue Op2, SDValue Op3); SDValue Op1, SDValue Op2, SDValue Op3);
SDNode *getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT, MachineSDNode *getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT,
const SDValue *Ops, unsigned NumOps); const SDValue *Ops, unsigned NumOps);
SDNode *getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT1, EVT VT2); MachineSDNode *getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT1, EVT VT2);
SDNode *getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT1, EVT VT2, MachineSDNode *getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT1, EVT VT2,
SDValue Op1); SDValue Op1);
SDNode *getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT1, MachineSDNode *getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT1,
EVT VT2, SDValue Op1, SDValue Op2); EVT VT2, SDValue Op1, SDValue Op2);
SDNode *getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT1, MachineSDNode *getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT1,
EVT VT2, SDValue Op1, SDValue Op2, SDValue Op3); EVT VT2, SDValue Op1, SDValue Op2, SDValue Op3);
SDNode *getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT1, EVT VT2, MachineSDNode *getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT1, EVT VT2,
const SDValue *Ops, unsigned NumOps); const SDValue *Ops, unsigned NumOps);
SDNode *getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT1, EVT VT2, MachineSDNode *getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT1, EVT VT2,
EVT VT3, SDValue Op1, SDValue Op2); EVT VT3, SDValue Op1, SDValue Op2);
SDNode *getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT1, EVT VT2, MachineSDNode *getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT1, EVT VT2,
EVT VT3, SDValue Op1, SDValue Op2, SDValue Op3); EVT VT3, SDValue Op1, SDValue Op2, SDValue Op3);
SDNode *getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT1, EVT VT2, MachineSDNode *getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT1, EVT VT2,
EVT VT3, const SDValue *Ops, unsigned NumOps); EVT VT3, const SDValue *Ops, unsigned NumOps);
SDNode *getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT1, EVT VT2, MachineSDNode *getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT1, EVT VT2,
EVT VT3, EVT VT4, const SDValue *Ops, unsigned NumOps); EVT VT3, EVT VT4, const SDValue *Ops, unsigned NumOps);
SDNode *getMachineNode(unsigned Opcode, DebugLoc dl, MachineSDNode *getMachineNode(unsigned Opcode, DebugLoc dl,
const std::vector<EVT> &ResultTys, const SDValue *Ops, const std::vector<EVT> &ResultTys, const SDValue *Ops,
unsigned NumOps); unsigned NumOps);
SDNode *getMachineNode(unsigned Opcode, DebugLoc dl, SDVTList VTs, MachineSDNode *getMachineNode(unsigned Opcode, DebugLoc dl, SDVTList VTs,
const SDValue *Ops, unsigned NumOps); const SDValue *Ops, unsigned NumOps);
/// getTargetExtractSubreg - A convenience function for creating /// getTargetExtractSubreg - A convenience function for creating

View File

@ -4612,115 +4612,126 @@ SDNode *SelectionDAG::MorphNodeTo(SDNode *N, unsigned Opc,
/// Note that getMachineNode returns the resultant node. If there is already a /// Note that getMachineNode returns the resultant node. If there is already a
/// node of the specified opcode and operands, it returns that node instead of /// node of the specified opcode and operands, it returns that node instead of
/// the current one. /// the current one.
SDNode *SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT) { MachineSDNode *
SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT) {
SDVTList VTs = getVTList(VT); SDVTList VTs = getVTList(VT);
return getMachineNode(Opcode, dl, VTs, 0, 0); return getMachineNode(Opcode, dl, VTs, 0, 0);
} }
SDNode *SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT, MachineSDNode *
SDValue Op1) { SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT, SDValue Op1) {
SDVTList VTs = getVTList(VT); SDVTList VTs = getVTList(VT);
SDValue Ops[] = { Op1 }; SDValue Ops[] = { Op1 };
return getMachineNode(Opcode, dl, VTs, Ops, array_lengthof(Ops)); return getMachineNode(Opcode, dl, VTs, Ops, array_lengthof(Ops));
} }
SDNode *SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT, MachineSDNode *
SDValue Op1, SDValue Op2) { SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT,
SDValue Op1, SDValue Op2) {
SDVTList VTs = getVTList(VT); SDVTList VTs = getVTList(VT);
SDValue Ops[] = { Op1, Op2 }; SDValue Ops[] = { Op1, Op2 };
return getMachineNode(Opcode, dl, VTs, Ops, array_lengthof(Ops)); return getMachineNode(Opcode, dl, VTs, Ops, array_lengthof(Ops));
} }
SDNode *SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT, MachineSDNode *
SDValue Op1, SDValue Op2, SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT,
SDValue Op3) { SDValue Op1, SDValue Op2, SDValue Op3) {
SDVTList VTs = getVTList(VT); SDVTList VTs = getVTList(VT);
SDValue Ops[] = { Op1, Op2, Op3 }; SDValue Ops[] = { Op1, Op2, Op3 };
return getMachineNode(Opcode, dl, VTs, Ops, array_lengthof(Ops)); return getMachineNode(Opcode, dl, VTs, Ops, array_lengthof(Ops));
} }
SDNode *SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT, MachineSDNode *
const SDValue *Ops, unsigned NumOps) { SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT,
const SDValue *Ops, unsigned NumOps) {
SDVTList VTs = getVTList(VT); SDVTList VTs = getVTList(VT);
return getMachineNode(Opcode, dl, VTs, Ops, NumOps); return getMachineNode(Opcode, dl, VTs, Ops, NumOps);
} }
SDNode *SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, MachineSDNode *
EVT VT1, EVT VT2) { SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT1, EVT VT2) {
SDVTList VTs = getVTList(VT1, VT2); SDVTList VTs = getVTList(VT1, VT2);
return getMachineNode(Opcode, dl, VTs, 0, 0); return getMachineNode(Opcode, dl, VTs, 0, 0);
} }
SDNode *SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT1, MachineSDNode *
EVT VT2, SDValue Op1) { SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl,
EVT VT1, EVT VT2, SDValue Op1) {
SDVTList VTs = getVTList(VT1, VT2); SDVTList VTs = getVTList(VT1, VT2);
SDValue Ops[] = { Op1 }; SDValue Ops[] = { Op1 };
return getMachineNode(Opcode, dl, VTs, Ops, array_lengthof(Ops)); return getMachineNode(Opcode, dl, VTs, Ops, array_lengthof(Ops));
} }
SDNode *SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT1, MachineSDNode *
EVT VT2, SDValue Op1, SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl,
SDValue Op2) { EVT VT1, EVT VT2, SDValue Op1, SDValue Op2) {
SDVTList VTs = getVTList(VT1, VT2); SDVTList VTs = getVTList(VT1, VT2);
SDValue Ops[] = { Op1, Op2 }; SDValue Ops[] = { Op1, Op2 };
return getMachineNode(Opcode, dl, VTs, Ops, array_lengthof(Ops)); return getMachineNode(Opcode, dl, VTs, Ops, array_lengthof(Ops));
} }
SDNode *SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT1, MachineSDNode *
EVT VT2, SDValue Op1, SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl,
SDValue Op2, SDValue Op3) { EVT VT1, EVT VT2, SDValue Op1,
SDValue Op2, SDValue Op3) {
SDVTList VTs = getVTList(VT1, VT2); SDVTList VTs = getVTList(VT1, VT2);
SDValue Ops[] = { Op1, Op2, Op3 }; SDValue Ops[] = { Op1, Op2, Op3 };
return getMachineNode(Opcode, dl, VTs, Ops, array_lengthof(Ops)); return getMachineNode(Opcode, dl, VTs, Ops, array_lengthof(Ops));
} }
SDNode *SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, MachineSDNode *
EVT VT1, EVT VT2, SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl,
const SDValue *Ops, unsigned NumOps) { EVT VT1, EVT VT2,
const SDValue *Ops, unsigned NumOps) {
SDVTList VTs = getVTList(VT1, VT2); SDVTList VTs = getVTList(VT1, VT2);
return getMachineNode(Opcode, dl, VTs, Ops, NumOps); return getMachineNode(Opcode, dl, VTs, Ops, NumOps);
} }
SDNode *SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, MachineSDNode *
EVT VT1, EVT VT2, EVT VT3, SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl,
SDValue Op1, SDValue Op2) { EVT VT1, EVT VT2, EVT VT3,
SDValue Op1, SDValue Op2) {
SDVTList VTs = getVTList(VT1, VT2, VT3); SDVTList VTs = getVTList(VT1, VT2, VT3);
SDValue Ops[] = { Op1, Op2 }; SDValue Ops[] = { Op1, Op2 };
return getMachineNode(Opcode, dl, VTs, Ops, array_lengthof(Ops)); return getMachineNode(Opcode, dl, VTs, Ops, array_lengthof(Ops));
} }
SDNode *SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, MachineSDNode *
EVT VT1, EVT VT2, EVT VT3, SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl,
SDValue Op1, SDValue Op2, EVT VT1, EVT VT2, EVT VT3,
SDValue Op3) { SDValue Op1, SDValue Op2, SDValue Op3) {
SDVTList VTs = getVTList(VT1, VT2, VT3); SDVTList VTs = getVTList(VT1, VT2, VT3);
SDValue Ops[] = { Op1, Op2, Op3 }; SDValue Ops[] = { Op1, Op2, Op3 };
return getMachineNode(Opcode, dl, VTs, Ops, array_lengthof(Ops)); return getMachineNode(Opcode, dl, VTs, Ops, array_lengthof(Ops));
} }
SDNode *SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, MachineSDNode *
EVT VT1, EVT VT2, EVT VT3, SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl,
const SDValue *Ops, unsigned NumOps) { EVT VT1, EVT VT2, EVT VT3,
const SDValue *Ops, unsigned NumOps) {
SDVTList VTs = getVTList(VT1, VT2, VT3); SDVTList VTs = getVTList(VT1, VT2, VT3);
return getMachineNode(Opcode, dl, VTs, Ops, NumOps); return getMachineNode(Opcode, dl, VTs, Ops, NumOps);
} }
SDNode *SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT1, MachineSDNode *
EVT VT2, EVT VT3, EVT VT4, SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT1,
const SDValue *Ops, unsigned NumOps) { EVT VT2, EVT VT3, EVT VT4,
const SDValue *Ops, unsigned NumOps) {
SDVTList VTs = getVTList(VT1, VT2, VT3, VT4); SDVTList VTs = getVTList(VT1, VT2, VT3, VT4);
return getMachineNode(Opcode, dl, VTs, Ops, NumOps); return getMachineNode(Opcode, dl, VTs, Ops, NumOps);
} }
SDNode *SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, MachineSDNode *
const std::vector<EVT> &ResultTys, SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl,
const SDValue *Ops, unsigned NumOps) { const std::vector<EVT> &ResultTys,
const SDValue *Ops, unsigned NumOps) {
SDVTList VTs = getVTList(&ResultTys[0], ResultTys.size()); SDVTList VTs = getVTList(&ResultTys[0], ResultTys.size());
return getMachineNode(Opcode, dl, VTs, Ops, NumOps); return getMachineNode(Opcode, dl, VTs, Ops, NumOps);
} }
SDNode *SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc DL, SDVTList VTs, MachineSDNode *
const SDValue *Ops, unsigned NumOps) { SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc DL, SDVTList VTs,
const SDValue *Ops, unsigned NumOps) {
bool DoCSE = VTs.VTs[VTs.NumVTs-1] != MVT::Flag; bool DoCSE = VTs.VTs[VTs.NumVTs-1] != MVT::Flag;
MachineSDNode *N; MachineSDNode *N;
void *IP; void *IP;
@ -4730,7 +4741,7 @@ SDNode *SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc DL, SDVTList VTs,
AddNodeIDNode(ID, ~Opcode, VTs, Ops, NumOps); AddNodeIDNode(ID, ~Opcode, VTs, Ops, NumOps);
IP = 0; IP = 0;
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
return E; return cast<MachineSDNode>(E);
} }
// Allocate a new MachineSDNode. // Allocate a new MachineSDNode.