[LLVMdev] idf_iterator and MachineFunctions

Chris Lattner sabre at nondot.org
Sun Mar 18 18:11:49 PDT 2007


On Sun, 18 Mar 2007, Lang Hames wrote:
> 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.

As Gordon mentioned, there isn't a trivial way to do this, as there isn't 
a single exit node in the MBB CFG.

> 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).

That seems odd to me too.  It sounds like Inverse<MF*> should be removed.

-Chris

-- 
http://nondot.org/sabre/
http://llvm.org/



More information about the llvm-dev mailing list