/** * @see com.ibm.wala.shrikeBT.IInstruction.Visitor#visitShift(IShiftInstruction) */ @Override public void visitShift(IShiftInstruction instruction) { int val2 = workingState.pop(); int val1 = workingState.pop(); int result = reuseOrCreateDef(); workingState.push(result); emitInstruction(insts.BinaryOpInstruction(getCurrentInstructionIndex(), instruction.getOperator(), false, instruction.isUnsigned(), result, val1, val2, true)); }
/** * @see com.ibm.wala.shrikeBT.IInstruction.Visitor#visitBinaryOp(IBinaryOpInstruction) */ @Override public void visitBinaryOp(IBinaryOpInstruction instruction) { int val2 = workingState.pop(); int val1 = workingState.pop(); int result = reuseOrCreateDef(); workingState.push(result); boolean isFloat = instruction.getType().equals(TYPE_double) || instruction.getType().equals(TYPE_float); emitInstruction(insts.BinaryOpInstruction(getCurrentInstructionIndex(), instruction.getOperator(), instruction.throwsExceptionOnOverflow(), instruction .isUnsigned(), result, val1, val2, !isFloat)); }
@Override public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses) { return insts.BinaryOpInstruction(iindex, getOperator(), false, false, defs == null || defs.length == 0 ? getDef(0) : defs[0], uses == null ? getUse(0) : uses[0], uses == null ? getUse(1) : uses[1], mayBeIntegerOp()); }
/** * @see com.ibm.wala.shrikeBT.IInstruction.Visitor#visitBinaryOp(IBinaryOpInstruction) */ @Override public void visitBinaryOp(IBinaryOpInstruction instruction) { int val2 = workingState.pop(); int val1 = workingState.pop(); int result = reuseOrCreateDef(); workingState.push(result); boolean isFloat = instruction.getType().equals(TYPE_double) || instruction.getType().equals(TYPE_float); emitInstruction(insts.BinaryOpInstruction(getCurrentInstructionIndex(), instruction.getOperator(), instruction.throwsExceptionOnOverflow(), instruction .isUnsigned(), result, val1, val2, !isFloat)); }
@Override public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses) { return insts.BinaryOpInstruction(iindex, getOperator(), false, false, defs == null || defs.length == 0 ? getDef(0) : defs[0], uses == null ? getUse(0) : uses[0], uses == null ? getUse(1) : uses[1], mayBeIntegerOp()); }
/** * @see com.ibm.wala.shrikeBT.IInstruction.Visitor#visitShift(IShiftInstruction) */ @Override public void visitShift(IShiftInstruction instruction) { int val2 = workingState.pop(); int val1 = workingState.pop(); int result = reuseOrCreateDef(); workingState.push(result); emitInstruction(insts.BinaryOpInstruction(getCurrentInstructionIndex(), instruction.getOperator(), false, instruction.isUnsigned(), result, val1, val2, true)); }
/** * @see com.ibm.wala.shrikeBT.IInstruction.Visitor#visitBinaryOp(IBinaryOpInstruction) */ @Override public void visitBinaryOperation(BinaryOperation instruction) { int val2 = workingState.getLocal(instruction.oper2); int val1 = workingState.getLocal(instruction.oper1); int dest = instruction.destination; // int val2 = workingState.pop(); // int val1 = workingState.pop(); int result = reuseOrCreateDef(); setLocal(dest, result); // workingState.push(result); // boolean isFloat = instruction.getType().equals(TYPE_double) || instruction.getType().equals(TYPE_float); emitInstruction(insts.BinaryOpInstruction(getCurrentInstructionIndex(), instruction.getOperator(), false, instruction.isUnsigned(), result, val1, val2, !instruction.isFloat())); }
/** * @see com.ibm.wala.shrikeBT.IInstruction.Visitor#visitBinaryOp(IBinaryOpInstruction) */ @Override public void visitBinaryOperation(BinaryOperation instruction) { int val2 = workingState.getLocal(instruction.oper2); int val1 = workingState.getLocal(instruction.oper1); int dest = instruction.destination; // int val2 = workingState.pop(); // int val1 = workingState.pop(); int result = reuseOrCreateDef(); setLocal(dest, result); // workingState.push(result); // boolean isFloat = instruction.getType().equals(TYPE_double) || instruction.getType().equals(TYPE_float); emitInstruction(insts.BinaryOpInstruction(getCurrentInstructionIndex(), instruction.getOperator(), false, instruction.isUnsigned(), result, val1, val2, !instruction.isFloat())); }
emitInstruction(insts.BinaryOpInstruction(getCurrentInstructionIndex(), instruction.getOperator(), false, instruction.isUnsigned(), result, val2, val1, !instruction.isFloat())); else emitInstruction(insts.BinaryOpInstruction(getCurrentInstructionIndex(), instruction.getOperator(), false, instruction.isUnsigned(), result, val1, val2, !instruction.isFloat())); } catch (AssertionError e) { System.err.println("When visiting Instuction " + instruction);
emitInstruction(insts.BinaryOpInstruction(getCurrentInstructionIndex(), instruction.getOperator(), false, instruction.isUnsigned(), result, val2, val1, !instruction.isFloat())); else emitInstruction(insts.BinaryOpInstruction(getCurrentInstructionIndex(), instruction.getOperator(), false, instruction.isUnsigned(), result, val1, val2, !instruction.isFloat())); } catch (AssertionError e) { System.err.println("When visiting Instuction " + instruction);
protected int processAssignOp(CAstNode v, CAstNode a, int temp, WalkContext c) { WalkContext context = c; int rval = c.getValue(v); CAstNode op = a.getChild(2); int temp2 = context.currentScope().allocateTempValue(); boolean mayBeInteger = handleBinaryOpThrow(a, op, context); int currentInstruction = context.cfg().getCurrentInstruction(); context.cfg().addInstruction( insts.BinaryOpInstruction(currentInstruction, translateBinaryOpcode(op), false, false, temp2, temp, rval, mayBeInteger)); context.cfg().noteOperands(currentInstruction, context.getSourceMap().getPosition(a.getChild(0)), context.getSourceMap().getPosition(v)); if (mayBeInteger) { context.cfg().newBlock(true); } return temp2; }
protected int processAssignOp(CAstNode v, CAstNode a, int temp, WalkContext c) { WalkContext context = c; int rval = c.getValue(v); CAstNode op = a.getChild(2); int temp2 = context.currentScope().allocateTempValue(); boolean mayBeInteger = handleBinaryOpThrow(a, op, context); int currentInstruction = context.cfg().getCurrentInstruction(); context.cfg().addInstruction( insts.BinaryOpInstruction(currentInstruction, translateBinaryOpcode(op), false, false, temp2, temp, rval, mayBeInteger)); context.cfg().noteOperands(currentInstruction, context.getSourceMap().getPosition(a.getChild(0)), context.getSourceMap().getPosition(v)); if (mayBeInteger) { context.cfg().newBlock(true); } return temp2; }
@Override protected void leaveBinaryExpr(CAstNode n, WalkContext c, CAstVisitor<WalkContext> visitor) { WalkContext context = c; int result = c.getValue(n); CAstNode l = n.getChild(1); CAstNode r = n.getChild(2); assert c.getValue(r) != -1 : CAstPrinter.print(n); assert c.getValue(l) != -1 : CAstPrinter.print(n); boolean mayBeInteger = handleBinaryOpThrow(n, n.getChild(0), context); int currentInstruction = context.cfg().currentInstruction; context.cfg().addInstruction( insts.BinaryOpInstruction(currentInstruction, translateBinaryOpcode(n.getChild(0)), false, false, result, c.getValue(l), c.getValue(r), mayBeInteger)); context.cfg().noteOperands(currentInstruction, context.getSourceMap().getPosition(l), context.getSourceMap().getPosition(r)); if (mayBeInteger) { context.cfg().newBlock(true); } }
@Override protected void leaveBinaryExpr(CAstNode n, WalkContext c, CAstVisitor<WalkContext> visitor) { WalkContext context = c; int result = c.getValue(n); CAstNode l = n.getChild(1); CAstNode r = n.getChild(2); assert c.getValue(r) != -1 : CAstPrinter.print(n); assert c.getValue(l) != -1 : CAstPrinter.print(n); boolean mayBeInteger = handleBinaryOpThrow(n, n.getChild(0), context); int currentInstruction = context.cfg().currentInstruction; context.cfg().addInstruction( insts.BinaryOpInstruction(currentInstruction, translateBinaryOpcode(n.getChild(0)), false, false, result, c.getValue(l), c.getValue(r), mayBeInteger)); context.cfg().noteOperands(currentInstruction, context.getSourceMap().getPosition(l), context.getSourceMap().getPosition(r)); if (mayBeInteger) { context.cfg().newBlock(true); } }