Search in sources :

Example 1 with SourceVariable

use of com.oracle.truffle.llvm.parser.metadata.debuginfo.SourceVariable in project sulong by graalvm.

the class LLVMBitcodeFunctionVisitor method visit.

@Override
public void visit(InstructionBlock block) {
    List<Phi> blockPhis = phis.get(block);
    ArrayList<LLVMLivenessAnalysis.NullerInformation> blockNullerInfos = liveness.getNullableWithinBlock()[block.getBlockIndex()];
    LLVMBitcodeInstructionVisitor visitor = new LLVMBitcodeInstructionVisitor(frame, blockPhis, nodeFactory, argCount, symbols, runtime, blockNullerInfos, function.getSourceFunction(), notNullable, dbgInfoHandler);
    if (initDebugValues) {
        for (SourceVariable variable : function.getSourceFunction().getVariables()) {
            final LLVMExpressionNode initNode = dbgInfoHandler.createInitializer(variable);
            if (initNode != null) {
                visitor.addInstructionUnchecked(initNode);
            }
        }
        initDebugValues = false;
    }
    for (int i = 0; i < block.getInstructionCount(); i++) {
        Instruction instruction = block.getInstruction(i);
        visitor.setInstructionIndex(i);
        instruction.accept(visitor);
    }
    blocks.add(nodeFactory.createBasicBlockNode(runtime, visitor.getInstructions(), visitor.getControlFlowNode(), block.getBlockIndex(), block.getName()));
}
Also used : Phi(com.oracle.truffle.llvm.parser.LLVMPhiManager.Phi) SourceVariable(com.oracle.truffle.llvm.parser.metadata.debuginfo.SourceVariable) LLVMExpressionNode(com.oracle.truffle.llvm.runtime.nodes.api.LLVMExpressionNode) Instruction(com.oracle.truffle.llvm.parser.model.symbols.instructions.Instruction)

Example 2 with SourceVariable

use of com.oracle.truffle.llvm.parser.metadata.debuginfo.SourceVariable in project sulong by graalvm.

the class LLVMRuntimeDebugInformation method registerStaticDebugSymbols.

void registerStaticDebugSymbols(FunctionDefinition fn) {
    if (!isEnabled) {
        return;
    }
    for (SourceVariable local : fn.getSourceFunction().getVariables()) {
        if (local.isSingleDeclaration()) {
            final DbgDeclareInstruction dbg = local.getSingleDeclaration();
            FrameSlot frameSlot = null;
            if (dbg.getValue() instanceof AllocateInstruction) {
                frameSlot = frame.findFrameSlot(((AllocateInstruction) dbg.getValue()).getName());
            }
            if (frameSlot == null) {
                continue;
            }
            final LLVMSourceSymbol symbol = local.getSymbol();
            final LLVMFrameValueAccess alloc = factory.createDebugFrameValue(frameSlot, true);
            notNullableSlots.add(frameSlot);
            context.getSourceContext().registerFrameValue(symbol, alloc);
            local.addStaticValue();
        } else if (local.isSingleValue()) {
            final DbgValueInstruction dbg = local.getSingleValue();
            final MDExpression expr = dbg.getExpression();
            final SymbolImpl value = dbg.getValue();
            if (expr.getElementCount() != 0) {
                continue;
            }
            final boolean mustDereference = mustDereferenceValue(expr, local.getSourceType(), value);
            staticValueAccessVisitor.registerStaticAccess(local, value, mustDereference);
        }
    }
}
Also used : SourceVariable(com.oracle.truffle.llvm.parser.metadata.debuginfo.SourceVariable) DbgDeclareInstruction(com.oracle.truffle.llvm.parser.model.symbols.instructions.DbgDeclareInstruction) LLVMFrameValueAccess(com.oracle.truffle.llvm.runtime.debug.scope.LLVMFrameValueAccess) SymbolImpl(com.oracle.truffle.llvm.parser.model.SymbolImpl) AllocateInstruction(com.oracle.truffle.llvm.parser.model.symbols.instructions.AllocateInstruction) FrameSlot(com.oracle.truffle.api.frame.FrameSlot) DbgValueInstruction(com.oracle.truffle.llvm.parser.model.symbols.instructions.DbgValueInstruction) MDExpression(com.oracle.truffle.llvm.parser.metadata.MDExpression) LLVMSourceSymbol(com.oracle.truffle.llvm.runtime.debug.LLVMSourceSymbol)

Aggregations

SourceVariable (com.oracle.truffle.llvm.parser.metadata.debuginfo.SourceVariable)2 FrameSlot (com.oracle.truffle.api.frame.FrameSlot)1 Phi (com.oracle.truffle.llvm.parser.LLVMPhiManager.Phi)1 MDExpression (com.oracle.truffle.llvm.parser.metadata.MDExpression)1 SymbolImpl (com.oracle.truffle.llvm.parser.model.SymbolImpl)1 AllocateInstruction (com.oracle.truffle.llvm.parser.model.symbols.instructions.AllocateInstruction)1 DbgDeclareInstruction (com.oracle.truffle.llvm.parser.model.symbols.instructions.DbgDeclareInstruction)1 DbgValueInstruction (com.oracle.truffle.llvm.parser.model.symbols.instructions.DbgValueInstruction)1 Instruction (com.oracle.truffle.llvm.parser.model.symbols.instructions.Instruction)1 LLVMSourceSymbol (com.oracle.truffle.llvm.runtime.debug.LLVMSourceSymbol)1 LLVMFrameValueAccess (com.oracle.truffle.llvm.runtime.debug.scope.LLVMFrameValueAccess)1 LLVMExpressionNode (com.oracle.truffle.llvm.runtime.nodes.api.LLVMExpressionNode)1