scale.backend.trips2
Class Trips2RegisterSet

java.lang.Object
  extended by scale.backend.RegisterSet
      extended by scale.backend.trips2.Trips2RegisterSet

public class Trips2RegisterSet
extends RegisterSet

This class describes the register set of the TRIPS Grid Processor.

$Id: Trips2RegisterSet.java,v 1.26 2007-08-27 18:30:14 burrill Exp $

Copyright 2007 by the Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.

TRIPS has 128 programmable registers and makes no distinction between floating point and integer registers.

Reg #Usage
R0Program Counter (PC)
R1Stack Pointer (SP)
R2Link Register (LR)
R3First Argument and Return Values
R4 - R10Arguments
R11Global Pointer/Reserved
R12 - R69Local Variables
R70 - R126Scratch Variables
R17Reserved


Field Summary
static int bankAccesses
          Specify the number of registers in a bank that can be accessed in the same block.
static int FF_REG
          First floating point argument register.
static int FL_REG
          Last floating point argument register.
static int FP_REG
          Frame pointer register.
static int FR_REG
          Floating point function value return register.
static int FREG_SIZE
          Size in bytes of integer register.
static int IF_REG
          First argument register.
static int IL_REG
          Last rgument register.
static int IR_REG
          Function value return register.
static int IREG_SIZE
          Size in bytes of integer register.
static int numBanks
          Specify the number of banks that (real) registers are divided into.
static int perBlockRegAccesses
          Specify the number of register accesses allowed in the same block.
static int RA_REG
          Return address register.
static int regSetSize
          Specify the number of actual (real) registers.
static int SP_REG
          Stack pointer register.
 
Fields inherited from class scale.backend.RegisterSet
ADRREG, AFIREG, AIREG, checkMask, CNTREG, DBLEREG, FIREG, FLTREG, INTREG, nextRegister, PAIRREG, QUADREG, RDREG, registers, sizeMask, SPCREG, typeMask
 
Constructor Summary
Trips2RegisterSet()
           
 
Method Summary
 int getBank(int reg)
          Return which bank a given (real) register is in.
 short[] getCalleeSaves()
          Return the callee saves registers.
 short[] getCalleeUses()
          Return the callee uses registers.
 short[] getPreferredOrder()
          Return a mapping from an order index to a real register number.
 int numAllocatableRegisters()
          Return the number of unique registers that can hold programmer values.
 java.lang.String predicateRegisterName(int reg)
          Convert a predicate register number into its assembly language form.
 java.lang.String registerName(int reg)
          Convert a register number into its assembly language form.
 int registerSize(int reg)
          Return the size of the register in addressable memory units.
protected  void setLowTmpReg(int lowTempReg)
          Update the register allocator with the lowest used temp register for the current routine.
protected  void setRegisters(int[] map, int nextRegister)
          Update the registers array and next temp register.
 int tempRegisterType(Type type, long bs)
          Return the register type with the size information added.
 boolean useContiguous()
          Return true if virtual registers, that require more than one real register, must be allocated to contiguous real registers.
 
Methods inherited from class scale.backend.RegisterSet
actualRegister, adrRegister, compatible, compatibleNS, continueRegister, display, doubleRegister, floatRegister, getResultRegister, getType, initialize, intRegister, isAdrType, isContinueType, isDoubleType, isFloatType, isIntType, isModType, isPairType, isQuadType, isReadOnlyType, isSpecialType, lastRegister, modRegister, newTempRegister, numContiguousRegisters, numContiguousType, numRealRegisters, numRegisters, pairRegister, quadRegister, rangeBegin, rangeEnd, readOnlyRegister, setResultRegister, specialRegister, tempRegister, tempRegisterType, virtualRegister
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IR_REG

public static final int IR_REG
Function value return register.

See Also:
Constant Field Values

IF_REG

public static final int IF_REG
First argument register.

See Also:
Constant Field Values

IL_REG

