Class CodeGenerator¶
-
class
CodeGenerator
¶ Subclassed by ScalarCodeGenerator
Public Functions
-
std::vector<llvm::Value *>
codegen
(const Analyzer::Expr *expr, const bool fetch_columns, const CompilationOptions &co)¶
-
std::vector<llvm::Value *>
codegenHoistedConstants
(const std::vector<const Analyzer::Constant *> &constants, const EncodingType enc_type, const int dict_id)¶
-
llvm::Value *
codegenCastBetweenIntTypes
(llvm::Value *operand_lv, const SQLTypeInfo &operand_ti, const SQLTypeInfo &ti, bool upscale = true)¶
-
void
codegenCastBetweenIntTypesOverflowChecks
(llvm::Value *operand_lv, const SQLTypeInfo &operand_ti, const SQLTypeInfo &ti, const int64_t scale)¶
-
llvm::Value *
toBool
(llvm::Value *lv)¶
-
llvm::Value *
castArrayPointer
(llvm::Value *ptr, const SQLTypeInfo &elem_ti)¶
Public Static Functions
-
std::unordered_set<llvm::Function *>
markDeadRuntimeFuncs
(llvm::Module &module, const std::vector<llvm::Function *> &roots, const std::vector<llvm::Function *> &leaves)¶
-
ExecutionEngineWrapper
generateNativeCPUCode
(llvm::Function *func, const std::unordered_set<llvm::Function *> &live_funcs, const CompilationOptions &co)¶
-
std::string
generatePTX
(const std::string &cuda_llir, llvm::TargetMachine *nvptx_target_machine, llvm::LLVMContext &context)¶
-
std::unique_ptr<llvm::TargetMachine>
initializeNVPTXBackend
(const CudaMgr_Namespace::NvidiaDeviceArch arch)¶
-
bool
alwaysCloneRuntimeFunction
(const llvm::Function *func)¶
-
void
linkModuleWithLibdevice
(Executor *executor, llvm::Module &module, llvm::PassManagerBuilder &pass_manager_builder, const GPUTarget &gpu_target)¶
-
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)¶
-
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)¶
-
bool
prioritizeQuals
(const RelAlgExecutionUnit &ra_exe_unit, std::vector<Analyzer::Expr *> &primary_quals, std::vector<Analyzer::Expr *> &deferred_quals, const PlanState::HoistedFiltersSet &hoisted_quals)¶
-
ArrayLoadCodegen
codegenGeoArrayLoadAndNullcheck
(llvm::Value *byte_stream, llvm::Value *pos, const SQLTypeInfo &ti, CgenState *cgen_state)¶
Private Functions
-
std::vector<llvm::Value *>
codegen
(const Analyzer::Constant *constant, const EncodingType enc_type, const int dict_id, const CompilationOptions &co)¶
-
std::vector<llvm::Value *>
codegenColumn
(const Analyzer::ColumnVar *col_var, const bool fetch_column, const CompilationOptions &co)¶
-
llvm::Value *
codegenArith
(const Analyzer::BinOper *bin_oper, const CompilationOptions &co)¶
-
llvm::Value *
codegenUMinus
(const Analyzer::UOper *uoper, const CompilationOptions &co)¶
-
llvm::Value *
codegenCmp
(const Analyzer::BinOper *bin_oper, const CompilationOptions &co)¶
-
llvm::Value *
codegenCmp
(const SQLOps optype, const SQLQualifier qualifier, std::vector<llvm::Value *> lhs_lvs, const SQLTypeInfo &lhs_ti, const Analyzer::Expr *rhs, const CompilationOptions &co)¶
-
llvm::Value *
codegenIsNull
(const Analyzer::UOper *uoper, const CompilationOptions &co)¶
-
llvm::Value *
codegenIsNullNumber
(llvm::Value *operand_lv, const SQLTypeInfo &ti)¶
-
llvm::Value *
codegenLogical
(const Analyzer::BinOper *bin_oper, const CompilationOptions &co)¶
-
llvm::Value *
codegenLogical
(const Analyzer::UOper *uoper, const CompilationOptions &co)¶
-
llvm::Value *
codegenCast
(const Analyzer::UOper *uoper, const CompilationOptions &co)¶
-
llvm::Value *
codegenCast
(llvm::Value *operand_lv, const SQLTypeInfo &operand_ti, const SQLTypeInfo &ti, const bool operand_is_const, const CompilationOptions &co)¶
-
llvm::Value *
codegen
(const Analyzer::InValues *expr, const CompilationOptions &co)¶
-
llvm::Value *
codegen
(const Analyzer::InIntegerSet *expr, const CompilationOptions &co)¶
-
std::vector<llvm::Value *>
codegen
(const Analyzer::CaseExpr *case_expr, const CompilationOptions &co)¶
-
llvm::Value *
codegen
(const Analyzer::ExtractExpr *extract_expr, const CompilationOptions &co)¶
-
llvm::Value *
codegen
(const Analyzer::DateaddExpr *dateadd_expr, const CompilationOptions &co)¶
-
llvm::Value *
codegen
(const Analyzer::DatediffExpr *datediff_expr, const CompilationOptions &co)¶
-
llvm::Value *
codegen
(const Analyzer::DatetruncExpr *datetrunc_expr, const CompilationOptions &co)¶
-
llvm::Value *
codegen
(const Analyzer::CharLengthExpr *expr, const CompilationOptions &co)¶
-
llvm::Value *
codegen
(const Analyzer::KeyForStringExpr *expr, const CompilationOptions &co)¶
-
llvm::Value *
codegen
(const Analyzer::SampleRatioExpr *expr, const CompilationOptions &co)¶
-
llvm::Value *
codegen
(const Analyzer::WidthBucketExpr *expr, const CompilationOptions &co)¶
-
llvm::Value *
codegenConstantWidthBucketExpr
(const Analyzer::WidthBucketExpr *expr, const CompilationOptions &co)¶
-
llvm::Value *
codegenWidthBucketExpr
(const Analyzer::WidthBucketExpr *expr, const CompilationOptions &co)¶
-
llvm::Value *
codegen
(const Analyzer::LowerExpr *expr, const CompilationOptions &co)¶
-
llvm::Value *
codegen
(const Analyzer::LikeExpr *expr, const CompilationOptions &co)¶
-
llvm::Value *
codegen
(const Analyzer::RegexpExpr *expr, const CompilationOptions &co)¶
-
llvm::Value *
codegenUnnest
(const Analyzer::UOper *uoper, const CompilationOptions &co)¶
-
llvm::Value *
codegenArrayAt
(const Analyzer::BinOper *array_at, const CompilationOptions &co)¶
-
llvm::Value *
codegen
(const Analyzer::CardinalityExpr *expr, const CompilationOptions &co)¶
-
std::vector<llvm::Value *>
codegenArrayExpr
(const Analyzer::ArrayExpr *array_expr, const CompilationOptions &co)¶
-
std::vector<llvm::Value *>
codegenGeoColumnVar
(const Analyzer::GeoColumnVar *geo_col_var, const bool fetch_columns, const CompilationOptions &co)¶
-
std::vector<llvm::Value *>
codegenGeoExpr
(const Analyzer::GeoExpr *expr, const CompilationOptions &co)¶
-
std::vector<llvm::Value *>
codegenGeoConstant
(const Analyzer::GeoConstant *geo_constant, const CompilationOptions &co)¶
-
std::vector<llvm::Value *>
codegenGeoOperator
(const Analyzer::GeoOperator *geo_operator, const CompilationOptions &co)¶
-
std::vector<llvm::Value *>
codegenGeoUOper
(const Analyzer::GeoUOper *geo_expr, const CompilationOptions &co)¶
-
std::vector<llvm::Value *>
codegenGeoBinOper
(const Analyzer::GeoBinOper *geo_expr, const CompilationOptions &co)¶
-
std::vector<llvm::Value *>
codegenGeosPredicateCall
(const std::string &func, std::vector<llvm::Value *> argument_list, const CompilationOptions &co)¶
-
std::vector<llvm::Value *>
codegenGeosConstructorCall
(const std::string &func, std::vector<llvm::Value *> argument_list, llvm::Value *result_srid, const CompilationOptions &co)¶
-
llvm::Value *
codegenFunctionOper
(const Analyzer::FunctionOper *function_oper, const CompilationOptions &co)¶
-
llvm::Value *
codegenFunctionOperWithCustomTypeHandling
(const Analyzer::FunctionOperWithCustomTypeHandling *function_oper, const CompilationOptions &co)¶
-
llvm::Value *
codegen
(const Analyzer::BinOper *bin_oper, const CompilationOptions &co)¶
-
llvm::Value *
codegen
(const Analyzer::UOper *u_oper, const CompilationOptions &co)¶
-
std::vector<llvm::Value *>
codegenHoistedConstantsLoads
(const SQLTypeInfo &type_info, const EncodingType enc_type, const int dict_id, const int16_t lit_off)¶
-
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)¶
-
std::vector<llvm::Value *>
codegenColVar
(const Analyzer::ColumnVar *col_var, const bool fetch_column, const bool update_query_plan, const CompilationOptions &co)¶
-
llvm::Value *
codegenFixedLengthColVar
(const Analyzer::ColumnVar *col_var, llvm::Value *col_byte_stream, llvm::Value *pos_arg)¶
-
llvm::Value *
codegenFixedLengthColVarInWindow
(const Analyzer::ColumnVar *col_var, llvm::Value *col_byte_stream, llvm::Value *pos_arg)¶
-
llvm::Value *
codegenWindowPosition
(WindowFunctionContext *window_func_context, llvm::Value *pos_arg)¶
-
std::vector<llvm::Value *>
codegenVariableLengthStringColVar
(llvm::Value *col_byte_stream, llvm::Value *pos_arg)¶
-
llvm::Value *
codegenRowId
(const Analyzer::ColumnVar *col_var, const CompilationOptions &co)¶
-
llvm::Value *
codgenAdjustFixedEncNull
(llvm::Value *val, const SQLTypeInfo &col_ti)¶
-
std::vector<llvm::Value *>
codegenOuterJoinNullPlaceholder
(const Analyzer::ColumnVar *col_var, const bool fetch_column, const CompilationOptions &co)¶
-
llvm::Value *
codegenIntArith
(const Analyzer::BinOper *bin_oper, llvm::Value *lhs_lv, llvm::Value *rhs_lv, const CompilationOptions &co)¶
-
llvm::Value *
codegenFpArith
(const Analyzer::BinOper *bin_oper, llvm::Value *lhs_lv, llvm::Value *rhs_lv)¶
-
llvm::Value *
codegenCastTimestampToDate
(llvm::Value *ts_lv, const int dimen, const bool nullable)¶
-
llvm::Value *
codegenCastBetweenTimestamps
(llvm::Value *ts_lv, const SQLTypeInfo &operand_dimen, const SQLTypeInfo &target_dimen, const bool nullable)¶
-
llvm::Value *
codegenCastFromString
(llvm::Value *operand_lv, const SQLTypeInfo &operand_ti, const SQLTypeInfo &ti, const bool operand_is_const, const CompilationOptions &co)¶
-
llvm::Value *
codegenCastToFp
(llvm::Value *operand_lv, const SQLTypeInfo &operand_ti, const SQLTypeInfo &ti)¶
-
llvm::Value *
codegenCastFromFp
(llvm::Value *operand_lv, const SQLTypeInfo &operand_ti, const SQLTypeInfo &ti)¶
-
llvm::Value *
codegenAdd
(const Analyzer::BinOper *bin_oper, llvm::Value *lhs_lv, llvm::Value *rhs_lv, const std::string &null_typename, const std::string &null_check_suffix, const SQLTypeInfo &ti, const CompilationOptions &co)¶
-
llvm::Value *
codegenSub
(const Analyzer::BinOper *bin_oper, llvm::Value *lhs_lv, llvm::Value *rhs_lv, const std::string &null_typename, const std::string &null_check_suffix, const SQLTypeInfo &ti, const CompilationOptions &co)¶
-
void
codegenSkipOverflowCheckForNull
(llvm::Value *lhs_lv, llvm::Value *rhs_lv, llvm::BasicBlock *no_overflow_bb, const SQLTypeInfo &ti)¶
-
llvm::Value *
codegenMul
(const Analyzer::BinOper *bin_oper, llvm::Value *lhs_lv, llvm::Value *rhs_lv, const std::string &null_typename, const std::string &null_check_suffix, const SQLTypeInfo &ti, const CompilationOptions &co, bool downscale = true)¶
-
llvm::Value *
codegenDiv
(llvm::Value *lhs_lv, llvm::Value *rhs_lv, const std::string &null_typename, const std::string &null_check_suffix, const SQLTypeInfo &ti, bool upscale = true)¶
-
llvm::Value *
codegenDeciDiv
(const Analyzer::BinOper *bin_oper, const CompilationOptions &co)¶
-
llvm::Value *
codegenMod
(llvm::Value *lhs_lv, llvm::Value *rhs_lv, const std::string &null_typename, const std::string &null_check_suffix, const SQLTypeInfo &ti)¶
-
llvm::Value *
codegenCase
(const Analyzer::CaseExpr *case_expr, llvm::Type *case_llvm_type, const bool is_real_str, const CompilationOptions &co)¶
-
llvm::Value *
codegenExtractHighPrecisionTimestamps
(llvm::Value *ts_lv, const SQLTypeInfo &ti, const ExtractField &field)¶
-
llvm::Value *
codegenDateTruncHighPrecisionTimestamps
(llvm::Value *ts_lv, const SQLTypeInfo &ti, const DatetruncField &field)¶
-
llvm::Value *
codegenCmpDecimalConst
(const SQLOps optype, const SQLQualifier qualifier, const Analyzer::Expr *lhs, const SQLTypeInfo &lhs_ti, const Analyzer::Expr *rhs, const CompilationOptions &co)¶
-
llvm::Value *
codegenQualifierCmp
(const SQLOps optype, const SQLQualifier qualifier, std::vector<llvm::Value *> lhs_lvs, const Analyzer::Expr *rhs, const CompilationOptions &co)¶
-
llvm::Value *
codegenLogicalShortCircuit
(const Analyzer::BinOper *bin_oper, const CompilationOptions &co)¶
-
llvm::Value *
foundOuterJoinMatch
(const size_t nesting_level) const¶
-
llvm::Value *
colByteStream
(const Analyzer::ColumnVar *col_var, const bool fetch_column, const bool hoist_literals)¶
-
std::shared_ptr<const Analyzer::ColumnVar>
hashJoinLhsTuple
(const Analyzer::ColumnVar *rhs, const Analyzer::BinOper *tautological_eq) const¶
-
std::unique_ptr<InValuesBitmap>
createInValuesBitmap
(const Analyzer::InValues *in_values, const CompilationOptions &co)¶
-
std::tuple<CodeGenerator::ArgNullcheckBBs, llvm::Value *>
beginArgsNullcheck
(const Analyzer::FunctionOper *function_oper, const std::vector<llvm::Value *> &orig_arg_lvs)¶
-
llvm::Value *
endArgsNullcheck
(const ArgNullcheckBBs &bbs, llvm::Value *fn_ret_lv, llvm::Value *null_array_ptr, const Analyzer::FunctionOper *function_oper)¶
-
llvm::Value *
codegenFunctionOperNullArg
(const Analyzer::FunctionOper *function_oper, const std::vector<llvm::Value *> &orig_arg_lvs)¶
-
llvm::Value *
codegenCompression
(const SQLTypeInfo &type_info)¶
-
std::pair<llvm::Value *, llvm::Value *>
codegenArrayBuff
(llvm::Value *chunk, llvm::Value *row_pos, SQLTypes array_type, bool cast_and_extend)¶
-
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)¶
-
llvm::StructType *
createPointStructType
(const std::string &udf_func_name, size_t param_num)¶
-
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)¶
-
llvm::StructType *
createLineStringStructType
(const std::string &udf_func_name, size_t param_num)¶
-
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::StructType *
createPolygonStructType
(const std::string &udf_func_name, size_t param_num)¶
-
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)¶
-
llvm::StructType *
createMultiPolygonStructType
(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)¶
-
std::vector<llvm::Value *>
codegenFunctionOperCastArgs
(const Analyzer::FunctionOper *function_oper, const ExtensionFunction *ext_func_sig, const std::vector<llvm::Value *> &orig_arg_lvs, const std::vector<size_t> &orig_arg_lvs_index, const std::unordered_map<llvm::Value *, llvm::Value *> &const_arr_size, const CompilationOptions &co)¶
-
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)¶
Friends
-
friend
CodeGenerator::GroupByAndAggregate
-
struct
ArgNullcheckBBs
¶
-
struct
GPUTarget
¶
-
std::vector<llvm::Value *>