public final class PhysicalRegisterSet extends GenericPhysicalRegisterSet
Implementation Notes:
Due to some historical ugliness not yet cleaned up, the register
allocator depend on properties cached in the
next
field of Register. The constructor sets the
following properties:
The register allocator allocates registers according to the order in these lists. For volatile registers, it traverses the lists in order, starting with getFirstVolatile() and traversing with getNext(). For non-volatiles, it traverses the lists Backwards , starting with getLastNonvolatile() and using getPrev().
TODO; clean up all this and provide appropriate enumerators
Modifier and Type | Class and Description |
---|---|
(package private) class |
PhysicalRegisterSet.PhysicalRegisterEnumeration
An enumerator for use by the physical register utilities.
|
Modifier and Type | Field and Description |
---|---|
private static int[] |
CR_NUMS
The condition registers that we allocate
To avoid expensive save/restores when
making a JNI transition Jikes RVM only uses the
CR that the 64 bit PowerPC ELF ABI defines to be volatile.
|
private Register[] |
reg
This array holds a pool of objects representing physical registers
|
private static String[] |
registerName
register names for each class. used in printing the IR
The indices for "FP" and "JTOC" should always match the
final static values of int FP and int JTOC defined below.
|
(package private) static int |
TEMP |
private static int |
TSR_REG |
private BitSet |
volatileSet
The set of volatile registers; cached for efficiency
|
Constructor and Description |
---|
PhysicalRegisterSet()
Constructor: set up a pool of physical registers.
|
asIA32, asPPC, enumerateNonvolatileFPRsBackwards, getMappedIndex, getMappedObject, getMappingSize
private final BitSet volatileSet
private static final int[] CR_NUMS
private static final int TSR_REG
private static final String[] registerName
static final int TEMP
public PhysicalRegisterSet()
public static int getSize()
public int getNumberOfPhysicalRegisters()
getNumberOfPhysicalRegisters
in class GenericPhysicalRegisterSet
public static int getNumberOfNonvolatileGPRs()
public static int getNumberOfNonvolatileFPRs()
public boolean isAllocatable(Register r)
isAllocatable
in class GenericPhysicalRegisterSet
r
- the register in questionpublic Register getFP()
getFP
in class GenericPhysicalRegisterSet
public Register getTR()
getTR
in class GenericPhysicalRegisterSet
public Register getGPR(int n)
getGPR
in class GenericPhysicalRegisterSet
public Register getGPR(MachineRegister n)
getGPR
in class GenericPhysicalRegisterSet
n
- a registerpublic Register getFirstScratchGPR()
public Register getLastScratchGPR()
public Register getFirstVolatileGPR()
public Register getFirstNonvolatileGPR()
public Register getLastNonvolatileGPR()
public Register getFirstReturnGPR()
getFirstReturnGPR
in class GenericPhysicalRegisterSet
public Register getFPR(int n)
getFPR
in class GenericPhysicalRegisterSet
public Register getFirstScratchFPR()
public Register getFirstVolatileFPR()
public Register getLastScratchFPR()
public Register getFirstNonvolatileFPR()
public Register getLastNonvolatileFPR()
public Register getConditionRegister(int n)
n
- number of the condition registerpublic Register getFirstConditionRegister()
public Register getFirstVolatileConditionRegister()
public Register get(int n)
get
in class GenericPhysicalRegisterSet
n
- register numberpublic Register getFirstVolatile(int regClass)
regClass
- one of INT_REG, DOUBLE_REG, CONDITION_REG, or
SPECIAL_REGpublic Register getLastNonvolatile(int regClass)
regClass
- one of INT_REG, DOUBLE_REG, CONDITION_REG, or
SPECIAL_REGpublic static int getPhysicalRegisterType(Register r)
r
- a symbolic registerpublic byte getSPR(Register r)
r
- a physical register (XER, LR or CTR)public static String getName(int number)
number
- a register numberpublic static int getSpillSize(int type)
type
- one of INT_REG, DOUBLE_REG, CONDITION_REG, SPECIAL_REGpublic static int getSpillAlignment(int type)
type
- one of INT_REG, DOUBLE_REG, CONDITION_REG, SPECIAL_REGpublic Enumeration<Register> enumerateAll()
enumerateAll
in class GenericPhysicalRegisterSet
public Enumeration<Register> enumerateGPRs()
enumerateGPRs
in class GenericPhysicalRegisterSet
public Enumeration<Register> enumerateVolatileGPRs()
enumerateVolatileGPRs
in class GenericPhysicalRegisterSet
public Enumeration<Register> enumerateGPRParameters(int n)
n
- count of GPR parameters to enumeratepublic Enumeration<Register> enumerateNonvolatileGPRs()
enumerateNonvolatileGPRs
in class GenericPhysicalRegisterSet
public Enumeration<Register> enumerateNonvolatileGPRsBackwards()
enumerateNonvolatileGPRsBackwards
in class GenericPhysicalRegisterSet
public Enumeration<Register> enumerateVolatileFPRs()
enumerateVolatileFPRs
in class GenericPhysicalRegisterSet
public Enumeration<Register> enumerateFPRParameters(int n)
n
- count of FPR parameterspublic Enumeration<Register> enumerateNonvolatileFPRs()
enumerateNonvolatileFPRs
in class GenericPhysicalRegisterSet
public Enumeration<Register> enumerateVolatileConditionRegisters()
public Enumeration<Register> enumerateNonvolatileConditionRegisters()
public Enumeration<Register> enumerateVolatiles(int regClass)
enumerateVolatiles
in class GenericPhysicalRegisterSet
regClass
- one of INT_REG, DOUBLE_REG, CONDITION_REGpublic Enumeration<Register> enumerateVolatiles()
enumerateVolatiles
in class GenericPhysicalRegisterSet
public BitSet getVolatiles()
public Enumeration<Register> enumerateNonvolatiles(int regClass)
regClass
- one of INT_REG, DOUBLE_REG, CONDITION_REGpublic Enumeration<Register> enumerateNonvolatilesBackwards(int regClass)
enumerateNonvolatilesBackwards
in class GenericPhysicalRegisterSet
public int getGPRParamIndex(Register r)
r
- a physical registerpublic int getFPRParamIndex(Register r)
r
- a physical registerpublic Register getSecondHalf(Register r)
r
- a register