diff options
author | Dan Gohman <gohman@apple.com> | 2008-07-07 18:26:29 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2008-07-07 18:26:29 +0000 |
commit | 6d9cdd56173fb915a9e3a8f0f6b5a8ed9bed1098 (patch) | |
tree | f0fd01dcd9027f62e7e0176ab6bba577f17087d9 /include/llvm/CodeGen | |
parent | e4706a0b51cbb6ba74844dd70a51a5fea0d2c336 (diff) |
Remove most of the uses of SDOperandPtr, usually replacing it with a
simple const SDOperand*, which is what's usually needed.
For AddNodeIDOperands, which is small, just duplicate the function to
accept an SDUse*.
For SelectionDAG::getNode - Add an overload that accepts SDUse* that
copies the operands into a temporary SDOperand array, but also has
special-case checks for 0 through 3 operands to avoid the copy in
the common cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53183 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen')
-rw-r--r-- | include/llvm/CodeGen/SelectionDAG.h | 42 | ||||
-rw-r--r-- | include/llvm/CodeGen/SelectionDAGNodes.h | 8 |
2 files changed, 27 insertions, 23 deletions
diff --git a/include/llvm/CodeGen/SelectionDAG.h b/include/llvm/CodeGen/SelectionDAG.h index 4f532ba43b..6568d90951 100644 --- a/include/llvm/CodeGen/SelectionDAG.h +++ b/include/llvm/CodeGen/SelectionDAG.h @@ -306,11 +306,14 @@ public: SDOperand getNode(unsigned Opcode, MVT VT, SDOperand N1, SDOperand N2, SDOperand N3, SDOperand N4, SDOperand N5); - SDOperand getNode(unsigned Opcode, MVT VT, SDOperandPtr Ops, unsigned NumOps); + SDOperand getNode(unsigned Opcode, MVT VT, + const SDOperand *Ops, unsigned NumOps); + SDOperand getNode(unsigned Opcode, MVT VT, + const SDUse *Ops, unsigned NumOps); SDOperand getNode(unsigned Opcode, std::vector<MVT> &ResultTys, - SDOperandPtr Ops, unsigned NumOps); + const SDOperand *Ops, unsigned NumOps); SDOperand getNode(unsigned Opcode, const MVT *VTs, unsigned NumVTs, - SDOperandPtr Ops, unsigned NumOps); + const SDOperand *Ops, unsigned NumOps); SDOperand getNode(unsigned Opcode, SDVTList VTs); SDOperand getNode(unsigned Opcode, SDVTList VTs, SDOperand N); SDOperand getNode(unsigned Opcode, SDVTList VTs, SDOperand N1, SDOperand N2); @@ -322,7 +325,7 @@ public: SDOperand N1, SDOperand N2, SDOperand N3, SDOperand N4, SDOperand N5); SDOperand getNode(unsigned Opcode, SDVTList VTs, - SDOperandPtr Ops, unsigned NumOps); + const SDOperand *Ops, unsigned NumOps); SDOperand getMemcpy(SDOperand Chain, SDOperand Dst, SDOperand Src, SDOperand Size, unsigned Align, @@ -383,13 +386,13 @@ public: /// getMergeValues - Create a MERGE_VALUES node from the given operands. /// Allowed to return something different (and simpler) if Simplify is true. - SDOperand getMergeValues(SDOperandPtr Ops, unsigned NumOps, + SDOperand getMergeValues(const SDOperand *Ops, unsigned NumOps, bool Simplify = true); /// getMergeValues - Create a MERGE_VALUES node from the given types and ops. /// Allowed to return something different (and simpler) if Simplify is true. /// May be faster than the above version if VTs is known and NumOps is large. - SDOperand getMergeValues(SDVTList VTs, SDOperandPtr Ops, unsigned NumOps, + SDOperand getMergeValues(SDVTList VTs, const SDOperand *Ops, unsigned NumOps, bool Simplify = true) { if (Simplify && NumOps == 1) return Ops[0]; @@ -446,7 +449,8 @@ public: SDOperand Op3, SDOperand Op4); SDOperand UpdateNodeOperands(SDOperand N, SDOperand Op1, SDOperand Op2, SDOperand Op3, SDOperand Op4, SDOperand Op5); - SDOperand UpdateNodeOperands(SDOperand N, SDOperandPtr Ops, unsigned NumOps); + SDOperand UpdateNodeOperands(SDOperand N, + const SDOperand *Ops, unsigned NumOps); /// SelectNodeTo - These are used for target selectors to *mutate* the /// specified node to have the specified return type, Target opcode, and @@ -460,12 +464,12 @@ public: SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT, SDOperand Op1, SDOperand Op2, SDOperand Op3); SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT, - SDOperandPtr Ops, unsigned NumOps); + const SDOperand *Ops, unsigned NumOps); SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT1, MVT VT2); SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT1, - MVT VT2, SDOperandPtr Ops, unsigned NumOps); + MVT VT2, const SDOperand *Ops, unsigned NumOps); SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT1, - MVT VT2, MVT VT3, SDOperandPtr Ops, unsigned NumOps); + MVT VT2, MVT VT3, const SDOperand *Ops, unsigned NumOps); SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT1, MVT VT2, SDOperand Op1); SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT1, @@ -473,7 +477,7 @@ public: SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT1, MVT VT2, SDOperand Op1, SDOperand Op2, SDOperand Op3); SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, SDVTList VTs, - SDOperandPtr Ops, unsigned NumOps); + const SDOperand *Ops, unsigned NumOps); /// getTargetNode - These are used for target selectors to create a new node @@ -488,7 +492,7 @@ public: SDNode *getTargetNode(unsigned Opcode, MVT VT, SDOperand Op1, SDOperand Op2, SDOperand Op3); SDNode *getTargetNode(unsigned Opcode, MVT VT, - SDOperandPtr Ops, unsigned NumOps); + const SDOperand *Ops, unsigned NumOps); SDNode *getTargetNode(unsigned Opcode, MVT VT1, MVT VT2); SDNode *getTargetNode(unsigned Opcode, MVT VT1, MVT VT2, SDOperand Op1); SDNode *getTargetNode(unsigned Opcode, MVT VT1, @@ -496,22 +500,22 @@ public: SDNode *getTargetNode(unsigned Opcode, MVT VT1, MVT VT2, SDOperand Op1, SDOperand Op2, SDOperand Op3); SDNode *getTargetNode(unsigned Opcode, MVT VT1, MVT VT2, - SDOperandPtr Ops, unsigned NumOps); + const SDOperand *Ops, unsigned NumOps); SDNode *getTargetNode(unsigned Opcode, MVT VT1, MVT VT2, MVT VT3, SDOperand Op1, SDOperand Op2); SDNode *getTargetNode(unsigned Opcode, MVT VT1, MVT VT2, MVT VT3, SDOperand Op1, SDOperand Op2, SDOperand Op3); SDNode *getTargetNode(unsigned Opcode, MVT VT1, MVT VT2, MVT VT3, - SDOperandPtr Ops, unsigned NumOps); + const SDOperand *Ops, unsigned NumOps); SDNode *getTargetNode(unsigned Opcode, MVT VT1, MVT VT2, MVT VT3, MVT VT4, - SDOperandPtr Ops, unsigned NumOps); + const SDOperand *Ops, unsigned NumOps); SDNode *getTargetNode(unsigned Opcode, std::vector<MVT> &ResultTys, - SDOperandPtr Ops, unsigned NumOps); + const SDOperand *Ops, unsigned NumOps); /// getNodeIfExists - Get the specified node if it's already available, or /// else return NULL. SDNode *getNodeIfExists(unsigned Opcode, SDVTList VTs, - SDOperandPtr Ops, unsigned NumOps); + const SDOperand *Ops, unsigned NumOps); /// DAGUpdateListener - Clients of various APIs that cause global effects on /// the DAG can optionally implement this interface. This allows the clients @@ -546,7 +550,7 @@ public: DAGUpdateListener *UpdateListener = 0); void ReplaceAllUsesWith(SDNode *From, SDNode *To, DAGUpdateListener *UpdateListener = 0); - void ReplaceAllUsesWith(SDNode *From, SDOperandPtr To, + void ReplaceAllUsesWith(SDNode *From, const SDOperand *To, DAGUpdateListener *UpdateListener = 0); /// ReplaceAllUsesOfValueWith - Replace any uses of From with To, leaving @@ -638,7 +642,7 @@ private: SDNode *FindModifiedNodeSlot(SDNode *N, SDOperand Op, void *&InsertPos); SDNode *FindModifiedNodeSlot(SDNode *N, SDOperand Op1, SDOperand Op2, void *&InsertPos); - SDNode *FindModifiedNodeSlot(SDNode *N, SDOperandPtr Ops, unsigned NumOps, + SDNode *FindModifiedNodeSlot(SDNode *N, const SDOperand *Ops, unsigned NumOps, void *&InsertPos); void DeleteNodeNotInCSEMaps(SDNode *N); diff --git a/include/llvm/CodeGen/SelectionDAGNodes.h b/include/llvm/CodeGen/SelectionDAGNodes.h index 0831d43f5d..f5ab0707c4 100644 --- a/include/llvm/CodeGen/SelectionDAGNodes.h +++ b/include/llvm/CodeGen/SelectionDAGNodes.h @@ -1271,7 +1271,7 @@ protected: Prev = 0; Next = 0; } - SDNode(unsigned Opc, SDVTList VTs, SDOperandPtr Ops, unsigned NumOps) + SDNode(unsigned Opc, SDVTList VTs, const SDUse *Ops, unsigned NumOps) : NodeType(Opc), NodeId(-1), UsesSize(0), Uses(NULL) { OperandsNeedDelete = true; NumOperands = NumOps; @@ -1280,8 +1280,8 @@ protected: for (unsigned i = 0; i != NumOps; ++i) { OperandList[i] = Ops[i]; OperandList[i].setUser(this); - Ops[i].Val->addUse(OperandList[i]); - ++Ops[i].Val->UsesSize; + Ops[i].getSDOperand().Val->addUse(OperandList[i]); + ++Ops[i].getSDOperand().Val->UsesSize; } ValueList = VTs.VTs; @@ -1320,7 +1320,7 @@ protected: /// opcode, types, and operands to the specified value. This should only be /// used by the SelectionDAG class. void MorphNodeTo(unsigned Opc, SDVTList L, - SDOperandPtr Ops, unsigned NumOps); + const SDOperand *Ops, unsigned NumOps); void addUser(unsigned i, SDNode *User) { assert(User->OperandList[i].getUser() && "Node without parent"); |