Search in sources :

Example 1 with ArithmeticOperation

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);
}
Also used : DebugExprType(com.oracle.truffle.llvm.runtime.debug.debugexpr.parser.DebugExprType) LLVMExpressionNode(com.oracle.truffle.llvm.runtime.nodes.api.LLVMExpressionNode) ArithmeticOperation(com.oracle.truffle.llvm.runtime.ArithmeticOperation)

Example 2 with ArithmeticOperation

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());
    }
}
Also used : LLVMExpressionNode(com.oracle.truffle.llvm.runtime.nodes.api.LLVMExpressionNode) ArithmeticOperation(com.oracle.truffle.llvm.runtime.ArithmeticOperation)

Example 3 with ArithmeticOperation

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);
}
Also used : DebugExprType(com.oracle.truffle.llvm.runtime.debug.debugexpr.parser.DebugExprType) LLVMExpressionNode(com.oracle.truffle.llvm.runtime.nodes.api.LLVMExpressionNode) ArithmeticOperation(com.oracle.truffle.llvm.runtime.ArithmeticOperation)

Aggregations

ArithmeticOperation (com.oracle.truffle.llvm.runtime.ArithmeticOperation)3 LLVMExpressionNode (com.oracle.truffle.llvm.runtime.nodes.api.LLVMExpressionNode)3 DebugExprType (com.oracle.truffle.llvm.runtime.debug.debugexpr.parser.DebugExprType)2