public void Decl(Symbols.Var var) { int size = var.GetType() is Symbols.CHAR ? 4 : var.GetType().GetSizeType(); this.offset += size; AddCode(Com.SUB, new Addr(Reg.ESP), new Val(size, 4)); this.address.Add(var, new Addr(Reg.EBP, size) - this.offset); }
public void Push(Syntax.Identifier identifier) { Reg r1 = GetFreeReg(); Symbols.Var var = identifier.GetVariable(); AddCode(Com.LEA, new Addr(r1), new Val(this.address[var])); //lea eax, cast[addr] AddCode(Com.PUSH, new Addr(r1)); //push eax FreeReg(r1); this.stack.Push(Type.GetType(var.GetType().GetSizeType())); }
public void Import(Symbols.Var func) { Symbols.Func f = (Symbols.Func)func.GetType(); this.address.Add(func, new Addr(func.GetName())); this.imports.Add(func.GetName() + ", '" + func.GetName() + "'"); }
public void SetVariable(Symbols.Var variable) { this.variable = variable; this.type = variable.GetType(); }