Ejemplo n.º 1
0
Archivo: TypeOf.cs Proyecto: 7shi/LLPML
        public static void AddCodes(NodeBase caller, BlockBase parent, NodeBase target, OpModule codes, string op, Addr32 dest)
        {
            if (target is TypeOf) target = (target as TypeOf).Target;

            var v = target as Variant;
            if (v != null && parent.GetFunction(v.Name) == null)
            {
                var fpname = (target as Variant).Name;
                var fpt = Types.GetType(parent, fpname);
                if (fpt == null || !fpt.Check())
                    throw caller.Abort("undefined type: {0}", fpname);
                codes.AddCodesV(op, dest, codes.GetTypeObject(fpt));
                return;
            }

            var tt = target.Type;
            var tr = tt as TypeReference;
            var tts = tt.Type as TypeStruct;
            if (tr != null && (tr.IsArray || (tts != null && tts.IsClass)))
            {
                target.AddCodesV(codes, "mov", null);
                var label = new OpCode();
                codes.Add(I386.Test(Reg32.EAX, Reg32.EAX));
                codes.Add(I386.Jcc(Cc.Z, label.Address));
                codes.Add(I386.MovRA(Reg32.EAX, Addr32.NewRO(Reg32.EAX, -16)));
                codes.Add(label);
                codes.AddCodes(op, dest);
            }
            else
                codes.AddCodesV(op, dest, codes.GetTypeObject(tt));
        }
Ejemplo n.º 2
0
Archivo: Null.cs Proyecto: 7shi/LLPML
 public override void AddCodesV(OpModule codes, string op, Addr32 dest)
 {
     codes.AddCodesV(op, dest, Val32.New(0));
 }
Ejemplo n.º 3
0
 public override void AddCodesV(OpModule codes, string op, Addr32 dest)
 {
     codes.AddCodesV(op, dest, codes.GetAddress(this));
 }
Ejemplo n.º 4
0
 public override void AddCodesV(OpModule codes, string op, Addr32 dest)
 {
     codes.AddCodesV(op, dest, codes.GetString(Value));
 }
Ejemplo n.º 5
0
 public override void AddCodesV(OpModule codes, string op, Addr32 dest)
 {
     Val32 v;
     var m = codes.Module;
     if (func != null)
         v = func.GetAddress(m);
     else
     {
         var vv = GetVar();
         if (vv != null)
         {
             vv.AddCodesV(codes, op, dest);
             return;
         }
         var c = GetConst();
         if (c != null)
         {
             c.AddCodesV(codes, op, dest);
             return;
         }
         var f = GetFunction();
         if (f == null)
         {
             var g = GetGetter();
             if (g != null)
             {
                 Call.NewName(Parent, g.Name).AddCodesV(codes, op, dest);
                 return;
             }
             throw Abort("undefined symbol: " + name);
         }
         v = f.GetAddress(m);
     }
     codes.AddCodesV(op, dest, v);
 }