Add edge source labels to SelectionDAG graphs, now that the graph printing

framework omits differentiated edge sources in the case where the labels
are empty strings.

llvm-svn: 90254
This commit is contained in:
Dan Gohman 2009-12-01 19:20:00 +00:00
parent 8def6e3daf
commit b2ae02979f
2 changed files with 10 additions and 0 deletions

View File

@ -2397,6 +2397,11 @@ public:
SDNodeIterator operator++(int) { // Postincrement
SDNodeIterator tmp = *this; ++*this; return tmp;
}
size_t operator-(SDNodeIterator Other) const {
assert(Node == Other.Node &&
"Cannot compare iterators of two different nodes!");
return Operand - Other.Operand;
}
static SDNodeIterator begin(SDNode *N) { return SDNodeIterator(N, 0); }
static SDNodeIterator end (SDNode *N) {

View File

@ -50,6 +50,11 @@ namespace llvm {
return ((const SDNode *) Node)->getValueType(i).getEVTString();
}
template<typename EdgeIter>
static std::string getEdgeSourceLabel(const void *Node, EdgeIter I) {
return itostr(I - SDNodeIterator::begin((SDNode *) Node));
}
/// edgeTargetsEdgeSource - This method returns true if this outgoing edge
/// should actually target another edge source, not a node. If this method
/// is implemented, getEdgeTarget should be implemented.