Search in sources :

Example 1 with LLVMFunctionStartNode

use of com.oracle.truffle.llvm.nodes.func.LLVMFunctionStartNode in project sulong by graalvm.

the class LLVMBasicBlockNode method fillStackTrace.

private void fillStackTrace(SulongStackTrace stackTrace, int errorIndex) {
    final LLVMSourceLocation loc = getLastAvailableSourceLocation(errorIndex);
    final LLVMFunctionStartNode f = NodeUtil.findParent(this, LLVMFunctionStartNode.class);
    stackTrace.addStackTraceElement(f.getOriginalName(), loc, f.getName(), f.getBcSource().getName(), blockName());
}
Also used : LLVMFunctionStartNode(com.oracle.truffle.llvm.nodes.func.LLVMFunctionStartNode) LLVMSourceLocation(com.oracle.truffle.llvm.runtime.debug.scope.LLVMSourceLocation)

Example 2 with LLVMFunctionStartNode

use of com.oracle.truffle.llvm.nodes.func.LLVMFunctionStartNode in project sulong by graalvm.

the class LLVMPrintStackTrace method fillStackTrace.

private static void fillStackTrace(SulongStackTrace stackTrace, Node node) {
    LLVMBasicBlockNode block = NodeUtil.findParent(node, LLVMBasicBlockNode.class);
    LLVMFunctionStartNode f = NodeUtil.findParent(node, LLVMFunctionStartNode.class);
    if (block == null || f == null) {
        LLVMIntrinsicExpressionNode intrinsic = NodeUtil.findParent(node, LLVMIntrinsicExpressionNode.class);
        if (intrinsic != null) {
            stackTrace.addStackTraceElement(intrinsic.toString(), null, null);
        }
        return;
    }
    LLVMSourceLocation location = null;
    if (node instanceof LLVMNode && ((LLVMNode) node).getSourceLocation() != null) {
        location = ((LLVMNode) node).getSourceLocation();
    }
    if (location == null) {
        location = block.getSourceLocation();
    }
    if (location != null) {
        stackTrace.addStackTraceElement(f.getOriginalName(), location, f.getBcName(), f.getBcSource().getName(), blockName(block));
        return;
    }
    SourceSection s = node.getSourceSection();
    if (s == null) {
        s = f.getSourceSection();
    }
    if (s == null) {
        stackTrace.addStackTraceElement(f.getBcName(), f.getBcSource().getName(), blockName(block));
    } else {
        location = LLVMSourceLocation.createUnknown(s);
        stackTrace.addStackTraceElement(f.getOriginalName(), location, f.getBcName(), f.getBcSource().getName(), blockName(block));
    }
}
Also used : LLVMFunctionStartNode(com.oracle.truffle.llvm.nodes.func.LLVMFunctionStartNode) LLVMIntrinsicExpressionNode(com.oracle.truffle.llvm.nodes.intrinsics.llvm.LLVMIntrinsicRootNode.LLVMIntrinsicExpressionNode) LLVMBasicBlockNode(com.oracle.truffle.llvm.nodes.base.LLVMBasicBlockNode) LLVMSourceLocation(com.oracle.truffle.llvm.runtime.debug.scope.LLVMSourceLocation) SourceSection(com.oracle.truffle.api.source.SourceSection) LLVMNode(com.oracle.truffle.llvm.runtime.nodes.api.LLVMNode)

Example 3 with LLVMFunctionStartNode

use of com.oracle.truffle.llvm.nodes.func.LLVMFunctionStartNode in project sulong by graalvm.

the class LLVMWriteNode method getSourceDescription.

@Override
public String getSourceDescription() {
    LLVMBasicBlockNode basicBlock = NodeUtil.findParent(this, LLVMBasicBlockNode.class);
    assert basicBlock != null : getParent().getClass();
    LLVMFunctionStartNode functionStartNode = NodeUtil.findParent(basicBlock, LLVMFunctionStartNode.class);
    assert functionStartNode != null : basicBlock.getParent().getClass();
    if (basicBlock.getBlockId() == 0) {
        return String.format("assignment of %s in first basic block in function %s", getSlot().getIdentifier(), functionStartNode.getBcName());
    } else {
        return String.format("assignment of %s in basic block %s in function %s", getSlot().getIdentifier(), basicBlock.getBlockName(), functionStartNode.getBcName());
    }
}
Also used : LLVMFunctionStartNode(com.oracle.truffle.llvm.nodes.func.LLVMFunctionStartNode) LLVMBasicBlockNode(com.oracle.truffle.llvm.nodes.base.LLVMBasicBlockNode)

Aggregations

LLVMFunctionStartNode (com.oracle.truffle.llvm.nodes.func.LLVMFunctionStartNode)3 LLVMBasicBlockNode (com.oracle.truffle.llvm.nodes.base.LLVMBasicBlockNode)2 LLVMSourceLocation (com.oracle.truffle.llvm.runtime.debug.scope.LLVMSourceLocation)2 SourceSection (com.oracle.truffle.api.source.SourceSection)1 LLVMIntrinsicExpressionNode (com.oracle.truffle.llvm.nodes.intrinsics.llvm.LLVMIntrinsicRootNode.LLVMIntrinsicExpressionNode)1 LLVMNode (com.oracle.truffle.llvm.runtime.nodes.api.LLVMNode)1