コード例 #1
0
        public override List <HighLevel.Instruction> GetHighLevel(HighLevel.HlGraph Context)
        {
            List <HighLevel.Instruction> List = new List <HighLevel.Instruction>();

            HighLevel.LocationNode Argument = Context.ReadStackLocationNode(Context.StackPointer);
            Context.DefineStackLocationNode(Context.StackPointer, Argument.Location.DataType);

            List.Add(new HighLevel.AssignmentInstruction(Context.DefineStackLocationNode(Context.StackPointer + 1), Argument));
            return(List);
        }
コード例 #2
0
        public override List <HighLevel.Instruction> GetHighLevel(HighLevel.HlGraph Context)
        {
            List <HighLevel.Instruction> List = new List <HighLevel.Instruction>();

            List.Add(new HighLevel.AssignmentInstruction(Context.DefineStackLocationNode(Context.StackPointer + 1, typeof(double)), new HighLevel.DoubleConstantNode(m_Constant)));
            return(List);
        }
コード例 #3
0
        public override List <HighLevel.Instruction> GetHighLevel(HighLevel.HlGraph Context)
        {
            List <HighLevel.Instruction> List = new List <HighLevel.Instruction>();

            HighLevel.Node Argument;
            HighLevel.Node Left = Context.ReadStackLocationNode(Context.StackPointer - 1), Right = Context.ReadStackLocationNode(Context.StackPointer);
            if (Opcode == OpCodes.Add)
            {
                Argument = new HighLevel.AddNode(Left, Right);
            }
            else if (Opcode == OpCodes.Sub)
            {
                Argument = new HighLevel.SubNode(Left, Right);
            }
            else if (Opcode == OpCodes.Mul)
            {
                Argument = new HighLevel.MulNode(Left, Right);
            }
            else if (Opcode == OpCodes.Div)
            {
                Argument = new HighLevel.DivNode(Left, Right);
            }
            else if (Opcode == OpCodes.Rem)
            {
                Argument = new HighLevel.ModNode(Left, Right);
            }
            else
            {
                throw new InvalidOperationException();
            }

            List.Add(new HighLevel.AssignmentInstruction(Context.DefineStackLocationNode(Context.StackPointer - 1), Argument));
            return(List);
        }
コード例 #4
0
        public override List <HighLevel.Instruction> GetHighLevel(HighLevel.HlGraph Context)
        {
            List <HighLevel.Instruction> List = new List <HighLevel.Instruction>();

            List.Add(new HighLevel.AssignmentInstruction(Context.DefineStackLocationNode(Context.StackPointer), new HighLevel.DerefNode(Context.ReadStackLocationNode(Context.StackPointer))));
            return(List);
        }
コード例 #5
0
        public override List <HighLevel.Instruction> GetHighLevel(HighLevel.HlGraph Context)
        {
            List <HighLevel.Instruction> List = new List <HighLevel.Instruction>();

            List.Add(new HighLevel.AssignmentInstruction(Context.DefineStackLocationNode(Context.StackPointer + 1), Context.ArgumentNode(m_Index)));
            return(List);
        }
コード例 #6
0
        public override List <HighLevel.Instruction> GetHighLevel(HighLevel.HlGraph Context)
        {
            List <HighLevel.Instruction> List = new List <HighLevel.Instruction>();

            HighLevel.Node Argument;
            if (Opcode == OpCodes.Ceq)
            {
                Argument = new HighLevel.EqualsNode(Context.ReadStackLocationNode(Context.StackPointer - 1), Context.ReadStackLocationNode(Context.StackPointer));
            }
            else if (Opcode == OpCodes.Cgt || Opcode == OpCodes.Cgt_Un)
            {
                Argument = new HighLevel.GreaterNode(Context.ReadStackLocationNode(Context.StackPointer - 1), Context.ReadStackLocationNode(Context.StackPointer));
            }
            else if (Opcode == OpCodes.Clt || Opcode == OpCodes.Clt_Un)
            {
                Argument = new HighLevel.LessNode(Context.ReadStackLocationNode(Context.StackPointer - 1), Context.ReadStackLocationNode(Context.StackPointer));
            }
            else
            {
                throw new InvalidOperationException();
            }

            List.Add(new HighLevel.AssignmentInstruction(Context.DefineStackLocationNode(Context.StackPointer - 1, typeof(int)), Argument));
            return(List);
        }
コード例 #7
0
        public override List <HighLevel.Instruction> GetHighLevel(HighLevel.HlGraph Context)
        {
            List <HighLevel.Instruction> List = new List <HighLevel.Instruction>();

            HighLevel.ArrayAccessNode Argument = new HighLevel.ArrayAccessNode(ArrayType);
            Argument.SubNodes.Add(Context.ReadStackLocationNode(Context.StackPointer - 1));
            Argument.SubNodes.Add(Context.ReadStackLocationNode(Context.StackPointer));

            List.Add(new HighLevel.AssignmentInstruction(Context.DefineStackLocationNode(Context.StackPointer - 1), Argument));
            return(List);
        }
コード例 #8
0
        public override List <HighLevel.Instruction> GetHighLevel(HighLevel.HlGraph Context)
        {
            List <HighLevel.Instruction> List = new List <HighLevel.Instruction>();

            HighLevel.Node Argument;
            if (FieldInfo.IsStatic)
            {
                Argument = new HighLevel.LocationNode(Context.StaticFieldLocation(FieldInfo));
            }
            else
            {
                Argument = new HighLevel.InstanceFieldNode(Context.ReadStackLocationNode(Context.StackPointer), FieldInfo);
            }

            List.Add(new HighLevel.AssignmentInstruction(Context.DefineStackLocationNode(m_WithoutThis ? Context.StackPointer + 1 : Context.StackPointer), Argument));
            return(List);
        }
コード例 #9
0
        public override List <HighLevel.Instruction> GetHighLevel(HighLevel.HlGraph Context)
        {
            List <HighLevel.Instruction> List = new List <HighLevel.Instruction>();

            HighLevel.Node Result = null;
            if (StackProduceCount != 0)
            {
                Result = Context.DefineStackLocationNode(Context.StackPointer - StackConsumeCount + 1, MethodInfo.ReturnType);
            }

            HighLevel.Node CallNode = new HighLevel.CallNode(MethodInfo);
            for (int i = StackConsumeCount - 1; i >= 0; i--)
            {
                CallNode.SubNodes.Add(Context.ReadStackLocationNode(Context.StackPointer - i));
            }

            Context.TranslateCallNode(ref Result, ref CallNode);

            List.Add(new HighLevel.AssignmentInstruction(Result, CallNode));
            return(List);
        }
コード例 #10
0
        public override List <HighLevel.Instruction> GetHighLevel(HighLevel.HlGraph Context)
        {
            List <HighLevel.Instruction> List = new List <HighLevel.Instruction>();

            HighLevel.Node Argument;
            if (FieldInfo.IsStatic)
            {
                Argument = new HighLevel.LocationNode(Context.StaticFieldLocation(FieldInfo));
            }
            else
            {
                Argument = new HighLevel.InstanceFieldNode(Context.ReadStackLocationNode(Context.StackPointer), FieldInfo);
            }

            bool isStruct = FieldInfo.FieldType.IsValueType && !FieldInfo.FieldType.IsPrimitive && !FieldInfo.FieldType.IsEnum;

            if (!isStruct)
            {
                Argument = new HighLevel.AddressOfNode(Argument);
            }

            List.Add(new HighLevel.AssignmentInstruction(Context.DefineStackLocationNode(Context.StackPointer), Argument));
            return(List);
        }