public class CFGTransformations extends CompilerPhase
Modifier and Type | Field and Description |
---|---|
private static boolean |
DEBUG |
container
Constructor and Description |
---|
CFGTransformations() |
Modifier and Type | Method and Description |
---|---|
private static float |
edgeFrequency(BasicBlock a,
BasicBlock b) |
private static void |
ensureLandingPad(LSTNode n,
IR ir) |
private static void |
ensureLandingPads(IR ir) |
private static void |
ensureLandingPads(LSTNode t,
IR ir) |
private static boolean |
exitsLoop(BasicBlock b,
BitVector loop) |
String |
getName()
Returns the name of the phase.
|
(package private) static boolean |
inLoop(BasicBlock b,
BitVector nloop) |
private static BasicBlock[] |
inLoopPredecessors(LSTNode n) |
private static BasicBlock[] |
inLoopSuccessors(LSTNode n) |
(package private) static void |
killFallThroughs(IR ir,
BitVector nloop) |
private static BasicBlock[] |
loopPredecessors(LSTNode n) |
CompilerPhase |
newExecution(IR ir)
Return this instance of this phase.
|
void |
perform(IR ir)
This is the method that actually does the work of the phase.
|
boolean |
printingEnabled(OptOptions options,
boolean before)
Returns
true if the phase wants the IR dumped before and/or after it runs. |
boolean |
shouldPerform(OptOptions options)
Should this phase be performed?
|
static void |
splitCriticalEdges(IR ir)
Critical edge removal: if (a,b) is an edge in the cfg where `a' has more
than one out-going edge and `b' has more than one in-coming edge,
insert a new empty block `c' on the edge between `a' and `b'.
|
(package private) static void |
staticPerform(IR ir) |
private static boolean |
turnLoopIntoUntil(LSTNode n,
IR ir)
Transforms a given loop.
|
private static boolean |
turnLoopTreeIntoUntils(LSTNode t,
IR ir) |
private static boolean |
turnWhilesIntoUntils(IR ir) |
dumpIR, dumpIR, getClassConstructor, getCompilerPhaseConstructor, getCompilerPhaseConstructor, performPhase, reportAdditionalStats, setContainer, verify
private static final boolean DEBUG
public CFGTransformations()
public CompilerPhase newExecution(IR ir)
newExecution
in class CompilerPhase
ir
- not usedpublic void perform(IR ir)
CompilerPhase
perform
in class CompilerPhase
ir
- the IR on which to apply the phasestatic void staticPerform(IR ir)
public boolean shouldPerform(OptOptions options)
shouldPerform
in class CompilerPhase
options
- the compiler options for the compilationtrue
if the opt level is at least 2 and whiles should be turned into untilspublic String getName()
getName
in class CompilerPhase
public boolean printingEnabled(OptOptions options, boolean before)
true
if the phase wants the IR dumped before and/or after it runs.printingEnabled
in class CompilerPhase
options
- the compiler options for the compilationbefore
- true when invoked before perform, false otherwise.private static boolean turnWhilesIntoUntils(IR ir)
private static boolean turnLoopTreeIntoUntils(LSTNode t, IR ir)
private static void ensureLandingPads(IR ir)
private static void ensureLandingPads(LSTNode t, IR ir)
private static float edgeFrequency(BasicBlock a, BasicBlock b)
private static void ensureLandingPad(LSTNode n, IR ir)
private static boolean turnLoopIntoUntil(LSTNode n, IR ir)
Look for the set S of in-loop predecessors of the loop header h. Make a copy h' of the loop header and redirect all edges going from nodes in S to h. Make them point to h' instead.
As an effect of this transformation, the old header is now not anymore part of the loop, but guards it.
n
- anodeir
- the governing IRprivate static BasicBlock[] loopPredecessors(LSTNode n)
private static BasicBlock[] inLoopPredecessors(LSTNode n)
private static BasicBlock[] inLoopSuccessors(LSTNode n)
static void killFallThroughs(IR ir, BitVector nloop)
static boolean inLoop(BasicBlock b, BitVector nloop)
private static boolean exitsLoop(BasicBlock b, BitVector loop)
public static void splitCriticalEdges(IR ir)
We do this to provide landing pads for loop-invariant code motion. So we split only edges, where `a' has a lower loop nesting depth than `b'.
ir
- the IR to process