org.jikesrvm.compilers.opt.ir.ia32
Class PhysicalRegisterSet

java.lang.Object
  extended by org.jikesrvm.compilers.opt.ir.GenericPhysicalRegisterSet
      extended by org.jikesrvm.compilers.opt.ir.ia32.PhysicalRegisterSet
All Implemented Interfaces:
PhysicalRegisterConstants, BitSetMapping, RegisterConstants
Direct Known Subclasses:
ArchitectureSpecificOpt.PhysicalRegisterSet

public abstract class PhysicalRegisterSet
extends GenericPhysicalRegisterSet
implements RegisterConstants, PhysicalRegisterConstants

This class represents a set of Registers corresponding to the IA32 register set.


Nested Class Summary
(package private) static class PhysicalRegisterSet.PhysicalRegisterEnumeration
          An enumerator for use by the physical register utilities.
(package private)  class PhysicalRegisterSet.RangeEnumeration
          An enumerator for use by the physical register utilities.
 
Nested classes/interfaces inherited from interface org.jikesrvm.ia32.RegisterConstants
RegisterConstants.FloatingPointMachineRegister, RegisterConstants.FPR, RegisterConstants.GPR, RegisterConstants.MachineRegister, RegisterConstants.MM, RegisterConstants.XMM
 
Field Summary
private  BitSet fpSet
          Cache the set of floating-point registers for efficiency
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
private  BitSet volatileSet
          Cache the set of volatile registers for efficiency
 
Fields inherited from interface org.jikesrvm.compilers.opt.regalloc.ia32.PhysicalRegisterConstants
AF, C0, C1, C2, C3, CF, CONDITION_VALUE, DOUBLE_REG, DOUBLE_VALUE, FIRST_DOUBLE, FIRST_INT, FIRST_SPECIAL, FLOAT_VALUE, INT_REG, INT_VALUE, NUM_SPECIALS, NUMBER_TYPE, OF, PF, SF, SPECIAL_REG, ST0, ST1, ZF
 
Fields inherited from interface org.jikesrvm.ia32.RegisterConstants
ALL_FPRS, ALL_GPRS, EAX, EBP, EBX, ECX, EDI, EDX, ESI, ESP, FP0, FP1, FP2, FP3, FP4, FP5, FP6, FP7, INSTRUCTION_WIDTH, LG_INSTRUCTION_WIDTH, MM0, MM1, MM10, MM11, MM12, MM13, MM14, MM15, MM2, MM3, MM4, MM5, MM6, MM7, MM8, MM9, NATIVE_NONVOLATILE_FPRS, NATIVE_NONVOLATILE_GPRS, NATIVE_PARAMETER_FPRS, NATIVE_PARAMETER_GPRS, NATIVE_VOLATILE_FPRS, NATIVE_VOLATILE_GPRS, NONVOLATILE_FPRS, NONVOLATILE_GPRS, NUM_FPRS, NUM_GPRS, NUM_NONVOLATILE_FPRS, NUM_NONVOLATILE_GPRS, NUM_PARAMETER_FPRS, NUM_PARAMETER_GPRS, NUM_RETURN_FPRS, NUM_RETURN_GPRS, NUM_VOLATILE_FPRS, NUM_VOLATILE_GPRS, PARAMETER_FPRS, PARAMETER_GPRS, R0, R1, R10, R11, R12, R13, R14, R15, R2, R3, R4, R5, R6, R7, R8, R9, RETURN_FPRS, RETURN_GPRS, STACK_POINTER, THREAD_REGISTER, VOLATILE_FPRS, VOLATILE_GPRS, XMM0, XMM1, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7, XMM8, XMM9
 
Constructor Summary
protected PhysicalRegisterSet()
          Constructor: set up a pool of physical registers.
 
