Search in sources :

Example 1 with DataLayout

use of com.oracle.truffle.llvm.runtime.datalayout.DataLayout in project graal by oracle.

the class LLVMDebuggerScopeFactory method createIRLevelScope.

@TruffleBoundary
public static Object createIRLevelScope(Node node, Frame frame, LLVMContext context) {
    DataLayout dataLayout = LLVMNode.findDataLayout(node);
    final LLVMDebuggerScopeEntries localScope = getIRLevelEntries(frame, context, dataLayout);
    final LLVMDebuggerScopeEntries globalScope = getIRLevelEntries(node, context, dataLayout);
    localScope.setParentScope(globalScope);
    return localScope;
}
Also used : DataLayout(com.oracle.truffle.llvm.runtime.datalayout.DataLayout) TruffleBoundary(com.oracle.truffle.api.CompilerDirectives.TruffleBoundary)

Example 2 with DataLayout

use of com.oracle.truffle.llvm.runtime.datalayout.DataLayout in project graal by oracle.

the class LLVMVAListNode method createAllocaNode.

LLVMExpressionNode createAllocaNode() {
    DataLayout dataLayout = getDataLayout();
    LLVMLanguage language = LLVMLanguage.get(null);
    PlatformCapability<?> capability = language.getCapability(PlatformCapability.class);
    return language.getActiveConfiguration().createNodeFactory(language, dataLayout).createAlloca(capability.getVAListType(), capability.getVAListAlignment());
}
Also used : DataLayout(com.oracle.truffle.llvm.runtime.datalayout.DataLayout) LLVMLanguage(com.oracle.truffle.llvm.runtime.LLVMLanguage)

Example 3 with DataLayout

use of com.oracle.truffle.llvm.runtime.datalayout.DataLayout 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 4 with DataLayout

use of com.oracle.truffle.llvm.runtime.datalayout.DataLayout in project graal by oracle.

the class DITypeExtractor method visit.

@Override
public void visit(MDSubprogram mdSubprogram) {
    // 'this' parameter of thunk methods is missing in the debug info, thus fix here.
    LLVMSourceType llvmSourceType = resolve(mdSubprogram.getType());
    if (Flags.THUNK.isSetIn(mdSubprogram.getFlags())) {
        SymbolImpl symbol = MDValue.getIfInstance(mdSubprogram.getFunction());
        if (symbol != null && symbol instanceof FunctionDefinition) {
            FunctionDefinition function = (FunctionDefinition) symbol;
            final DataLayout dataLayout = LLVMLanguage.get(null).getDefaultDataLayout();
            LLVMSourceType llvmSourceReturnType = LLVMSourceTypeFactory.resolveType(function.getType().getReturnType(), dataLayout);
            List<LLVMSourceType> typeList = new ArrayList<>();
            typeList.add(llvmSourceReturnType);
            for (FunctionParameter fp : function.getParameters()) {
                LLVMSourceType parameterSourceType = LLVMSourceTypeFactory.resolveType(fp.getType(), dataLayout);
                typeList.add(parameterSourceType);
            }
            llvmSourceType = new LLVMSourceFunctionType(typeList);
        }
    }
    parsedTypes.put(mdSubprogram, llvmSourceType);
}
Also used : DataLayout(com.oracle.truffle.llvm.runtime.datalayout.DataLayout) SymbolImpl(com.oracle.truffle.llvm.parser.model.SymbolImpl) ArrayList(java.util.ArrayList) FunctionDefinition(com.oracle.truffle.llvm.parser.model.functions.FunctionDefinition) LLVMSourceType(com.oracle.truffle.llvm.runtime.debug.type.LLVMSourceType) LLVMSourceFunctionType(com.oracle.truffle.llvm.runtime.debug.type.LLVMSourceFunctionType) FunctionParameter(com.oracle.truffle.llvm.parser.model.functions.FunctionParameter)

Example 5 with DataLayout

use of com.oracle.truffle.llvm.runtime.datalayout.DataLayout in project graal by oracle.

the class ParserDriver method parseBinary.

/**
 * Parses a binary (bitcode with optional meta information from an ELF, Mach-O object file).
 */
