|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectkanga.meta.KangaStorage
public final class KangaStorage
This wrapper represent a "union" structure of a storage unit in Kanga. A value in Kanga can be stored in either a register or on the stack. This class represents that storage information.
KangaReg| Constructor Summary | |
|---|---|
KangaStorage(int offset)
Wraps a storage unit in a stack with the given offset from the stack pointer. |
|
KangaStorage(KangaReg reg)
Wraps a storage unit in a register. |
|
| Method Summary | |
|---|---|
KangaReg |
getReg()
Returns the storage register. |
int |
getSpillOffset()
Returns the spill offset where the storage is. |
boolean |
inRegister()
Returns true if this storage unit is register-based. |
boolean |
inStack()
Returns true if this storage unit is stack-based. |
SimpleExp |
lookupAsExp(KangaContext context)
Looks up the storage unit and returns the corresponding Kanga expression that represents it (wraps a Reg AST). |
KangaReg |
lookupAsReg(KangaReg scratch,
KangaContext context)
Looks up the storage unit and returns the corresponding register that represents it. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public KangaStorage(KangaReg reg)
reg - the register where storage happenspublic KangaStorage(int offset)
offset - the offset from the stack pointer where storage happens| Method Detail |
|---|
public boolean inStack()
true if this storage unit is stack-based.
true if this storage unit is stack-basedpublic boolean inRegister()
true if this storage unit is register-based.
true if this storage unit is register-basedpublic KangaReg getReg()
public int getSpillOffset()
public SimpleExp lookupAsExp(KangaContext context)
MOVE
instruction to a scratch register if the storage is in the stack.
context - the context where a potential MOVE statement
is attached
Reg,
KangaReg.SCRATCH_0
public KangaReg lookupAsReg(KangaReg scratch,
KangaContext context)
ALOAD statement to
a scratch register first if the storage is not register-based (in stack).
scratch - the scratch register to which potential loaded value is
stored if need be (and also the register returned if
that happens)context - the context where a potential MOVE statement
is attached
KangaReg.SCRATCH_0,
KangaReg.SCRATCH_1
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||