Search in sources :

Example 1 with Function

use of com.oracle.truffle.llvm.runtime.LLVMFunctionCode.Function in project graal by oracle.

the class LLVMParser method defineFunction.

private void defineFunction(FunctionSymbol functionSymbol, ModelModule model, DataLayout dataLayout) {
    assert !functionSymbol.isExternal();
    // handle the file scope
    FunctionDefinition functionDefinition = (FunctionDefinition) functionSymbol;
    LazyToTruffleConverterImpl lazyConverter = new LazyToTruffleConverterImpl(runtime, functionDefinition, source, model.getFunctionParser(functionDefinition), model.getFunctionProcessor(), dataLayout);
    Function function = new LazyLLVMIRFunction(lazyConverter);
    LLVMFunction llvmFunction = LLVMFunction.create(functionSymbol.getName(), function, functionSymbol.getType(), runtime.getBitcodeID(), functionSymbol.getIndex(), functionDefinition.isExported(), runtime.getFile().getPath(), functionDefinition.isExternalWeak());
    lazyConverter.setRootFunction(llvmFunction);
    runtime.getFileScope().register(llvmFunction);
    registerInPublicFileScope(llvmFunction);
    final boolean cxxInterop = LLVMLanguage.getContext().getEnv().getOptions().get(SulongEngineOption.CXX_INTEROP);
    if (cxxInterop) {
        model.getFunctionParser(functionDefinition).parseLinkageName(runtime);
    }
}
Also used : LazyLLVMIRFunction(com.oracle.truffle.llvm.runtime.LLVMFunctionCode.LazyLLVMIRFunction) LLVMFunction(com.oracle.truffle.llvm.runtime.LLVMFunction) Function(com.oracle.truffle.llvm.runtime.LLVMFunctionCode.Function) LLVMFunction(com.oracle.truffle.llvm.runtime.LLVMFunction) FunctionDefinition(com.oracle.truffle.llvm.parser.model.functions.FunctionDefinition) LazyLLVMIRFunction(com.oracle.truffle.llvm.runtime.LLVMFunctionCode.LazyLLVMIRFunction)

Aggregations

FunctionDefinition (com.oracle.truffle.llvm.parser.model.functions.FunctionDefinition)1 LLVMFunction (com.oracle.truffle.llvm.runtime.LLVMFunction)1 Function (com.oracle.truffle.llvm.runtime.LLVMFunctionCode.Function)1 LazyLLVMIRFunction (com.oracle.truffle.llvm.runtime.LLVMFunctionCode.LazyLLVMIRFunction)1