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

Method Build

cpp/src/gandiva/llvm_generator.cc:93–113  ·  view source on GitHub ↗

\brief Build the code for the expression trees for default mode with a LLVM ObjectCache. Each element in the vector represents an expression tree

Source from the content-addressed store, hash-verified

91/// \brief Build the code for the expression trees for default mode with a LLVM
92/// ObjectCache. Each element in the vector represents an expression tree
93Status LLVMGenerator::Build(const ExpressionVector& exprs, SelectionVector::Mode mode) {
94 selection_vector_mode_ = mode;
95
96 for (auto& expr : exprs) {
97 auto output = annotator_.AddOutputFieldDescriptor(expr->result());
98 ARROW_RETURN_NOT_OK(Add(expr, output));
99 }
100
101 // Compile and inject into the process' memory the generated function.
102 ARROW_RETURN_NOT_OK(engine_->FinalizeModule());
103
104 // setup the jit functions for each expression.
105 for (auto& compiled_expr : compiled_exprs_) {
106 auto fn_name = compiled_expr->GetFunctionName(mode);
107 ARROW_ASSIGN_OR_RAISE(auto fn_ptr, engine_->CompiledFunction(fn_name));
108 auto jit_fn = reinterpret_cast<EvalFunc>(fn_ptr);
109 compiled_expr->SetJITFunction(selection_vector_mode_, jit_fn);
110 }
111
112 return Status::OK();
113}
114
115/// \brief Build the code for the expression trees for default mode. Each
116/// element in the vector represents an expression tree

Callers 2

MakeMethod · 0.45
MakeMethod · 0.45

Calls 7

FinalizeModuleMethod · 0.80
GetFunctionNameMethod · 0.80
SetJITFunctionMethod · 0.80
AddFunction · 0.50
OKFunction · 0.50
resultMethod · 0.45

Tested by

no test coverage detected