OmniSciDB  0264ff685a
CgenState Struct Reference

#include <CgenState.h>

+ Collaboration diagram for CgenState:

Classes

struct  FunctionOperValue
 
struct  HoistedLiteralLoadLocator
 

Public Types

using LiteralValue = 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 > >
 
using LiteralValues = std::vector< LiteralValue >
 

Public Member Functions

 CgenState (const size_t num_query_infos, const bool contains_left_deep_outer_join)
 
 CgenState (llvm::LLVMContext &context)
 
size_t getOrAddLiteral (const Analyzer::Constant *constant, const EncodingType enc_type, const int dict_id, const int device_id)
 
const std::unordered_map< int, LiteralValues > & getLiterals () const
 
llvm::Value * addStringConstant (const std::string &str)
 
const InValuesBitmapaddInValuesBitmap (std::unique_ptr< InValuesBitmap > &in_values_bitmap)
 
llvm::Value * emitExternalCall (const std::string &fname, llvm::Type *ret_type, const std::vector< llvm::Value *> args, const std::vector< llvm::Attribute::AttrKind > &fnattrs={}, const bool has_struct_return=false)
 
llvm::Value * emitCall (const std::string &fname, const std::vector< llvm::Value *> &args)
 
size_t getLiteralBufferUsage (const int device_id)
 
llvm::Value * castToTypeIn (llvm::Value *val, const size_t bit_width)
 
std::pair< llvm::ConstantInt *, llvm::ConstantInt * > inlineIntMaxMin (const size_t byte_width, const bool is_signed)
 
llvm::ConstantInt * inlineIntNull (const SQLTypeInfo &)
 
llvm::ConstantFP * inlineFpNull (const SQLTypeInfo &)
 
template<class T >
llvm::ConstantInt * llInt (const T v) const
 
llvm::ConstantFP * llFp (const float v) const
 
llvm::ConstantFP * llFp (const double v) const
 
llvm::ConstantInt * llBool (const bool v) const
 
void emitErrorCheck (llvm::Value *condition, llvm::Value *errorCode, std::string label)
 
llvm::Value * nullValueAsDouble (SQLTypeInfo const &)
 

Static Public Member Functions

static size_t literalBytes (const CgenState::LiteralValue &lit)
 
static size_t addAligned (const size_t off_in, const size_t alignment)
 

Public Attributes

llvm::Module * module_
 
llvm::Function * row_func_
 
llvm::Function * filter_func_
 
llvm::Function * current_func_
 
llvm::BasicBlock * row_func_bb_
 
llvm::BasicBlock * filter_func_bb_
 
llvm::CallInst * row_func_call_
 
llvm::CallInst * filter_func_call_
 
std::vector< llvm::Function * > helper_functions_
 
llvm::LLVMContext & context_
 
llvm::ValueToValueMapTy vmap_
 
llvm::IRBuilder ir_builder_
 
std::unordered_map< int, std::vector< llvm::Value * > > fetch_cache_
 
std::vector< FunctionOperValueext_call_cache_
 
std::vector< llvm::Value * > group_by_expr_cache_
 
std::vector< llvm::Value * > str_constants_
 
std::vector< llvm::Value * > frag_offsets_
 
const bool contains_left_deep_outer_join_
 
std::vector< llvm::Value * > outer_join_match_found_per_level_
 
std::unordered_map< int, llvm::Value * > scan_idx_to_hash_pos_
 
InsertionOrderedMap filter_func_args_
 
std::vector< std::unique_ptr< const InValuesBitmap > > in_values_bitmaps_
 
bool needs_error_check_
 
bool needs_geos_
 
llvm::Function * query_func_
 
llvm::IRBuilder query_func_entry_ir_builder_
 
std::unordered_map< int, std::vector< llvm::Value * > > query_func_literal_loads_
 
std::unordered_map< llvm::Value *, HoistedLiteralLoadLocatorrow_func_hoisted_literals_
 

Private Member Functions

template<class T >
size_t getOrAddLiteral (const T &val, const int device_id)
 

Private Attributes

std::unordered_map< int, LiteralValuesliterals_
 
std::unordered_map< int, size_t > literal_bytes_
 

Detailed Description

Definition at line 31 of file CgenState.h.

Member Typedef Documentation

◆ LiteralValue

using CgenState::LiteralValue = 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> >

Definition at line 198 of file CgenState.h.

◆ LiteralValues

using CgenState::LiteralValues = std::vector<LiteralValue>

Definition at line 199 of file CgenState.h.

Constructor & Destructor Documentation

◆ CgenState() [1/2]

CgenState::CgenState ( const size_t  num_query_infos,
const bool  contains_left_deep_outer_join 
)
inline

Definition at line 33 of file CgenState.h.

34  : module_(nullptr)
35  , row_func_(nullptr)
36  , filter_func_(nullptr)
37  , current_func_(nullptr)
38  , row_func_bb_(nullptr)
39  , filter_func_bb_(nullptr)
40  , row_func_call_(nullptr)
41  , filter_func_call_(nullptr)
44  , contains_left_deep_outer_join_(contains_left_deep_outer_join)
45  , outer_join_match_found_per_level_(std::max(num_query_infos, size_t(1)) - 1)
46  , needs_error_check_(false)
47  , needs_geos_(false)
48  , query_func_(nullptr)
std::vector< llvm::Value * > outer_join_match_found_per_level_
Definition: CgenState.h:344
llvm::Function * query_func_
Definition: CgenState.h:351
llvm::IRBuilder ir_builder_
Definition: CgenState.h:333
bool needs_geos_
Definition: CgenState.h:349
const bool contains_left_deep_outer_join_
Definition: CgenState.h:343
llvm::Function * row_func_
Definition: CgenState.h:323
llvm::Module * module_
Definition: CgenState.h:322
llvm::LLVMContext & context_
Definition: CgenState.h:331
llvm::Function * current_func_
Definition: CgenState.h:325
llvm::CallInst * filter_func_call_
Definition: CgenState.h:329
bool needs_error_check_
Definition: CgenState.h:348
llvm::IRBuilder query_func_entry_ir_builder_
Definition: CgenState.h:352
llvm::BasicBlock * filter_func_bb_
Definition: CgenState.h:327
llvm::Function * filter_func_
Definition: CgenState.h:324
llvm::LLVMContext & getGlobalLLVMContext()
llvm::CallInst * row_func_call_
Definition: CgenState.h:328
llvm::BasicBlock * row_func_bb_
Definition: CgenState.h:326

◆ CgenState() [2/2]

