Hi, I am working with regular dominator tree and not MachineDominatorTree. I wanted to modify the CFG structure and for that I need to change successor of a basic block. How can I do that? Or is there a way to cast a BasicBlock to MachineBasicBlock so that i can use functions addSucessor and removeSuccessor for the basic block. It will be great if someone can help. regards, Ambika
Nick Lewycky
2010-May-01 20:41 UTC
[LLVMdev] How to change successor of a regular Basic block
ambika wrote:> Hi, > > I am working with regular dominator tree and not MachineDominatorTree. > I wanted to modify the CFG structure and for that I need to change > successor of a basic block. > How can I do that?The last instruction in a BasicBlock is the TerminatorInst. Replace that instruction with one that flows into the blocks you want. See http://llvm.org/docs/LangRef.html#terminators . (Don't forget to update the phi nodes, if applicable. See BasicBlock::removePredecessor().)> Or is there a way to cast a BasicBlock to MachineBasicBlock so that i > can use functions addSucessor and removeSuccessor for the basic block.No. There's no Machine-etc classes until codegen time. Nick
Apparently Analagous Threads
- [LLVMdev] Problem to remove successors
- [LLVMdev] hi, Hi, (Preccessors' Number) < MachineBasicBlock's Number < (Successors's Number), Is it really?
- [LLVMdev] Find all backedges of CFG by MachineDominatorTree. please look at my jpg.
- [LLVMdev] Find all backedges of CFG by MachineDominatorTree. please look at my jpg.
- [LLVMdev] [Fwd: Can someone help me with error while i make my own pass]