[LLVMdev] MBB Critical edges

Evan Cheng evan.cheng at apple.com
Fri Aug 17 14:34:58 PDT 2007


Sorry about the tardiness of my reply. My mail client has playing  
tricks with me. :-)

I am assuming the issue has nothing to do the branch to jumptable  
instructions but rather the MachineJumpTableInfo associated with every  
MachineFunction? If so, please take a look at BranchFoldiing.cpp for  
an example.

Evan

On Aug 10, 2007, at 12:30 PM, Fernando Magno Quintao Pereira wrote:

>
> Hi all,
>
>     I have a pass to break critical edges of Machine Basic Blocks,  
> but I
> just discovered a bug (when compiling code for x86). The problem is  
> 'jumpl
> *%reg'. I don't know how to update the jump table for this type of
> instruction. The code that I had (see below) does not update the jump
> table, and the actual branch keeps jumping to the old basic block,  
> instead
> of the new. Could someone help me to fix this? If it works fine, I can
> send a patch for this pass.
>
>     /// modify every branch in src that points to dst to point
>     /// to the new machine basic block "crit_mbb" instead:
>     MachineBasicBlock::iterator mii = src.end();
>     bool found_branch = false;
>     while (mii != src.begin()) {
>         mii--;
>         // if there are no more branches, finish the loop
>         if (!tii->isTerminatorInstr(mii->getOpcode())) {
>             break;
>         }
>         // Scan the operands of this branch, replacing any
>         // uses of dst with crit_mbb.
>         for (unsigned i = 0, e = mii->getNumOperands(); i != e; ++i) {
>             if (mii->getOperand(i).isMachineBasicBlock() &&
>                  mii->getOperand(i).getMachineBasicBlock() == & dst) {
>                 found_branch = true;
>                 mii->getOperand(i).setMachineBasicBlock(crit_mbb);
>             }
>         }
>     }
>
> Thanks a lot,
>
> Fernando
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list