CgenState::CgenState ( llvm::LLVMContext &  context)
inline

Definition at line 51 of file CgenState.h.

52  : module_(nullptr)
53  , row_func_(nullptr)
54  , context_(context)
57  , needs_error_check_(false)
58  , needs_geos_(false)
59  , query_func_(nullptr)
llvm::Function * query_func_
Definition: CgenState.h:351
llvm::IRBuilder ir_builder_
Definition: CgenState.h:333
bool needs_geos_
Definition: CgenState.h:349
const bool contains_left_deep_outer_join_
Definition: CgenState.h:343
llvm::Function * row_func_
Definition: CgenState.h:323
llvm::Module * module_
Definition: CgenState.h:322
llvm::LLVMContext & context_
Definition: CgenState.h:331
bool needs_error_check_
Definition: CgenState.h:348
llvm::IRBuilder query_func_entry_ir_builder_
Definition: CgenState.h:352

Member Function Documentation

◆ addAligned()

static size_t CgenState::addAligned ( const size_t  off_in,
const size_t  alignment 
)
inlinestatic

Definition at line 392 of file CgenState.h.

Referenced by getOrAddLiteral(), and Executor::serializeLiterals().

392  {
393  size_t off = off_in;
394  if (off % alignment != 0) {
395  off += (alignment - off % alignment);
396  }
397  return off + alignment;
398  }
+ Here is the caller graph for this function:

◆ addInValuesBitmap()

const InValuesBitmap* CgenState::addInValuesBitmap ( std::unique_ptr< InValuesBitmap > &  in_values_bitmap)
inline

Definition at line 212 of file CgenState.h.

References in_values_bitmaps_.

Referenced by CodeGenerator::codegen().

213  {
214  if (in_values_bitmap->isEmpty()) {
215  return in_values_bitmap.get();
216  }
217  in_values_bitmaps_.emplace_back(std::move(in_values_bitmap));
218  return in_values_bitmaps_.back().get();
219  }
std::vector< std::unique_ptr< const InValuesBitmap > > in_values_bitmaps_
Definition: CgenState.h:347
+ Here is the caller graph for this function:

◆ addStringConstant()

llvm::Value* CgenState::addStringConstant ( const std::string &  str)
inline

Definition at line 203 of file CgenState.h.

References context_, get_int_type(), ir_builder_, str_constants_, and to_string().

Referenced by CodeGenerator::codegen().

203  {
204  llvm::Value* str_lv = ir_builder_.CreateGlobalString(
205  str, "str_const_" + std::to_string(std::hash<std::string>()(str)));
206  auto i8_ptr = llvm::PointerType::get(get_int_type(8, context_), 0);
207  str_constants_.push_back(str_lv);
208  str_lv = ir_builder_.CreateBitCast(str_lv, i8_ptr);
209  return str_lv;
210  }
llvm::IRBuilder ir_builder_
Definition: CgenState.h:333
std::vector< llvm::Value * > str_constants_
Definition: CgenState.h:341
llvm::Type * get_int_type(const int width, llvm::LLVMContext &context)
std::string to_string(char const *&&v)
llvm::LLVMContext & context_
Definition: CgenState.h:331
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ castToTypeIn()

llvm::Value * CgenState::castToTypeIn ( llvm::Value *  val,
const size_t  bit_width 
)

Definition at line 106 of file CgenState.cpp.

References CHECK, context_, get_int_type(), and ir_builder_.

Referenced by CodeGenerator::codegenCast(), CodeGenerator::codegenCmp(), CodeGenerator::codegenLogical(), CodeGenerator::codegenLogicalShortCircuit(), getLiteralBufferUsage(), Executor::groupByColumnCodegen(), and nullValueAsDouble().

106  {
107  auto src_bits = val->getType()->getScalarSizeInBits();
108  if (src_bits == dst_bits) {
109  return val;
110  }
111  if (val->getType()->isIntegerTy()) {
112  return ir_builder_.CreateIntCast(
113  val, get_int_type(dst_bits, context_), src_bits != 1);
114  }
115  // real (not dictionary-encoded) strings; store the pointer to the payload
116  if (val->getType()->isPointerTy()) {
117  return ir_builder_.CreatePointerCast(val, get_int_type(dst_bits, context_));
118  }
119 
120  CHECK(val->getType()->isFloatTy() || val->getType()->isDoubleTy());
121 
122  llvm::Type* dst_type = nullptr;
123  switch (dst_bits) {
124  case 64:
125  dst_type = llvm::Type::getDoubleTy(context_);
126  break;
127  case 32:
128  dst_type = llvm::Type::getFloatTy(context_);
129  break;
130  default:
131  CHECK(false);
132  }
133 
134  return ir_builder_.CreateFPCast(val, dst_type);
135 }
llvm::IRBuilder ir_builder_
Definition: CgenState.h:333
llvm::Type * get_int_type(const int width, llvm::LLVMContext &context)
llvm::LLVMContext & context_
Definition: CgenState.h:331
#define CHECK(condition)
Definition: Logger.h:197
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ emitCall()

llvm::Value * CgenState::emitCall ( const std::string &  fname,
const std::vector< llvm::Value *> &  args 
)

Definition at line 137 of file CgenState.cpp.

References CHECK, g_rt_module, ir_builder_, module_, and vmap_.

Referenced by CodeGenerator::codegen(), CodeGenerator::codegenAdd(), CodeGenerator::codegenCase(), CodeGenerator::codegenCast(), CodeGenerator::codegenCastBetweenIntTypes(), CodeGenerator::codegenCastBetweenIntTypesOverflowChecks(), CodeGenerator::codegenCastBetweenTimestamps(), CodeGenerator::codegenCastFromFp(), CodeGenerator::codegenCastToFp(), CodeGenerator::codegenCmp(), CodeGenerator::codegenDiv(), CodeGenerator::codegenFpArith(), CodeGenerator::codegenFunctionOperWithCustomTypeHandling(), CodeGenerator::codegenLogical(), CodeGenerator::codegenMod(), CodeGenerator::codegenMul(), CodeGenerator::codegenSub(), CodeGenerator::codegenUMinus(), emitExternalCall(), and Executor::groupByColumnCodegen().

