From: Chris Lattner Date: Mon, 17 Oct 2005 01:36:23 +0000 (+0000) Subject: Add notes about MF.viewCFG() and friends. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=f623a0844110f3d753296ec61f683349f05058ac;p=oota-llvm.git Add notes about MF.viewCFG() and friends. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23765 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/docs/ProgrammersManual.html b/docs/ProgrammersManual.html index 464618aa37a..e4d50039f60 100644 --- a/docs/ProgrammersManual.html +++ b/docs/ProgrammersManual.html @@ -41,6 +41,7 @@ option
  • The InstVisitor template
  • The general graph API --> +
  • Viewing graphs while debugging code
  • Helpful Hints for Common Operations @@ -491,6 +492,44 @@ maintainable and useful.

    + + + +
    + +

    Several of the important data structures in LLVM are graphs: for example +CFGs made out of LLVM BasicBlocks, CFGs made out of +LLVM MachineBasicBlocks, and +Instruction Selection +DAGs. In many cases, while debugging various parts of the compiler, it is +nice to instantly visualize these graphs.

    + +

    LLVM provides several callbacks that are available in a debug build to do +exactly that. If you call the Function::viewCFG() method, for example, +the current LLVM tool will pop up a window containing the CFG for the function +where each basic block is a node in the graph, and each node contains the +instructions in the block. Similarly, there also exists +Function::viewCFGOnly() (does not include the instructions), the +MachineFunction::viewCFG() and MachineFunction::viewCFGOnly(), +and the SelectionDAG::viewGraph() methods. Within GDB, for example, +you can usually use something like "call DAG.viewGraph()" to pop +up a window. Alternatively, you can sprinkle calls to these functions in your +code in places you want to debug.

    + +

    Getting this to work requires a small amount of configuration. On Unix +systems with X11, install the graphviz +toolkit, and make sure 'dot' and 'gv' are in your path. If you are running on +Mac OS/X, download and install the Mac OS/X Graphviz program, and add +/Applications/Graphviz.app/Contents/MacOS/ (or whereever you install +it) to your path. Once in your system and path are set up, rerun the LLVM +configure script and rebuild LLVM to enable this functionality.

    + +
    + +