Method Summary
 Enumeration<Register> enumerateAll()
          Enumerate all the physical registers in this set.
 Enumeration<Register> enumerateFPRs()
          Enumerate all the FPRs in this set.
 Enumeration<Register> enumerateGPRs()
          Enumerate all the GPRs in this set.
 PhysicalRegisterSet.PhysicalRegisterEnumeration enumerateNonvolatileFPRs()
          Enumerate all the nonvolatile FPRs in this set.
 PhysicalRegisterSet.PhysicalRegisterEnumeration enumerateNonvolatileGPRs()
          Enumerate all the nonvolatile GPRs in this set.
 Enumeration<Register> enumerateNonvolatileGPRsBackwards()
          Enumerate all the nonvolatile GPRs in this set, backwards
 Enumeration<Register> enumerateNonvolatiles(int regClass)
          Enumerate the nonvolatile physical registers of a given class.
 Enumeration<Register> enumerateNonvolatilesBackwards(int regClass)
          Enumerate the nonvolatile physical registers of a given class, backwards
 PhysicalRegisterSet.PhysicalRegisterEnumeration enumerateVolatileFPRs()
          Enumerate all the volatile FPRs in this set.
 PhysicalRegisterSet.PhysicalRegisterEnumeration enumerateVolatileGPRs()
          Enumerate all the volatile GPRs in this set.
 Enumeration<Register> enumerateVolatiles()
          Enumerate all the volatile physical registers
 Enumeration<Register> enumerateVolatiles(int regClass)
          Enumerate the volatile physical registers of a given class.
 Register get(int n)
           
 Register getAF()
           
 Register getC0()
           
 Register getC1()
           
 Register getC2()
           
 Register getC3()
           
 Register getCF()
           
 Register getEAX()
           
 Register getEBP()
           
 Register getEBX()
           
 Register getECX()
           
 Register getEDI()
           
 Register getEDX()
           
 Register getESI()
           
 Register getESP()
           
 Register getFirstReturnGPR()
           
 Register getFP()
           
 Register getFPR(int n)
           
 Register getFPR(RegisterConstants.FloatingPointMachineRegister n)
           
static int getFPRIndex(Register r)
           
 Register getFPRParam(int n)
          Return the (zero-based indexed) nth FPR that may hold a parameter.
 BitSet getFPRs()
           
 Register getGPR(int n)
           
 Register getGPR(RegisterConstants.GPR n)
           
static int getGPRIndex(Register r)
           
 Register getGPRParam(int n)
          Return the (zero-based indexed) nth GPR that may hold a parameter.
static String getName(int number)
          Get the register name for a register with a particular number in the pool
static int getNumberOfFPRParams()
          Return the total number of FPRs that may hold parameters.
static int getNumberOfGPRParams()
          Return the total number of GPRs that may hold parameters.
static int getNumberOfNonvolatileGPRs()
          Return the total number of nonvolatile GPRs.
 int getNumberOfPhysicalRegisters()
          Return the total number of physical registers.
 Register getOF()
           
 Register getPF()
           
static int getPhysicalRegisterType(Register r)
          Given a symbolic register, return a code that gives the physical register type to hold the value of the symbolic register.
 Register getReturnFPR()
           
 Register getReturnGPR(int n)
          Return the (zero-based indexed) nth GPR that may hold a return value.
 Register getSecondReturnGPR()
           
 Register getSF()
           
static int getSize()
          Return the total number of physical registers.
static int getSpillAlignment(int type)
          Get the required spill alignment for a register with a particular type
static int getSpillSize(int type)
          Get the spill size for a register with a particular type
 Register getST0()
           
 Register getST1()
           
 Register getTR()
           
 BitSet getVolatiles()
           
 Register getZF()
           
 boolean isAllocatable(Register r)
          Is a particular register subject to allocation?
 
Methods inherited from class org.jikesrvm.compilers.opt.ir.GenericPhysicalRegisterSet
enumerateNonvolatileFPRsBackwards, getMappedIndex, getMappedObject, getMappingSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

reg

private final Register[] reg
This array holds a pool of objects representing physical registers


volatileSet

private final BitSet volatileSet
Cache the set of volatile registers for efficiency


fpSet

private final BitSet fpSet
Cache the set of floating-point registers for efficiency


registerName

private static final String[] registerName
Register names for each class. used in printing the IR

Constructor Detail

PhysicalRegisterSet

protected PhysicalRegisterSet()
Constructor: set up a pool of physical registers.

Method Detail

getSize

public static int getSize()
Return the total number of physical registers.


getNumberOfPhysicalRegisters