138  {
139  // Get the implementation from the runtime module.
140  auto func_impl = g_rt_module->getFunction(fname);
141  CHECK(func_impl) << fname;
142  // Get the function reference from the query module.
143  auto func = module_->getFunction(fname);
144  CHECK(func);
145  // If the function called isn't external, clone the implementation from the runtime
146  // module.
147  if (func->isDeclaration() && !func_impl->isDeclaration()) {
148  auto DestI = func->arg_begin();
149  for (auto arg_it = func_impl->arg_begin(); arg_it != func_impl->arg_end(); ++arg_it) {
150  DestI->setName(arg_it->getName());
151  vmap_[&*arg_it] = &*DestI++;
152  }
153 
154  llvm::SmallVector<llvm::ReturnInst*, 8> Returns; // Ignore returns cloned.
155  llvm::CloneFunctionInto(func, func_impl, vmap_, /*ModuleLevelChanges=*/true, Returns);
156  }
157 
158  return ir_builder_.CreateCall(func, args);
159 }
llvm::IRBuilder ir_builder_
Definition: CgenState.h:333
llvm::Module * module_
Definition: CgenState.h:322
std::unique_ptr< llvm::Module > g_rt_module
#define CHECK(condition)
Definition: Logger.h:197
llvm::ValueToValueMapTy vmap_
Definition: CgenState.h:332
+ Here is the caller graph for this function:

◆ emitErrorCheck()

void CgenState::emitErrorCheck ( llvm::Value *  condition,
llvm::Value *  errorCode,
std::string  label 
)

Definition at line 161 of file CgenState.cpp.

References context_, current_func_, ir_builder_, and needs_error_check_.

Referenced by llBool().

163  {
164  needs_error_check_ = true;
165  auto check_ok = llvm::BasicBlock::Create(context_, label + "_ok", current_func_);
166  auto check_fail = llvm::BasicBlock::Create(context_, label + "_fail", current_func_);
167  ir_builder_.CreateCondBr(condition, check_ok, check_fail);
168  ir_builder_.SetInsertPoint(check_fail);
169  ir_builder_.CreateRet(errorCode);
170  ir_builder_.SetInsertPoint(check_ok);
171 }
llvm::IRBuilder ir_builder_
Definition: CgenState.h:333
llvm::LLVMContext & context_
Definition: CgenState.h:331
llvm::Function * current_func_
Definition: CgenState.h:325
bool needs_error_check_
Definition: CgenState.h:348
+ Here is the caller graph for this function:

◆ emitExternalCall()

llvm::Value* CgenState::emitExternalCall ( const std::string &  fname,
llvm::Type ret_type,
const std::vector< llvm::Value *>  args,
const std::vector< llvm::Attribute::AttrKind > &  fnattrs = {},
const bool  has_struct_return = false 
)
inline

Definition at line 222 of file CgenState.h.

References CHECK, CHECK_EQ, context_, emitCall(), ir_builder_, module_, and run_benchmark_import::result.

Referenced by CodeGenerator::codegen(), CodeGenerator::codegenArrayAt(), CodeGenerator::codegenArrayBuff(), CodeGenerator::codegenArrayExpr(), CodeGenerator::codegenCastFromString(), CodeGenerator::codegenCastTimestampToDate(), CodeGenerator::codegenFunctionOper(), CodeGenerator::codegenFunctionOperCastArgs(), CodeGenerator::codegenFunctionOperNullArg(), CodeGenerator::codegenFunctionOperWithCustomTypeHandling(), CodeGenerator::codegenGeoArgs(), CodeGenerator::codegenGeosConstructorCall(), CodeGenerator::codegenGeosPredicateCall(), CodeGenerator::codegenIsNull(), CodeGenerator::codegenQualifierCmp(), and Executor::groupByColumnCodegen().

226  {},
227  const bool has_struct_return = false) {
228  std::vector<llvm::Type*> arg_types;
229  for (const auto arg : args) {
230  arg_types.push_back(arg->getType());
231  }
232  auto func_ty = llvm::FunctionType::get(ret_type, arg_types, false);
233  llvm::AttributeList attrs;
234  if (!fnattrs.empty()) {
235  std::vector<std::pair<unsigned, llvm::Attribute>> indexedAttrs;
236  indexedAttrs.reserve(fnattrs.size());
237  for (auto attr : fnattrs) {
238  indexedAttrs.emplace_back(llvm::AttributeList::FunctionIndex,
239  llvm::Attribute::get(context_, attr));
240  }
241  attrs = llvm::AttributeList::get(context_,
242  {&indexedAttrs.front(), indexedAttrs.size()});
243  }
244 
245  auto func_p = module_->getOrInsertFunction(fname, func_ty, attrs);
246  CHECK(func_p);
247  auto callee = func_p.getCallee();
248  llvm::Function* func{nullptr};
249  if (auto callee_cast = llvm::dyn_cast<llvm::ConstantExpr>(callee)) {
250  // Get or insert function automatically adds a ConstantExpr cast if the return type
251  // of the existing function does not match the supplied return type.
252  CHECK(callee_cast->isCast());
253  CHECK_EQ(callee_cast->getNumOperands(), size_t(1));
254  func = llvm::dyn_cast<llvm::Function>(callee_cast->getOperand(0));
255  } else {
256  func = llvm::dyn_cast<llvm::Function>(callee);
257  }
258  CHECK(func);
259  llvm::FunctionType* func_type = func_p.getFunctionType();
260  CHECK(func_type);
261  if (has_struct_return) {
262  const auto arg_ti = func_type->getParamType(0);
263  CHECK(arg_ti->isPointerTy() && arg_ti->getPointerElementType()->isStructTy());
264  auto attr_list = func->getAttributes();
265  llvm::AttrBuilder arr_arg_builder(attr_list.getParamAttributes(0));
266  arr_arg_builder.addAttribute(llvm::Attribute::StructRet);
267  func->addParamAttrs(0, arr_arg_builder);
268  }
269  const size_t arg_start = has_struct_return ? 1 : 0;
270  for (size_t i = arg_start; i < func->arg_size(); i++) {
271  const auto arg_ti = func_type->getParamType(i);
272  if (arg_ti->isPointerTy() && arg_ti->getPointerElementType()->isStructTy()) {
273  auto attr_list = func->getAttributes();
274  llvm::AttrBuilder arr_arg_builder(attr_list.getParamAttributes(i));
275  arr_arg_builder.addByValAttr(arg_ti->getPointerElementType());
276  func->addParamAttrs(i, arr_arg_builder);
277  }
278  }
279  llvm::Value* result = ir_builder_.CreateCall(func_p, args);
280  // check the assumed type
281  CHECK_EQ(result->getType(), ret_type);
282  return result;
283  }
#define CHECK_EQ(x, y)
Definition: Logger.h:205
llvm::IRBuilder ir_builder_
Definition: CgenState.h:333
llvm::Module * module_
Definition: CgenState.h:322
llvm::LLVMContext & context_
Definition: CgenState.h:331
#define CHECK(condition)
Definition: Logger.h:197
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLiteralBufferUsage()

