43 return ((
const SDNode *) Node)->getNumValues();
47 return ((
const SDNode *) Node)->getValueType(i).getEVTString();
50 template<
typename EdgeIter>
58 template<
typename EdgeIter>
66 template<
typename EdgeIter>
89 template<
typename EdgeIter>
95 return "color=red,style=bold";
97 return "color=blue,style=dashed";
116 if (!Attrs.empty()) {
117 if (Attrs.find(
"shape=") == std::string::npos)
118 return std::string(
"shape=Mrecord,") + Attrs;
123 return "shape=Mrecord";
131 "color=blue,style=dashed");
151 errs() <<
"SelectionDAG::viewGraph is only available in debug builds on "
152 <<
"systems with Graphviz or gv!\n";
168 errs() <<
"SelectionDAG::clearGraphAttrs is only available in debug builds"
169 <<
" on systems with Graphviz or gv!\n";
180 errs() <<
"SelectionDAG::setGraphAttrs is only available in debug builds"
181 <<
" on systems with Graphviz or gv!\n";
190 std::map<const SDNode *, std::string>::const_iterator
I =
198 errs() <<
"SelectionDAG::getGraphAttrs is only available in debug builds"
199 <<
" on systems with Graphviz or gv!\n";
200 return std::string();
210 errs() <<
"SelectionDAG::setGraphColor is only available in debug builds"
211 <<
" on systems with Graphviz or gv!\n";
219 int level,
bool &printed) {
220 bool hit_limit =
false;
226 DEBUG(
dbgs() <<
"setSubgraphColor hit max level\n");
231 unsigned oldSize = visited.
size();
233 if (visited.
size() != oldSize) {
238 hit_limit = setSubgraphColorHelper(*i, Color, visited, level+1, printed) || hit_limit;
242 errs() <<
"SelectionDAG::setSubgraphColor is only available in debug builds"
243 <<
" on systems with Graphviz or gv!\n";
253 bool printed =
false;
254 if (setSubgraphColorHelper(N, Color, visited, 0, printed)) {
256 if (
strcmp(Color,
"red") == 0) {
257 setSubgraphColorHelper(N,
"blue", visited, 0, printed);
258 }
else if (
strcmp(Color,
"yellow") == 0) {
259 setSubgraphColorHelper(N,
"green", visited, 0, printed);
264 errs() <<
"SelectionDAG::setSubgraphColor is only available in debug builds"
265 <<
" on systems with Graphviz or gv!\n";
272 O <<
"SU(" << SU->
NodeNum <<
"): ";
277 while (!GluedNodes.
empty()) {
278 O << DOTGraphTraits<SelectionDAG*>
279 ::getSimpleNodeLabel(GluedNodes.
back(),
DAG);
281 if (!GluedNodes.
empty())
285 O <<
"CROSS RC COPY";
297 "color=blue,style=dashed");
static bool hasEdgeDestLabels()
int strcmp(const char *s1, const char *s2);
void push_back(const T &Elt)
void emitSimpleNode(const void *ID, const std::string &Attr, const std::string &Label, unsigned NumEdgeSources=0, const std::vector< std::string > *EdgeSourceLabels=0)
emitSimpleNode - Outputs a simple (non-record) node
static bool edgeTargetsEdgeSource(const void *Node, EdgeIter I)
const std::string getGraphAttrs(const SDNode *N) const
static std::string getSimpleNodeLabel(const SDNode *Node, const SelectionDAG *G)
static void addCustomGraphFeatures(SelectionDAG *G, GraphWriter< SelectionDAG * > &GW)
SDNode * getGluedNode() const
virtual void getCustomGraphFeatures(GraphWriter< ScheduleDAG * > &GW) const
static bool hasNodeAddressLabel(const SDNode *Node, const SelectionDAG *Graph)
void setSubgraphColor(SDNode *N, const char *Color)
const SDValue & getOperand(unsigned Num) const
static std::string getGraphName(const SelectionDAG *G)
static std::string getEdgeDestLabel(const void *Node, unsigned i)
virtual std::string getGraphNodeLabel(const SUnit *SU) const
unsigned getResNo() const
get the index which selects a specific result in the SDNode
static error_code advance(T &it, size_t Val)
MachineFunction & getMachineFunction() const
static unsigned numEdgeDestLabels(const void *Node)
static std::string getEdgeSourceLabel(const void *Node, EdgeIter I)
std::string getNodeLabel(const void *, const GraphType &)
static SDNodeIterator begin(const SDNode *N)
bool LLVM_ATTRIBUTE_UNUSED_RESULT empty() const
SDNode * getNode() const
get the SDNode which holds the desired result
void setGraphColor(const SDNode *N, const char *Color)
static std::string getEdgeAttributes(const void *Node, EdgeIter EI, const SelectionDAG *Graph)
void ViewGraph(const GraphType &G, const Twine &Name, bool ShortNames=false, const Twine &Title="", GraphProgram::Name Program=GraphProgram::DOT)
const SDNode * getNode() const
static std::string itostr(int64_t X)
static std::string getNodeAttributes(const SDNode *N, const SelectionDAG *Graph)
const SDValue & getRoot() const
std::pair< iterator, bool > insert(const ValueT &V)
DOTGraphTraits(bool isSimple=false)
static EdgeIter getEdgeTarget(const void *Node, EdgeIter I)
void print_details(raw_ostream &OS, const SelectionDAG *G) const
raw_ostream & dbgs()
dbgs - Return a circular-buffered debug stream.
std::map< const SDNode *, std::string > NodeGraphAttrs
std::string getName(ID id, ArrayRef< Type * > Tys=None)
static bool renderGraphFromBottomUp()
void setGraphAttrs(const SDNode *N, const char *Attrs)
static SDNodeIterator end(const SDNode *N)
StringRef getName() const
std::vector< SUnit > SUnits
void emitEdge(const void *SrcNodeID, int SrcNodePort, const void *DestNodeID, int DestNodePort, const std::string &Attrs)
emitEdge - Output an edge from a simple node into the graph...
SUnit - Scheduling unit. This is a node in the scheduling DAG.
std::string getOperationName(const SelectionDAG *G=0) const