public final int getNumberOfPhysicalRegisters()
Description copied from class: GenericPhysicalRegisterSet
Return the total number of physical registers.

Specified by:
getNumberOfPhysicalRegisters in class GenericPhysicalRegisterSet

getNumberOfNonvolatileGPRs

public static int getNumberOfNonvolatileGPRs()
Return the total number of nonvolatile GPRs.


getNumberOfGPRParams

public static int getNumberOfGPRParams()
Return the total number of GPRs that may hold parameters.


getNumberOfFPRParams

public static int getNumberOfFPRParams()
Return the total number of FPRs that may hold parameters.


getGPRParam

public final Register getGPRParam(int n)
Return the (zero-based indexed) nth GPR that may hold a parameter.


getFPRParam

public final Register getFPRParam(int n)
Return the (zero-based indexed) nth FPR that may hold a parameter.


getReturnGPR

public Register getReturnGPR(int n)
Return the (zero-based indexed) nth GPR that may hold a return value.


isAllocatable

public boolean isAllocatable(Register r)
Is a particular register subject to allocation?


getTR

public Register getTR()
Specified by:
getTR in class GenericPhysicalRegisterSet
Returns:
the processor register

getFP

public Register getFP()
Specified by:
getFP in class GenericPhysicalRegisterSet
Returns:
the frame pointer register

getEAX

public Register getEAX()
Returns:
the EAX register

getECX

public Register getECX()
Returns:
the ECX register

getEDX

public Register getEDX()
Returns:
the EDX register

getEBX

public Register getEBX()
Returns:
the EBX register

getESP

public Register getESP()
Returns:
the ESP register

getEBP

public Register getEBP()
Returns:
the EBP register

getESI

public Register getESI()
Returns:
the ESI register

getEDI

public Register getEDI()
Returns:
the EDI register

getAF

public Register getAF()
Returns:
a register representing the AF bit of the EFLAGS register.

getCF

public Register getCF()
Returns:
a register representing the CF bit of the EFLAGS register.

getOF

public Register getOF()
Returns:
a register representing the OF bit of the EFLAGS register.

getPF

public Register getPF()
Returns:
a register representing the PF bit of the EFLAGS register.

getSF

public Register getSF()
Returns:
a register representing the SF bit of the EFLAGS register.

getZF

public Register getZF()
Returns:
a register representing the ZF bit of the EFLAGS register.

getC0

public Register getC0()
Returns:
a register representing the C0 floating-point status bit

getC1

public Register getC1()
Returns:
a register representing the C1 floating-point status bit

getC2

public Register getC2()
Returns:
a register representing the C2 floating-point status bit

getC3

public Register getC3()
Returns:
a register representing the C3 floating-point status bit

getGPR

public Register getGPR(RegisterConstants.GPR n)
Returns:
the nth physical GPR

getGPR

public Register getGPR(int n)
Specified by:
getGPR in class GenericPhysicalRegisterSet
Returns:
the nth physical GPR

getGPRIndex

public static int getGPRIndex(Register r)
Returns:
the index into the GPR set corresponding to a given register. PRECONDITION: r is a physical GPR

getFirstReturnGPR

public Register getFirstReturnGPR()
Specified by:
getFirstReturnGPR in class GenericPhysicalRegisterSet
Returns:
the first GPR register used to hold a return value

getSecondReturnGPR

public Register getSecondReturnGPR()
Returns:
the second GPR register used to hold a return value

getST0

public Register getST0()
Returns:
the FPR register used to hold a return value

getST1

public Register getST1()
Returns:
the special ST1 x87 register

getReturnFPR

public Register getReturnFPR()
Returns:
the FPR register used to hold a return value

getFPR

public Register getFPR(RegisterConstants.FloatingPointMachineRegister n)
Returns:
the nth physical FPR

getFPR

public Register getFPR(int n)
Specified by:
getFPR in class GenericPhysicalRegisterSet
Returns:
the nth physical FPR

getFPRIndex

public static int getFPRIndex(Register r)
Returns:
the index into the GPR set corresponding to a given register. PRECONDITION: r is a physical GPR

get

public Register get(int n)
Specified by:
get in class GenericPhysicalRegisterSet
Returns:
the nth physical register in the pool.

