Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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()));
        }
Esempio n. 3
0
 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() + "'");
 }
Esempio n. 4
0
 public void SetVariable(Symbols.Var variable)
 {
     this.variable = variable;
     this.type     = variable.GetType();
 }
Esempio n. 5
0
 public void SetVariable(Symbols.Var variable)
 {
     this.variable = variable;
     this.type = variable.GetType();
 }