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

Method Build

cpp/src/gandiva/llvm_generator.cc:94–114  ·  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

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

Callers 3

MakeMethod · 0.45
MakeMethod · 0.45
TEST_FFunction · 0.45

Calls 7

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

Tested by 1

TEST_FFunction · 0.36