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); }
public override List <HighLevel.Instruction> GetHighLevel(HighLevel.HlGraph Context) { List <HighLevel.Instruction> List = new List <HighLevel.Instruction>(); HighLevel.Node Argument = Context.ReadStackLocationNode(Context.StackPointer); if (Opcode == OpCodes.Brfalse || Opcode == OpCodes.Brfalse_S) { Argument = new HighLevel.LogicalNotNode(Argument); } List.Add(new HighLevel.ConditionalBranchInstruction(Argument, Context.GetBlock(m_BranchTargetOffset))); return(List); }
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); }