Search in sources :

Example 1 with LLVMFunctionStartNode

use of com.oracle.truffle.llvm.runtime.nodes.func.LLVMFunctionStartNode in project graal by oracle.

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 LLVMInstrumentableNode) {
        location = ((LLVMInstrumentableNode) 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.runtime.nodes.func.LLVMFunctionStartNode) LLVMIntrinsicExpressionNode(com.oracle.truffle.llvm.runtime.nodes.intrinsics.llvm.LLVMIntrinsicRootNode.LLVMIntrinsicExpressionNode) LLVMInstrumentableNode(com.oracle.truffle.llvm.runtime.nodes.api.LLVMInstrumentableNode) LLVMBasicBlockNode(com.oracle.truffle.llvm.runtime.nodes.base.LLVMBasicBlockNode) LLVMSourceLocation(com.oracle.truffle.llvm.runtime.debug.scope.LLVMSourceLocation) SourceSection(com.oracle.truffle.api.source.SourceSection)

Example 2 with LLVMFunctionStartNode

use of com.oracle.truffle.llvm.runtime.nodes.func.LLVMFunctionStartNode in project graal by oracle.

the class LLVMPanic method createPanicLocation.

protected PanicLocType createPanicLocation() {
    LLVMFunctionStartNode startNode = (LLVMFunctionStartNode) getRootNode();
    DataLayout dataSpecConverter = startNode.getDatalayout();
    return PanicLocType.create(dataSpecConverter);
}
Also used : LLVMFunctionStartNode(com.oracle.truffle.llvm.runtime.nodes.func.LLVMFunctionStartNode) DataLayout(com.oracle.truffle.llvm.runtime.datalayout.DataLayout)

Example 3 with LLVMFunctionStartNode

use of com.oracle.truffle.llvm.runtime.nodes.func.LLVMFunctionStartNode in project graal by oracle.

the class BasicNodeFactory method createFunction.

@Override
public RootNode createFunction(int exceptionValueSlot, LLVMBasicBlockNode[] allFunctionNodes, UniquesRegion uniquesRegion, LLVMStatementNode[] copyArgumentsToFrame, FrameDescriptor frameDescriptor, int loopSuccessorSlot, LocalVariableDebugInfo debugInfo, String name, String originalName, int argumentCount, Source bcSource, LLVMSourceLocation location, LLVMFunction rootFunction) {
    LLVMUniquesRegionAllocNode uniquesRegionAllocNode = uniquesRegion.isEmpty() ? null : LLVMUniquesRegionAllocNodeGen.create(createAlloca(uniquesRegion.getSize(), uniquesRegion.getAlignment()));
    LLVMDispatchBasicBlockNode body = LLVMDispatchBasicBlockNodeGen.create(exceptionValueSlot, allFunctionNodes, loopSuccessorSlot, debugInfo);
    body.setSourceLocation(LLVMSourceLocation.orDefault(location));
    LLVMStackAccess stackAccess = createStackAccess();
    LLVMFunctionRootNode functionRoot = LLVMFunctionRootNodeGen.create(uniquesRegionAllocNode, stackAccess, copyArgumentsToFrame, body, frameDescriptor);
    functionRoot.setSourceLocation(LLVMSourceLocation.orDefault(location));
    return new LLVMFunctionStartNode(language, stackAccess, functionRoot, frameDescriptor, name, argumentCount, originalName, bcSource, location, dataLayout, rootFunction);
}
Also used : LLVMStackAccess(com.oracle.truffle.llvm.runtime.memory.LLVMStack.LLVMStackAccess) LLVMFunctionStartNode(com.oracle.truffle.llvm.runtime.nodes.func.LLVMFunctionStartNode) LLVMUniquesRegionAllocNode(com.oracle.truffle.llvm.runtime.memory.LLVMUniquesRegionAllocNode) LLVMFunctionRootNode(com.oracle.truffle.llvm.runtime.nodes.control.LLVMFunctionRootNode) LLVMDispatchBasicBlockNode(com.oracle.truffle.llvm.runtime.nodes.control.LLVMDispatchBasicBlockNode)

Aggregations

LLVMFunctionStartNode (com.oracle.truffle.llvm.runtime.nodes.func.LLVMFunctionStartNode)3 SourceSection (com.oracle.truffle.api.source.SourceSection)1 DataLayout (com.oracle.truffle.llvm.runtime.datalayout.DataLayout)1 LLVMSourceLocation (com.oracle.truffle.llvm.runtime.debug.scope.LLVMSourceLocation)1 LLVMStackAccess (com.oracle.truffle.llvm.runtime.memory.LLVMStack.LLVMStackAccess)1 LLVMUniquesRegionAllocNode (com.oracle.truffle.llvm.runtime.memory.LLVMUniquesRegionAllocNode)1 LLVMInstrumentableNode (com.oracle.truffle.llvm.runtime.nodes.api.LLVMInstrumentableNode)1 LLVMBasicBlockNode (com.oracle.truffle.llvm.runtime.nodes.base.LLVMBasicBlockNode)1 LLVMDispatchBasicBlockNode (com.oracle.truffle.llvm.runtime.nodes.control.LLVMDispatchBasicBlockNode)1 LLVMFunctionRootNode (com.oracle.truffle.llvm.runtime.nodes.control.LLVMFunctionRootNode)1 LLVMIntrinsicExpressionNode (com.oracle.truffle.llvm.runtime.nodes.intrinsics.llvm.LLVMIntrinsicRootNode.LLVMIntrinsicExpressionNode)1