diff options
author | Dan Gohman <gohman@apple.com> | 2008-07-09 23:03:14 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2008-07-09 23:03:14 +0000 |
commit | b9c33c32292d0ae5da2d75623a84a0e7796a2b63 (patch) | |
tree | 183104403198bc320675e679ecf019ad7c78ab3d /include | |
parent | 1373c1c3951ddd785d4f7f83c0bc89df699d22a0 (diff) | |
download | llvm-b9c33c32292d0ae5da2d75623a84a0e7796a2b63.tar.gz llvm-b9c33c32292d0ae5da2d75623a84a0e7796a2b63.tar.bz2 llvm-b9c33c32292d0ae5da2d75623a84a0e7796a2b63.tar.xz |
Simplify hasNUsesOfValue and hasAnyUsesOfValue even more. This
makes their special-case checks of use_size() less beneficial,
so remove them. This eliminates all but one use of use_size(),
which is in AssignTopologicalOrder, which uses it only once for
each node, and so can reasonably afford to recompute it, as
this allows the UsesSize field of SDNode to be removed
altogether.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53377 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/CodeGen/SelectionDAGNodes.h | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/include/llvm/CodeGen/SelectionDAGNodes.h b/include/llvm/CodeGen/SelectionDAGNodes.h index 16b406c0a5..745a9b6dfc 100644 --- a/include/llvm/CodeGen/SelectionDAGNodes.h +++ b/include/llvm/CodeGen/SelectionDAGNodes.h @@ -1048,9 +1048,6 @@ private: /// NumOperands/NumValues - The number of entries in the Operand/Value list. unsigned short NumOperands, NumValues; - /// UsesSize - The size of the uses list. - unsigned UsesSize; - /// Uses - List of uses for this SDNode. SDUse *Uses; @@ -1075,9 +1072,11 @@ public: return NodeType - ISD::BUILTIN_OP_END; } - size_t use_size() const { return UsesSize; } + size_t use_size() const { return std::distance(use_begin(), use_end()); } bool use_empty() const { return Uses == NULL; } - bool hasOneUse() const { return use_size() == 1; } + bool hasOneUse() const { + return !use_empty() && next(use_begin()) == use_end(); + } /// getNodeId - Return the unique node id. /// @@ -1249,7 +1248,7 @@ protected: } SDNode(unsigned Opc, SDVTList VTs, const SDOperand *Ops, unsigned NumOps) - : NodeType(Opc), NodeId(-1), UsesSize(0), Uses(NULL) { + : NodeType(Opc), NodeId(-1), Uses(NULL) { OperandsNeedDelete = true; NumOperands = NumOps; OperandList = NumOps ? new SDUse[NumOperands] : 0; @@ -1258,7 +1257,6 @@ protected: OperandList[i] = Ops[i]; OperandList[i].setUser(this); Ops[i].Val->addUse(OperandList[i]); - ++Ops[i].Val->UsesSize; } ValueList = VTs.VTs; @@ -1266,7 +1264,7 @@ protected: } SDNode(unsigned Opc, SDVTList VTs, const SDUse *Ops, unsigned NumOps) - : NodeType(Opc), NodeId(-1), UsesSize(0), Uses(NULL) { + : NodeType(Opc), NodeId(-1), Uses(NULL) { OperandsNeedDelete = true; NumOperands = NumOps; OperandList = NumOps ? new SDUse[NumOperands] : 0; @@ -1275,7 +1273,6 @@ protected: OperandList[i] = Ops[i]; OperandList[i].setUser(this); Ops[i].getSDOperand().Val->addUse(OperandList[i]); - ++Ops[i].getSDOperand().Val->UsesSize; } ValueList = VTs.VTs; @@ -1283,7 +1280,7 @@ protected: } SDNode(unsigned Opc, SDVTList VTs) - : NodeType(Opc), NodeId(-1), UsesSize(0), Uses(NULL) { + : NodeType(Opc), NodeId(-1), Uses(NULL) { OperandsNeedDelete = false; // Operands set with InitOperands. NumOperands = 0; OperandList = 0; @@ -1298,13 +1295,11 @@ protected: assert(OperandList == 0 && "Operands already set!"); NumOperands = NumOps; OperandList = Ops; - UsesSize = 0; Uses = NULL; for (unsigned i = 0; i != NumOps; ++i) { OperandList[i].setUser(this); Ops[i].getVal()->addUse(OperandList[i]); - ++Ops[i].getVal()->UsesSize; } } @@ -1323,14 +1318,12 @@ protected: void addUser(unsigned i, SDNode *User) { assert(User->OperandList[i].getUser() && "Node without parent"); addUse(User->OperandList[i]); - ++UsesSize; } void removeUser(unsigned i, SDNode *User) { assert(User->OperandList[i].getUser() && "Node without parent"); SDUse &Op = User->OperandList[i]; Op.removeFromList(); - --UsesSize; } }; |