org.jikesrvm.compilers.opt.regalloc
Class LinearScan

java.lang.Object
  extended by org.jikesrvm.compilers.opt.driver.OptimizationPlanElement
      extended by org.jikesrvm.compilers.opt.driver.OptimizationPlanCompositeElement
          extended by org.jikesrvm.compilers.opt.regalloc.LinearScan

public final class LinearScan
extends OptimizationPlanCompositeElement

Main driver for linear scan register allocation.


Nested Class Summary
(package private) static class LinearScan.ActiveSet
          "Active set" for linear scan register allocation.
(package private) static class LinearScan.BasicInterval
          Implements a basic live interval (no holes), which is a pair begin - the starting point of the interval end - the ending point of the interval Begin and end are numbers given to each instruction by a numbering pass.
(package private) static class LinearScan.CompoundInterval
          Implements a live interval with holes; ie; a list of basic live intervals.
(package private) static class LinearScan.IncreasingEndMappedIntervalSet
          Implements a set of Basic Intervals, sorted by end number.
(package private) static class LinearScan.IncreasingStartIntervalSet
          Implements a set of Basic Intervals, sorted by start number.
(package private) static class LinearScan.IncreasingStartMappedIntervalSet
          Implements a set of Basic Intervals, sorted by start number.
static class LinearScan.IntervalAnalysis
          phase to compute linear scan intervals.
(package private) static class LinearScan.IntervalSet
           
static class LinearScan.LinearScanPhase
           
static class LinearScan.LinearScanState
           
(package private) static class LinearScan.MappedBasicInterval
          A basic interval contained in a CompoundInterval.
(package private) static class LinearScan.RegisterRestrictionsPhase
          A phase to compute register restrictions.
(package private) static class LinearScan.SpillCode
          Insert Spill Code after register assignment.
(package private) static class LinearScan.SpillLocationInterval
          The following represents the intervals assigned to a particular spill location
(package private) static class LinearScan.SpillLocationManager
          The following class manages allocation and reuse of spill locations.
(package private) static class LinearScan.UpdateGCMaps1
          Update GC maps after register allocation but before inserting spill code.
(package private) static class LinearScan.UpdateGCMaps2
          Update GC Maps again, to account for changes induced by spill code.
static class LinearScan.UpdateOSRMaps
          Update GC maps after register allocation but before inserting spill code.
 
Field Summary
private static boolean DEBUG
           
private static boolean DEBUG_COALESCE
           
private static boolean GC_DEBUG
           
private static boolean MUTATE_FMOV
          Mark FMOVs that end a live range?
private static boolean VERBOSE_DEBUG
           
 
Constructor Summary
LinearScan()
          Build this phase as a composite of others.
 
Method Summary
(package private) static int getDFN(Instruction inst)
          returns the dfn associated with the passed instruction
(package private) static int getDfnBegin(LiveIntervalElement live, BasicBlock bb)
          Return the Depth-first-number of the beginning of the live interval.
(package private) static int getDfnEnd(LiveIntervalElement live, BasicBlock bb)
          Return the Depth-first-number of the end of the live interval.
(package private) static LinearScan.CompoundInterval getInterval(Register reg)
          Returns the interval associated with the passed register.
 String getName()
           
(package private) static void printDfns(IR ir)
          Print the DFN numbers associated with each instruction
 boolean printingEnabled(OptOptions options, boolean before)
          Returns true if the phase wants the IR dumped before and/or after it runs.
(package private) static void setDFN(Instruction inst, int dfn)
          Associates the passed dfn number with the instruction
(package private) static void setInterval(Register reg, LinearScan.CompoundInterval interval)
          Associates the passed live interval with the passed register, using the scratchObject field of Register.
 boolean shouldPerform(OptOptions options)
          Register allocation is required
 
Methods inherited from class org.jikesrvm.compilers.opt.driver.OptimizationPlanCompositeElement
compose, elapsedTime, initializeForMeasureCompilation, perform, reportStats
 
Methods inherited from class org.jikesrvm.compilers.opt.driver.OptimizationPlanElement
prettyPrintTime
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MUTATE_FMOV

private static final boolean MUTATE_FMOV
Mark FMOVs that end a live range?

See Also:
Constant Field Values

DEBUG

private static final boolean DEBUG
See Also:
Constant Field Values

VERBOSE_DEBUG

private static final boolean VERBOSE_DEBUG
See Also:
Constant Field Values

GC_DEBUG

private static final boolean GC_DEBUG
See Also:
Constant Field Values

DEBUG_COALESCE

private static final boolean DEBUG_COALESCE
See Also:
Constant Field Values
Constructor Detail

LinearScan

LinearScan()
Build this phase as a composite of others.

Method Detail

shouldPerform

public boolean shouldPerform(OptOptions options)
Register allocation is required

Overrides:
shouldPerform in class OptimizationPlanCompositeElement
Parameters:
options - The Options object for the current compilation.
Returns:
true if the plan element should be performed.

getName

public String getName()
Overrides:
getName in class OptimizationPlanCompositeElement
Returns:
a String which is the name of the phase.

printingEnabled

public boolean printingEnabled(OptOptions options,
                               boolean before)
Description copied from class: OptimizationPlanCompositeElement
Returns true if the phase wants the IR dumped before and/or after it runs. By default, printing is not enabled. Subclasses should overide this method if they want to provide IR dumping.

Overrides:
printingEnabled in class OptimizationPlanCompositeElement
Parameters:
options - the compiler options for the compilation
before - true when invoked before perform, false otherwise.
Returns:
true if the IR should be printed, false otherwise.

setInterval

static void setInterval(Register reg,
                        LinearScan.CompoundInterval interval)
Associates the passed live interval with the passed register, using the scratchObject field of Register.

Parameters:
reg - the register
interval - the live interval

getInterval

static LinearScan.CompoundInterval getInterval(Register reg)
Returns the interval associated with the passed register.

Parameters:
reg - the register
Returns:
the live interval or null

getDFN

static int getDFN(Instruction inst)
returns the dfn associated with the passed instruction

Parameters:
inst - the instruction
Returns:
the associated dfn

setDFN

static void setDFN(Instruction inst,
                   int dfn)
Associates the passed dfn number with the instruction

Parameters:
inst - the instruction
dfn - the dfn number

printDfns

static void printDfns(IR ir)
Print the DFN numbers associated with each instruction


getDfnEnd

static int getDfnEnd(LiveIntervalElement live,
                     BasicBlock bb)
Return the Depth-first-number of the end of the live interval. Return the dfn for the end of the basic block if the interval is open-ended.


getDfnBegin

static int getDfnBegin(LiveIntervalElement live,
                       BasicBlock bb)
Return the Depth-first-number of the beginning of the live interval. Return the dfn for the beginning of the basic block if the interval is open-ended.