OmniSciDB  ca0c39ec8f
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CodeGenerator.h
Go to the documentation of this file.
1 /*
2  * Copyright 2022 HEAVY.AI, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include <llvm/IR/Value.h>
20 
21 #include "../Analyzer/Analyzer.h"
22 #include "Execute.h"
23 
24 // Code generation utility to be used for queries and scalar expressions.
26  public:
28  : executor_(executor)
29  , cgen_state_(executor->cgen_state_.get())
30  , plan_state_(executor->plan_state_.get()) {}
31 
32  // Overload which can be used without an executor, for SQL scalar expression code
33  // generation.
34  CodeGenerator(CgenState* cgen_state, PlanState* plan_state)
35  : executor_(nullptr), cgen_state_(cgen_state), plan_state_(plan_state) {}
36 
37  // Generates IR value(s) for the given analyzer expression.
38  std::vector<llvm::Value*> codegen(const Analyzer::Expr*,
39  const bool fetch_columns,
40  const CompilationOptions&);
41 
42  llvm::Value* codegenPerRowStringOper(const Analyzer::StringOper* string_oper,
43  const CompilationOptions& co);
44 
45  llvm::Value* codegenPseudoStringOper(
46  const Analyzer::ColumnVar*,
47  const std::vector<StringOps_Namespace::StringOpInfo>& string_op_infos,
48  const CompilationOptions&);
49 
50  // Generates constant values in the literal buffer of a query.
51  std::vector<llvm::Value*> codegenHoistedConstants(
52  const std::vector<const Analyzer::Constant*>& constants,
53  const EncodingType enc_type,
54  const int dict_id);
55 
56  static llvm::ConstantInt* codegenIntConst(const Analyzer::Constant* constant,
57  CgenState* cgen_state);
58 
59  llvm::Value* codegenCastBetweenIntTypes(llvm::Value* operand_lv,
60  const SQLTypeInfo& operand_ti,
61  const SQLTypeInfo& ti,
62  bool upscale = true);
63 
64  void codegenCastBetweenIntTypesOverflowChecks(llvm::Value* operand_lv,
65  const SQLTypeInfo& operand_ti,
66  const SQLTypeInfo& ti,
67  const int64_t scale);
68 
69  // Generates the index of the current row in the context of query execution.
70  llvm::Value* posArg(const Analyzer::Expr*) const;
71 
72  llvm::Value* toBool(llvm::Value*);
73 
74  llvm::Value* castArrayPointer(llvm::Value* ptr, const SQLTypeInfo& elem_ti);
75 
76  static std::unordered_set<llvm::Function*> markDeadRuntimeFuncs(
77  llvm::Module& module,
78  const std::vector<llvm::Function*>& roots,
79  const std::vector<llvm::Function*>& leaves);
80 
82  llvm::Function* func,
83  const std::unordered_set<llvm::Function*>& live_funcs,
84  const CompilationOptions& co);
85 
86  static std::string generatePTX(const std::string& cuda_llir,
87  llvm::TargetMachine* nvptx_target_machine,
88  llvm::LLVMContext& context);
89 
90  static std::unique_ptr<llvm::TargetMachine> initializeNVPTXBackend(
92 
93  static bool alwaysCloneRuntimeFunction(const llvm::Function* func);
94 
95  struct GPUTarget {
96  llvm::TargetMachine* nvptx_target_machine;
98  unsigned block_size;
101  };
102 
103  static void linkModuleWithLibdevice(Executor* executor,
104  llvm::Module& module,
105  llvm::PassManagerBuilder& pass_manager_builder,
106  const GPUTarget& gpu_target);
107 
108  static std::shared_ptr<GpuCompilationContext> generateNativeGPUCode(
109  Executor* executor,
110  llvm::Function* func,
111  llvm::Function* wrapper_func,
112  const std::unordered_set<llvm::Function*>& live_funcs,
113  const bool is_gpu_smem_used,
114  const CompilationOptions& co,
115  const GPUTarget& gpu_target);
116 
117  static void link_udf_module(const std::unique_ptr<llvm::Module>& udf_module,
118  llvm::Module& module,
119  CgenState* cgen_state,
120  llvm::Linker::Flags flags = llvm::Linker::Flags::None);
121 
122  static bool prioritizeQuals(const RelAlgExecutionUnit& ra_exe_unit,
123  std::vector<Analyzer::Expr*>& primary_quals,
124  std::vector<Analyzer::Expr*>& deferred_quals,
125  const PlanState::HoistedFiltersSet& hoisted_quals);
126 
127  struct ExecutorRequired : public std::runtime_error {
129  : std::runtime_error("Executor required to generate this expression") {}
130  };
131 
134  Executor* executor,
135  llvm::Value* nullable_lv,
136  const SQLTypeInfo& nullable_ti,
137  const std::string& name = "");
138 
139  llvm::Value* finalize(llvm::Value* null_lv, llvm::Value* notnull_lv);
140 
141  CgenState* cgen_state{nullptr};
142  std::string name;
143  llvm::BasicBlock* nullcheck_bb{nullptr};
144  llvm::PHINode* nullcheck_value{nullptr};
145  std::unique_ptr<DiamondCodegen> null_check;
146  };
147 
148  static ArrayLoadCodegen codegenGeoArrayLoadAndNullcheck(llvm::Value* byte_stream,
149  llvm::Value* pos,
150  const SQLTypeInfo& ti,
151  CgenState* cgen_state);
152 
153  llvm::Value* codegenCastBetweenTimestamps(llvm::Value* ts_lv,
154  const SQLTypeInfo& operand_dimen,
155  const SQLTypeInfo& target_dimen,
156  const bool nullable);
157 
158  // Generate the position for the given window function and the query iteration position.
159  llvm::Value* codegenWindowPosition(const WindowFunctionContext* window_func_context,
160  llvm::Value* pos_arg);
161 
162  private:
163  std::vector<llvm::Value*> codegen(const Analyzer::Constant*,
164  const EncodingType enc_type,
165  const int dict_id,
166  const CompilationOptions&);
167 
168  virtual std::vector<llvm::Value*> codegenColumn(const Analyzer::ColumnVar*,
169  const bool fetch_column,
170  const CompilationOptions&);
171 
172  llvm::Value* codegenArith(const Analyzer::BinOper*, const CompilationOptions&);
173 
174  llvm::Value* codegenUMinus(const Analyzer::UOper*, const CompilationOptions&);
175 
176  llvm::Value* codegenCmp(const Analyzer::BinOper*, const CompilationOptions&);
177 
178  llvm::Value* codegenCmp(const SQLOps,
179  const SQLQualifier,
180  std::vector<llvm::Value*>,
181  const SQLTypeInfo&,
182  const Analyzer::Expr*,
183  const CompilationOptions&);
184 
185  llvm::Value* codegenIsNull(const Analyzer::UOper*, const CompilationOptions&);
186 
187  llvm::Value* codegenIsNullNumber(llvm::Value*, const SQLTypeInfo&);
188 
189  llvm::Value* codegenLogical(const Analyzer::BinOper*, const CompilationOptions&);
190 
191  llvm::Value* codegenLogical(const Analyzer::UOper*, const CompilationOptions&);
192 
193  llvm::Value* codegenCast(const Analyzer::UOper*, const CompilationOptions&);
194 
195  llvm::Value* codegenCast(llvm::Value* operand_lv,
196  const SQLTypeInfo& operand_ti,
197  const SQLTypeInfo& ti,
198  const bool operand_is_const,
199  const CompilationOptions& co);
200 
201  llvm::Value* codegen(const Analyzer::InValues*, const CompilationOptions&);
202 
203  llvm::Value* codegen(const Analyzer::InIntegerSet* expr, const CompilationOptions& co);
204 
205  std::vector<llvm::Value*> codegen(const Analyzer::CaseExpr*, const CompilationOptions&);
206 
207  llvm::Value* codegen(const Analyzer::ExtractExpr*, const CompilationOptions&);
208 
209  llvm::Value* codegen(const Analyzer::DateaddExpr*, const CompilationOptions&);
210 
211  llvm::Value* codegen(const Analyzer::DatediffExpr*, const CompilationOptions&);
212 
213  llvm::Value* codegen(const Analyzer::DatetruncExpr*, const CompilationOptions&);
214 
215  llvm::Value* codegen(const Analyzer::CharLengthExpr*, const CompilationOptions&);
216 
217  llvm::Value* codegen(const Analyzer::KeyForStringExpr*, const CompilationOptions&);
218 
219  llvm::Value* codegen(const Analyzer::SampleRatioExpr*, const CompilationOptions&);
220 
221  llvm::Value* codegen(const Analyzer::WidthBucketExpr*, const CompilationOptions&);
222 
224  const CompilationOptions&);
225 
227  const CompilationOptions&);
228 
229  llvm::Value* codegen(const Analyzer::StringOper*, const CompilationOptions&);
230 
231  llvm::Value* codegen(const Analyzer::LikeExpr*, const CompilationOptions&);
232 
233  llvm::Value* codegen(const Analyzer::RegexpExpr*, const CompilationOptions&);
234 
235  llvm::Value* codegenUnnest(const Analyzer::UOper*, const CompilationOptions&);
236 
237  llvm::Value* codegenArrayAt(const Analyzer::BinOper*, const CompilationOptions&);
238 
239  llvm::Value* codegen(const Analyzer::CardinalityExpr*, const CompilationOptions&);
240 
241  std::vector<llvm::Value*> codegenArrayExpr(const Analyzer::ArrayExpr*,
242  const CompilationOptions&);
243 
244  std::vector<llvm::Value*> codegenGeoColumnVar(const Analyzer::GeoColumnVar*,
245  const bool fetch_columns,
246  const CompilationOptions& co);
247 
248  std::vector<llvm::Value*> codegenGeoExpr(const Analyzer::GeoExpr*,
249  const CompilationOptions&);
250 
251  std::vector<llvm::Value*> codegenGeoConstant(const Analyzer::GeoConstant*,
252  const CompilationOptions&);
253 
254  std::vector<llvm::Value*> codegenGeoOperator(const Analyzer::GeoOperator*,
255  const CompilationOptions&);
256 
257  std::vector<llvm::Value*> codegenGeoUOper(const Analyzer::GeoUOper*,
258  const CompilationOptions&);
259 
260  std::vector<llvm::Value*> codegenGeoBinOper(const Analyzer::GeoBinOper*,
261  const CompilationOptions&);
262 
263  std::vector<llvm::Value*> codegenGeosPredicateCall(const std::string&,
264  std::vector<llvm::Value*>,
265  const CompilationOptions&);
266 
267  std::vector<llvm::Value*> codegenGeosConstructorCall(const std::string&,
268  std::vector<llvm::Value*>,
269  llvm::Value*,
270  const CompilationOptions&);
271 
272  std::vector<llvm::Value*> codegenGeoArgs(
273  const std::vector<std::shared_ptr<Analyzer::Expr>>&,
274  const CompilationOptions&);
275 
276  llvm::Value* codegenFunctionOper(const Analyzer::FunctionOper*,
277  const CompilationOptions&);
278 
281  const CompilationOptions&);
282 
283  llvm::Value* codegen(const Analyzer::BinOper*, const CompilationOptions&);
284 
285  llvm::Value* codegen(const Analyzer::UOper*, const CompilationOptions&);
286 
287  std::vector<llvm::Value*> codegenHoistedConstantsLoads(const SQLTypeInfo& type_info,
288  const EncodingType enc_type,
289  const int dict_id,
290  const int16_t lit_off,
291  const size_t lit_bytes);
292 
293  std::vector<llvm::Value*> codegenHoistedConstantsPlaceholders(
294  const SQLTypeInfo& type_info,
295  const EncodingType enc_type,
296  const int16_t lit_off,
297  const std::vector<llvm::Value*>& literal_loads);
298 
299  std::vector<llvm::Value*> codegenColVar(const Analyzer::ColumnVar*,
300  const bool fetch_column,
301  const bool update_query_plan,
302  const CompilationOptions&);
303 
304  llvm::Value* codegenFixedLengthColVar(
305  const Analyzer::ColumnVar* col_var,
306  llvm::Value* col_byte_stream,
307  llvm::Value* pos_arg,
308  const WindowFunctionContext* window_function_context = nullptr);
309 
310  // Generates code for a fixed length column when a window function is active.
312  const Analyzer::ColumnVar* col_var,
313  llvm::Value* col_byte_stream,
314  llvm::Value* pos_arg,
315  const WindowFunctionContext* window_function_context = nullptr);
316 
317  std::vector<llvm::Value*> codegenVariableLengthStringColVar(
318  llvm::Value* col_byte_stream,
319  llvm::Value* pos_arg);
320 
321  llvm::Value* codegenRowId(const Analyzer::ColumnVar* col_var,
322  const CompilationOptions& co);
323 
324  llvm::Value* codgenAdjustFixedEncNull(llvm::Value*, const SQLTypeInfo&);
325 
326  std::vector<llvm::Value*> codegenOuterJoinNullPlaceholder(
327  const Analyzer::ColumnVar* col_var,
328  const bool fetch_column,
329  const CompilationOptions& co);
330 
331  llvm::Value* codegenIntArith(const Analyzer::BinOper*,
332  llvm::Value*,
333  llvm::Value*,
334  const CompilationOptions&);
335 
336  llvm::Value* codegenFpArith(const Analyzer::BinOper*, llvm::Value*, llvm::Value*);
337 
338  llvm::Value* codegenCastTimestampToTime(llvm::Value* ts_lv,
339  const int dimen,
340  const bool nullable);
341 
342  llvm::Value* codegenCastTimestampToDate(llvm::Value* ts_lv,
343  const int dimen,
344  const bool nullable);
345 
346  llvm::Value* codegenCastFromString(llvm::Value* operand_lv,
347  const SQLTypeInfo& operand_ti,
348  const SQLTypeInfo& ti,
349  const bool operand_is_const,
350  const CompilationOptions& co);
351 
352  llvm::Value* codegenCastToFp(llvm::Value* operand_lv,
353  const SQLTypeInfo& operand_ti,
354  const SQLTypeInfo& ti);
355 
356  llvm::Value* codegenCastFromFp(llvm::Value* operand_lv,
357  const SQLTypeInfo& operand_ti,
358  const SQLTypeInfo& ti);
359 
360  llvm::Value* codegenAdd(const Analyzer::BinOper*,
361  llvm::Value*,
362  llvm::Value*,
363  const std::string& null_typename,
364  const std::string& null_check_suffix,
365  const SQLTypeInfo&,
366  const CompilationOptions&);
367 
368  llvm::Value* codegenSub(const Analyzer::BinOper*,
369  llvm::Value*,
370  llvm::Value*,
371  const std::string& null_typename,
372  const std::string& null_check_suffix,
373  const SQLTypeInfo&,
374  const CompilationOptions&);
375 
376  void codegenSkipOverflowCheckForNull(llvm::Value* lhs_lv,
377  llvm::Value* rhs_lv,
378  llvm::BasicBlock* no_overflow_bb,
379  const SQLTypeInfo& ti);
380 
381  llvm::Value* codegenMul(const Analyzer::BinOper*,
382  llvm::Value*,
383  llvm::Value*,
384  const std::string& null_typename,
385  const std::string& null_check_suffix,
386  const SQLTypeInfo&,
387  const CompilationOptions&,
388  bool downscale = true);
389 
390  llvm::Value* codegenDiv(llvm::Value*,
391  llvm::Value*,
392  const std::string& null_typename,
393  const std::string& null_check_suffix,
394  const SQLTypeInfo&,
395  bool upscale = true);
396 
397  llvm::Value* codegenDeciDiv(const Analyzer::BinOper*, const CompilationOptions&);
398 
399  llvm::Value* codegenMod(llvm::Value*,
400  llvm::Value*,
401  const std::string& null_typename,
402  const std::string& null_check_suffix,
403  const SQLTypeInfo&);
404 
405  llvm::Value* codegenCase(const Analyzer::CaseExpr*,
406  llvm::Type* case_llvm_type,
407  const bool is_real_str,
408  const CompilationOptions&);
409 
410  llvm::Value* codegenExtractHighPrecisionTimestamps(llvm::Value*,
411  const SQLTypeInfo&,
412  const ExtractField&);
413 
414  llvm::Value* codegenDateTruncHighPrecisionTimestamps(llvm::Value*,
415  const SQLTypeInfo&,
416  const DatetruncField&);
417 
418  llvm::Value* codegenCmpDecimalConst(const SQLOps,
419  const SQLQualifier,
420  const Analyzer::Expr*,
421  const SQLTypeInfo&,
422  const Analyzer::Expr*,
423  const CompilationOptions&);
424 
425  llvm::Value* codegenOverlaps(const SQLOps,
426  const SQLQualifier,
427  const std::shared_ptr<Analyzer::Expr>,
428  const std::shared_ptr<Analyzer::Expr>,
429  const CompilationOptions&);
430 
431  llvm::Value* codegenStrCmp(const SQLOps,
432  const SQLQualifier,
433  const std::shared_ptr<Analyzer::Expr>,
434  const std::shared_ptr<Analyzer::Expr>,
435  const CompilationOptions&);
436 
437  llvm::Value* codegenQualifierCmp(const SQLOps,
438  const SQLQualifier,
439  std::vector<llvm::Value*>,
440  const Analyzer::Expr*,
441  const CompilationOptions&);
442 
443  llvm::Value* codegenLogicalShortCircuit(const Analyzer::BinOper*,
444  const CompilationOptions&);
445 
446  llvm::Value* codegenDictLike(const std::shared_ptr<Analyzer::Expr> arg,
447  const Analyzer::Constant* pattern,
448  const bool ilike,
449  const bool is_simple,
450  const char escape_char,
451  const CompilationOptions&);
452 
453  llvm::Value* codegenDictStrCmp(const std::shared_ptr<Analyzer::Expr>,
454  const std::shared_ptr<Analyzer::Expr>,
455  const SQLOps,
456  const CompilationOptions& co);
457 
458  llvm::Value* codegenDictRegexp(const std::shared_ptr<Analyzer::Expr> arg,
459  const Analyzer::Constant* pattern,
460  const char escape_char,
461  const CompilationOptions&);
462 
463  // Returns the IR value which holds true iff at least one match has been found for outer
464  // join, null if there's no outer join condition on the given nesting level.
465  llvm::Value* foundOuterJoinMatch(const size_t nesting_level) const;
466 
468 
469  llvm::Value* colByteStream(const Analyzer::ColumnVar* col_var,
470  const bool fetch_column,
471  const bool hoist_literals);
472 
473  std::shared_ptr<const Analyzer::Expr> hashJoinLhs(const Analyzer::ColumnVar* rhs) const;
474 
475  std::shared_ptr<const Analyzer::ColumnVar> hashJoinLhsTuple(
476  const Analyzer::ColumnVar* rhs,
477  const Analyzer::BinOper* tautological_eq) const;
478 
479  bool needCastForHashJoinLhs(const Analyzer::ColumnVar* rhs) const;
480 
481  std::unique_ptr<InValuesBitmap> createInValuesBitmap(const Analyzer::InValues*,
482  const CompilationOptions&);
483 
484  bool checkExpressionRanges(const Analyzer::UOper*, int64_t, int64_t);
485 
486  bool checkExpressionRanges(const Analyzer::BinOper*, int64_t, int64_t);
487 
489  llvm::BasicBlock* args_null_bb;
490  llvm::BasicBlock* args_notnull_bb;
491  llvm::BasicBlock* orig_bb;
492  };
493 
494  std::tuple<ArgNullcheckBBs, llvm::Value*> beginArgsNullcheck(
495  const Analyzer::FunctionOper* function_oper,
496  const std::vector<llvm::Value*>& orig_arg_lvs);
497 
498  llvm::Value* endArgsNullcheck(const ArgNullcheckBBs&,
499  llvm::Value*,
500  llvm::Value*,
501  const Analyzer::FunctionOper*);
502 
504  const std::vector<llvm::Value*>&);
505 
506  llvm::Value* codegenCompression(const SQLTypeInfo& type_info);
507 
508  std::pair<llvm::Value*, llvm::Value*> codegenArrayBuff(llvm::Value* chunk,
509  llvm::Value* row_pos,
510  SQLTypes array_type,
511  bool cast_and_extend);
512 
513  void codegenBufferArgs(const std::string& udf_func_name,
514  size_t param_num,
515  llvm::Value* buffer_buf,
516  llvm::Value* buffer_size,
517  llvm::Value* buffer_is_null,
518  std::vector<llvm::Value*>& output_args);
519 
520  llvm::StructType* createPointStructType(const std::string& udf_func_name,
521  size_t param_num);
522 
523  void codegenGeoPointArgs(const std::string& udf_func_name,
524  size_t param_num,
525  llvm::Value* point_buf,
526  llvm::Value* point_size,
527  llvm::Value* compression,
528  llvm::Value* input_srid,
529  llvm::Value* output_srid,
530  std::vector<llvm::Value*>& output_args);
531 
532  llvm::StructType* createMultiPointStructType(const std::string& udf_func_name,
533  size_t param_num);
534 
535  void codegenGeoMultiPointArgs(const std::string& udf_func_name,
536  size_t param_num,
537  llvm::Value* multi_point_buf,
538  llvm::Value* multi_point_size,
539  // TODO: bounds?
540  llvm::Value* compression,
541  llvm::Value* input_srid,
542  llvm::Value* output_srid,
543  std::vector<llvm::Value*>& output_args);
544 
545  llvm::StructType* createLineStringStructType(const std::string& udf_func_name,
546  size_t param_num);
547 
548  void codegenGeoLineStringArgs(const std::string& udf_func_name,
549  size_t param_num,
550  llvm::Value* line_string_buf,
551  llvm::Value* line_string_size,
552  llvm::Value* compression,
553  llvm::Value* input_srid,
554  llvm::Value* output_srid,
555  std::vector<llvm::Value*>& output_args);
556 
557  llvm::StructType* createMultiLineStringStructType(const std::string& udf_func_name,
558  size_t param_num);
559 
560  void codegenGeoMultiLineStringArgs(const std::string& udf_func_name,
561  size_t param_num,
562  llvm::Value* multi_linestring_coords,
563  llvm::Value* multi_linestring_size,
564  llvm::Value* linestring_sizes,
565  llvm::Value* linestring_sizes_size,
566  // TODO: bounds?
567  llvm::Value* compression,
568  llvm::Value* input_srid,
569  llvm::Value* output_srid,
570  std::vector<llvm::Value*>& output_args);
571 
572  llvm::StructType* createPolygonStructType(const std::string& udf_func_name,
573  size_t param_num);
574 
575  void codegenGeoPolygonArgs(const std::string& udf_func_name,
576  size_t param_num,
577  llvm::Value* polygon_buf,
578  llvm::Value* polygon_size,
579  llvm::Value* ring_sizes_buf,
580  llvm::Value* num_rings,
581  llvm::Value* compression,
582  llvm::Value* input_srid,
583  llvm::Value* output_srid,
584  std::vector<llvm::Value*>& output_args);
585 
586  llvm::StructType* createMultiPolygonStructType(const std::string& udf_func_name,
587  size_t param_num);
588 
589  void codegenGeoMultiPolygonArgs(const std::string& udf_func_name,
590  size_t param_num,
591  llvm::Value* polygon_coords,
592  llvm::Value* polygon_coords_size,
593  llvm::Value* ring_sizes_buf,
594  llvm::Value* ring_sizes,
595  llvm::Value* polygon_bounds,
596  llvm::Value* polygon_bounds_sizes,
597  llvm::Value* compression,
598  llvm::Value* input_srid,
599  llvm::Value* output_srid,
600  std::vector<llvm::Value*>& output_args);
601 
602  std::vector<llvm::Value*> codegenFunctionOperCastArgs(
603  const Analyzer::FunctionOper*,
604  const ExtensionFunction*,
605  const std::vector<llvm::Value*>&,
606  const std::vector<size_t>&,
607  const std::unordered_map<llvm::Value*, llvm::Value*>&,
608  const CompilationOptions&);
609 
610  // Return LLVM intrinsic providing fast arithmetic with overflow check
611  // for the given binary operation.
612  llvm::Function* getArithWithOverflowIntrinsic(const Analyzer::BinOper* bin_oper,
613  llvm::Type* type);
614 
615  // Generate code for the given binary operation with overflow check.
616  // Signed integer add, sub and mul operations are supported. Overflow
617  // check is performed using LLVM arithmetic intrinsics which are not
618  // supported for GPU. Return the IR value which holds operation result.
619  llvm::Value* codegenBinOpWithOverflowForCPU(const Analyzer::BinOper* bin_oper,
620  llvm::Value* lhs_lv,
621  llvm::Value* rhs_lv,
622  const std::string& null_check_suffix,
623  const SQLTypeInfo& ti);
624 
625  Executor* executor_;
626 
627  protected:
628  Executor* executor() const {
629  if (!executor_) {
630  throw ExecutorRequired();
631  }
632  return executor_;
633  }
634 
637 
638  friend class GroupByAndAggregate;
639 };
640 
641 // Code generator specialized for scalar expressions which doesn't require an executor.
643  public:
644  // Constructor which takes the runtime module.
645  ScalarCodeGenerator(std::unique_ptr<llvm::Module> llvm_module)
646  : CodeGenerator(nullptr, nullptr), module_(std::move(llvm_module)) {}
647 
648  // Function generated for a given analyzer expression. For GPU, a wrapper which meets
649  // the kernel signature constraints (returns void, takes all arguments as pointers) is
650  // generated. Also returns the list of column expressions for which compatible input
651  // parameters must be passed to the input of the generated function.
653  llvm::Function* func;
654  llvm::Function* wrapper_func;
655  std::vector<std::shared_ptr<Analyzer::ColumnVar>> inputs;
656  };
657 
658  // Compiles the given scalar expression to IR and the list of columns in the expression,
659  // needed to provide inputs to the generated function.
661  const bool fetch_columns,
662  const CompilationOptions& co);
663 
664  // Generates the native function pointers for each device.
665  // NB: this is separated from the compile method to allow building higher level code
666  // generators which can inline the IR for evaluating a single expression (for example
667  // loops).
668  std::vector<void*> generateNativeCode(Executor* executor,
669  const CompiledExpression& compiled_expression,
670  const CompilationOptions& co);
671 
673 
674  using ColumnMap =
675  std::unordered_map<InputColDescriptor, std::shared_ptr<Analyzer::ColumnVar>>;
676 
677  private:
678  std::vector<llvm::Value*> codegenColumn(const Analyzer::ColumnVar*,
679  const bool fetch_column,
680  const CompilationOptions&) override;
681 
682  // Collect the columns used by the given analyzer expressions and fills in the column
683  // map to be used during code generation.
685 
686  std::vector<void*> generateNativeGPUCode(Executor* executor,
687  llvm::Function* func,
688  llvm::Function* wrapper_func,
689  const CompilationOptions& co);
690 
691  std::unique_ptr<llvm::Module> module_;
693  std::unique_ptr<CgenState> own_cgen_state_;
694  std::unique_ptr<PlanState> own_plan_state_;
695  std::unique_ptr<CudaMgr_Namespace::CudaMgr> cuda_mgr_;
696  std::shared_ptr<GpuCompilationContext> gpu_compilation_context_;
697  std::unique_ptr<llvm::TargetMachine> nvptx_target_machine_;
698 };
699 
704 std::unique_ptr<llvm::Module> runtime_module_shallow_copy(CgenState* cgen_state);
705 
709 std::vector<llvm::Value*> generate_column_heads_load(const int num_columns,
710  llvm::Value* byte_stream_arg,
711  llvm::IRBuilder<>& ir_builder,
712  llvm::LLVMContext& ctx);
llvm::StructType * createLineStringStructType(const std::string &udf_func_name, size_t param_num)
void codegenGeoMultiPolygonArgs(const std::string &udf_func_name, size_t param_num, llvm::Value *polygon_coords, llvm::Value *polygon_coords_size, llvm::Value *ring_sizes_buf, llvm::Value *ring_sizes, llvm::Value *polygon_bounds, llvm::Value *polygon_bounds_sizes, llvm::Value *compression, llvm::Value *input_srid, llvm::Value *output_srid, std::vector< llvm::Value * > &output_args)
llvm::Value * codegenIntArith(const Analyzer::BinOper *, llvm::Value *, llvm::Value *, const CompilationOptions &)
llvm::Value * codegenPerRowStringOper(const Analyzer::StringOper *string_oper, const CompilationOptions &co)
CompiledExpression compile(const Analyzer::Expr *expr, const bool fetch_columns, const CompilationOptions &co)
NullCheckCodegen(CgenState *cgen_state, Executor *executor, llvm::Value *nullable_lv, const SQLTypeInfo &nullable_ti, const std::string &name="")
Definition: IRCodegen.cpp:1401
llvm::Value * codegenCastFromFp(llvm::Value *operand_lv, const SQLTypeInfo &operand_ti, const SQLTypeInfo &ti)
Definition: CastIR.cpp:517
std::vector< llvm::Value * > codegenColumn(const Analyzer::ColumnVar *, const bool fetch_column, const CompilationOptions &) override
llvm::Value * codegenStrCmp(const SQLOps, const SQLQualifier, const std::shared_ptr< Analyzer::Expr >, const std::shared_ptr< Analyzer::Expr >, const CompilationOptions &)
Definition: CompareIR.cpp:366
llvm::Value * codegenConstantWidthBucketExpr(const Analyzer::WidthBucketExpr *, const CompilationOptions &)
Definition: IRCodegen.cpp:303
std::unique_ptr< llvm::Module > runtime_module_shallow_copy(CgenState *cgen_state)
llvm::BasicBlock * args_notnull_bb
llvm::BasicBlock * nullcheck_bb
SQLTypes
Definition: sqltypes.h:53
std::unique_ptr< PlanState > own_plan_state_
llvm::Value * codegenArith(const Analyzer::BinOper *, const CompilationOptions &)
CgenState * cgen_state_
ExecutionEngineWrapper execution_engine_
void codegenGeoPolygonArgs(const std::string &udf_func_name, size_t param_num, llvm::Value *polygon_buf, llvm::Value *polygon_size, llvm::Value *ring_sizes_buf, llvm::Value *num_rings, llvm::Value *compression, llvm::Value *input_srid, llvm::Value *output_srid, std::vector< llvm::Value * > &output_args)
SQLQualifier
Definition: sqldefs.h:70
llvm::Value * codegenRowId(const Analyzer::ColumnVar *col_var, const CompilationOptions &co)
Definition: ColumnIR.cpp:339
llvm::StructType * createMultiPointStructType(const std::string &udf_func_name, size_t param_num)
llvm::Value * codegenFixedLengthColVarInWindow(const Analyzer::ColumnVar *col_var, llvm::Value *col_byte_stream, llvm::Value *pos_arg, const WindowFunctionContext *window_function_context=nullptr)
Definition: ColumnIR.cpp:294
std::vector< llvm::Value * > codegenFunctionOperCastArgs(const Analyzer::FunctionOper *, const ExtensionFunction *, const std::vector< llvm::Value * > &, const std::vector< size_t > &, const std::unordered_map< llvm::Value *, llvm::Value * > &, const CompilationOptions &)
llvm::StructType * createMultiLineStringStructType(const std::string &udf_func_name, size_t param_num)
SQLOps
Definition: sqldefs.h:28
llvm::Value * codegenMod(llvm::Value *, llvm::Value *, const std::string &null_typename, const std::string &null_check_suffix, const SQLTypeInfo &)
llvm::Value * codegenFunctionOperNullArg(const Analyzer::FunctionOper *, const std::vector< llvm::Value * > &)
std::vector< llvm::Value * > codegenOuterJoinNullPlaceholder(const Analyzer::ColumnVar *col_var, const bool fetch_column, const CompilationOptions &co)
Definition: ColumnIR.cpp:452
std::unique_ptr< llvm::TargetMachine > nvptx_target_machine_
llvm::Value * posArg(const Analyzer::Expr *) const
Definition: ColumnIR.cpp:550
std::shared_ptr< GpuCompilationContext > gpu_compilation_context_
llvm::Value * castArrayPointer(llvm::Value *ptr, const SQLTypeInfo &elem_ti)
llvm::Value * codegenCastToFp(llvm::Value *operand_lv, const SQLTypeInfo &operand_ti, const SQLTypeInfo &ti)
Definition: CastIR.cpp:474
llvm::Value * codgenAdjustFixedEncNull(llvm::Value *, const SQLTypeInfo &)
Definition: ColumnIR.cpp:396
llvm::Value * codegenPseudoStringOper(const Analyzer::ColumnVar *, const std::vector< StringOps_Namespace::StringOpInfo > &string_op_infos, const CompilationOptions &)
llvm::Value * foundOuterJoinMatch(const size_t nesting_level) const
Definition: ColumnIR.cpp:445
llvm::Value * codegenExtractHighPrecisionTimestamps(llvm::Value *, const SQLTypeInfo &, const ExtractField &)
Definition: DateTimeIR.cpp:257
llvm::StructType * createPointStructType(const std::string &udf_func_name, size_t param_num)
virtual std::vector< llvm::Value * > codegenColumn(const Analyzer::ColumnVar *, const bool fetch_column, const CompilationOptions &)
Definition: ColumnIR.cpp:92
std::unordered_set< std::shared_ptr< Analyzer::Expr >> HoistedFiltersSet
Definition: PlanState.h:45
llvm::Value * codegenDeciDiv(const Analyzer::BinOper *, const CompilationOptions &)
static ExecutionEngineWrapper generateNativeCPUCode(llvm::Function *func, const std::unordered_set< llvm::Function * > &live_funcs, const CompilationOptions &co)
llvm::Value * codegenArrayAt(const Analyzer::BinOper *, const CompilationOptions &)
Definition: ArrayIR.cpp:26
std::unordered_map< InputColDescriptor, std::shared_ptr< Analyzer::ColumnVar >> ColumnMap
static std::string generatePTX(const std::string &cuda_llir, llvm::TargetMachine *nvptx_target_machine, llvm::LLVMContext &context)
std::vector< llvm::Value * > codegenGeoBinOper(const Analyzer::GeoBinOper *, const CompilationOptions &)
Definition: GeoIR.cpp:247
const CudaMgr_Namespace::CudaMgr * cuda_mgr
Definition: CodeGenerator.h:97
void codegenBufferArgs(const std::string &udf_func_name, size_t param_num, llvm::Value *buffer_buf, llvm::Value *buffer_size, llvm::Value *buffer_is_null, std::vector< llvm::Value * > &output_args)
std::unique_ptr< CudaMgr_Namespace::CudaMgr > cuda_mgr_
llvm::Value * codegenFpArith(const Analyzer::BinOper *, llvm::Value *, llvm::Value *)
llvm::Value * codegenIsNull(const Analyzer::UOper *, const CompilationOptions &)
Definition: LogicalIR.cpp:380
llvm::TargetMachine * nvptx_target_machine
Definition: CodeGenerator.h:96
std::pair< llvm::Value *, llvm::Value * > codegenArrayBuff(llvm::Value *chunk, llvm::Value *row_pos, SQLTypes array_type, bool cast_and_extend)
std::shared_ptr< const Analyzer::Expr > hashJoinLhs(const Analyzer::ColumnVar *rhs) const
Definition: ColumnIR.cpp:588
llvm::Value * codegenWindowPosition(const WindowFunctionContext *window_func_context, llvm::Value *pos_arg)
Definition: ColumnIR.cpp:230
EncodingType
Definition: sqltypes.h:228
CudaMgr_Namespace::CudaMgr * getCudaMgr() const
std::vector< llvm::Value * > codegenGeoExpr(const Analyzer::GeoExpr *, const CompilationOptions &)
Definition: GeoIR.cpp:97
llvm::Value * codegenDiv(llvm::Value *, llvm::Value *, const std::string &null_typename, const std::string &null_check_suffix, const SQLTypeInfo &, bool upscale=true)
llvm::Value * codegenCmpDecimalConst(const SQLOps, const SQLQualifier, const Analyzer::Expr *, const SQLTypeInfo &, const Analyzer::Expr *, const CompilationOptions &)
Definition: CompareIR.cpp:398
std::tuple< ArgNullcheckBBs, llvm::Value * > beginArgsNullcheck(const Analyzer::FunctionOper *function_oper, const std::vector< llvm::Value * > &orig_arg_lvs)
std::vector< llvm::Value * > codegenHoistedConstants(const std::vector< const Analyzer::Constant * > &constants, const EncodingType enc_type, const int dict_id)
Definition: ConstantIR.cpp:373
std::vector< llvm::Value * > codegenGeoOperator(const Analyzer::GeoOperator *, const CompilationOptions &)
Definition: GeoIR.cpp:132
static std::unordered_set< llvm::Function * > markDeadRuntimeFuncs(llvm::Module &module, const std::vector< llvm::Function * > &roots, const std::vector< llvm::Function * > &leaves)
DatetruncField
Definition: DateTruncate.h:27
std::vector< llvm::Value * > codegenGeoUOper(const Analyzer::GeoUOper *, const CompilationOptions &)
Definition: GeoIR.cpp:167
void codegenSkipOverflowCheckForNull(llvm::Value *lhs_lv, llvm::Value *rhs_lv, llvm::BasicBlock *no_overflow_bb, const SQLTypeInfo &ti)
std::vector< llvm::Value * > codegenHoistedConstantsPlaceholders(const SQLTypeInfo &type_info, const EncodingType enc_type, const int16_t lit_off, const std::vector< llvm::Value * > &literal_loads)
Definition: ConstantIR.cpp:280
CodeGenerator(Executor *executor)
Definition: CodeGenerator.h:27
void codegenGeoMultiPointArgs(const std::string &udf_func_name, size_t param_num, llvm::Value *multi_point_buf, llvm::Value *multi_point_size, llvm::Value *compression, llvm::Value *input_srid, llvm::Value *output_srid, std::vector< llvm::Value * > &output_args)
llvm::Value * codegenBinOpWithOverflowForCPU(const Analyzer::BinOper *bin_oper, llvm::Value *lhs_lv, llvm::Value *rhs_lv, const std::string &null_check_suffix, const SQLTypeInfo &ti)
llvm::Value * codegenWidthBucketExpr(const Analyzer::WidthBucketExpr *, const CompilationOptions &)
Definition: IRCodegen.cpp:376
llvm::Value * codegenFunctionOper(const Analyzer::FunctionOper *, const CompilationOptions &)
llvm::Value * codegenCastBetweenIntTypes(llvm::Value *operand_lv, const SQLTypeInfo &operand_ti, const SQLTypeInfo &ti, bool upscale=true)
Definition: CastIR.cpp:343
Executor * executor_
llvm::Value * codegenOverlaps(const SQLOps, const SQLQualifier, const std::shared_ptr< Analyzer::Expr >, const std::shared_ptr< Analyzer::Expr >, const CompilationOptions &)
Definition: CompareIR.cpp:285
llvm::Value * codegenDictStrCmp(const std::shared_ptr< Analyzer::Expr >, const std::shared_ptr< Analyzer::Expr >, const SQLOps, const CompilationOptions &co)
llvm::Value * codegenCastTimestampToDate(llvm::Value *ts_lv, const int dimen, const bool nullable)
Definition: CastIR.cpp:157
static void link_udf_module(const std::unique_ptr< llvm::Module > &udf_module, llvm::Module &module, CgenState *cgen_state, llvm::Linker::Flags flags=llvm::Linker::Flags::None)
std::vector< llvm::Value * > codegenArrayExpr(const Analyzer::ArrayExpr *, const CompilationOptions &)
Definition: ArrayIR.cpp:91
llvm::Value * codegenDictRegexp(const std::shared_ptr< Analyzer::Expr > arg, const Analyzer::Constant *pattern, const char escape_char, const CompilationOptions &)
llvm::BasicBlock * args_null_bb
void codegenGeoMultiLineStringArgs(const std::string &udf_func_name, size_t param_num, llvm::Value *multi_linestring_coords, llvm::Value *multi_linestring_size, llvm::Value *linestring_sizes, llvm::Value *linestring_sizes_size, llvm::Value *compression, llvm::Value *input_srid, llvm::Value *output_srid, std::vector< llvm::Value * > &output_args)
llvm::Function * getArithWithOverflowIntrinsic(const Analyzer::BinOper *bin_oper, llvm::Type *type)
std::vector< llvm::Value * > codegenColVar(const Analyzer::ColumnVar *, const bool fetch_column, const bool update_query_plan, const CompilationOptions &)
Definition: ColumnIR.cpp:104
ScalarCodeGenerator(std::unique_ptr< llvm::Module > llvm_module)
std::vector< llvm::Value * > codegenGeosConstructorCall(const std::string &, std::vector< llvm::Value * >, llvm::Value *, const CompilationOptions &)
Definition: GeoIR.cpp:469
llvm::Value * codegenUMinus(const Analyzer::UOper *, const CompilationOptions &)
void codegenGeoPointArgs(const std::string &udf_func_name, size_t param_num, llvm::Value *point_buf, llvm::Value *point_size, llvm::Value *compression, llvm::Value *input_srid, llvm::Value *output_srid, std::vector< llvm::Value * > &output_args)
PlanState * plan_state_
std::vector< llvm::Value * > codegen(const Analyzer::Expr *, const bool fetch_columns, const CompilationOptions &)
Definition: IRCodegen.cpp:30
static llvm::ConstantInt * codegenIntConst(const Analyzer::Constant *constant, CgenState *cgen_state)
Definition: ConstantIR.cpp:89
Expression class for string functions The &quot;arg&quot; constructor parameter must be an expression that reso...
Definition: Analyzer.h:1464
std::vector< llvm::Value * > codegenGeosPredicateCall(const std::string &, std::vector< llvm::Value * >, const CompilationOptions &)
Definition: GeoIR.cpp:436
llvm::StructType * createPolygonStructType(const std::string &udf_func_name, size_t param_num)
static std::shared_ptr< GpuCompilationContext > generateNativeGPUCode(Executor *executor, llvm::Function *func, llvm::Function *wrapper_func, const std::unordered_set< llvm::Function * > &live_funcs, const bool is_gpu_smem_used, const CompilationOptions &co, const GPUTarget &gpu_target)
llvm::Value * codegenQualifierCmp(const SQLOps, const SQLQualifier, std::vector< llvm::Value * >, const Analyzer::Expr *, const CompilationOptions &)
Definition: CompareIR.cpp:548
llvm::Value * endArgsNullcheck(const ArgNullcheckBBs &, llvm::Value *, llvm::Value *, const Analyzer::FunctionOper *)
llvm::Value * codegenSub(const Analyzer::BinOper *, llvm::Value *, llvm::Value *, const std::string &null_typename, const std::string &null_check_suffix, const SQLTypeInfo &, const CompilationOptions &)
void codegenCastBetweenIntTypesOverflowChecks(llvm::Value *operand_lv, const SQLTypeInfo &operand_ti, const SQLTypeInfo &ti, const int64_t scale)
Definition: CastIR.cpp:416
static bool alwaysCloneRuntimeFunction(const llvm::Function *func)
ColumnMap prepare(const Analyzer::Expr *)
static ArrayLoadCodegen codegenGeoArrayLoadAndNullcheck(llvm::Value *byte_stream, llvm::Value *pos, const SQLTypeInfo &ti, CgenState *cgen_state)
Definition: GeoIR.cpp:23
std::unique_ptr< CgenState > own_cgen_state_
llvm::Value * codegenCase(const Analyzer::CaseExpr *, llvm::Type *case_llvm_type, const bool is_real_str, const CompilationOptions &)
Definition: CaseIR.cpp:55
std::vector< llvm::Value * > generate_column_heads_load(const int num_columns, llvm::Value *byte_stream_arg, llvm::IRBuilder<> &ir_builder, llvm::LLVMContext &ctx)
static void linkModuleWithLibdevice(Executor *executor, llvm::Module &module, llvm::PassManagerBuilder &pass_manager_builder, const GPUTarget &gpu_target)
ExtractField
llvm::Value * toBool(llvm::Value *)
Definition: LogicalIR.cpp:343
std::vector< llvm::Value * > codegenGeoColumnVar(const Analyzer::GeoColumnVar *, const bool fetch_columns, const CompilationOptions &co)
Definition: GeoIR.cpp:52
static bool prioritizeQuals(const RelAlgExecutionUnit &ra_exe_unit, std::vector< Analyzer::Expr * > &primary_quals, std::vector< Analyzer::Expr * > &deferred_quals, const PlanState::HoistedFiltersSet &hoisted_quals)
Definition: LogicalIR.cpp:157
std::vector< void * > generateNativeGPUCode(Executor *executor, llvm::Function *func, llvm::Function *wrapper_func, const CompilationOptions &co)
llvm::Value * codegenFunctionOperWithCustomTypeHandling(const Analyzer::FunctionOperWithCustomTypeHandling *, const CompilationOptions &)
llvm::Value * codegenCmp(const Analyzer::BinOper *, const CompilationOptions &)
Definition: CompareIR.cpp:230
bool needCastForHashJoinLhs(const Analyzer::ColumnVar *rhs) const
Definition: ColumnIR.cpp:654
llvm::Value * codegenCastBetweenTimestamps(llvm::Value *ts_lv, const SQLTypeInfo &operand_dimen, const SQLTypeInfo &target_dimen, const bool nullable)
Definition: CastIR.cpp:194
llvm::Value * codegenUnnest(const Analyzer::UOper *, const CompilationOptions &)
Definition: ArrayIR.cpp:20
std::vector< llvm::Value * > codegenGeoArgs(const std::vector< std::shared_ptr< Analyzer::Expr >> &, const CompilationOptions &)
Definition: GeoIR.cpp:355
llvm::Value * finalize(llvm::Value *null_lv, llvm::Value *notnull_lv)
Definition: IRCodegen.cpp:1437
std::vector< llvm::Value * > codegenHoistedConstantsLoads(const SQLTypeInfo &type_info, const EncodingType enc_type, const int dict_id, const int16_t lit_off, const size_t lit_bytes)
Definition: ConstantIR.cpp:142
llvm::Value * colByteStream(const Analyzer::ColumnVar *col_var, const bool fetch_column, const bool hoist_literals)
Definition: ColumnIR.cpp:534
llvm::Value * codegenIsNullNumber(llvm::Value *, const SQLTypeInfo &)
Definition: LogicalIR.cpp:409
llvm::Value * codegenLogical(const Analyzer::BinOper *, const CompilationOptions &)
Definition: LogicalIR.cpp:298
std::unique_ptr< llvm::Module > module_
llvm::Value * codegenCompression(const SQLTypeInfo &type_info)
llvm::Value * codegenCastTimestampToTime(llvm::Value *ts_lv, const int dimen, const bool nullable)
Definition: CastIR.cpp:137
std::vector< llvm::Value * > codegenGeoConstant(const Analyzer::GeoConstant *, const CompilationOptions &)
Definition: GeoIR.cpp:111
std::vector< std::shared_ptr< Analyzer::ColumnVar > > inputs
llvm::Value * codegenCastFromString(llvm::Value *operand_lv, const SQLTypeInfo &operand_ti, const SQLTypeInfo &ti, const bool operand_is_const, const CompilationOptions &co)
Definition: CastIR.cpp:226
CodeGenerator(CgenState *cgen_state, PlanState *plan_state)
Definition: CodeGenerator.h:34
llvm::Value * codegenCast(const Analyzer::UOper *, const CompilationOptions &)
Definition: CastIR.cpp:21
llvm::Value * codegenDateTruncHighPrecisionTimestamps(llvm::Value *, const SQLTypeInfo &, const DatetruncField &)
Definition: DateTimeIR.cpp:301
std::unique_ptr< InValuesBitmap > createInValuesBitmap(const Analyzer::InValues *, const CompilationOptions &)
Definition: InValuesIR.cpp:111
llvm::Value * codegenMul(const Analyzer::BinOper *, llvm::Value *, llvm::Value *, const std::string &null_typename, const std::string &null_check_suffix, const SQLTypeInfo &, const CompilationOptions &, bool downscale=true)
std::shared_ptr< const Analyzer::ColumnVar > hashJoinLhsTuple(const Analyzer::ColumnVar *rhs, const Analyzer::BinOper *tautological_eq) const
Definition: ColumnIR.cpp:717
llvm::Value * codegenFixedLengthColVar(const Analyzer::ColumnVar *col_var, llvm::Value *col_byte_stream, llvm::Value *pos_arg, const WindowFunctionContext *window_function_context=nullptr)
Definition: ColumnIR.cpp:243
std::vector< llvm::Value * > codegenVariableLengthStringColVar(llvm::Value *col_byte_stream, llvm::Value *pos_arg)
Definition: ColumnIR.cpp:324
std::vector< void * > generateNativeCode(Executor *executor, const CompiledExpression &compiled_expression, const CompilationOptions &co)
void codegenGeoLineStringArgs(const std::string &udf_func_name, size_t param_num, llvm::Value *line_string_buf, llvm::Value *line_string_size, llvm::Value *compression, llvm::Value *input_srid, llvm::Value *output_srid, std::vector< llvm::Value * > &output_args)
llvm::Value * codegenAdd(const Analyzer::BinOper *, llvm::Value *, llvm::Value *, const std::string &null_typename, const std::string &null_check_suffix, const SQLTypeInfo &, const CompilationOptions &)
bool checkExpressionRanges(const Analyzer::UOper *, int64_t, int64_t)
llvm::Value * codegenLogicalShortCircuit(const Analyzer::BinOper *, const CompilationOptions &)
Definition: LogicalIR.cpp:196
std::unique_ptr< DiamondCodegen > null_check
static std::unique_ptr< llvm::TargetMachine > initializeNVPTXBackend(const CudaMgr_Namespace::NvidiaDeviceArch arch)
llvm::Value * resolveGroupedColumnReference(const Analyzer::ColumnVar *)
Definition: ColumnIR.cpp:515
llvm::Value * codegenDictLike(const std::shared_ptr< Analyzer::Expr > arg, const Analyzer::Constant *pattern, const bool ilike, const bool is_simple, const char escape_char, const CompilationOptions &)
Executor * executor() const
llvm::StructType * createMultiPolygonStructType(const std::string &udf_func_name, size_t param_num)