MCPcopy Create free account
hub / github.com/apache/cloudberry / load_module

Function load_module

src/backend/jit/llvm/llvmjit_inline.cpp:480–504  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

478}
479
480static std::unique_ptr<llvm::Module>
481load_module(llvm::StringRef Identifier)
482{
483 LLVMMemoryBufferRef buf;
484 LLVMModuleRef mod;
485 char path[MAXPGPATH];
486 char *msg;
487
488 snprintf(path, MAXPGPATH,"%s/bitcode/%s", pkglib_path, Identifier.data());
489
490 if (LLVMCreateMemoryBufferWithContentsOfFile(path, &buf, &msg))
491 elog(FATAL, "failed to open bitcode file \"%s\": %s",
492 path, msg);
493 if (LLVMGetBitcodeModuleInContext2(LLVMGetGlobalContext(), buf, &mod))
494 elog(FATAL, "failed to parse bitcode in file \"%s\"", path);
495
496 /*
497 * Currently there's no use in more detailed debug info for JITed
498 * code. Until that changes, not much point in wasting memory and cycles
499 * on processing debuginfo.
500 */
501 llvm::StripDebugInfo(*llvm::unwrap(mod));
502
503 return std::unique_ptr<llvm::Module>(llvm::unwrap(mod));
504}
505
506/*
507 * Compute list of referenced variables, functions and the instruction count

Callers 1

load_module_cachedFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected