[LLVMdev] idf_iterator and MachineFunctions
Lang Hames
lhames at gmail.com
Sun Mar 18 00:22:47 PDT 2007
Hi,
I need to do an inverse-depth-first iteration over the basic blocks in
a machine function (i.e. starting from the last block and following
predecessor edges) for a liveness analysis I'm writing.
idf_iterator seems like it's almost the class I need, but it starts at
the first block in the function at present, rather than the last one
(because of the specialisiation of GraphTraits for
Inverse<MachineFunction*> - getEntryNode returns mf->front()). That
seems odd to me - you can only ever get to the first block with it
(incrementing the iterator once yields idf_end(mf), and there's no
decrement operation).
Is this behaviour intentional?
If it is I'll need to write some inverse iteration functions myself.
Is there a recommended way to find the final block (the one with
successors={}) in a machine function? (will mf->back() always return
it?)
Thanks,
Lang.
More information about the llvm-dev
mailing list