size_t CgenState::getLiteralBufferUsage ( const int  device_id)
inline

Definition at line 287 of file CgenState.h.

References castToTypeIn(), inlineFpNull(), inlineIntMaxMin(), inlineIntNull(), and literal_bytes_.

287 { return literal_bytes_[device_id]; }
std::unordered_map< int, size_t > literal_bytes_
Definition: CgenState.h:420
+ Here is the call graph for this function:

◆ getLiterals()

const std::unordered_map<int, LiteralValues>& CgenState::getLiterals ( ) const
inline

Definition at line 201 of file CgenState.h.

References literals_.

201 { return literals_; }
std::unordered_map< int, LiteralValues > literals_
Definition: CgenState.h:419

◆ getOrAddLiteral() [1/2]

size_t CgenState::getOrAddLiteral ( const Analyzer::Constant constant,
const EncodingType  enc_type,
const int  dict_id,
const int  device_id 
)
inline

Definition at line 62 of file CgenState.h.

References Datum::bigintval, Datum::boolval, CHECK, CHECK_EQ, decimal_to_int_type(), Datum::doubleval, Datum::floatval, Analyzer::Constant::get_constval(), Analyzer::Constant::get_is_null(), Analyzer::Expr::get_type_info(), Analyzer::Constant::get_value_list(), inline_fp_null_val(), inline_int_null_val(), Datum::intval, kARRAY, kBIGINT, kBOOLEAN, kCHAR, kDATE, kDOUBLE, kENCODING_DICT, kENCODING_GEOINT, kENCODING_NONE, kFLOAT, kINT, kINTERVAL_DAY_TIME, kINTERVAL_YEAR_MONTH, kSMALLINT, kTEXT, kTIME, kTIMESTAMP, kTINYINT, kVARCHAR, Datum::smallintval, Datum::stringval, Datum::tinyintval, and run_benchmark_import::type.

Referenced by CodeGenerator::codegenHoistedConstants().

65  {
66  const auto& ti = constant->get_type_info();
67  const auto type = ti.is_decimal() ? decimal_to_int_type(ti) : ti.get_type();
68  switch (type) {
69  case kBOOLEAN:
70  return getOrAddLiteral(constant->get_is_null()
71  ? int8_t(inline_int_null_val(ti))
72  : int8_t(constant->get_constval().boolval ? 1 : 0),
73  device_id);
74  case kTINYINT:
75  return getOrAddLiteral(constant->get_is_null()
76  ? int8_t(inline_int_null_val(ti))
77  : constant->get_constval().tinyintval,
78  device_id);
79  case kSMALLINT:
80  return getOrAddLiteral(constant->get_is_null()
81  ? int16_t(inline_int_null_val(ti))
82  : constant->get_constval().smallintval,
83  device_id);
84  case kINT:
85  return getOrAddLiteral(constant->get_is_null() ? int32_t(inline_int_null_val(ti))
86  : constant->get_constval().intval,
87  device_id);
88  case kBIGINT:
89  return getOrAddLiteral(constant->get_is_null()
90  ? int64_t(inline_int_null_val(ti))
91  : constant->get_constval().bigintval,
92  device_id);
93  case kFLOAT:
94  return getOrAddLiteral(constant->get_is_null()
95  ? float(inline_fp_null_val(ti))
96  : constant->get_constval().floatval,
97  device_id);
98  case kDOUBLE:
99  return getOrAddLiteral(constant->get_is_null()
100  ? inline_fp_null_val(ti)
101  : constant->get_constval().doubleval,
102  device_id);
103  case kCHAR:
104  case kTEXT:
105  case kVARCHAR:
106  if (enc_type == kENCODING_DICT) {
107  if (constant->get_is_null()) {
108  return getOrAddLiteral(int32_t(inline_int_null_val(ti)), device_id);
109  }
110  return getOrAddLiteral(
111  std::make_pair(*constant->get_constval().stringval, dict_id), device_id);
112  }
113  CHECK_EQ(kENCODING_NONE, enc_type);
114  if (constant->get_is_null()) {
115  throw std::runtime_error(
116  "CHAR / VARCHAR NULL literal not supported in this context"); // TODO(alex):
117  // support
118  // null
119  }
120  return getOrAddLiteral(*constant->get_constval().stringval, device_id);
121  case kTIME:
122  case kTIMESTAMP:
123  case kDATE:
124  case kINTERVAL_DAY_TIME:
126  // TODO(alex): support null
127  return getOrAddLiteral(constant->get_constval().bigintval, device_id);
128  case kARRAY: {
129  if (enc_type == kENCODING_NONE) {
130  if (ti.get_subtype() == kDOUBLE) {
131  std::vector<double> double_array_literal;
132  for (const auto& value : constant->get_value_list()) {
133  const auto c = dynamic_cast<const Analyzer::Constant*>(value.get());
134  CHECK(c);
135  double d = c->get_constval().doubleval;
136  double_array_literal.push_back(d);
137  }
138  return getOrAddLiteral(double_array_literal, device_id);
139  }
140  if (ti.get_subtype() == kINT) {
141  std::vector<int32_t> int32_array_literal;
142  for (const auto& value : constant->get_value_list()) {
143  const auto c = dynamic_cast<const Analyzer::Constant*>(value.get());
144  CHECK(c);
145  int32_t i = c->get_constval().intval;
146  int32_array_literal.push_back(i);
147  }
148  return getOrAddLiteral(int32_array_literal, device_id);
149  }
150  if (ti.get_subtype() == kTINYINT) {
151  std::vector<int8_t> int8_array_literal;
152  for (const auto& value : constant->get_value_list()) {
153  const auto c = dynamic_cast<const Analyzer::Constant*>(value.get());
154  CHECK(c);
155  int8_t i = c->get_constval().tinyintval;
156  int8_array_literal.push_back(i);
157  }
158  if (ti.get_comp_param() == 64) {
159  return getOrAddLiteral(std::make_pair(int8_array_literal, 64), device_id);
160  }
161  return getOrAddLiteral(int8_array_literal, device_id);
162  }
163  throw std::runtime_error("Unsupported literal array");
164  }
165  if (enc_type == kENCODING_GEOINT) {
166  if (ti.get_subtype() == kTINYINT) {
167  std::vector<int8_t> int8_array_literal;
168  for (const auto& value : constant->get_value_list()) {
169  const auto c = dynamic_cast<const Analyzer::Constant*>(value.get());
170  CHECK(c);
171  int8_t i = c->get_constval().tinyintval;
172  int8_array_literal.push_back(i);
173  }
174  if (ti.get_comp_param() == 32) {
175  return getOrAddLiteral(std::make_pair(int8_array_literal, 32), device_id);
176  }
177  return getOrAddLiteral(int8_array_literal, device_id);
178  }
179  }
180  throw std::runtime_error("Encoded literal arrays are not supported");
181  }
182  default:
183  abort();
184  }
185  }
#define CHECK_EQ(x, y)
Definition: Logger.h:205
Definition: sqltypes.h:48
const std::list< std::shared_ptr< Analyzer::Expr > > & get_value_list() const
Definition: Analyzer.h:337
double inline_fp_null_val(const SQL_TYPE_INFO &ti)
Datum get_constval() const
Definition: Analyzer.h:335
size_t getOrAddLiteral(const Analyzer::Constant *constant, const EncodingType enc_type, const int dict_id, const int device_id)
Definition: CgenState.h:62
int64_t bigintval
Definition: sqltypes.h:206
std::string * stringval
Definition: sqltypes.h:211
SQLTypes decimal_to_int_type(const SQLTypeInfo &ti)
Definition: Datum.cpp:303
bool get_is_null() const
Definition: Analyzer.h:334
Definition: sqltypes.h:51
Definition: sqltypes.h:52
Definition: sqltypes.h:40
const SQLTypeInfo & get_type_info() const
Definition: Analyzer.h:78
#define CHECK(condition)
Definition: Logger.h:197
int64_t inline_int_null_val(const SQL_TYPE_INFO &ti)
Definition: sqltypes.h:44
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getOrAddLiteral() [2/2]

