[llvm-commits] CVS: llvm/include/llvm/CodeGen/SelectionDAG.h SelectionDAGNodes.h
Evan Cheng
evan.cheng at apple.com
Wed Jul 26 23:38:35 PDT 2006
Changes in directory llvm/include/llvm/CodeGen:
SelectionDAG.h updated: 1.102 -> 1.103
SelectionDAGNodes.h updated: 1.136 -> 1.137
---
Log message:
Remove NodeDepth; Add NodeId which is a unique id per node per DAG. It can only be set by SelectionDAG.
---
Diffs of the changes: (+21 -41)
SelectionDAG.h | 6 ++++-
SelectionDAGNodes.h | 56 ++++++++++++++--------------------------------------
2 files changed, 21 insertions(+), 41 deletions(-)
Index: llvm/include/llvm/CodeGen/SelectionDAG.h
diff -u llvm/include/llvm/CodeGen/SelectionDAG.h:1.102 llvm/include/llvm/CodeGen/SelectionDAG.h:1.103
--- llvm/include/llvm/CodeGen/SelectionDAG.h:1.102 Thu Jun 29 18:57:05 2006
+++ llvm/include/llvm/CodeGen/SelectionDAG.h Thu Jul 27 01:38:21 2006
@@ -421,7 +421,11 @@
/// DeleteNode - Remove the specified node from the system. This node must
/// have no referrers.
void DeleteNode(SDNode *N);
-
+
+ /// AssignNodeIds - Assign a unique node id for each node in the DAG. It
+ /// returns the maximum id.
+ int AssignNodeIds();
+
void dump() const;
/// InsertISelMapEntry - A helper function to insert a key / element pair
Index: llvm/include/llvm/CodeGen/SelectionDAGNodes.h
diff -u llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.136 llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.137
--- llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.136 Tue Jul 18 19:00:37 2006
+++ llvm/include/llvm/CodeGen/SelectionDAGNodes.h Thu Jul 27 01:38:21 2006
@@ -654,7 +654,6 @@
// Forwarding methods - These forward to the corresponding methods in SDNode.
inline unsigned getOpcode() const;
- inline unsigned getNodeDepth() const;
inline unsigned getNumOperands() const;
inline const SDOperand &getOperand(unsigned i) const;
inline bool isTargetOpcode() const;
@@ -689,10 +688,8 @@
///
unsigned short NodeType;
- /// NodeDepth - Node depth is defined as MAX(Node depth of children)+1. This
- /// means that leaves have a depth of 1, things that use only leaves have a
- /// depth of 2, etc.
- unsigned short NodeDepth;
+ /// NodeId - Unique id per SDNode in the DAG.
+ int NodeId;
/// OperandList - The values that are used by this operation.
///
@@ -736,9 +733,9 @@
bool use_empty() const { return Uses.empty(); }
bool hasOneUse() const { return Uses.size() == 1; }
- /// getNodeDepth - Return the distance from this node to the leaves in the
- /// graph. The leaves have a depth of 1.
- unsigned getNodeDepth() const { return NodeDepth; }
+ /// getNodeId - Return the unique node id.
+ ///
+ int getNodeId() const { return NodeId; }
typedef std::vector<SDNode*>::const_iterator use_iterator;
use_iterator use_begin() const { return Uses.begin(); }
@@ -799,14 +796,14 @@
///
static MVT::ValueType *getValueTypeList(MVT::ValueType VT);
- SDNode(unsigned NT, MVT::ValueType VT) : NodeType(NT), NodeDepth(1) {
+ SDNode(unsigned NT, MVT::ValueType VT) : NodeType(NT), NodeId(-1) {
OperandList = 0; NumOperands = 0;
ValueList = getValueTypeList(VT);
NumValues = 1;
Prev = 0; Next = 0;
}
SDNode(unsigned NT, SDOperand Op)
- : NodeType(NT), NodeDepth(Op.Val->getNodeDepth()+1) {
+ : NodeType(NT), NodeId(-1) {
OperandList = new SDOperand[1];
OperandList[0] = Op;
NumOperands = 1;
@@ -816,11 +813,7 @@
Prev = 0; Next = 0;
}
SDNode(unsigned NT, SDOperand N1, SDOperand N2)
- : NodeType(NT) {
- if (N1.Val->getNodeDepth() > N2.Val->getNodeDepth())
- NodeDepth = N1.Val->getNodeDepth()+1;
- else
- NodeDepth = N2.Val->getNodeDepth()+1;
+ : NodeType(NT), NodeId(-1) {
OperandList = new SDOperand[2];
OperandList[0] = N1;
OperandList[1] = N2;
@@ -831,14 +824,7 @@
Prev = 0; Next = 0;
}
SDNode(unsigned NT, SDOperand N1, SDOperand N2, SDOperand N3)
- : NodeType(NT) {
- unsigned ND = N1.Val->getNodeDepth();
- if (ND < N2.Val->getNodeDepth())
- ND = N2.Val->getNodeDepth();
- if (ND < N3.Val->getNodeDepth())
- ND = N3.Val->getNodeDepth();
- NodeDepth = ND+1;
-
+ : NodeType(NT), NodeId(-1) {
OperandList = new SDOperand[3];
OperandList[0] = N1;
OperandList[1] = N2;
@@ -852,16 +838,7 @@
Prev = 0; Next = 0;
}
SDNode(unsigned NT, SDOperand N1, SDOperand N2, SDOperand N3, SDOperand N4)
- : NodeType(NT) {
- unsigned ND = N1.Val->getNodeDepth();
- if (ND < N2.Val->getNodeDepth())
- ND = N2.Val->getNodeDepth();
- if (ND < N3.Val->getNodeDepth())
- ND = N3.Val->getNodeDepth();
- if (ND < N4.Val->getNodeDepth())
- ND = N4.Val->getNodeDepth();
- NodeDepth = ND+1;
-
+ : NodeType(NT), NodeId(-1) {
OperandList = new SDOperand[4];
OperandList[0] = N1;
OperandList[1] = N2;
@@ -875,18 +852,16 @@
NumValues = 0;
Prev = 0; Next = 0;
}
- SDNode(unsigned Opc, const std::vector<SDOperand> &Nodes) : NodeType(Opc) {
+ SDNode(unsigned Opc, const std::vector<SDOperand> &Nodes)
+ : NodeType(Opc), NodeId(-1) {
NumOperands = Nodes.size();
OperandList = new SDOperand[NumOperands];
- unsigned ND = 0;
for (unsigned i = 0, e = Nodes.size(); i != e; ++i) {
OperandList[i] = Nodes[i];
SDNode *N = OperandList[i].Val;
N->Uses.push_back(this);
- if (ND < N->getNodeDepth()) ND = N->getNodeDepth();
}
- NodeDepth = ND+1;
ValueList = 0;
NumValues = 0;
Prev = 0; Next = 0;
@@ -1035,6 +1010,10 @@
}
}
}
+
+ void setNodeId(int Id) {
+ NodeId = Id;
+ }
};
@@ -1043,9 +1022,6 @@
inline unsigned SDOperand::getOpcode() const {
return Val->getOpcode();
}
-inline unsigned SDOperand::getNodeDepth() const {
- return Val->getNodeDepth();
-}
inline MVT::ValueType SDOperand::getValueType() const {
return Val->getValueType(ResNo);
}
More information about the llvm-commits
mailing list