|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectscale.backend.trips2.Trips2Allocator
public class Trips2Allocator
This class implements a quick and dirty register allocator for the Trips TIL.
$Id: Trips2Allocator.java,v 1.76 2007-10-23 17:18:56 beroy Exp $
Copyright 2008 by the
Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.
This allocator is based upon QDRA.
It is different in that it only allocates registers for the virtual registers
that are alive across basic block boundaries. The virtual registers that are
used only within a single basic block are not allocated.
| Field Summary | |
|---|---|
protected BitVect[] |
blocksDefdIn
|
protected BitVect[] |
blocksUsedIn
|
protected static int |
finalSpillCount
|
protected static int |
finalSpillLdCnt
|
protected static int |
finalSpillStCnt
|
protected Hyperblock[] |
hbs
|
static boolean |
LBSA2
Try to avoid spilling in a hyperblock if the spills would cause the hyperblock to violate a block constraint. |
protected int[] |
map
|
protected static int |
maxVRCount
|
protected static int |
redoCount
|
protected int[] |
sorted
|
protected int |
spillCount
|
protected boolean[] |
spilled
|
protected double[] |
strengths
|
protected BitVect[] |
tLiveIn
|
protected BitVect[] |
tLiveOut
|
protected BitVect[] |
tLiveUse
|
protected boolean |
trace
|
protected int[] |
unallocated
|
| Constructor Summary | |
|---|---|
Trips2Allocator(Generator gen,
Hyperblock hbStart,
boolean trace)
Setup a quick & dirty register allocation. |
|
| Method Summary | |
|---|---|
int[] |
allocate()
Determine a mapping from virtual registers to real registers. |
protected int |
allocateRealRegisters(BitVect allocReg)
Generate a virtual register to real register mapping. |
protected BitVect |
computeLiveness()
Compute liveness. |
protected void |
computeStats(java.lang.String msg,
int retries)
Compute the statistics after register allocation. |
protected void |
computeStrength(int numVirtual,
int numReal)
Determine the importance of each register. |
protected double |
computeStrengthBlockSize(int vr)
Compute the strength of a virtual register based on the size of the hyperblocks the virtual register spans. |
protected void |
initialize()
Initialize the register allocator. |
static int |
maxVirtualRegs()
Return the maximum number of virtual registers encountered. |
protected void |
meekSpill(int numNotAllocated)
Spill the registers that were not allocated. |
static int |
redo()
Return the number of times register allocation was re-done. |
static int |
spillLoads()
Return the number of loads inserted by spilling. |
static int |
spills()
Return the number of spills required. |
static int |
spillStores()
Return the number of stores inserted by spilling. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static int redoCount
protected static int maxVRCount
protected static int finalSpillCount
protected static int finalSpillStCnt
protected static int finalSpillLdCnt
public static boolean LBSA2
protected int spillCount
protected int[] unallocated
protected int[] sorted
protected double[] strengths
protected boolean[] spilled
protected int[] map
protected Hyperblock[] hbs
protected BitVect[] tLiveUse
protected BitVect[] tLiveIn
protected BitVect[] tLiveOut
protected BitVect[] blocksUsedIn
protected BitVect[] blocksDefdIn
protected boolean trace
| Constructor Detail |
|---|
public Trips2Allocator(Generator gen,
Hyperblock hbStart,
boolean trace)
gen - is the instruction generator in usehbStart - is the entry to the hyperblock flow graphtrace - is true if the register allocation should be traced| Method Detail |
|---|
public static int spills()
public static int spillLoads()
public static int spillStores()
public static int redo()
public static int maxVirtualRegs()
public int[] allocate()
protected void computeStats(java.lang.String msg,
int retries)
protected void initialize()
protected BitVect computeLiveness()
protected void meekSpill(int numNotAllocated)
numNotAllocated - is the number of un-allocated virtual registersprotected double computeStrengthBlockSize(int vr)
protected void computeStrength(int numVirtual,
int numReal)
protected int allocateRealRegisters(BitVect allocReg)
allocReg - is true if the register should be allocated
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||