[LLVMdev] Out of range address

Fernando Magno Quintao Pereira fernando at CS.UCLA.EDU
Tue Oct 3 16:35:59 PDT 2006

>>     I am having some problems when compiling huge programs (like gcc).
>> I have a machine pass to destroy critical edges, and I have to add
>> new basic blocks, but sometimes the program is too big, and the new
>> basic block gets out of addressing range.
> Make sure to run your pass before the PPC branch selection pass.  The
> branch selection pass is the one that makes sure that out-of-range
> branches are handled.  If you run after that, you have to do this
> yourself.

Thank you for the help, Chris.

     my pass runs before the branch selector, but the selector is not
resolving the branches that I changed due to critical edges. So, I
think I am forgetting to do something to guarantee that this will
happen. Could someone read this pseudo code to see if it makes sense?

     const BasicBlock * src_bb = src.getBasicBlock();
     const BasicBlock * dst_bb = dst.getBasicBlock();
     MachineBasicBlock * crit_mbb = new MachineBasicBlock(src_bb);

     /// modify the llvm control flow graph
     src.removeSuccessor(& dst);
     crit_mbb->addSuccessor(& dst);

     /// insert the new block into the machine function.
     mf.getBasicBlockList().insert(mf.end(), crit_mbb);

     /// insert a unconditional branch linking the new block to dst
     /// modify every branch in src that points to dst to point to the new
     /// machine basic block instead:
     /// Change all the phi functions in dst, so that the incoming block be
     /// crit_mbb, instead of src

thanks a lot,


More information about the llvm-dev mailing list