use of com.oracle.truffle.llvm.parser.LLVMParser 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;
}
Aggregations