Class JitControlFlowModel.BlockSplitter
- Enclosing class:
JitControlFlowModel
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.
-
Constructor Summary
ConstructorsConstructorDescriptionBlockSplitter
(PcodeProgram program) Construct a new block splitter to process the given program -
Method Summary
Modifier and TypeMethodDescriptionvoid
addBranches
(Collection<? extends JitPassage.Branch> branches) Notify the splitter of the given branches before analysisPerform the actual analysis
-
Constructor Details
-
BlockSplitter
Construct a new block splitter to process the given programNo analysis is performed in the constructor. The client must call
addBranches(Collection)
and thensplitBlocks()
.- Parameters:
program
- the program, i.e., list of p-code ops
-
-
Method Details
-
addBranches
Notify the splitter of the given branches before analysisThe splitter immediately indexes the given branches by source and target op.
- Parameters:
branches
- the branches
-
splitBlocks
Perform the actual analysis- Returns:
- the resulting split blocks, keyed by
JitControlFlowModel.JitBlock.start()
-