private LLVMParserResult parseBinary(BinaryParserResult binaryParserResult, TruffleFile file) {
    ModelModule module = new ModelModule();
    Source source = binaryParserResult.getSource();
    LLVMScanner.parseBitcode(binaryParserResult.getBitcode(), module, source);
    TargetDataLayout layout = module.getTargetDataLayout();
    DataLayout targetDataLayout = new DataLayout(layout.getDataLayout());
    verifyBitcodeSource(source, targetDataLayout, getTargetTriple(module));
    NodeFactory nodeFactory = context.getLanguage().getActiveConfiguration().createNodeFactory(language, targetDataLayout);
    // Create a new public file scope to be returned inside sulong library.
    LLVMScope publicFileScope = new LLVMScope();
    LLVMScope fileScope = new LLVMScope();
    LLVMParserRuntime runtime = new LLVMParserRuntime(fileScope, publicFileScope, nodeFactory, bitcodeID, file, binaryParserResult.getLibraryName(), getSourceFilesWithChecksums(context.getEnv(), module), binaryParserResult.getLocator());
    LLVMParser parser = new LLVMParser(source, runtime);
    LLVMParserResult result = parser.parse(module, targetDataLayout);
    createDebugInfo(module, new LLVMSymbolReadResolver(runtime, null, GetStackSpaceFactory.createAllocaFactory(), targetDataLayout, false));
    return result;
}
Also used : ModelModule(com.oracle.truffle.llvm.parser.model.ModelModule) DataLayout(com.oracle.truffle.llvm.runtime.datalayout.DataLayout) TargetDataLayout(com.oracle.truffle.llvm.parser.model.target.TargetDataLayout) TargetDataLayout(com.oracle.truffle.llvm.parser.model.target.TargetDataLayout) CommonNodeFactory(com.oracle.truffle.llvm.runtime.CommonNodeFactory) NodeFactory(com.oracle.truffle.llvm.runtime.NodeFactory) LLVMParser(com.oracle.truffle.llvm.parser.LLVMParser) LLVMSymbolReadResolver(com.oracle.truffle.llvm.parser.nodes.LLVMSymbolReadResolver) LLVMScope(com.oracle.truffle.llvm.runtime.LLVMScope) LLVMParserResult(com.oracle.truffle.llvm.parser.LLVMParserResult) LLVMParserRuntime(com.oracle.truffle.llvm.parser.LLVMParserRuntime) Source(com.oracle.truffle.api.source.Source)

Aggregations

DataLayout (com.oracle.truffle.llvm.runtime.datalayout.DataLayout)6 LLVMParserRuntime (com.oracle.truffle.llvm.parser.LLVMParserRuntime)2 TruffleBoundary (com.oracle.truffle.api.CompilerDirectives.TruffleBoundary)1 Source (com.oracle.truffle.api.source.Source)1 LLVMParser (com.oracle.truffle.llvm.parser.LLVMParser)1 LLVMParserResult (com.oracle.truffle.llvm.parser.LLVMParserResult)1 ModelModule (com.oracle.truffle.llvm.parser.model.ModelModule)1 SymbolImpl (com.oracle.truffle.llvm.parser.model.SymbolImpl)1 FunctionDefinition (com.oracle.truffle.llvm.parser.model.functions.FunctionDefinition)1 FunctionParameter (com.oracle.truffle.llvm.parser.model.functions.FunctionParameter)1 GlobalVariable (com.oracle.truffle.llvm.parser.model.symbols.globals.GlobalVariable)1 TargetDataLayout (com.oracle.truffle.llvm.parser.model.target.TargetDataLayout)1 LLVMSymbolReadResolver (com.oracle.truffle.llvm.parser.nodes.LLVMSymbolReadResolver)1 CommonNodeFactory (com.oracle.truffle.llvm.runtime.CommonNodeFactory)1 GetStackSpaceFactory (com.oracle.truffle.llvm.runtime.GetStackSpaceFactory)1 LLVMLanguage (com.oracle.truffle.llvm.runtime.LLVMLanguage)1 LLVMScope (com.oracle.truffle.llvm.runtime.LLVMScope)1 NodeFactory (com.oracle.truffle.llvm.runtime.NodeFactory)1 LLVMSourceFunctionType (com.oracle.truffle.llvm.runtime.debug.type.LLVMSourceFunctionType)1 LLVMSourceType (com.oracle.truffle.llvm.runtime.debug.type.LLVMSourceType)1