public class CalleeSaveLayout extends Object
Modifier and Type | Field and Description |
---|---|
int |
frameOffsetToCSA
The offset from the frame pointer to the CSA.
|
private Register[] |
indexToReg |
Register[] |
registers
The list of registers contained by this CSA.
|
private int[] |
regNumToIndex
Map from register numbers to slot indexes in the CSA.
|
int |
size
The size (in bytes) of the CSA.
|
int |
slotSize
The size (in bytes) of an indexable slot in the CSA.
|
Constructor and Description |
---|
CalleeSaveLayout(TargetDescription target,
int frameOffsetToCSA,
int size,
int slotSize,
Register... registers)
Creates a CSA layout.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(int reg)
Determines if the CSA includes a slot for a given register.
|
int |
indexOf(int reg)
Gets the index of a given register in the CSA.
|
int |
offsetOf(int reg)
Gets the offset of a given register in the CSA.
|
int |
offsetOf(Register reg)
Gets the offset of a given register in the CSA.
|
Register |
registerAt(int index)
Gets the register whose slot in the CSA is at a given index.
|
String |
toString() |
public final int size
private final int[] regNumToIndex
private final Register[] indexToReg
public final int frameOffsetToCSA
Integer.MAX_VALUE
.public CalleeSaveLayout(TargetDescription target, int frameOffsetToCSA, int size, int slotSize, Register... registers)
size
- size (in bytes) of the CSA. If this is -1
, then the CSA size will be
computed from registers
.slotSize
- the size (in bytes) of an indexable slot in the
CSAregisters
- the registers that can be saved in the CSApublic int offsetOf(int reg)
reg
in the CSAIllegalArgumentException
- if reg
does not have a slot in the CSApublic int indexOf(int reg)
reg
in the CSAIllegalArgumentException
- if reg
does not have a slot in the CSApublic int offsetOf(Register reg)
reg
in the CSAIllegalArgumentException
- if reg
does not have a slot in the CSApublic boolean contains(int reg)
reg
- the register to testreg
public Register registerAt(int index)
index
- an index of a slot in the CSAindex
or null
if
index
does not denote a slot in the CSA aligned with a register