public static final int IL_REG
Last rgument register.

See Also:
Constant Field Values

RA_REG

public static final int RA_REG
Return address register.

See Also:
Constant Field Values

SP_REG

public static final int SP_REG
Stack pointer register.

See Also:
Constant Field Values

FP_REG

public static final int FP_REG
Frame pointer register. For most functions the frame pointer register is not used. If the function calls alloca the frame pointer register is used to access the function's stack frame while allowing the stack pointer to be changed by alloca which allocates space for the user on the stack. Upon entry to these functions, the address in the stack pointer register is decremented and this address is then copied into the frame pointer register. The address in the frame pointer register is copied back into the stack pointer register just before the stack pointer register is incremented upon function return.

See Also:
Constant Field Values

FR_REG

public static final int FR_REG
Floating point function value return register.

See Also:
Constant Field Values

FF_REG

public static final int FF_REG
First floating point argument register.

See Also:
Constant Field Values

FL_REG

public static final int FL_REG
Last floating point argument register.

See Also:
Constant Field Values

IREG_SIZE

public static final int IREG_SIZE
Size in bytes of integer register.

See Also:
Constant Field Values

FREG_SIZE

public static final int FREG_SIZE
Size in bytes of integer register.

See Also:
Constant Field Values

regSetSize

public static int regSetSize
Specify the number of actual (real) registers. Default is 128 registers. The maximum allowed value is 1024 and the minimum allowed value is 16.


numBanks

public static int numBanks
Specify the number of banks that (real) registers are divided into. Default is 4 banks. Which bank a register is in is determined by RegNum % NumBanks.


bankAccesses

public static int bankAccesses
Specify the number of registers in a bank that can be accessed in the same block. Default is 8 registers. The size of the register set should be evenly divisible by the number of banks.


perBlockRegAccesses

public static int perBlockRegAccesses
Specify the number of register accesses allowed in the same block. This is equal to the number of banks * number of allowed bank accesses/block.

Constructor Detail

Trips2RegisterSet

public Trips2RegisterSet()
Method Detail

setLowTmpReg

protected void setLowTmpReg(int lowTempReg)
Update the register allocator with the lowest used temp register for the current routine. Should be called just prior to generating code for this routine.


registerName

public java.lang.String registerName(int reg)
Convert a register number into its assembly language form.

Specified by:
registerName in class RegisterSet

predicateRegisterName

public java.lang.String predicateRegisterName(int reg)
Convert a predicate register number into its assembly language form.


getBank

public int getBank(int reg)
Return which bank a given (real) register is in.


getPreferredOrder

public short[] getPreferredOrder()
Return a mapping from an order index to a real register number. This mapping allows the order of allocation of real registers to be specified.

Overrides:
getPreferredOrder in class RegisterSet

useContiguous

public boolean useContiguous()
Return true if virtual registers, that require more than one real register, must be allocated to contiguous real registers.

Overrides:
useContiguous in class RegisterSet

registerSize

public int registerSize(int reg)
Return the size of the register in addressable memory units.

Specified by:
registerSize in class RegisterSet

getCalleeSaves

public short[] getCalleeSaves()
Return the callee saves registers.

Specified by:
getCalleeSaves in class RegisterSet

getCalleeUses

public short[] getCalleeUses()
Return the callee uses registers.

Specified by:
getCalleeUses in class RegisterSet

numAllocatableRegisters

public int numAllocatableRegisters()
Return the number of unique registers that can hold programmer values.

Specified by:
numAllocatableRegisters in class RegisterSet
Returns:
the number of unique registers that can hold programmer values.

tempRegisterType

public int tempRegisterType(Type type,
                            long bs)
Return the register type with the size information added.

Specified by:
tempRegisterType in class RegisterSet
Parameters:
type - is the type required
bs - is the size required

setRegisters

protected void setRegisters(int[] map,
                            int nextRegister)
Update the registers array and next temp register.