Example #1
0
        private void EmitLdloc(AILEmitter Context, int Index, ARegisterType Type)
        {
            ARegister Reg = new ARegister(Index, Type);

            Context.Generator.EmitLdloc(Context.GetLocalIndex(Reg));

            AILConv.EmitConv(Context, Context.GetLocalType(Reg), OperType);
        }
Example #2
0
        private void InitLocals()
        {
            int ParamsStart = ATranslatedSub.FixedArgTypes.Length;

            Locals = new Dictionary <ARegister, int>();

            for (int Index = 0; Index < Subroutine.Params.Count; Index++)
            {
                ARegister Reg = Subroutine.Params[Index];

                Generator.EmitLdarg(Index + ParamsStart);

                AILConv.EmitConv(this, GetFieldType(Reg.Type), GetLocalType(Reg));

                Generator.EmitStloc(GetLocalIndex(Reg));
            }
        }
Example #3
0
        private void LoadLocals(AILEmitter Context, long Inputs, ARegisterType BaseType)
        {
            for (int Bit = 0; Bit < 64; Bit++)
            {
                long Mask = 1L << Bit;

                if ((Inputs & Mask) != 0)
                {
                    ARegister Reg = AILEmitter.GetRegFromBit(Bit, BaseType);

                    Context.Generator.EmitLdarg(ATranslatedSub.RegistersArgIdx);
                    Context.Generator.Emit(OpCodes.Ldfld, Reg.GetField());

                    AILConv.EmitConv(
                        Context,
                        Context.GetFieldType(Reg.Type),
                        Context.GetLocalType(Reg));

                    Context.Generator.EmitStloc(Context.GetLocalIndex(Reg));
                }
            }
        }