public class CFGTranslationPhaseThree extends Object
Modifier and Type | Class and Description |
---|---|
protected static interface |
CFGTranslationPhaseThree.PredecessorHolder
A simple wrapper object that holds a basic block and allows to set one of its successors.
|
Constructor and Description |
---|
CFGTranslationPhaseThree() |
Modifier and Type | Method and Description |
---|---|
protected static BlockImpl |
computeNeighborhoodOfEmptyBlock(RegularBlockImpl start,
Set<RegularBlockImpl> emptyBlocks,
Set<CFGTranslationPhaseThree.PredecessorHolder> predecessors)
Compute the set of empty regular basic blocks
emptyBlocks , starting at start
and going both forward and backwards. |
protected static void |
computeNeighborhoodOfEmptyBlockBackwards(RegularBlockImpl start,
Set<RegularBlockImpl> emptyBlocks,
Set<CFGTranslationPhaseThree.PredecessorHolder> predecessors)
Compute the set of empty regular basic blocks
emptyBlocks , starting at start
and looking only backwards in the control flow graph. |
protected static CFGTranslationPhaseThree.PredecessorHolder |
getPredecessorHolder(BlockImpl pred,
BlockImpl cur)
Return a predecessor holder that can be used to set the successor of
pred in the
place where previously the edge pointed to cur . |
static ControlFlowGraph |
process(ControlFlowGraph cfg)
Perform phase three on the control flow graph
cfg . |
protected static CFGTranslationPhaseThree.PredecessorHolder |
singleSuccessorHolder(SingleSuccessorBlockImpl s,
BlockImpl old)
Returns a
CFGTranslationPhaseThree.PredecessorHolder that sets the successor of a single successor block
s . |
public static ControlFlowGraph process(ControlFlowGraph cfg)
cfg
.cfg
- the control flow graph. Ownership is transfered to this method and the caller is
not allowed to read or modify cfg
after the call to process
any more.protected static BlockImpl computeNeighborhoodOfEmptyBlock(RegularBlockImpl start, Set<RegularBlockImpl> emptyBlocks, Set<CFGTranslationPhaseThree.PredecessorHolder> predecessors)
emptyBlocks
, starting at start
and going both forward and backwards. Furthermore, compute the predecessors of these empty
blocks (predecessors
), and their single successor (return value).start
- the starting point of the search (an empty, regular basic block)emptyBlocks
- a set to be filled by this method with all empty basic blocks found
(including start
).predecessors
- a set to be filled by this method with all predecessorsprotected static void computeNeighborhoodOfEmptyBlockBackwards(RegularBlockImpl start, Set<RegularBlockImpl> emptyBlocks, Set<CFGTranslationPhaseThree.PredecessorHolder> predecessors)
emptyBlocks
, starting at start
and looking only backwards in the control flow graph. Furthermore, compute the predecessors
of these empty blocks (predecessors
).start
- the starting point of the search (an empty, regular basic block)emptyBlocks
- a set to be filled by this method with all empty basic blocks found
(including start
).predecessors
- a set to be filled by this method with all predecessorsprotected static CFGTranslationPhaseThree.PredecessorHolder getPredecessorHolder(BlockImpl pred, BlockImpl cur)
pred
in the
place where previously the edge pointed to cur
. Additionally, the predecessor holder
also takes care of unlinking (i.e., removing the pred
from cur's
predecessors).pred
- a block whose successor should be setcur
- the previous successor of pred
pred
protected static CFGTranslationPhaseThree.PredecessorHolder singleSuccessorHolder(SingleSuccessorBlockImpl s, BlockImpl old)
CFGTranslationPhaseThree.PredecessorHolder
that sets the successor of a single successor block
s
.CFGTranslationPhaseThree.PredecessorHolder
that sets the successor of a single successor block
s