[llvm-commits] CVS: llvm/include/llvm/CodeGen/SelectionDAG.h SelectionDAGNodes.h
Chris Lattner
lattner at cs.uiuc.edu
Fri Jan 7 13:09:09 PST 2005
Changes in directory llvm/include/llvm/CodeGen:
SelectionDAG.h updated: 1.7 -> 1.8
SelectionDAGNodes.h updated: 1.3 -> 1.4
---
Log message:
Add a new SelectionDAG::RemoveDeadNodes method
---
Diffs of the changes: (+20 -1)
Index: llvm/include/llvm/CodeGen/SelectionDAG.h
diff -u llvm/include/llvm/CodeGen/SelectionDAG.h:1.7 llvm/include/llvm/CodeGen/SelectionDAG.h:1.8
--- llvm/include/llvm/CodeGen/SelectionDAG.h:1.7 Fri Jan 7 01:45:38 2005
+++ llvm/include/llvm/CodeGen/SelectionDAG.h Fri Jan 7 15:08:55 2005
@@ -93,6 +93,12 @@
/// the graph.
void Legalize(TargetLowering &TLI);
+ /// RemoveDeadNodes - This method deletes all unreachable nodes in the
+ /// SelectionDAG, including nodes (like loads) that have uses of their token
+ /// chain but no other uses and no side effect. If a node is passed in as an
+ /// argument, it is used as the seed for node deletion.
+ void RemoveDeadNodes(SDNode *N = 0);
+
SDOperand getConstant(uint64_t Val, MVT::ValueType VT);
SDOperand getConstantFP(double Val, MVT::ValueType VT);
SDOperand getGlobalAddress(const GlobalValue *GV, MVT::ValueType VT);
@@ -150,6 +156,9 @@
}
void dump() const;
+
+private:
+ void DeleteNodeIfDead(SDNode *N, void *NodeSet);
};
}
Index: llvm/include/llvm/CodeGen/SelectionDAGNodes.h
diff -u llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.3 llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.4
--- llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.3 Fri Jan 7 13:21:49 2005
+++ llvm/include/llvm/CodeGen/SelectionDAGNodes.h Fri Jan 7 15:08:55 2005
@@ -409,6 +409,17 @@
void setValueTypes(std::vector<MVT::ValueType> &VTs) {
std::swap(Values, VTs);
}
+
+ void removeUser(SDNode *User) {
+ // Remove this user from the operand's use list.
+ for (unsigned i = Uses.size(); ; --i) {
+ assert(i != 0 && "Didn't find user!");
+ if (Uses[i-1] == User) {
+ Uses.erase(Uses.begin()+i-1);
+ break;
+ }
+ }
+ }
};
@@ -498,7 +509,6 @@
GlobalAddressSDNode(const GlobalValue *GA, MVT::ValueType VT)
: SDNode(ISD::GlobalAddress, VT) {
TheGlobal = const_cast<GlobalValue*>(GA);
-
}
public:
More information about the llvm-commits
mailing list