\brief Build the code for the expression trees for default mode with a LLVM ObjectCache. Each element in the vector represents an expression tree
| 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 |
| 94 | Status 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 |