use of com.oracle.truffle.llvm.runtime.ArithmeticOperation in project graal by oracle.
the class DebugExprNodeFactory method createDivNode.
public DebugExpressionPair createDivNode(DebugExpressionPair left, DebugExpressionPair right) {
checkError(left, "/");
checkError(right, "/");
DebugExprType commonType = DebugExprType.commonType(left.getType(), right.getType());
DebugExpressionPair leftPair = createCastIfNecessary(left, commonType);
DebugExpressionPair rightPair = createCastIfNecessary(right, commonType);
ArithmeticOperation op = commonType.isUnsigned() ? ArithmeticOperation.UDIV : ArithmeticOperation.DIV;
LLVMExpressionNode node = CommonNodeFactory.createArithmeticOp(op, commonType.getLLVMRuntimeType(), leftPair.getNode(), rightPair.getNode());
return DebugExpressionPair.create(node, commonType);
}
use of com.oracle.truffle.llvm.runtime.ArithmeticOperation in project graal by oracle.
the class DebugExprNodeFactory method createShiftRight.
public DebugExpressionPair createShiftRight(DebugExpressionPair left, DebugExpressionPair right) {
checkError(left, ">>");
checkError(right, ">>");
ArithmeticOperation op = left.getType().isUnsigned() ? ArithmeticOperation.LSHR : ArithmeticOperation.ASHR;
LLVMExpressionNode node = CommonNodeFactory.createArithmeticOp(op, left.getType().getLLVMRuntimeType(), left.getNode(), right.getNode());
if (!right.getType().isIntegerType() || !left.getType().isIntegerType()) {
throw DebugExprException.typeError(node, left.getNode(), right.getNode());
} else {
return DebugExpressionPair.create(node, left.getType());
}
}
use of com.oracle.truffle.llvm.runtime.ArithmeticOperation in project graal by oracle.
the class DebugExprNodeFactory method createRemNode.
public DebugExpressionPair createRemNode(DebugExpressionPair left, DebugExpressionPair right) {
checkError(left, "%");
checkError(right, "%");
DebugExprType commonType = DebugExprType.commonType(left.getType(), right.getType());
ArithmeticOperation op = commonType.isUnsigned() ? ArithmeticOperation.UREM : ArithmeticOperation.REM;
LLVMExpressionNode node = CommonNodeFactory.createArithmeticOp(op, commonType.getLLVMRuntimeType(), left.getNode(), right.getNode());
return DebugExpressionPair.create(node, commonType);
}
Aggregations