[llvm-dev] Update control flow graph when splitting a machine basic block? (original) (raw)

Friedman, Eli via llvm-dev llvm-dev at lists.llvm.org
Fri Nov 10 11:02:50 PST 2017


On 11/10/2017 4:33 AM, 章明 via llvm-dev wrote:

Hi, there!

There are situations where a machine basic block has to be split into two machine basic blocks, e.g., to place a constant pool entry or to fix a conditional branch so that its target is within its range (https://reviews.llvm.org/D38918).

The right way to update the CFG very much depends on how you're transforming it.

However, it doesn't appear to be straightforward how the control flow graph should be updated when a machine basic block is split, especially when the split point is between two branches.In this case, in order to determine the successors of each of the two machine basic block, one needs to know the target of each terminator. If we ignore indirect branches whose targets are not known at compile-time, I wonder whether something like the following is viable or not:

Your pseudo-code looks similar to ARMBaseInstrInfo::analyzeBranch.

-Eli

-- Employee of Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project



More information about the llvm-dev mailing list