[LLVMdev] inserting blocks into a Function
Sameer D. Sahasrabuddhe
sameerds at it.iitb.ac.in
Thu Apr 28 21:50:46 PDT 2005
On Thu, Apr 28, 2005 at 11:22:26PM -0500, Chris Lattner wrote:
> BasicBlock *SplitBlockPredecessors(BasicBlock *BB, const char *Suffix,
> const std::vector<BasicBlock*> &Preds);
>
> Basically, given a BB with multiple predecessors, it inserts (and returns)
> a new block, moving the predecessors in Preds to the new block and leaving
> the rest to the old block. The loop-simplify pass uses this to do
> preheader insertion and other fun stuff.
Great! SplitBlockPredecessors is exactly the function that I was
thinking of ... hadn't noticed the LoopSimplify pass before ...
although the pass I am working on is different, I can leave the
preheader insertion to LoopSimplify and forget about it.
I was wondering, the above function seems general enough to be
available as a utility function by itself ... but since I am not a
compiler guy myself, dunno if anyone actually ends up needing such a
function. Anyway, the LoopSimplify code's been quite helpful as a
quick intro to handling side-effects when modifying the CFG.
Thanks!
Sameer.
--
Research Scholar, KReSIT, IIT Bombay
http://www.it.iitb.ac.in/~sameerds/
More information about the llvm-dev
mailing list