public override void CGenAddress(CGenState state) {
Env.Entry entry = this.Env.Find(this.Name).Value;
Int32 offset = entry.Offset;
switch (entry.Kind) {
case Env.EntryKind.FRAME:
case Env.EntryKind.STACK:
state.LEA(offset, Reg.EBP, Reg.EAX);
return;
case Env.EntryKind.GLOBAL:
state.LEA(this.Name, Reg.EAX);
return;
case Env.EntryKind.ENUM:
case Env.EntryKind.TYPEDEF:
default:
throw new InvalidProgramException("cannot get the address of " + entry.Kind);
}
}