public InstructionStatement(BasicBlockInstruction instruction) { if (instruction == null) { throw new ArgumentNullException("instruction"); } Instruction = instruction; }
public InstructionStatement(BasicBlockInstruction instruction) { if (instruction == null) throw new ArgumentNullException("instruction"); Instruction = instruction; }
public static BasicBlockInstruction MapInstruction(this BasicBlockInstruction bbi, Dictionary <VirtualRegister, VirtualRegister> regmap) { switch (bbi.OpCode) { case IROpCodes.ADD: case IROpCodes.SUB: case IROpCodes.MUL: case IROpCodes.DIV: case IROpCodes.MIN: case IROpCodes.MAX: case IROpCodes.REM: case IROpCodes.AND: case IROpCodes.OR: case IROpCodes.XOR: case IROpCodes.EQ: case IROpCodes.NE: case IROpCodes.GE: case IROpCodes.GT: case IROpCodes.LE: case IROpCodes.LT: BinaryOperation bop = bbi as BinaryOperation; return(new BinaryOperation(bop.OpCode, bop.Target.MapOperand(regmap), bop.LeftOperand.MapOperand(regmap), bop.RightOperand.MapOperand(regmap))); case IROpCodes.MAD: MADOperation mad = bbi as MADOperation; return(new MADOperation(mad.Target.MapOperand(regmap), mad.MulLeftOperand.MapOperand(regmap), mad.MulRightOperand.MapOperand(regmap), mad.AddOperand.MapOperand(regmap))); case IROpCodes.NEG: case IROpCodes.ABS: case IROpCodes.NOT: case IROpCodes.SQRT: case IROpCodes.RSQRT: case IROpCodes.SIN: case IROpCodes.COS: case IROpCodes.LG2: case IROpCodes.EX2: case IROpCodes.MOV: case IROpCodes.CVT: UnaryOperation uop = bbi as UnaryOperation; return(new UnaryOperation(uop.OpCode, uop.Target.MapOperand(regmap), uop.Operand.MapOperand(regmap))); case IROpCodes.LD: LDInstruction load = bbi as LDInstruction; return(new LDInstruction(load.Target.MapOperand(regmap), load.Address.MapOperand(regmap))); case IROpCodes.ST: STInstruction store = bbi as STInstruction; return(new STInstruction(store.Address.MapOperand(regmap), store.Source.MapOperand(regmap))); case IROpCodes.CALL: CALLInstruction call = bbi as CALLInstruction; return(new CALLInstruction(call.Target, call.Arguments.Select(op => op.MapOperand(regmap)).ToList())); case IROpCodes.SYNC: return(new SYNCInstruction()); default: throw new NotSupportedException(); } }