template<class T >
size_t CgenState::getOrAddLiteral ( const T &  val,
const int  device_id 
)
inlineprivate

Definition at line 402 of file CgenState.h.

References addAligned(), literal_bytes_, literalBytes(), and literals_.

402  {
403  const LiteralValue var_val(val);
404  size_t literal_found_off{0};
405  auto& literals = literals_[device_id];
406  for (const auto& literal : literals) {
407  const auto lit_bytes = literalBytes(literal);
408  literal_found_off = addAligned(literal_found_off, lit_bytes);
409  if (literal == var_val) {
410  return literal_found_off - lit_bytes;
411  }
412  }
413  literals.emplace_back(val);
414  const auto lit_bytes = literalBytes(var_val);
415  literal_bytes_[device_id] = addAligned(literal_bytes_[device_id], lit_bytes);
416  return literal_bytes_[device_id] - lit_bytes;
417  }
static size_t literalBytes(const CgenState::LiteralValue &lit)
Definition: CgenState.h:361
static size_t addAligned(const size_t off_in, const size_t alignment)
Definition: CgenState.h:392
std::unordered_map< int, size_t > literal_bytes_
Definition: CgenState.h:420
std::unordered_map< int, LiteralValues > literals_
Definition: CgenState.h:419
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
Definition: CgenState.h:198
+ Here is the call graph for this function:

◆ inlineFpNull()

llvm::ConstantFP * CgenState::inlineFpNull ( const SQLTypeInfo type_info)

Definition at line 65 of file CgenState.cpp.

References CHECK, SQLTypeInfo::get_type(), SQLTypeInfo::is_fp(), kDOUBLE, kFLOAT, llFp(), NULL_DOUBLE, and NULL_FLOAT.

Referenced by CodeGenerator::codegenArrayAt(), CodeGenerator::codegenCastFromFp(), CodeGenerator::codegenCastToFp(), CodeGenerator::codegenUMinus(), CodeGenerator::endArgsNullcheck(), getLiteralBufferUsage(), CodeGenerator::NullCheckCodegen::NullCheckCodegen(), and nullValueAsDouble().

65  {
66  CHECK(type_info.is_fp());
67  switch (type_info.get_type()) {
68  case kFLOAT:
69  return llFp(NULL_FLOAT);
70  case kDOUBLE:
71  return llFp(NULL_DOUBLE);
72  default:
73  abort();
74  }
75 }
#define NULL_DOUBLE
llvm::ConstantFP * llFp(const float v) const
Definition: CgenState.h:304
#define NULL_FLOAT
#define CHECK(condition)
Definition: Logger.h:197
HOST DEVICE SQLTypes get_type() const
Definition: sqltypes.h:311
bool is_fp() const
Definition: sqltypes.h:482
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ inlineIntMaxMin()

std::pair< llvm::ConstantInt *, llvm::ConstantInt * > CgenState::inlineIntMaxMin ( const size_t  byte_width,
const bool  is_signed 
)

Definition at line 77 of file CgenState.cpp.

References CHECK_EQ, context_, inline_int_max_min(), inline_uint_max_min(), and ll_int().

Referenced by CodeGenerator::codegenAdd(), CodeGenerator::codegenCastBetweenIntTypesOverflowChecks(), CodeGenerator::codegenDiv(), CodeGenerator::codegenMul(), CodeGenerator::codegenSub(), CodeGenerator::codegenUMinus(), and getLiteralBufferUsage().

79  {
80  int64_t max_int{0}, min_int{0};
81  if (is_signed) {
82  std::tie(max_int, min_int) = inline_int_max_min(byte_width);
83  } else {
84  uint64_t max_uint{0}, min_uint{0};
85  std::tie(max_uint, min_uint) = inline_uint_max_min(byte_width);
86  max_int = static_cast<int64_t>(max_uint);
87  CHECK_EQ(uint64_t(0), min_uint);
88  }
89  switch (byte_width) {
90  case 1:
91  return std::make_pair(::ll_int(static_cast<int8_t>(max_int), context_),
92  ::ll_int(static_cast<int8_t>(min_int), context_));
93  case 2:
94  return std::make_pair(::ll_int(static_cast<int16_t>(max_int), context_),
95  ::ll_int(static_cast<int16_t>(min_int), context_));
96  case 4:
97  return std::make_pair(::ll_int(static_cast<int32_t>(max_int), context_),
98  ::ll_int(static_cast<int32_t>(min_int), context_));
99  case 8:
100  return std::make_pair(::ll_int(max_int, context_), ::ll_int(min_int, context_));
101  default:
102  abort();
103  }
104 }
#define CHECK_EQ(x, y)
Definition: Logger.h:205
llvm::ConstantInt * ll_int(const T v, llvm::LLVMContext &context)
llvm::LLVMContext & context_
Definition: CgenState.h:331
std::pair< uint64_t, uint64_t > inline_uint_max_min(const size_t byte_width)
std::pair< int64_t, int64_t > inline_int_max_min(const size_t byte_width)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ inlineIntNull()

llvm::ConstantInt * CgenState::inlineIntNull ( const SQLTypeInfo type_info)

Definition at line 27 of file CgenState.cpp.

References CHECK, SQLTypeInfo::get_compression(), SQLTypeInfo::get_type(), inline_int_null_val(), SQLTypeInfo::is_string(), kARRAY, kBIGINT, kBOOLEAN, kDATE, kDECIMAL, kENCODING_DICT, kENCODING_NONE, kINT, kINTERVAL_DAY_TIME, kINTERVAL_YEAR_MONTH, kNUMERIC, kSMALLINT, kTIME, kTIMESTAMP, kTINYINT, llInt(), and run_benchmark_import::type.

Referenced by CodeGenerator::codegen(), CodeGenerator::codegenArrayAt(), CodeGenerator::codegenCastBetweenIntTypes(), CodeGenerator::codegenCastBetweenIntTypesOverflowChecks(), CodeGenerator::codegenCastBetweenTimestamps(), CodeGenerator::codegenCastFromFp(), CodeGenerator::codegenCastToFp(), CodeGenerator::codegenCmp(), CodeGenerator::codegenDiv(), CodeGenerator::codegenIntConst(), CodeGenerator::codegenIsNullNumber(), CodeGenerator::codegenLogical(), CodeGenerator::codegenLogicalShortCircuit(), CodeGenerator::codegenUMinus(), CodeGenerator::endArgsNullcheck(), getLiteralBufferUsage(), CodeGenerator::NullCheckCodegen::NullCheckCodegen(), and nullValueAsDouble().

27  {
28  auto type = type_info.get_type();
29  if (type_info.is_string()) {
30  switch (type_info.get_compression()) {
31  case kENCODING_DICT:
32  return llInt(static_cast<int32_t>(inline_int_null_val(type_info)));
33  case kENCODING_NONE:
34  return llInt(int64_t(0));
35  default:
36  CHECK(false);
37  }
38  }
39  switch (type) {
40  case kBOOLEAN:
41  return llInt(static_cast<int8_t>(inline_int_null_val(type_info)));
42  case kTINYINT:
43  return llInt(static_cast<int8_t>(inline_int_null_val(type_info)));
44  case kSMALLINT:
45  return llInt(static_cast<int16_t>(inline_int_null_val(type_info)));
46  case kINT:
47  return llInt(static_cast<int32_t>(inline_int_null_val(type_info)));
48  case kBIGINT:
49  case kTIME:
50  case kTIMESTAMP:
51  case kDATE:
52  case kINTERVAL_DAY_TIME:
54  return llInt(inline_int_null_val(type_info));
55  case kDECIMAL:
56  case kNUMERIC:
57  return llInt(inline_int_null_val(type_info));
58  case kARRAY:
59  return llInt(int64_t(0));
60  default:
61  abort();
62  }
63 }
bool is_string() const
Definition: sqltypes.h:478
Definition: sqltypes.h:48
HOST DEVICE EncodingType get_compression() const
Definition: sqltypes.h:319
Definition: sqltypes.h:52
#define CHECK(condition)
Definition: Logger.h:197
HOST DEVICE SQLTypes get_type() const
Definition: sqltypes.h:311
int64_t inline_int_null_val(const SQL_TYPE_INFO &ti)
Definition: sqltypes.h:44
llvm::ConstantInt * llInt(const T v) const
Definition: CgenState.h:300
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ literalBytes()

static size_t CgenState::literalBytes ( const CgenState::LiteralValue lit)
inlinestatic

Definition at line 361 of file CgenState.h.

Referenced by CodeGenerator::codegenHoistedConstantsLoads(), getOrAddLiteral(), and Executor::serializeLiterals().

361  {
362  switch (lit.which()) {
363  case 0:
364  return 1; // int8_t
365  case 1:
366  return 2; // int16_t
367  case 2:
368  return 4; // int32_t
369  case 3:
370  return 8; // int64_t
371  case 4:
372  return 4; // float
373  case 5:
374  return 8; // double
375  case 6:
376  return 4; // std::pair<std::string, int>
377  case 7:
378  return 4; // std::string
379  case 8:
380  return 4; // std::vector<double>
381  case 9:
382  return 4; // std::vector<int32_t>
383  case 10:
384  return 4; // std::vector<int8_t>
385  case 11:
386  return 4; // std::pair<std::vector<int8_t>, int>
387  default:
388  abort();
389  }
390  }
+ Here is the caller graph for this function:

◆ llBool()

llvm::ConstantInt* CgenState::llBool ( const bool  v) const
inline

Definition at line 314 of file CgenState.h.

References context_, emitErrorCheck(), run_benchmark_import::label, ll_bool(), and nullValueAsDouble().

Referenced by Executor::buildIsDeletedCb(), Executor::buildJoinLoops(), CodeGenerator::codegenGeosConstructorCall(), and CodeGenerator::codegenGeosPredicateCall().

314 { return ::ll_bool(v, context_); }
llvm::LLVMContext & context_
Definition: CgenState.h:331
llvm::ConstantInt * ll_bool(const bool v, llvm::LLVMContext &context)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ llFp() [1/2]

llvm::ConstantFP* CgenState::llFp ( const float  v) const
inline

Definition at line 304 of file CgenState.h.

References context_.

Referenced by CodeGenerator::codegenCmp(), CodeGenerator::codegenDiv(), CodeGenerator::codegenFpArith(), CodeGenerator::codegenIsNullNumber(), and inlineFpNull().

304  {
305  return static_cast<llvm::ConstantFP*>(
306  llvm::ConstantFP::get(llvm::Type::getFloatTy(context_), v));
307  }
llvm::LLVMContext & context_
Definition: CgenState.h:331
+ Here is the caller graph for this function:

◆ llFp() [2/2]

llvm::ConstantFP* CgenState::llFp ( const double  v) const
inline

Definition at line 309 of file CgenState.h.

References context_.

309  {
310  return static_cast<llvm::ConstantFP*>(
311  llvm::ConstantFP::get(llvm::Type::getDoubleTy(context_), v));
312  }
llvm::LLVMContext & context_
Definition: CgenState.h:331

◆ llInt()

template<class T >
llvm::ConstantInt* CgenState::llInt ( const T  v) const
inline

Definition at line 300 of file CgenState.h.

References context_, and ll_int().

Referenced by Executor::buildIsDeletedCb(), Executor::buildJoinLoops(), CodeGenerator::codegen(), CodeGenerator::codegenAdd(), CodeGenerator::codegenArrayExpr(), CodeGenerator::codegenBinOpWithOverflowForCPU(), CodeGenerator::codegenCastBetweenIntTypes(), CodeGenerator::codegenCastBetweenIntTypesOverflowChecks(), CodeGenerator::codegenCastBetweenTimestamps(), CodeGenerator::codegenCmp(), CodeGenerator::codegenCompression(), CodeGenerator::codegenDiv(), CodeGenerator::codegenFunctionOper(), CodeGenerator::codegenFunctionOperCastArgs(), CodeGenerator::codegenFunctionOperWithCustomTypeHandling(), CodeGenerator::codegenGeoArgs(), CodeGenerator::codegenGeoBinOper(), CodeGenerator::codegenGeosConstructorCall(), CodeGenerator::codegenGeosPredicateCall(), CodeGenerator::codegenGeoUOper(), CodeGenerator::codegenHoistedConstantsLoads(), CodeGenerator::codegenHoistedConstantsPlaceholders(), CodeGenerator::codegenIntConst(), Executor::codegenJoinLoops(), CodeGenerator::codegenMod(), CodeGenerator::codegenMul(), CodeGenerator::codegenSub(), CodeGenerator::codegenUMinus(), Executor::groupByColumnCodegen(), and inlineIntNull().

300  {
302  }
llvm::ConstantInt * ll_int(const T v, llvm::LLVMContext &context)
llvm::LLVMContext & context_
Definition: CgenState.h:331
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nullValueAsDouble()

llvm::Value * CgenState::nullValueAsDouble ( SQLTypeInfo const &  ti)

Definition at line 173 of file CgenState.cpp.

References castToTypeIn(), context_, SQLTypeInfo::get_size(), inlineFpNull(), inlineIntNull(), ir_builder_, and SQLTypeInfo::is_fp().

Referenced by llBool().

173  {
174  if (ti.is_fp()) {
175  return ti.get_size() == sizeof(double)
176  ? inlineFpNull(ti)
177  : ir_builder_.CreateFPCast(
178  castToTypeIn(inlineFpNull(ti), 8 * sizeof(double)),
179  llvm::Type::getDoubleTy(context_));
180  } else {
181  return ir_builder_.CreateSIToFP(castToTypeIn(inlineIntNull(ti), 8 * sizeof(double)),
182  llvm::Type::getDoubleTy(context_));
183  }
184 }
llvm::Value * castToTypeIn(llvm::Value *val, const size_t bit_width)
Definition: CgenState.cpp:106
llvm::IRBuilder ir_builder_
Definition: CgenState.h:333
llvm::LLVMContext & context_
Definition: CgenState.h:331
llvm::ConstantInt * inlineIntNull(const SQLTypeInfo &)
Definition: CgenState.cpp:27
llvm::ConstantFP * inlineFpNull(const SQLTypeInfo &)
Definition: CgenState.cpp:65
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ contains_left_deep_outer_join_

const bool CgenState::contains_left_deep_outer_join_

Definition at line 343 of file CgenState.h.

◆ context_

llvm::LLVMContext& CgenState::context_

Definition at line 331 of file CgenState.h.

Referenced by addStringConstant(), CodeGenerator::beginArgsNullcheck(), Executor::buildIsDeletedCb(), CodeGenerator::castArrayPointer(), castToTypeIn(), CodeGenerator::codegen(), CodeGenerator::codegenAdd(), CodeGenerator::codegenArrayAt(), CodeGenerator::codegenArrayBuff(), CodeGenerator::codegenArrayExpr(), CodeGenerator::codegenBinOpWithOverflowForCPU(), CodeGenerator::codegenBufferArgs(), CodeGenerator::codegenCase(), CodeGenerator::codegenCast(), CodeGenerator::codegenCastBetweenIntTypes(), CodeGenerator::codegenCastBetweenIntTypesOverflowChecks(), CodeGenerator::codegenCastFromFp(), CodeGenerator::codegenCastFromString(), CodeGenerator::codegenCastTimestampToDate(), CodeGenerator::codegenCastToFp(), CodeGenerator::codegenDiv(), CodeGenerator::codegenFunctionOper(), CodeGenerator::codegenFunctionOperCastArgs(), CodeGenerator::codegenFunctionOperNullArg(), CodeGenerator::codegenFunctionOperWithCustomTypeHandling(), CodeGenerator::codegenGeoArgs(), CodeGenerator::codegenGeoBinOper(), CodeGenerator::codegenGeosConstructorCall(), CodeGenerator::codegenGeosPredicateCall(), CodeGenerator::codegenGeoUOper(), CodeGenerator::codegenHoistedConstantsLoads(), CodeGenerator::codegenIsNull(), Executor::codegenJoinLoops(), CodeGenerator::codegenLogicalShortCircuit(), CodeGenerator::codegenMod(), CodeGenerator::codegenMul(), CodeGenerator::codegenQualifierCmp(), CodeGenerator::codegenSkipOverflowCheckForNull(), CodeGenerator::codegenSub(), CodeGenerator::codegenUMinus(), anonymous_namespace{ResultSetReductionCodegen.cpp}::create_entry_block(), anonymous_namespace{ResultSetReductionJIT.cpp}::create_llvm_function(), anonymous_namespace{ResultSetReductionInterpreterStubs.cpp}::create_stub_function(), CodeGenerator::createLineStringStructType(), CodeGenerator::createMultiPolygonStructType(), CodeGenerator::createPointStructType(), CodeGenerator::createPolygonStructType(), emitErrorCheck(), emitExternalCall(), CodeGenerator::endArgsNullcheck(), anonymous_namespace{TableFunctionCompilationContext.cpp}::generate_entry_point(), CodeGenerator::generateNativeGPUCode(), anonymous_namespace{ExtensionsIR.cpp}::get_buffer_struct_type(), Executor::groupByColumnCodegen(), inlineIntMaxMin(), llBool(), llFp(), llInt(), AutomaticIRMetadataGuard::markInstructions(), CodeGenerator::NullCheckCodegen::NullCheckCodegen(), nullValueAsDouble(), and Executor::redeclareFilterFunction().

◆ current_func_

◆ ext_call_cache_

std::vector<FunctionOperValue> CgenState::ext_call_cache_

Definition at line 339 of file CgenState.h.

Referenced by CodeGenerator::codegenFunctionOper().

◆ fetch_cache_

std::unordered_map<int, std::vector<llvm::Value*> > CgenState::fetch_cache_

Definition at line 334 of file CgenState.h.

◆ filter_func_

◆ filter_func_args_

InsertionOrderedMap CgenState::filter_func_args_

Definition at line 346 of file CgenState.h.

Referenced by Executor::redeclareFilterFunction().

◆ filter_func_bb_

llvm::BasicBlock* CgenState::filter_func_bb_

Definition at line 327 of file CgenState.h.

◆ filter_func_call_

llvm::CallInst* CgenState::filter_func_call_

Definition at line 329 of file CgenState.h.

◆ frag_offsets_

std::vector<llvm::Value*> CgenState::frag_offsets_

Definition at line 342 of file CgenState.h.

◆ group_by_expr_cache_

std::vector<llvm::Value*> CgenState::group_by_expr_cache_

Definition at line 340 of file CgenState.h.

Referenced by Executor::groupByColumnCodegen().

◆ helper_functions_

std::vector<llvm::Function*> CgenState::helper_functions_

Definition at line 330 of file CgenState.h.

Referenced by CodeGenerator::generateNativeGPUCode().

◆ in_values_bitmaps_

std::vector<std::unique_ptr<const InValuesBitmap> > CgenState::in_values_bitmaps_

Definition at line 347 of file CgenState.h.

Referenced by addInValuesBitmap().

◆ ir_builder_

llvm::IRBuilder CgenState::ir_builder_

Definition at line 333 of file CgenState.h.

Referenced by addStringConstant(), CodeGenerator::beginArgsNullcheck(), Executor::buildIsDeletedCb(), Executor::buildJoinLoops(), CodeGenerator::castArrayPointer(), castToTypeIn(), JoinLoop::codegen(), CodeGenerator::codegen(), CodeGenerator::codegenAdd(), CodeGenerator::codegenArrayAt(), CodeGenerator::codegenArrayBuff(), CodeGenerator::codegenArrayExpr(), CodeGenerator::codegenBinOpWithOverflowForCPU(), CodeGenerator::codegenBufferArgs(), CodeGenerator::codegenCase(), CodeGenerator::codegenCast(), CodeGenerator::codegenCastBetweenIntTypes(), CodeGenerator::codegenCastBetweenIntTypesOverflowChecks(), CodeGenerator::codegenCastBetweenTimestamps(), CodeGenerator::codegenCastFromFp(), CodeGenerator::codegenCastToFp(), CodeGenerator::codegenCmp(), CodeGenerator::codegenDiv(), CodeGenerator::codegenFpArith(), CodeGenerator::codegenFunctionOper(), CodeGenerator::codegenFunctionOperCastArgs(), CodeGenerator::codegenFunctionOperNullArg(), CodeGenerator::codegenFunctionOperWithCustomTypeHandling(), CodeGenerator::codegenGeoArgs(), CodeGenerator::codegenGeoLineStringArgs(), CodeGenerator::codegenGeoMultiPolygonArgs(), CodeGenerator::codegenGeoPointArgs(), CodeGenerator::codegenGeoPolygonArgs(), CodeGenerator::codegenGeosConstructorCall(), CodeGenerator::codegenGeosPredicateCall(), CodeGenerator::codegenHoistedConstantsPlaceholders(), CodeGenerator::codegenIsNullNumber(), Executor::codegenJoinLoops(), CodeGenerator::codegenLogical(), CodeGenerator::codegenLogicalShortCircuit(), CodeGenerator::codegenMod(), CodeGenerator::codegenMul(), CodeGenerator::codegenSkipOverflowCheckForNull(), CodeGenerator::codegenSub(), CodeGenerator::codegenUMinus(), anonymous_namespace{ResultSetReductionCodegen.cpp}::create_entry_block(), anonymous_namespace{ResultSetReductionInterpreterStubs.cpp}::create_stub_function(), emitCall(), emitErrorCheck(), emitExternalCall(), CodeGenerator::endArgsNullcheck(), JoinLoop::evaluateOuterJoinCondition(), CodeGenerator::NullCheckCodegen::finalize(), Executor::groupByColumnCodegen(), CodeGenerator::NullCheckCodegen::NullCheckCodegen(), nullValueAsDouble(), and CodeGenerator::toBool().

◆ literal_bytes_

std::unordered_map<int, size_t> CgenState::literal_bytes_
private

Definition at line 420 of file CgenState.h.

Referenced by getLiteralBufferUsage(), and getOrAddLiteral().

◆ literals_

std::unordered_map<int, LiteralValues> CgenState::literals_
private

Definition at line 419 of file CgenState.h.

Referenced by getLiterals(), and getOrAddLiteral().

◆ module_

◆ needs_error_check_

◆ needs_geos_

bool CgenState::needs_geos_

◆ outer_join_match_found_per_level_

std::vector<llvm::Value*> CgenState::outer_join_match_found_per_level_

Definition at line 344 of file CgenState.h.

Referenced by Executor::buildJoinLoops().

◆ query_func_

llvm::Function* CgenState::query_func_

Definition at line 351 of file CgenState.h.

Referenced by CodeGenerator::codegenHoistedConstantsLoads().

◆ query_func_entry_ir_builder_

llvm::IRBuilder CgenState::query_func_entry_ir_builder_

Definition at line 352 of file CgenState.h.

Referenced by CodeGenerator::codegenHoistedConstantsLoads().

◆ query_func_literal_loads_

std::unordered_map<int, std::vector<llvm::Value*> > CgenState::query_func_literal_loads_

Definition at line 353 of file CgenState.h.

Referenced by CodeGenerator::codegenHoistedConstants().

◆ row_func_

◆ row_func_bb_

llvm::BasicBlock* CgenState::row_func_bb_

Definition at line 326 of file CgenState.h.

◆ row_func_call_

llvm::CallInst* CgenState::row_func_call_

Definition at line 328 of file CgenState.h.

◆ row_func_hoisted_literals_

std::unordered_map<llvm::Value*, HoistedLiteralLoadLocator> CgenState::row_func_hoisted_literals_

Definition at line 359 of file CgenState.h.

Referenced by CodeGenerator::codegenHoistedConstantsPlaceholders().

◆ scan_idx_to_hash_pos_

std::unordered_map<int, llvm::Value*> CgenState::scan_idx_to_hash_pos_

Definition at line 345 of file CgenState.h.

Referenced by Executor::addJoinLoopIterator().

◆ str_constants_

std::vector<llvm::Value*> CgenState::str_constants_

Definition at line 341 of file CgenState.h.

Referenced by addStringConstant().

◆ vmap_

llvm::ValueToValueMapTy CgenState::vmap_

The documentation for this struct was generated from the following files: