public override List <HighLevel.Instruction> GetHighLevel(HighLevel.HlGraph Context) { List <HighLevel.Instruction> List = new List <HighLevel.Instruction>(); List.Add(new HighLevel.BranchInstruction(Context.GetBlock(m_BranchTargetOffset))); return(List); }
public override List <HighLevel.Instruction> GetHighLevel(HighLevel.HlGraph Context) { List <HighLevel.Instruction> List = new List <HighLevel.Instruction>(); for (int i = 0; i < m_BranchTargetOffsets.Count; i++) // Add all conditional branches { HighLevel.Node Argument = new HighLevel.EqualsNode(Context.ReadStackLocationNode(Context.StackPointer), new HighLevel.IntegerConstantNode(i)); List.Add(new HighLevel.ConditionalBranchInstruction(Argument, Context.GetBlock(m_BranchTargetOffsets[i]))); } 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 Argument; if (Opcode == OpCodes.Beq || Opcode == OpCodes.Beq_S) { Argument = new HighLevel.EqualsNode(Context.ReadStackLocationNode(Context.StackPointer - 1), Context.ReadStackLocationNode(Context.StackPointer)); } else if (Opcode == OpCodes.Bne_Un || Opcode == OpCodes.Bne_Un_S) { Argument = new HighLevel.NotEqualsNode(Context.ReadStackLocationNode(Context.StackPointer - 1), Context.ReadStackLocationNode(Context.StackPointer)); } else if (Opcode == OpCodes.Bge || Opcode == OpCodes.Bge_S || Opcode == OpCodes.Bge_Un || Opcode == OpCodes.Bge_Un_S) { Argument = new HighLevel.GreaterEqualsNode(Context.ReadStackLocationNode(Context.StackPointer - 1), Context.ReadStackLocationNode(Context.StackPointer)); } else if (Opcode == OpCodes.Bgt || Opcode == OpCodes.Bgt_S || Opcode == OpCodes.Bgt_Un || Opcode == OpCodes.Bgt_Un_S) { Argument = new HighLevel.GreaterNode(Context.ReadStackLocationNode(Context.StackPointer - 1), Context.ReadStackLocationNode(Context.StackPointer)); } else if (Opcode == OpCodes.Ble || Opcode == OpCodes.Ble_S || Opcode == OpCodes.Ble_Un || Opcode == OpCodes.Ble_Un_S) { Argument = new HighLevel.LessEqualsNode(Context.ReadStackLocationNode(Context.StackPointer - 1), Context.ReadStackLocationNode(Context.StackPointer)); } else if (Opcode == OpCodes.Blt || Opcode == OpCodes.Blt_S || Opcode == OpCodes.Blt_Un || Opcode == OpCodes.Blt_Un_S) { Argument = new HighLevel.LessNode(Context.ReadStackLocationNode(Context.StackPointer - 1), Context.ReadStackLocationNode(Context.StackPointer)); } else { throw new InvalidOperationException(); } List.Add(new HighLevel.ConditionalBranchInstruction(Argument, Context.GetBlock(m_BranchTargetOffset))); return(List); }