scale.backend.trips2
Class Trips2AllocatorHybrid

java.lang.Object
  extended by scale.backend.trips2.Trips2Allocator
      extended by scale.backend.trips2.Trips2AllocatorHybrid

public class Trips2AllocatorHybrid
extends Trips2Allocator

This class implements a hybrid version of the trips register allocator.

$Id: Trips2AllocatorHybrid.java,v 1.3 2007-07-27 16:09:49 beroy Exp $

Copyright 2005 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.
This allocator first allocates virtual registers from shortest to longest liveranges. If there are any spills, it redoes the allocation in reverse order, from longest to shortest liveranges and then picks the allocation with the fewest spills.


Field Summary
static boolean enabled
          True: use the hybrid register allocator.
 
Fields inherited from class scale.backend.trips2.Trips2Allocator
blocksDefdIn, blocksUsedIn, finalSpillCount, finalSpillLdCnt, finalSpillStCnt, hbs, LBSA2, map, maxVRCount, redoCount, sorted, spillCount, spilled, strengths, tLiveIn, tLiveOut, tLiveUse, trace, unallocated
 
Constructor Summary
Trips2AllocatorHybrid(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  void computeStrength(int numVirtual, int numReal)
          Determine the importance of each register.
 
Methods inherited from class scale.backend.trips2.Trips2Allocator
allocateRealRegisters, computeLiveness, computeStats, computeStrengthBlockSize, initialize, maxVirtualRegs, meekSpill, redo, spillLoads, spills, spillStores
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

enabled

public static boolean enabled
True: use the hybrid register allocator.

Constructor Detail

Trips2AllocatorHybrid

public Trips2AllocatorHybrid(Generator gen,
                             Hyperblock hbStart,
                             boolean trace)
Setup a quick & dirty register allocation.

Parameters:
gen - is the instruction generator in use
hbStart - is the entry to the hyperblock flow graph
trace - is true if the register allocation should be traced
Method Detail

allocate

public int[] allocate()
Determine a mapping from virtual registers to real registers. This may involve the insertion of spill code to load and store the value of a virtual register.

Overrides:
allocate in class Trips2Allocator
Returns:
the mapping from virtual register to real register.

computeStrength

protected void computeStrength(int numVirtual,
                               int numReal)
Determine the importance of each register. Importance is the measure of how important it is to allocate it before other registers.

Overrides:
computeStrength in class Trips2Allocator