PenYiWang via llvm-dev
2020-Mar-13 11:21 UTC
[llvm-dev] Why MachineBasicBlcok doesn't have transferPredecessors() ?
Hi I want to ask a question. (Maybe it is a trivial question.) I found that there is transferSuccessors() in MachineBasicBlcok So that when manipulating MachineBasicBlock, we can use transferSuccessors to update the CFG easily. Why there is not transferPredecessors in MachineBasicBlcok ? Thank you -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200313/fa25667e/attachment.html>
Nicolai Hähnle via llvm-dev
2020-Mar-13 15:56 UTC
[llvm-dev] Why MachineBasicBlcok doesn't have transferPredecessors() ?
On Fri, Mar 13, 2020 at 12:22 PM PenYiWang via llvm-dev <llvm-dev at lists.llvm.org> wrote:> I found that there is transferSuccessors() in MachineBasicBlcok > > So that when manipulating MachineBasicBlock, > we can use transferSuccessors to update the CFG easily. > > Why there is not transferPredecessors in MachineBasicBlcok ?What would you want to use it for? If it's for splitting a block: the common pattern for splitting seems to be to create a new block that will be the successor of the old one rather than the other way around. One good reason for this is that doing it this way only requires fixing up (target-independent) phi instructions, while doing it the other way around would require fixing up the (target-specific!) branch instructions. Cheers, Nicolai -- Lerne, wie die Welt wirklich ist, aber vergiss niemals, wie sie sein sollte.
PenYiWang via llvm-dev
2020-Mar-13 16:09 UTC
[llvm-dev] Why MachineBasicBlcok doesn't have transferPredecessors() ?
for example I want to insert a new machine bb “before” a specific machine bb. or split a mbb and keep the later one as the original one. (to keep the label/Blackadder's correct t) (or keep other property of mbb) so I need to transfer the original mbb's predecessor to the new mbb. Nicolai Hähnle <nhaehnle at gmail.com> 於 2020年3月13日 週五 23:57 寫道:> On Fri, Mar 13, 2020 at 12:22 PM PenYiWang via llvm-dev > <llvm-dev at lists.llvm.org> wrote: > > I found that there is transferSuccessors() in MachineBasicBlcok > > > > So that when manipulating MachineBasicBlock, > > we can use transferSuccessors to update the CFG easily. > > > > Why there is not transferPredecessors in MachineBasicBlcok ? > > What would you want to use it for? If it's for splitting a block: the > common pattern for splitting seems to be to create a new block that > will be the successor of the old one rather than the other way around. > One good reason for this is that doing it this way only requires > fixing up (target-independent) phi instructions, while doing it the > other way around would require fixing up the (target-specific!) branch > instructions. > > Cheers, > Nicolai > > > -- > Lerne, wie die Welt wirklich ist, > aber vergiss niemals, wie sie sein sollte. >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200314/2536364e/attachment.html>