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

Function BuildJIT

cpp/src/gandiva/engine.cc:238–275  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

236#endif
237
238Result<std::unique_ptr<llvm::orc::LLJIT>> BuildJIT(
239 llvm::orc::JITTargetMachineBuilder jtmb,
240 std::shared_ptr<llvm::TargetMachine> target_machine,
241 std::optional<std::reference_wrapper<GandivaObjectCache>> object_cache) {
242 auto data_layout = target_machine->createDataLayout();
243
244 llvm::orc::LLJITBuilder jit_builder;
245
246#ifdef JIT_LINK_SUPPORTED
247 ARROW_RETURN_NOT_OK(UseJITLinkIfEnabled(jit_builder));
248#endif
249
250 jit_builder.setJITTargetMachineBuilder(std::move(jtmb));
251#if LLVM_VERSION_MAJOR >= 16
252 jit_builder.setDataLayout(std::make_optional(data_layout));
253#else
254 jit_builder.setDataLayout(llvm::Optional<llvm::DataLayout>(data_layout));
255#endif
256
257 if (object_cache.has_value()) {
258 jit_builder.setCompileFunctionCreator(
259 [tm = std::move(target_machine),
260 &object_cache](llvm::orc::JITTargetMachineBuilder JTMB)
261 -> llvm::Expected<std::unique_ptr<llvm::orc::IRCompileLayer::IRCompiler>> {
262 // after compilation, the object code will be stored into the given object
263 // cache
264 return std::make_unique<llvm::orc::SimpleCompiler>(*tm,
265 &object_cache.value().get());
266 });
267 }
268
269 auto maybe_jit = jit_builder.create();
270 ARROW_ASSIGN_OR_RAISE(auto jit,
271 AsArrowResult(maybe_jit, "Could not create LLJIT instance: "));
272
273 AddProcessSymbol(*jit);
274 return jit;
275}
276
277arrow::Status VerifyAndLinkModule(llvm::Module& dest_module,
278 std::unique_ptr<llvm::Module> src_ir_module) {

Callers

nothing calls this directly

Calls 4

UseJITLinkIfEnabledFunction · 0.85
AddProcessSymbolFunction · 0.85
getMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected