Moving on from Hello World

Hello everybody,

I’ve been following the guide at ( http://llvm.org/docs/WritingAnLLVMPass.html ) for Writing a llvm pass that outputs Hello World. After a little bit of help from Stackoverflow, this is now working fine and running.

My problem is that I’m struggling to get much further on from the hello world example - I’ve not been able to find the write incantation to access else of interest. All I’m looking to be able to at the moment is examine the SelectionDAG, and maybe print out the operations in the notes - can someone point me in the direction of a code fragment that I can drop into the hello world example that might let me achieve such a thing?

Thanks,

Joe

The SelectionDAG in particular is special; it's not accessible from
other passes.

-Eli

Ah - thank you Eli for your reply :slight_smile: obviously that’s a little disappointing :frowning: So if I did want to insert some code into llvm source on my machine (I’m building the debug version) that, say, iterated over the SelectionDAG - where might be a good place to put it?

Joe

SelectionDAGISel::CodeGenAndEmitDAG might be a decent place to start
looking. It really depends on what you're trying to do, though.

-Eli