public static ParamLessInstruction GetInstructionForOperator( string operatorVal, bool twoArg = true, DatSymbolType leftSideType = DatSymbolType.Void) { ParamLessInstruction instruction = new ParamLessInstruction(); switch (operatorVal) { case "=": instruction = GetAssignInstructionForDatSymbolType(leftSideType); break; case "+=": instruction = new AssignAdd(); break; case "-=": instruction = new AssignSubtract(); break; case "*=": instruction = new AssignMultiply(); break; case "/=": instruction = new AssignDivide(); break; case "+": if (twoArg) { instruction = new Add(); } else { instruction = new Plus(); } break; case "-": if (twoArg) { instruction = new Subtract(); } else { instruction = new Minus(); } break; case "<<": instruction = new ShiftLeft(); break; case ">>": instruction = new ShiftRight(); break; case ">": instruction = new Greater(); break; case ">=": instruction = new GreaterOrEqual(); break; case "<": instruction = new Less(); break; case "<=": instruction = new LessOrEqual(); break; case "==": instruction = new Equal(); break; case "!=": instruction = new NotEqual(); break; case "!": instruction = new Not(); break; case "~": instruction = new Negate(); break; case "*": instruction = new Multiply(); break; case "/": instruction = new Divide(); break; case "%": instruction = new Modulo(); break; case "&": instruction = new BitAnd(); break; case "|": instruction = new BitOr(); break; case "&&": instruction = new LogAnd(); break; case "||": instruction = new LogOr(); break; } if (instruction == null) { throw new Exception($"'{operatorVal}' does't have insctruction"); } return(instruction); }
public static IEnumerable <Tile> GetTiles() { return(new[] { LabelTile(), ConstTile <long>(), MemAccessTile(), MemAccessTile <long>(), Stack.Call(), Stack.Ret(), Stack.Push(), Stack.Pop(), Add.RegReg(), Add.RegConst <long>(), Add.ConstReg <long>(), Sub.RegReg(), Sub.RegConst <long>(), Sub.ConstReg <long>(), Mul.RegReg(), Mul.RegConst <long>(), Mul.ConstReg <long>(), Div.RegReg(), Div.RegConst <long>(), Div.ConstReg <long>(), Mod.RegReg(), Mod.RegConst <long>(), Mod.ConstReg <long>(), Shl.RegConst <long>(), Shr.RegConst <long>(), BitXor.RegReg(), BitXor.RegConst <long>(), BitXor.ConstReg <long>(), BitAnd.RegReg(), BitAnd.RegConst <long>(), BitAnd.ConstReg <long>(), BitOr.RegReg(), BitOr.RegConst <long>(), BitOr.ConstReg <long>(), LogAnd.RegReg(), LogAnd.RegConst(), LogAnd.ConstReg(), LogOr.RegReg(), LogOr.RegConst <long>(), LogOr.ConstReg <long>(), Unop.Inc_Reg(), Unop.Dec_Reg(), Unop.Plus_Reg(), Unop.Minus_Reg(), Unop.Neg_Reg(), Unop.BinNot_Reg(), Unop.LogNot_Reg(), Compare.RegReg_Eq(), Compare.RegReg_Neq(), Compare.RegReg_Lt(), Compare.RegReg_Le(), Compare.RegReg_Gt(), Compare.RegReg_Ge(), Compare.RegConst_Eq <long>(), Compare.RegConst_Neq <long>(), Compare.RegConst_Lt <long>(), Compare.RegConst_Le <long>(), Compare.RegConst_Gt <long>(), Compare.RegConst_Ge <long>(), Compare.ConstReg_Eq <long>(), Compare.ConstReg_Neq <long>(), Compare.ConstReg_Lt <long>(), Compare.ConstReg_Le <long>(), Compare.ConstReg_Gt <long>(), Compare.ConstReg_Ge <long>(), Assign.Reg_Reg(), Assign.Reg_Const(), Assign.Reg_AddConst(), Assign.Reg_SubConst(), Assign.MemReg_Reg(), Assign.MemReg_Const(), Assign.MemConst_Reg(), Assign.MemConst_Const(), Jump.Unconditional_Label(), Jump.Unconditional_Reg(), Jump.Cond_RegReg_Eq(), Jump.Cond_RegReg_Neq(), Jump.Cond_RegReg_Lt(), Jump.Cond_RegReg_Le(), Jump.Cond_RegReg_Gt(), Jump.Cond_RegReg_Ge(), Jump.Cond_RegConst_Eq <long>(), Jump.Cond_RegConst_Neq <long>(), Jump.Cond_RegConst_Lt <long>(), Jump.Cond_RegConst_Le <long>(), Jump.Cond_RegConst_Gt <long>(), Jump.Cond_RegConst_Ge <long>(), Jump.Cond_ConstReg_Eq <long>(), Jump.Cond_ConstReg_Neq <long>(), Jump.Cond_ConstReg_Lt <long>(), Jump.Cond_ConstReg_Le <long>(), Jump.Cond_ConstReg_Gt <long>(), Jump.Cond_ConstReg_Ge <long>(), Advanced.EffectiveMultiplication_RegConst(), Advanced.EffectiveMultiplication_ConstReg(), Advanced.EffectiveAddition_RegReg(), Advanced.EffectiveAddition_RegConst <long>(), Advanced.EffectiveAddition_ConstReg <long>(), Advanced.EffectiveAddition_ConstRegReg1 <long>(), Advanced.EffectiveAddition_ConstRegReg2 <long>(), Advanced.EffectiveAddition_RegConstReg1 <long>(), Advanced.EffectiveAddition_RegConstReg2 <long>(), Advanced.EffectiveAddition_RegRegConst1 <long>(), Advanced.EffectiveAddition_RegRegConst2 <long>() }); }