private static bool IsLeftToRightReassociable( IntrinsicPrototype prototype, out IntrinsicPrototype rightPrototype) { string op; string rightOp; bool isChecked; if (ArithmeticIntrinsics.TryParseArithmeticIntrinsicName(prototype.Name, out op, out isChecked) && !isChecked && intArithLeftToRight.TryGetValue(op, out rightOp) && prototype.ParameterTypes.All(x => x.IsIntegerType())) { rightPrototype = ArithmeticIntrinsics.CreatePrototype( rightOp, isChecked, prototype.ResultType, prototype.ParameterTypes); return(true); } else { rightPrototype = null; return(false); } }
/// <summary> /// Creates an arithmetic intrinsic. /// </summary> /// <param name="operatorName"> /// The name of the arithmetic operator to apply. /// </param> /// <param name="resultType"> /// The type of value produced by the intrinsic. /// </param> /// <param name="parameterTypes"> /// The parameter types taken by the intrinsic. /// </param> /// <param name="arguments"> /// The argument list to pass to the instruction. /// </param> /// <returns> /// An arithmetic intrinsic. /// </returns> public static Instruction CreateArithmeticIntrinsic( string operatorName, IType resultType, IReadOnlyList <IType> parameterTypes, IReadOnlyList <ValueTag> arguments) { return(ArithmeticIntrinsics.CreatePrototype( operatorName, resultType, parameterTypes).Instantiate(arguments)); }