public abstract class AbstractRegisterPool extends Object
Modifier and Type | Field and Description |
---|---|
private HashMap<Register,Register> |
_regPairs
When 2 registers are necessary to encode a result, such as with a long on
32bit architectures, this hash map remembers the pairing of registers.
|
protected int |
currentNum
All registers are assigned unique numbers; currentNum is the counter
containing the next available register number.
|
private Register |
end |
private Register |
start |
Constructor and Description |
---|
AbstractRegisterPool() |
Modifier and Type | Method and Description |
---|---|
Register |
getAddress()
Gets a new address register.
|
Register |
getCondition()
Gets a new condition register.
|
Register |
getDouble()
Gets a new double register.
|
Register |
getFirstSymbolicRegister() |
Register |
getFloat()
Gets a new float register.
|
Register |
getInteger()
Gets a new integer register.
|
Register |
getLong()
Gets a new long register.
|
Register |
getReg(Register template)
Get a new register of the same type as the argument register
|
Register |
getReg(RegisterOperand template)
Get a new register of the same type as the argument RegisterOperand
|
Register |
getReg(TypeReference type)
Get a new register of the appropriate type to hold values of 'type'
|
Register |
getSecondReg(Register reg)
MIR: Get the other half of the register pair that is
associated with the argument register.
|
Register |
getValidation()
Gets a new validation register.
|
private Register |
makeNewReg() |
RegisterOperand |
makeTemp(Operand op)
Make a temporary register operand that can hold the values
implied by the passed operand.
|
RegisterOperand |
makeTemp(RegisterOperand template)
Make a temporary register operand that is similar to the argument.
|
RegisterOperand |
makeTemp(TypeReference type)
Make a temporary register operand to hold values of the specified type
(a new register is allocated).
|
RegisterOperand |
makeTempAddress()
Make a temporary to hold an address (allocating a new register).
|
RegisterOperand |
makeTempBoolean()
Make a temporary to hold a boolean (allocating a new register).
|
RegisterOperand |
makeTempCondition()
Make a temporary to hold a condition code (allocating a new register).
|
RegisterOperand |
makeTempDouble()
Make a temporary to hold a double (allocating a new register).
|
RegisterOperand |
makeTempFloat()
Make a temporary to hold a float (allocating a new register).
|
RegisterOperand |
makeTempInt()
Make a temporary to hold an int (allocating a new register).
|
RegisterOperand |
makeTempLong()
Make a temporary to hold a long (allocating a new register).
|
RegisterOperand |
makeTempOffset()
Make a temporary to hold an address (allocating a new register).
|
RegisterOperand |
makeTempValidation()
Make a temporary to hold a guard (validation) (allocating a new register).
|
private void |
registerListappend(Register reg) |
private void |
registerListremove(Register e) |
void |
release(RegisterOperand r)
Release a now unused register.
|
void |
removeRegister(Register reg) |
private final HashMap<Register,Register> _regPairs
protected int currentNum
public AbstractRegisterPool()
public Register getFirstSymbolicRegister()
private void registerListappend(Register reg)
private void registerListremove(Register e)
private Register makeNewReg()
public void release(RegisterOperand r)
NOTE: It is the CALLERS responsibility to ensure that the register is no longer used!!!!
r
- the register to releasepublic void removeRegister(Register reg)
public Register getAddress()
public Register getInteger()
public Register getFloat()
public Register getDouble()
public Register getCondition()
public Register getLong()
public Register getValidation()
public Register getReg(Register template)
template
- the register to get the type frompublic Register getReg(RegisterOperand template)
template
- the register operand to get the type frompublic Register getReg(TypeReference type)
type
- the type of values that the register will holdpublic Register getSecondReg(Register reg)
Note: this isn't incredibly general, but all architectures we're currently targeting need at most 2 machine registers to hold Java data values, so for now don't bother implementing a general mechanism.
reg
- a register that may already be part of a register pairpublic RegisterOperand makeTemp(TypeReference type)
type
- the type of values to be held in the temp registerpublic RegisterOperand makeTemp(RegisterOperand template)
template
- the register operand to use as a template.public RegisterOperand makeTemp(Operand op)
op
- the operand to use as a template.public RegisterOperand makeTempAddress()
public RegisterOperand makeTempOffset()
public RegisterOperand makeTempInt()
public RegisterOperand makeTempBoolean()
public RegisterOperand makeTempFloat()
public RegisterOperand makeTempDouble()
public RegisterOperand makeTempLong()
public RegisterOperand makeTempCondition()
public RegisterOperand makeTempValidation()