[LLVMdev] CFG as DOT: where do node addresses come from?

Jakob Stoklund Olesen stoklund at 2pi.dk
Mon Mar 15 17:57:19 PDT 2010


On Mar 15, 2010, at 4:22 PM, Trevor Harmon wrote:

> Hi,
> 
> The -dot-cfg option of opt will write a diagram of an analyzed  
> function's CFG to DOT format. If you then open the DOT file, you will  
> see that the BasicBlocks are uniquely identified with hexadecimal  
> addresses. For example, an edge from one block to another may look like:
> 
> 	Node0x10026b0:s0 -> Node0x1004c20;
> 
> I've been trying to figure out where these hexadecimal addresses come  
> from. I've been up and down the code but remain at a loss. I can see  
> where GraphWriter.h is actually writing the strings to the DOT file,  
> and I can see that some of the DOT data is coming from DOTGraphTraits  
> in CFGPrinter.h. But the hexadecimal addresses are a mystery. I  
> thought perhaps a BasicBlock method, such as getName, might be  
> producing the addresses, but no.

>From GraphWriter.h:

    O << "\tNode" << static_cast<const void*>(Node) << " [shape=record,";

Printing a pointer on a raw_ostream produces a hexadecimal address.






More information about the llvm-dev mailing list