コード例 #1
0
        public override void RenderIL_Store(ILCanvas canvas, ILValue target, ILValue index, ILValue value)
        {
            target.RenderIL_Load(canvas);
            index.RenderIL_Load(canvas);

            value.GetILImplicitCast(GetElementType())
            .RenderIL_Load(canvas);

            canvas.Emit_Stelem_Ref();
        }
コード例 #2
0
 public override void EmitStore(ILCanvas canvas, ILValue target, ILValue to_store)
 {
     if (method_pair.CanSet())
     {
         method_pair.EmitStore(canvas, target, to_store);
     }
     else if (backing_field != null)
     {
         backing_field.EmitStore(canvas, target, to_store);
     }
 }
コード例 #3
0
 static public void UseValue(this ILCanvas item, ILValue value, Process <ILValue> process)
 {
     if (value.IsILCostTrivial())
     {
         process(value);
     }
     else
     {
         item.UseLocalValue(value, l => process(l));
     }
 }
コード例 #4
0
 public override void EmitLoad(ILCanvas canvas, ILValue target)
 {
     if (method_pair.CanGet())
     {
         method_pair.EmitLoad(canvas, target);
     }
     else if (backing_field != null)
     {
         backing_field.EmitLoad(canvas, target);
     }
 }
コード例 #5
0
        static public void RenderIL_LoadAddress(this ILValue item, ILCanvas canvas)
        {
            ILAddressable cast;

            if (item.Convert <ILAddressable>(out cast))
            {
                cast.RenderIL_LoadAddress(canvas);
            }
            else
            {
                item.RenderIL_LoadAddressInternal(canvas);
            }
        }
コード例 #6
0
        public ILLocal CreateCementedLocal(ILValue value)
        {
            ILLocal local;

            if (value.Convert <ILLocal>(out local))
            {
                if (local.IsCemented())
                {
                    return(local);
                }
            }

            return(cemented_locals.AddAndGet(new ILLocal(value.GetValueType(), null, value, true))
                   .Chain(l => AddStatement(new ILInitializeLocal(l))));
        }
コード例 #7
0
        public override void RenderIL_Store(ILCanvas canvas, ILValue value)
        {
            if (field.IsInstanceField())
            {
                RenderIL_LoadTarget(canvas);

                value.GetILImplicitCast(field.FieldType)
                .RenderIL_Load(canvas);

                canvas.Emit_Stfld(field);
            }
            else
            {
                value.GetILImplicitCast(field.FieldType)
                .RenderIL_Load(canvas);

                canvas.Emit_Stsfld(field);
            }
        }
コード例 #8
0
        public ILStatement GenerateStatement(ILValue value, IList <ILCase> cases, ILStatement else_statement, int min_index, int max_index, int index)
        {
            int less_index    = (index + min_index) / 2;
            int greater_index = (index + max_index) / 2;

            if (index == min_index || index == max_index)
            {
                return(new ILIf(
                           value.GetILEqualTo(label),
                           statement,
                           else_statement
                           ));
            }

            return(new ILIf(
                       value.GetILLessThan(label),
                       cases[less_index].GenerateStatement(value, cases, else_statement, min_index, index, less_index),
                       cases[greater_index].GenerateStatement(value, cases, else_statement, index, max_index, greater_index)
                       ));
        }
コード例 #9
0
 public override void EmitCastAddress(ILCanvas canvas, ILValue value)
 {
     value.RenderIL_LoadAddress(canvas);
 }
コード例 #10
0
 public override void RenderIL_Operate(ILCanvas canvas, ILValue input)
 {
     LoadValue(canvas, input); canvas.Emit_Neg();
 }
コード例 #11
0
 static public ILConstructorInvokation GetBaseILConstructor(this ILValue item, params ILValue[] arguments)
 {
     return(item.GetBaseILConstructor((IEnumerable <ILValue>)arguments));
 }
コード例 #12
0
 static public ILConstructorInvokation GetILConstructorInvokation(this ILValue item, ConstructorInfo constructor, params ILValue[] arguments)
 {
     return(item.GetILConstructorInvokation(constructor, (IEnumerable <ILValue>)arguments));
 }
コード例 #13
0
 public ILReturn(ILValue v)
 {
     value = v;
 }
コード例 #14
0
 public ILWhile(ILValue c, ILStatement w)
 {
     condition       = c;
     while_statement = w;
 }
コード例 #15
0
 public override void EmitStore(ILCanvas canvas, ILValue target, ILValue to_store)
 {
     new ILField(target, field_info).RenderIL_Store(canvas, to_store);
 }
コード例 #16
0
 public override void RenderIL_Operate(ILCanvas canvas, ILValue left, ILValue right)
 {
     typeof(string).GetStaticILMethodInvokation("Concat", left, right).RenderIL_Load(canvas);
 }
コード例 #17
0
 static public void RenderIL_LoadAddressInternal(this ILValue item, ILCanvas canvas)
 {
     item.RenderIL_Load(canvas);
     canvas.MakeAddressImmediate(item.GetValueType());
 }
コード例 #18
0
 static public ILField GetILField(this ILValue item, string name)
 {
     return(item.GetILField(item.GetValueType().GetInstanceField(name)));
 }
コード例 #19
0
 static public ILField GetILField(this ILValue item, FieldInfo field)
 {
     return(field.IfNotNull(f => new ILField(item, f)));
 }
コード例 #20
0
 static public ILStatement CreateILCalculate(this ILValue item)
 {
     return(item.IfNotNull(i => new ILCalculate(i)));
 }
コード例 #21
0
 public override void RenderIL_Operate(ILCanvas canvas, ILValue left, ILValue right)
 {
     LoadValues(canvas, left, right); canvas.Emit_Cgtoe();
 }
コード例 #22
0
 public ILAssignArray(ILValue a, IEnumerable <ILValue> v)
 {
     array  = a;
     values = v.ToList();
 }
コード例 #23
0
 public override void RenderIL_Operate(ILCanvas canvas, ILValue left, ILValue right)
 {
     typeof(ObjectExtensions_Compare).GetStaticILMethodInvokation("NotEqualsEX", left, right).RenderIL_Load(canvas);
 }
コード例 #24
0
 public ILAssign(ILValue d, ILValue s)
 {
     destination = d;
     source      = s;
 }
コード例 #25
0
 public override void EmitLoadAddress(ILCanvas canvas, ILValue target)
 {
     new ILField(target, field_info).RenderIL_LoadAddress(canvas);
 }
コード例 #26
0
 static public BasicType GetValueBasicType(this ILValue item)
 {
     return(item.GetValueType().GetBasicType());
 }
コード例 #27
0
        public override void EmitCast(ILCanvas canvas, ILValue value)
        {
            value.RenderIL_Load(canvas);

            canvas.Emit_Conv_R8();
        }
コード例 #28
0
 static public ILValue GetILIsNotNull(this ILValue item)
 {
     return(item.GetILNotEqualTo(ILNull.INSTANCE));
 }
コード例 #29
0
        public override void EmitCast(ILCanvas canvas, ILValue value)
        {
            value.RenderIL_Load(canvas);

            canvas.Emit_Unbox_Any(GetDestinationType());
        }
コード例 #30
0
 static public ILConstructorInvokation GetILConstructorInvokation(this ILValue item, ConstructorInfo constructor, IEnumerable <ILValue> arguments)
 {
     return(constructor.IfNotNull(c => new ILConstructorInvokation(item, constructor, arguments)));
 }