public void outABinopExpr(ABinopExpr node) { Value right = (Value) mProductions.removeLast(); BinopExpr expr = (BinopExpr) mProductions.removeLast(); Value left = (Value) mProductions.removeLast(); expr.setOp1(left); expr.setOp2(right); mProductions.addLast(expr); }
be.setOp2(uc.defineType(t)); } else if (op2 instanceof Local) { Type t = localTyped.get(op2); UntypedIntOrFloatConstant uc2 = (UntypedIntOrFloatConstant) op2; be.setOp2(uc2.toIntConstant()); } else if (op1 instanceof UntypedLongOrDoubleConstant && op2 instanceof UntypedLongOrDoubleConstant) { UntypedLongOrDoubleConstant uc1 = (UntypedLongOrDoubleConstant) op1; UntypedLongOrDoubleConstant uc2 = (UntypedLongOrDoubleConstant) op2; be.setOp2(uc2.toLongConstant()); } else { throw new RuntimeException("error: expected same type of untyped constants. Got " + stmt); } else if (op2 instanceof UntypedConstant) { UntypedConstant uc = (UntypedConstant) op2; be.setOp2(uc.defineType(op1.getType()));
private void handleBinopExpr(BinopExpr be, Stmt stmt, Type tlhs) { Value opl = be.getOp1(), opr = be.getOp2(); Type tl = AugEvalFunction.eval_(this.tg, opl, stmt, this.jb), tr = AugEvalFunction.eval_(this.tg, opr, stmt, this.jb); if (be instanceof AddExpr || be instanceof SubExpr || be instanceof MulExpr || be instanceof DivExpr || be instanceof RemExpr || be instanceof GeExpr || be instanceof GtExpr || be instanceof LeExpr || be instanceof LtExpr || be instanceof ShlExpr || be instanceof ShrExpr || be instanceof UshrExpr) { if (tlhs instanceof IntegerType) { be.setOp1(this.uv.visit(opl, IntType.v(), stmt)); be.setOp2(this.uv.visit(opr, IntType.v(), stmt)); } } else if (be instanceof CmpExpr || be instanceof CmpgExpr || be instanceof CmplExpr) { // No checks in the original assigner } else if (be instanceof AndExpr || be instanceof OrExpr || be instanceof XorExpr) { be.setOp1(this.uv.visit(opl, tlhs, stmt)); be.setOp2(this.uv.visit(opr, tlhs, stmt)); } else if (be instanceof EqExpr || be instanceof NeExpr) { if (tl instanceof BooleanType && tr instanceof BooleanType) { } else if (tl instanceof Integer1Type || tr instanceof Integer1Type) { } else if (tl instanceof IntegerType) { be.setOp1(this.uv.visit(opl, IntType.v(), stmt)); be.setOp2(this.uv.visit(opr, IntType.v(), stmt)); } } }
expr.setOp2(insertCast(expr.getOp2(), getTypeForCast(rop), getTypeForCast(lop), stmt));
be.setOp2(insertCast(be.getOp2(), getTypeForCast(rop), IntType.v(), stmt)); } else { error("Type Error(8)"); be.setOp2(insertCast(be.getOp2(), getTypeForCast(rop), getTypeForCast(lop), stmt)); lca = lop; be.setOp2(insertCast(be.getOp2(), getTypeForCast(rop), IntType.v(), stmt)); } else { error("Type Error(10)"); be.setOp2(insertCast(be.getOp2(), getTypeForCast(rop), IntType.v(), stmt)); } else { error("Type Error(10)"); be.setOp2(insertCast(be.getOp2(), getTypeForCast(rop), getTypeForCast(lop), stmt));
expr.setOp2(insertCast(expr.getOp2(), getTypeForCast(rop), getTypeForCast(lop), stmt));
expr.setOp2(insertCast(expr.getOp2(), getTypeForCast(rop), getTypeForCast(lop), stmt));
be.setOp2(insertCast(be.getOp2(), getTypeForCast(rop), IntType.v(), stmt)); be.setOp2(insertCast(be.getOp2(), getTypeForCast(rop), getTypeForCast(lop), stmt)); lca = lop; be.setOp2(insertCast(be.getOp2(), getTypeForCast(rop), IntType.v(), stmt)); be.setOp2(insertCast(be.getOp2(), getTypeForCast(rop), IntType.v(), stmt)); be.setOp2(insertCast(be.getOp2(), getTypeForCast(rop), getTypeForCast(lop), stmt));
be.setOp2(insertCast(be.getOp2(), getTypeForCast(rop), IntType.v(), stmt)); be.setOp2(insertCast(be.getOp2(), getTypeForCast(rop), getTypeForCast(lop), stmt)); lca = lop; be.setOp2(insertCast(be.getOp2(), getTypeForCast(rop), IntType.v(), stmt)); be.setOp2(insertCast(be.getOp2(), getTypeForCast(rop), IntType.v(), stmt)); be.setOp2(insertCast(be.getOp2(), getTypeForCast(rop), getTypeForCast(lop), stmt));