Exemple #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);
        }
Exemple #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()));
        }
Exemple #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() + "'");
 }
Exemple #4
0
 public void SetVariable(Symbols.Var variable)
 {
     this.variable = variable;
     this.type     = variable.GetType();
 }
 public void SetVariable(Symbols.Var variable)
 {
     this.variable = variable;
     this.type = variable.GetType();
 }