Class JitControlFlowModel.BlockSplitter

java.lang.Object
ghidra.pcode.emu.jit.analysis.JitControlFlowModel.BlockSplitter
Enclosing class:
JitControlFlowModel

public static class JitControlFlowModel.BlockSplitter extends Object
A class that splits a sequence of ops and associated branches into basic blocks.

This is the kernel of control flow analysis. It first indexes the branches by source and target op. Note that only non-fall-through branches are known at this point. Then, it traverses the list of ops. A split occurs following an op that is a branch source and/or preceding an op that is a branch target. A block is constructed when such a split point is encountered. In the case of a branch source, the branch is added to the newly constructed block. As traversal proceeds to the next op, it checks if the immediately-preceding block should have fall through (conditional or unconditional) by examining its last op. It adds a new fall-through branch if so. The end of the p-code op list is presumed a split point. If that final block "should have" fall through, an JitControlFlowModel.UnterminatedFlowException is thrown.

Once all the splitting is done, we have the blocks and all the branches (internal or external) that leave each block. We then compute all the branches (internal) that enter each block and the associated flows in both directions.