26 std::vector<const Analyzer::Constant*> constants(
63 llvm::Constant::getNullValue(
71 ->getStringDictionaryProxy(
72 dict_id,
executor()->getRowSetMemoryOwner(),
true)
73 ->getIdOfString(str_const))};
119 const int16_t lit_off) {
144 lit_buff_query_func_lv, off_lv);
145 auto var_length = len_lv;
147 var_start->setName(literal_name +
"_start");
148 var_start_address->setName(literal_name +
"_start_address");
149 var_length->setName(literal_name +
"_length");
151 return {var_start, var_start_address, var_length};
175 lit_buff_query_func_lv, off_lv);
176 auto var_length = len_lv;
178 var_start_address->setName(literal_name +
"_start_address");
179 var_length->setName(literal_name +
"_length");
181 return {var_start_address, var_length};
189 val_ptr_type = llvm::PointerType::get(
200 lit_lv->setName(literal_name);
207 const int16_t lit_off,
208 const std::vector<llvm::Value*>& literal_loads) {
215 llvm::Value* var_start = literal_loads[0];
216 llvm::Value* var_start_address = literal_loads[1];
217 llvm::Value* var_length = literal_loads[2];
219 llvm::PointerType* placeholder0_type =
220 llvm::PointerType::get(var_start->getType(), 0);
223 "__placeholder__" + literal_name +
"_start");
224 llvm::PointerType* placeholder1_type =
225 llvm::PointerType::get(var_start_address->getType(), 0);
228 "__placeholder__" + literal_name +
"_start_address");
229 llvm::PointerType* placeholder2_type =
230 llvm::PointerType::get(var_length->getType(), 0);
233 "__placeholder__" + literal_name +
"_length");
239 return {placeholder0, placeholder1, placeholder2};
246 llvm::Value* var_start_address = literal_loads[0];
247 llvm::Value* var_length = literal_loads[1];
249 llvm::PointerType* placeholder0_type =
250 llvm::PointerType::get(var_start_address->getType(), 0);
253 "__placeholder__" + literal_name +
"_start_address");
254 llvm::PointerType* placeholder1_type =
255 llvm::PointerType::get(var_length->getType(), 0);
258 "__placeholder__" + literal_name +
"_length");
263 return {placeholder0, placeholder1};
267 llvm::Value* to_return_lv = literal_loads[0];
272 "__placeholder__" + literal_name);
276 return {placeholder0};
280 const std::vector<const Analyzer::Constant*>& constants,
284 CHECK(!constants.empty());
286 const auto& type_info = constants.front()->get_type_info();
288 for (
size_t device_id = 0; device_id < constants.size(); ++device_id) {
289 const auto constant = constants[device_id];
290 const auto& crt_type_info = constant->get_type_info();
291 CHECK(type_info == crt_type_info);
292 const int16_t dev_lit_off =
297 lit_off = dev_lit_off;
302 std::vector<llvm::Value*> hoisted_literal_loads;
306 hoisted_literal_loads =
310 hoisted_literal_loads = entry->second;
314 type_info, enc_type, lit_off, hoisted_literal_loads);
315 return literal_placeholders;
std::vector< llvm::Value * > codegenHoistedConstants(const std::vector< const Analyzer::Constant *> &constants, const EncodingType enc_type, const int dict_id)
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)
Executor * executor() const
llvm::Value * addStringConstant(const std::string &str)
llvm::Function * query_func_
std::unordered_map< llvm::Value *, HoistedLiteralLoadLocator > row_func_hoisted_literals_
llvm::IRBuilder ir_builder_
std::unordered_map< int, std::vector< llvm::Value * > > query_func_literal_loads_
bool is_timeinterval() const
HOST DEVICE EncodingType get_compression() const
llvm::Type * get_int_type(const int width, llvm::LLVMContext &context)
static size_t literalBytes(const CgenState::LiteralValue &lit)
Datum get_constval() const
size_t get_bit_width(const SQLTypeInfo &ti)
llvm::LLVMContext & context_
size_t getOrAddLiteral(const Analyzer::Constant *constant, const EncodingType enc_type, const int dict_id, const int device_id)
llvm::Value * get_arg_by_name(llvm::Function *func, const std::string &name)
std::vector< llvm::Value * > codegenHoistedConstantsLoads(const SQLTypeInfo &type_info, const EncodingType enc_type, const int dict_id, const int16_t lit_off)
llvm::ConstantInt * inlineIntNull(const SQLTypeInfo &)
HOST DEVICE SQLTypes get_subtype() const
llvm::IRBuilder query_func_entry_ir_builder_
SQLTypes decimal_to_int_type(const SQLTypeInfo &ti)
ExecutorDeviceType device_type
std::vector< llvm::Value * > codegen(const Analyzer::Expr *, const bool fetch_columns, const CompilationOptions &)
static llvm::ConstantInt * codegenIntConst(const Analyzer::Constant *constant, CgenState *cgen_state)
const SQLTypeInfo & get_type_info() const
boost::variant< int8_t, int16_t, int32_t, int64_t, float, double, std::pair< std::string, int >, std::string, std::vector< double >, std::vector< int32_t >, std::vector< int8_t >, std::pair< std::vector< int8_t >, int > > LiteralValue
HOST DEVICE SQLTypes get_type() const
int64_t inline_int_null_val(const SQL_TYPE_INFO &ti)
llvm::ConstantInt * llInt(const T v) const