org.jikesrvm.compilers.opt.controlflow
Class LoopUnrolling

java.lang.Object
  extended by org.jikesrvm.compilers.opt.driver.CompilerPhase
      extended by org.jikesrvm.compilers.opt.controlflow.LoopUnrolling

public class LoopUnrolling
extends CompilerPhase


Nested Class Summary
(package private) static class LoopUnrolling.RealDefs
           
 
Field Summary
private static Constructor<CompilerPhase> constructor
          Constructor for this compiler phase
(package private) static boolean DEBUG
           
(package private) static int MAX_BLOCKS_FOR_NAIVE_UNROLLING
           
(package private) static int MaxInstructions
           
private static int theVisit
           
private  int unrollFactor
           
 
Fields inherited from class org.jikesrvm.compilers.opt.driver.CompilerPhase
container
 
Constructor Summary
LoopUnrolling()
           
 
Method Summary
private static Operand _follow(Operand use)
           
private static void _printDefs(Operand op)
           
(package private) static BasicBlock copyAndLinkBlock(IR ir, BasicBlock seqLast, BasicBlock block)
           
private static Instruction definingInstruction(Operand op)
           
(package private) static void deleteBranches(BasicBlock b)
           
private static Operand follow(Operand use)
           
 Constructor<CompilerPhase> getClassConstructor()
          Get a constructor object for this compiler phase
 String getName()
          Returns the name of the phase.
(package private) static void linkToLST(IR ir)
           
private static boolean loopInvariant(Operand op, BitVector nloop, int depth)
           
(package private) static BasicBlock[] makeSomeCopies(int unrollFactor, IR ir, BitVector nloop, int blocks, BasicBlock header, BasicBlock exitBlock, BasicBlock seqStart)
           
private static void markHeaders(LSTNode t)
           
private  void naiveUnroller(LSTNode t, IR ir)
           
 void perform(IR ir)
          This is the method that actually does the work of the phase.
private static boolean printDefs(Operand op, BitVector nloop, int depth)
           
(package private) static void report(String s)
           
 boolean shouldPerform(OptOptions options)
          This phase is disabled by default.
(package private)  boolean unrollLeaf(LSTNode t, IR ir)
           
(package private)  void unrollLoops(IR ir)
          unroll the loops in the given IR.
(package private)  int unrollLoopTree(LSTNode t, IR ir, int target)
          loop unrolling on a given loop structure sub tree
 
Methods inherited from class org.jikesrvm.compilers.opt.driver.CompilerPhase
dumpIR, dumpIR, getCompilerPhaseConstructor, getCompilerPhaseConstructor, newExecution, performPhase, printingEnabled, reportAdditionalStats, setContainer, verify
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

static final boolean DEBUG
See Also:
Constant Field Values

MAX_BLOCKS_FOR_NAIVE_UNROLLING

static final int MAX_BLOCKS_FOR_NAIVE_UNROLLING
See Also:
Constant Field Values

constructor

private static final Constructor<CompilerPhase> constructor
Constructor for this compiler phase


MaxInstructions

static final int MaxInstructions
See Also:
Constant Field Values

unrollFactor

private int unrollFactor

theVisit

private static int theVisit
Constructor Detail

LoopUnrolling

public LoopUnrolling()
Method Detail

getName

public String getName()
Returns the name of the phase.

Specified by:
getName in class CompilerPhase
Returns:
a String which is the name of the phase.

getClassConstructor

public Constructor<CompilerPhase> getClassConstructor()
Get a constructor object for this compiler phase

Overrides:
getClassConstructor in class CompilerPhase
Returns:
compiler phase constructor

shouldPerform

public boolean shouldPerform(OptOptions options)
This phase is disabled by default.

It will run only on O3 but O2 is the default maximum optimization level.

Overrides:
shouldPerform in class CompilerPhase
Parameters:
options - the compiler options for the compilation
Returns:
true if the phase should be performed

perform

public void perform(IR ir)
Description copied from class: CompilerPhase
This is the method that actually does the work of the phase.

Specified by:
perform in class CompilerPhase
Parameters:
ir - the IR on which to apply the phase

unrollLoops

void unrollLoops(IR ir)
unroll the loops in the given IR.


unrollLoopTree

int unrollLoopTree(LSTNode t,
                   IR ir,
                   int target)
loop unrolling on a given loop structure sub tree

Parameters:
t -
ir -

unrollLeaf

boolean unrollLeaf(LSTNode t,
                   IR ir)

naiveUnroller

private void naiveUnroller(LSTNode t,
                           IR ir)

report

static void report(String s)

follow

private static Operand follow(Operand use)

_follow

private static Operand _follow(Operand use)

definingInstruction

private static Instruction definingInstruction(Operand op)

loopInvariant

private static boolean loopInvariant(Operand op,
                                     BitVector nloop,
                                     int depth)

printDefs

private static boolean printDefs(Operand op,
                                 BitVector nloop,
                                 int depth)

_printDefs

private static void _printDefs(Operand op)

linkToLST

static void linkToLST(IR ir)

markHeaders

private static void markHeaders(LSTNode t)

makeSomeCopies

static BasicBlock[] makeSomeCopies(int unrollFactor,
                                   IR ir,
                                   BitVector nloop,
                                   int blocks,
                                   BasicBlock header,
                                   BasicBlock exitBlock,
                                   BasicBlock seqStart)

copyAndLinkBlock

static BasicBlock copyAndLinkBlock(IR ir,
                                   BasicBlock seqLast,
                                   BasicBlock block)

deleteBranches

static void deleteBranches(BasicBlock b)