MCPcopy Create free account
hub / github.com/apache/arrow / LoadPreCompiledIR

Method LoadPreCompiledIR

cpp/src/gandiva/engine.cc:407–428  ·  view source on GitHub ↗

Handling for pre-compiled IR libraries.

Source from the content-addressed store, hash-verified

405
406// Handling for pre-compiled IR libraries.
407Status Engine::LoadPreCompiledIR() {
408 const auto bitcode = llvm::StringRef(reinterpret_cast<const char*>(kPrecompiledBitcode),
409 kPrecompiledBitcodeSize);
410
411 /// Read from file into memory buffer.
412 llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> buffer_or_error =
413 llvm::MemoryBuffer::getMemBuffer(bitcode, "precompiled", false);
414
415 ARROW_RETURN_IF(!buffer_or_error,
416 Status::CodeGenError("Could not load module from IR: ",
417 buffer_or_error.getError().message()));
418
419 std::unique_ptr<llvm::MemoryBuffer> buffer = std::move(buffer_or_error.get());
420
421 /// Parse the IR module.
422 llvm::Expected<std::unique_ptr<llvm::Module>> module_or_error =
423 llvm::getOwningLazyBitcodeModule(std::move(buffer), *context());
424 // NOTE: llvm::handleAllErrors() fails linking with RTTI-disabled LLVM builds
425 // (ARROW-5148)
426 ARROW_RETURN_NOT_OK(VerifyAndLinkModule(*module_, std::move(module_or_error)));
427 return Status::OK();
428}
429
430static llvm::MemoryBufferRef AsLLVMMemoryBuffer(const arrow::Buffer& arrow_buffer) {
431 const auto data = reinterpret_cast<const char*>(arrow_buffer.data());

Callers

nothing calls this directly

Calls 5

CodeGenErrorFunction · 0.85
VerifyAndLinkModuleFunction · 0.85
contextFunction · 0.70
OKFunction · 0.50
getMethod · 0.45

Tested by

no test coverage detected