getPhysicalRegisterType

public static int getPhysicalRegisterType(Register r)
Given a symbolic register, return a code that gives the physical register type to hold the value of the symbolic register.

Parameters:
r - a symbolic register
Returns:
one of INT_REG, DOUBLE_REG

getName

public static String getName(int number)
Get the register name for a register with a particular number in the pool


getSpillSize

public static int getSpillSize(int type)
Get the spill size for a register with a particular type

Parameters:
type - one of INT_REG, DOUBLE_REG, SPECIAL_REG

getSpillAlignment

public static int getSpillAlignment(int type)
Get the required spill alignment for a register with a particular type

Parameters:
type - one of INT_REG, DOUBLE_REG, SPECIAL_REG

enumerateAll

public Enumeration<Register> enumerateAll()
Description copied from class: GenericPhysicalRegisterSet
Enumerate all the physical registers in this set.

Specified by:
enumerateAll in class GenericPhysicalRegisterSet

enumerateGPRs

public Enumeration<Register> enumerateGPRs()
Description copied from class: GenericPhysicalRegisterSet
Enumerate all the GPRs in this set.

Specified by:
enumerateGPRs in class GenericPhysicalRegisterSet

enumerateFPRs

public Enumeration<Register> enumerateFPRs()
Enumerate all the FPRs in this set.


enumerateVolatileGPRs

public PhysicalRegisterSet.PhysicalRegisterEnumeration enumerateVolatileGPRs()
Description copied from class: GenericPhysicalRegisterSet
Enumerate all the volatile GPRs in this set.

Specified by:
enumerateVolatileGPRs in class GenericPhysicalRegisterSet

enumerateNonvolatileGPRs

public PhysicalRegisterSet.PhysicalRegisterEnumeration enumerateNonvolatileGPRs()
Description copied from class: GenericPhysicalRegisterSet
Enumerate all the nonvolatile GPRs in this set.

Specified by:
enumerateNonvolatileGPRs in class GenericPhysicalRegisterSet

enumerateNonvolatileGPRsBackwards

public Enumeration<Register> enumerateNonvolatileGPRsBackwards()
Description copied from class: GenericPhysicalRegisterSet
Enumerate all the nonvolatile GPRs in this set, backwards

Overrides:
enumerateNonvolatileGPRsBackwards in class GenericPhysicalRegisterSet

enumerateVolatileFPRs

public PhysicalRegisterSet.PhysicalRegisterEnumeration enumerateVolatileFPRs()
Description copied from class: GenericPhysicalRegisterSet
Enumerate all the volatile FPRs in this set.

Specified by:
enumerateVolatileFPRs in class GenericPhysicalRegisterSet

enumerateNonvolatileFPRs

public PhysicalRegisterSet.PhysicalRegisterEnumeration enumerateNonvolatileFPRs()
Description copied from class: GenericPhysicalRegisterSet
Enumerate all the nonvolatile FPRs in this set.

Specified by:
enumerateNonvolatileFPRs in class GenericPhysicalRegisterSet

enumerateVolatiles

public Enumeration<Register> enumerateVolatiles(int regClass)
Enumerate the volatile physical registers of a given class.

Parameters:
regClass - one of INT_REG, DOUBLE_REG, SPECIAL_REG

enumerateVolatiles

public Enumeration<Register> enumerateVolatiles()
Description copied from class: GenericPhysicalRegisterSet
Enumerate all the volatile physical registers

Specified by:
enumerateVolatiles in class GenericPhysicalRegisterSet

getVolatiles

public BitSet getVolatiles()
Returns:
the set of volatile physical registers

getFPRs

public BitSet getFPRs()
Returns:
the set of FPR physical registers

enumerateNonvolatiles

public Enumeration<Register> enumerateNonvolatiles(int regClass)
Enumerate the nonvolatile physical registers of a given class.

Parameters:
regClass - one of INT_REG, DOUBLE_REG, SPECIAL_REG

enumerateNonvolatilesBackwards

public Enumeration<Register> enumerateNonvolatilesBackwards(int regClass)
Enumerate the nonvolatile physical registers of a given class, backwards

Parameters:
regClass - one of INT_REG, DOUBLE_REG, SPECIAL_REG