|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--comp.Scope
Manages a lexical scope. Our language has a simple scoping model: a global scope and function scope. A scope can answer questions about offsets from the frame pointer.
Type
Field Summary | |
(package private) FuncDefNode |
func
|
(package private) int |
localOffset
|
(package private) int |
parmOffset
|
Constructor Summary | |
Scope(FuncDefNode func)
|
Method Summary | |
void |
defineLocal(java.lang.String name,
Type type)
Add a local variable definition to this scope. |
void |
defineParm(java.lang.String name,
Type type)
Add a parameter definition to this scope. |
int |
getOffset(java.lang.String name)
Get the offset of this name in the current frame. |
Type |
getType(java.lang.String name)
Get the type of this variable. |
VarDef |
lookup(java.lang.String id)
Lookup the variable name in this scope. |
java.lang.String |
lValue(java.lang.String name,
Assembler asm,
RegBank bank)
Issue an lvalue. |
java.lang.String |
rValue(java.lang.String name,
Assembler asm,
RegBank bank)
Issue an rvalue for this name. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
int parmOffset
int localOffset
FuncDefNode func
Constructor Detail |
public Scope(FuncDefNode func)
Method Detail |
public java.lang.String toString()
toString
in class java.lang.Object
public VarDef lookup(java.lang.String id)
public Type getType(java.lang.String name)
public void defineParm(java.lang.String name, Type type)
public void defineLocal(java.lang.String name, Type type)
public java.lang.String rValue(java.lang.String name, Assembler asm, RegBank bank)
public java.lang.String lValue(java.lang.String name, Assembler asm, RegBank bank)
public int getOffset(java.lang.String name)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |