Get rid of the global CFGOnly flag by threading a ShortNames parameters through the GraphViz rendering code.

Update other uses in the codebase for this change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74084 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Owen Anderson
2009-06-24 17:37:09 +00:00
parent 8539cfd30e
commit 8cbc94afb7
8 changed files with 57 additions and 49 deletions

View File

@ -295,12 +295,6 @@ void MachineFunction::print(std::ostream &OS) const {
OS << "\n# End machine code for " << Fn->getName () << "().\n\n";
}
/// CFGOnly flag - This is used to control whether or not the CFG graph printer
/// prints out the contents of basic blocks or not. This is acceptable because
/// this code is only really used for debugging purposes.
///
static bool CFGOnly = false;
namespace llvm {
template<>
struct DOTGraphTraits<const MachineFunction*> : public DefaultDOTGraphTraits {
@ -309,13 +303,14 @@ namespace llvm {
}
static std::string getNodeLabel(const MachineBasicBlock *Node,
const MachineFunction *Graph) {
if (CFGOnly && Node->getBasicBlock() &&
const MachineFunction *Graph,
bool ShortNames) {
if (ShortNames && Node->getBasicBlock() &&
!Node->getBasicBlock()->getName().empty())
return Node->getBasicBlock()->getName() + ":";
std::ostringstream Out;
if (CFGOnly) {
if (ShortNames) {
Out << Node->getNumber() << ':';
return Out.str();
}
@ -348,9 +343,12 @@ void MachineFunction::viewCFG() const
void MachineFunction::viewCFGOnly() const
{
CFGOnly = true;
viewCFG();
CFGOnly = false;
#ifndef NDEBUG
ViewGraph(this, "mf" + getFunction()->getName(), true);
#else
cerr << "SelectionDAG::viewGraph is only available in debug builds on "
<< "systems with Graphviz or gv!\n";
#endif // NDEBUG
}
// The next two methods are used to construct and to retrieve