public QuadTuple(ILOperator op, ILIdentifier rv1, ILIdentifier rv2, ILIdentifier lv) { Operator = op; RValueA = rv1; RValueB = rv2; LValue = lv; }
public static void InjectConstant(this QuadTuple qt, ASTConstant constant, int isRValue, ILIdentifier str = null) { if (constant is ASTStringConstant sc) { if (isRValue == 0) { qt.RValueA = str; } else if (isRValue == 1) { qt.RValueB = str; } else { qt.LValue = str; } } else if (constant is ASTIntegerConstant ic) { if (isRValue == 0) { qt.RValueA = new ILIdentifier(ic.Value.ToString(), ILNameType.Constant, "int"); } else if (isRValue == 1) { qt.RValueB = new ILIdentifier(ic.Value.ToString(), ILNameType.Constant, "int"); } else { qt.LValue = new ILIdentifier(ic.Value.ToString(), ILNameType.Constant, "int"); } } else if (constant is ASTFloatConstant fp) { if (isRValue == 0) { qt.RValueA = new ILIdentifier(fp.Value.ToString(), ILNameType.Constant, "float"); } else if (isRValue == 1) { qt.RValueB = new ILIdentifier(fp.Value.ToString(), ILNameType.Constant, "float"); } else { qt.LValue = new ILIdentifier(fp.Value.ToString(), ILNameType.Constant, "float"); } } else if (constant is ASTCharConstant cc) { if (isRValue == 0) { qt.RValueA = new ILIdentifier(cc.Value.ToString(), ILNameType.Constant, "char"); } else if (isRValue == 1) { qt.RValueB = new ILIdentifier(cc.Value.ToString(), ILNameType.Constant, "char"); } else { qt.LValue = new ILIdentifier(cc.Value.ToString(), ILNameType.Constant, "char"); } } }