OmniSciDB  fe05a0c208
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 &)
 
llvm::Constant * inlineNull (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)
 

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_
 
std::map< std::pair
< llvm::Value *, llvm::Value * >
, ArrayLoadCodegen
array_load_cache_
 
std::unordered_map
< std::string, llvm::Value * > 
geo_target_cache_
 
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
*, HoistedLiteralLoadLocator
row_func_hoisted_literals_
 

Private Member Functions

template<class T >
size_t getOrAddLiteral (const T &val, const int device_id)
 
void maybeCloneFunctionRecursive (llvm::Function *fn)
 

Private Attributes

std::unordered_map< int,
LiteralValues
literals_
 
std::unordered_map< int, size_t > literal_bytes_
 

Detailed Description

Definition at line 37 of file CgenState.h.

Member Typedef Documentation

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 204 of file CgenState.h.

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

Definition at line 205 of file CgenState.h.

Constructor & Destructor Documentation

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

Definition at line 39 of file CgenState.h.

40  : module_(nullptr)
41  , row_func_(nullptr)
42  , filter_func_(nullptr)
43  , current_func_(nullptr)
44  , row_func_bb_(nullptr)
45  , filter_func_bb_(nullptr)
46  , row_func_call_(nullptr)
47  , filter_func_call_(nullptr)
50  , contains_left_deep_outer_join_(contains_left_deep_outer_join)
51  , outer_join_match_found_per_level_(std::max(num_query_infos, size_t(1)) - 1)
52  , needs_error_check_(false)
53  , needs_geos_(false)
54  , query_func_(nullptr)
std::vector< llvm::Value * > outer_join_match_found_per_level_
Definition: CgenState.h:346
llvm::Function * query_func_
Definition: CgenState.h:356
llvm::IRBuilder ir_builder_
Definition: CgenState.h:335
bool needs_geos_
Definition: CgenState.h:354
const bool contains_left_deep_outer_join_
Definition: CgenState.h:345
llvm::Function * row_func_
Definition: CgenState.h:325
llvm::Module * module_
Definition: CgenState.h:324
llvm::LLVMContext & context_
Definition: CgenState.h:333
llvm::Function * current_func_
Definition: CgenState.h:327
llvm::CallInst * filter_func_call_
Definition: CgenState.h:331
bool needs_error_check_
Definition: CgenState.h:353
llvm::IRBuilder query_func_entry_ir_builder_
Definition: CgenState.h:357
llvm::BasicBlock * filter_func_bb_
Definition: CgenState.h:329
llvm::Function * filter_func_
Definition: CgenState.h:326
llvm::LLVMContext & getGlobalLLVMContext()
llvm::CallInst * row_func_call_
Definition: CgenState.h:330
llvm::BasicBlock * row_func_bb_
Definition: CgenState.h:328
CgenState::CgenState ( llvm::LLVMContext &  context)
inline

Definition at line 57 of file CgenState.h.

58  : module_(nullptr)
59  , row_func_(nullptr)
60  , context_(context)
63  , needs_error_check_(false)
64  , needs_geos_(false)
65  , query_func_(nullptr)
llvm::Function * query_func_
Definition: CgenState.h:356
llvm::IRBuilder ir_builder_
Definition: CgenState.h:335
bool needs_geos_
Definition: CgenState.h:354
const bool contains_left_deep_outer_join_
Definition: CgenState.h:345
llvm::Function * row_func_
Definition: CgenState.h:325
llvm::Module * module_
Definition: CgenState.h:324
llvm::LLVMContext & context_
Definition: CgenState.h:333
bool needs_error_check_
Definition: CgenState.h:353
llvm::IRBuilder query_func_entry_ir_builder_
Definition: CgenState.h:357

Member Function Documentation

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

Definition at line 397 of file CgenState.h.

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

397  {
398  size_t off = off_in;
399  if (off % alignment != 0) {
400  off += (alignment - off % alignment);
401  }
402  return off + alignment;
403  }

+ Here is the caller graph for this function:

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

Definition at line 218 of file CgenState.h.

References in_values_bitmaps_.

Referenced by CodeGenerator::codegen().

219  {
220  if (in_values_bitmap->isEmpty()) {
221  return in_values_bitmap.get();
222  }
223  in_values_bitmaps_.emplace_back(std::move(in_values_bitmap));
224  return in_values_bitmaps_.back().get();
225  }
std::vector< std::unique_ptr< const InValuesBitmap > > in_values_bitmaps_
Definition: CgenState.h:349

+ Here is the caller graph for this function:

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

Definition at line 209 of file CgenState.h.

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

Referenced by CodeGenerator::codegen().

209  {
210  llvm::Value* str_lv = ir_builder_.CreateGlobalString(
211  str, "str_const_" + std::to_string(std::hash<std::string>()(str)));
212  auto i8_ptr = llvm::PointerType::get(get_int_type(8, context_), 0);
213  str_constants_.push_back(str_lv);
214  str_lv = ir_builder_.CreateBitCast(str_lv, i8_ptr);
215  return str_lv;
216  }
llvm::IRBuilder ir_builder_
Definition: CgenState.h:335
std::vector< llvm::Value * > str_constants_
Definition: CgenState.h:343
llvm::Type * get_int_type(const int width, llvm::LLVMContext &context)
std::string to_string(char const *&&v)
llvm::LLVMContext & context_
Definition: CgenState.h:333

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 112 of file CgenState.cpp.

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

Referenced by CodeGenerator::codegenCast(), CodeGenerator::codegenLogical(), and CodeGenerator::codegenLogicalShortCircuit().

112  {
113  auto src_bits = val->getType()->getScalarSizeInBits();
114  if (src_bits == dst_bits) {
115  return val;
116  }
117  if (val->getType()->isIntegerTy()) {
118  return ir_builder_.CreateIntCast(
119  val, get_int_type(dst_bits, context_), src_bits != 1);
120  }
121  // real (not dictionary-encoded) strings; store the pointer to the payload
122  if (val->getType()->isPointerTy()) {
123  return ir_builder_.CreatePointerCast(val, get_int_type(dst_bits, context_));
124  }
125 
126  CHECK(val->getType()->isFloatTy() || val->getType()->isDoubleTy());
127 
128  llvm::Type* dst_type = nullptr;
129  switch (dst_bits) {
130  case 64:
131  dst_type = llvm::Type::getDoubleTy(context_);
132  break;
133  case 32:
134  dst_type = llvm::Type::getFloatTy(context_);
135  break;
136  default:
137  CHECK(false);
138  }
139 
140  return ir_builder_.CreateFPCast(val, dst_type);
141 }
llvm::IRBuilder ir_builder_
Definition: CgenState.h:335
llvm::Type * get_int_type(const int width, llvm::LLVMContext &context)
llvm::LLVMContext & context_
Definition: CgenState.h:333
#define CHECK(condition)
Definition: Logger.h:203

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 174 of file CgenState.cpp.

References CHECK, ir_builder_, maybeCloneFunctionRecursive(), and module_.

Referenced by CodeGenerator::codegen(), CodeGenerator::codegenAdd(), CodeGenerator::codegenCase(), CodeGenerator::codegenCast(), CodeGenerator::codegenCastBetweenIntTypes(), CodeGenerator::codegenCastBetweenIntTypesOverflowChecks(), CodeGenerator::codegenCastBetweenTimestamps(), CodeGenerator::codegenCastFromFp(), CodeGenerator::codegenCastToFp(), CodeGenerator::codegenCmp(), CodeGenerator::codegenDateTruncHighPrecisionTimestamps(), CodeGenerator::codegenDiv(), CodeGenerator::codegenExtractHighPrecisionTimestamps(), CodeGenerator::codegenFpArith(), CodeGenerator::codegenFunctionOperWithCustomTypeHandling(), CodeGenerator::codegenLogical(), CodeGenerator::codegenMod(), CodeGenerator::codegenMul(), CodeGenerator::codegenSub(), CodeGenerator::codegenUMinus(), CodeGenerator::codegenWindowPosition(), and CodeGenerator::codgenAdjustFixedEncNull().

175  {
176  // Get the function reference from the query module.
177  auto func = module_->getFunction(fname);
178  CHECK(func);
179  // If the function called isn't external, clone the implementation from the runtime
180  // module.
182 
183  return ir_builder_.CreateCall(func, args);
184 }
void maybeCloneFunctionRecursive(llvm::Function *fn)
Definition: CgenState.cpp:143
llvm::IRBuilder ir_builder_
Definition: CgenState.h:335
llvm::Module * module_
Definition: CgenState.h:324
#define CHECK(condition)
Definition: Logger.h:203

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 186 of file CgenState.cpp.

References context_, current_func_, ir_builder_, and needs_error_check_.

188  {
189  needs_error_check_ = true;
190  auto check_ok = llvm::BasicBlock::Create(context_, label + "_ok", current_func_);
191  auto check_fail = llvm::BasicBlock::Create(context_, label + "_fail", current_func_);
192  ir_builder_.CreateCondBr(condition, check_ok, check_fail);
193  ir_builder_.SetInsertPoint(check_fail);
194  ir_builder_.CreateRet(errorCode);
195  ir_builder_.SetInsertPoint(check_ok);
196 }
llvm::IRBuilder ir_builder_
Definition: CgenState.h:335
llvm::LLVMContext & context_
Definition: CgenState.h:333
llvm::Function * current_func_
Definition: CgenState.h:327
bool needs_error_check_
Definition: CgenState.h:353
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 228 of file CgenState.h.

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

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

+ Here is the caller graph for this function:

size_t CgenState::getLiteralBufferUsage ( const int  device_id)
inline

Definition at line 293 of file CgenState.h.

References literal_bytes_.

293 { return literal_bytes_[device_id]; }
std::unordered_map< int, size_t > literal_bytes_
Definition: CgenState.h:427
const std::unordered_map<int, LiteralValues>& CgenState::getLiterals ( ) const
inline

Definition at line 207 of file CgenState.h.

References literals_.

207 { return literals_; }
std::unordered_map< int, LiteralValues > literals_
Definition: CgenState.h:426
size_t CgenState::getOrAddLiteral ( const Analyzer::Constant constant,
const EncodingType  enc_type,
const int  dict_id,
const int  device_id 
)
inline

Definition at line 68 of file CgenState.h.

References Datum::bigintval, Datum::boolval, CHECK, CHECK_EQ, test_fsi::d, 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(), i, 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().

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

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

Definition at line 407 of file CgenState.h.

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

407  {
408  const LiteralValue var_val(val);
409  size_t literal_found_off{0};
410  auto& literals = literals_[device_id];
411  for (const auto& literal : literals) {
412  const auto lit_bytes = literalBytes(literal);
413  literal_found_off = addAligned(literal_found_off, lit_bytes);
414  if (literal == var_val) {
415  return literal_found_off - lit_bytes;
416  }
417  }
418  literals.emplace_back(val);
419  const auto lit_bytes = literalBytes(var_val);
420  literal_bytes_[device_id] = addAligned(literal_bytes_[device_id], lit_bytes);
421  return literal_bytes_[device_id] - lit_bytes;
422  }
static size_t literalBytes(const CgenState::LiteralValue &lit)
Definition: CgenState.h:366
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:204
static size_t addAligned(const size_t off_in, const size_t alignment)
Definition: CgenState.h:397
std::unordered_map< int, size_t > literal_bytes_
Definition: CgenState.h:427
std::unordered_map< int, LiteralValues > literals_
Definition: CgenState.h:426

+ Here is the call graph for this function:

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

Definition at line 66 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::codegenFixedLengthColVarInWindow(), CodeGenerator::codegenGeoFunctionOperator(), CodeGenerator::codegenUMinus(), CodeGenerator::endArgsNullcheck(), inlineNull(), and CodeGenerator::NullCheckCodegen::NullCheckCodegen().

66  {
67  CHECK(type_info.is_fp());
68  switch (type_info.get_type()) {
69  case kFLOAT:
70  return llFp(NULL_FLOAT);
71  case kDOUBLE:
72  return llFp(NULL_DOUBLE);
73  default:
74  abort();
75  }
76 }
#define NULL_DOUBLE
#define NULL_FLOAT
bool is_fp() const
Definition: sqltypes.h:493
HOST DEVICE SQLTypes get_type() const
Definition: sqltypes.h:314
llvm::ConstantFP * llFp(const float v) const
Definition: CgenState.h:310
#define CHECK(condition)
Definition: Logger.h:203

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 83 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(), and CodeGenerator::codegenUMinus().

85  {
86  int64_t max_int{0}, min_int{0};
87  if (is_signed) {
88  std::tie(max_int, min_int) = inline_int_max_min(byte_width);
89  } else {
90  uint64_t max_uint{0}, min_uint{0};
91  std::tie(max_uint, min_uint) = inline_uint_max_min(byte_width);
92  max_int = static_cast<int64_t>(max_uint);
93  CHECK_EQ(uint64_t(0), min_uint);
94  }
95  switch (byte_width) {
96  case 1:
97  return std::make_pair(::ll_int(static_cast<int8_t>(max_int), context_),
98  ::ll_int(static_cast<int8_t>(min_int), context_));
99  case 2:
100  return std::make_pair(::ll_int(static_cast<int16_t>(max_int), context_),
101  ::ll_int(static_cast<int16_t>(min_int), context_));
102  case 4:
103  return std::make_pair(::ll_int(static_cast<int32_t>(max_int), context_),
104  ::ll_int(static_cast<int32_t>(min_int), context_));
105  case 8:
106  return std::make_pair(::ll_int(max_int, context_), ::ll_int(min_int, context_));
107  default:
108  abort();
109  }
110 }
#define CHECK_EQ(x, y)
Definition: Logger.h:211
llvm::ConstantInt * ll_int(const T v, llvm::LLVMContext &context)
llvm::LLVMContext & context_
Definition: CgenState.h:333
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:

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

Definition at line 28 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::codegenCastTimestampToDate(), CodeGenerator::codegenCastToFp(), CodeGenerator::codegenDateTruncHighPrecisionTimestamps(), CodeGenerator::codegenDiv(), CodeGenerator::codegenExtractHighPrecisionTimestamps(), CodeGenerator::codegenFixedLengthColVarInWindow(), CodeGenerator::codegenGeoOperator(), CodeGenerator::codegenIntConst(), CodeGenerator::codegenIsNullNumber(), CodeGenerator::codegenLogical(), CodeGenerator::codegenLogicalShortCircuit(), CodeGenerator::codegenQualifierCmp(), CodeGenerator::codegenUMinus(), CodeGenerator::codgenAdjustFixedEncNull(), CodeGenerator::endArgsNullcheck(), inlineNull(), and CodeGenerator::NullCheckCodegen::NullCheckCodegen().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

llvm::Constant * CgenState::inlineNull ( const SQLTypeInfo ti)

Definition at line 78 of file CgenState.cpp.

References inlineFpNull(), inlineIntNull(), and SQLTypeInfo::is_fp().

78  {
79  return ti.is_fp() ? static_cast<llvm::Constant*>(inlineFpNull(ti))
80  : static_cast<llvm::Constant*>(inlineIntNull(ti));
81 }
bool is_fp() const
Definition: sqltypes.h:493
llvm::ConstantInt * inlineIntNull(const SQLTypeInfo &)
Definition: CgenState.cpp:28
llvm::ConstantFP * inlineFpNull(const SQLTypeInfo &)
Definition: CgenState.cpp:66

+ Here is the call graph for this function:

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

Definition at line 366 of file CgenState.h.

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

366  {
367  switch (lit.which()) {
368  case 0:
369  return 1; // int8_t
370  case 1:
371  return 2; // int16_t
372  case 2:
373  return 4; // int32_t
374  case 3:
375  return 8; // int64_t
376  case 4:
377  return 4; // float
378  case 5:
379  return 8; // double
380  case 6:
381  return 4; // std::pair<std::string, int>
382  case 7:
383  return 4; // std::string
384  case 8:
385  return 4; // std::vector<double>
386  case 9:
387  return 4; // std::vector<int32_t>
388  case 10:
389  return 4; // std::vector<int8_t>
390  case 11:
391  return 4; // std::pair<std::vector<int8_t>, int>
392  default:
393  abort();
394  }
395  }

+ Here is the caller graph for this function:

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

Definition at line 320 of file CgenState.h.

References context_, and ll_bool().

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

320 { return ::ll_bool(v, context_); }
llvm::LLVMContext & context_
Definition: CgenState.h:333
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:

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

Definition at line 310 of file CgenState.h.

References context_.

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

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

+ Here is the caller graph for this function:

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

Definition at line 315 of file CgenState.h.

References context_.

315  {
316  return static_cast<llvm::ConstantFP*>(
317  llvm::ConstantFP::get(llvm::Type::getDoubleTy(context_), v));
318  }
llvm::LLVMContext & context_
Definition: CgenState.h:333
template<class T >
llvm::ConstantInt* CgenState::llInt ( const v) const
inline

Definition at line 306 of file CgenState.h.

References context_, and ll_int().

Referenced by Executor::buildIsDeletedCb(), CodeGenerator::codegen(), CodeGenerator::codegenAdd(), CodeGenerator::codegenArrayExpr(), CodeGenerator::codegenBinOpWithOverflowForCPU(), CodeGenerator::codegenCastBetweenIntTypes(), CodeGenerator::codegenCastBetweenIntTypesOverflowChecks(), CodeGenerator::codegenCastBetweenTimestamps(), CodeGenerator::codegenCastFromString(), CodeGenerator::codegenCastTimestampToDate(), CodeGenerator::codegenCompression(), CodeGenerator::codegenDateTruncHighPrecisionTimestamps(), CodeGenerator::codegenDiv(), CodeGenerator::codegenExtractHighPrecisionTimestamps(), CodeGenerator::codegenFixedLengthColVarInWindow(), CodeGenerator::codegenFunctionOper(), CodeGenerator::codegenFunctionOperCastArgs(), CodeGenerator::codegenFunctionOperWithCustomTypeHandling(), CodeGenerator::codegenGeoArgs(), CodeGenerator::codegenGeoBinOper(), CodeGenerator::codegenGeoFunctionOperator(), CodeGenerator::codegenGeoOperator(), CodeGenerator::codegenGeosConstructorCall(), CodeGenerator::codegenGeosPredicateCall(), CodeGenerator::codegenGeoUOper(), CodeGenerator::codegenHoistedConstantsLoads(), CodeGenerator::codegenHoistedConstantsPlaceholders(), CodeGenerator::codegenIntConst(), Executor::codegenJoinLoops(), CodeGenerator::codegenMod(), CodeGenerator::codegenMul(), CodeGenerator::codegenQualifierCmp(), CodeGenerator::codegenRowId(), CodeGenerator::codegenSub(), CodeGenerator::codegenUMinus(), CodeGenerator::codegenWindowPosition(), CodeGenerator::codgenAdjustFixedEncNull(), Executor::groupByColumnCodegen(), and inlineIntNull().

306  {
308  }
llvm::ConstantInt * ll_int(const T v, llvm::LLVMContext &context)
llvm::LLVMContext & context_
Definition: CgenState.h:333

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void CgenState::maybeCloneFunctionRecursive ( llvm::Function *  fn)
private

Definition at line 143 of file CgenState.cpp.

References CHECK, g_rt_module, and vmap_.

Referenced by emitCall().

143  {
144  CHECK(fn);
145  if (!fn->isDeclaration()) {
146  return;
147  }
148 
149  // Get the implementation from the runtime module.
150  auto func_impl = g_rt_module->getFunction(fn->getName());
151  CHECK(func_impl) << fn->getName().str();
152 
153  if (func_impl->isDeclaration()) {
154  return;
155  }
156 
157  auto DestI = fn->arg_begin();
158  for (auto arg_it = func_impl->arg_begin(); arg_it != func_impl->arg_end(); ++arg_it) {
159  DestI->setName(arg_it->getName());
160  vmap_[&*arg_it] = &*DestI++;
161  }
162 
163  llvm::SmallVector<llvm::ReturnInst*, 8> Returns; // Ignore returns cloned.
164  llvm::CloneFunctionInto(fn, func_impl, vmap_, /*ModuleLevelChanges=*/true, Returns);
165 
166  for (auto it = llvm::inst_begin(fn), e = llvm::inst_end(fn); it != e; ++it) {
167  if (llvm::isa<llvm::CallInst>(*it)) {
168  auto& call = llvm::cast<llvm::CallInst>(*it);
169  maybeCloneFunctionRecursive(call.getCalledFunction());
170  }
171  }
172 }
void maybeCloneFunctionRecursive(llvm::Function *fn)
Definition: CgenState.cpp:143
std::unique_ptr< llvm::Module > g_rt_module
#define CHECK(condition)
Definition: Logger.h:203
llvm::ValueToValueMapTy vmap_
Definition: CgenState.h:334

+ Here is the caller graph for this function:

Member Data Documentation

std::map<std::pair<llvm::Value*, llvm::Value*>, ArrayLoadCodegen> CgenState::array_load_cache_

Definition at line 351 of file CgenState.h.

Referenced by CodeGenerator::codegenGeoArrayLoadAndNullcheck().

const bool CgenState::contains_left_deep_outer_join_

Definition at line 345 of file CgenState.h.

llvm::LLVMContext& CgenState::context_

Definition at line 333 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::codegenDateTruncHighPrecisionTimestamps(), CodeGenerator::codegenDiv(), CodeGenerator::codegenFixedLengthColVar(), CodeGenerator::codegenFixedLengthColVarInWindow(), CodeGenerator::codegenFunctionOper(), CodeGenerator::codegenFunctionOperCastArgs(), CodeGenerator::codegenFunctionOperNullArg(), CodeGenerator::codegenFunctionOperWithCustomTypeHandling(), CodeGenerator::codegenGeoArgs(), CodeGenerator::codegenGeoArrayLoadAndNullcheck(), CodeGenerator::codegenGeoBinOper(), CodeGenerator::codegenGeoFunctionOperator(), CodeGenerator::codegenGeoOperator(), CodeGenerator::codegenGeosConstructorCall(), CodeGenerator::codegenGeosPredicateCall(), CodeGenerator::codegenGeoUOper(), CodeGenerator::codegenHoistedConstantsLoads(), CodeGenerator::codegenIsNull(), Executor::codegenJoinLoops(), CodeGenerator::codegenLogicalShortCircuit(), CodeGenerator::codegenMod(), CodeGenerator::codegenMul(), CodeGenerator::codegenOuterJoinNullPlaceholder(), CodeGenerator::codegenOverlaps(), CodeGenerator::codegenQualifierCmp(), CodeGenerator::codegenSkipOverflowCheckForNull(), CodeGenerator::codegenSub(), CodeGenerator::codegenUMinus(), CodeGenerator::codegenVariableLengthStringColVar(), CodeGenerator::codgenAdjustFixedEncNull(), CodeGenerator::colByteStream(), 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(), CodeGenerator::endArgsNullcheck(), anonymous_namespace{TableFunctionCompilationContext.cpp}::generate_entry_point(), anonymous_namespace{ExtensionsIR.cpp}::get_buffer_struct_type(), Executor::groupByColumnCodegen(), inlineIntMaxMin(), llBool(), llFp(), llInt(), AutomaticIRMetadataGuard::markInstructions(), CodeGenerator::NullCheckCodegen::NullCheckCodegen(), CodeGenerator::posArg(), and Executor::redeclareFilterFunction().

std::vector<FunctionOperValue> CgenState::ext_call_cache_

Definition at line 341 of file CgenState.h.

Referenced by CodeGenerator::codegenFunctionOper().

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

Definition at line 326 of file CgenState.h.

Referenced by Executor::redeclareFilterFunction().

InsertionOrderedMap CgenState::filter_func_args_

Definition at line 348 of file CgenState.h.

Referenced by Executor::redeclareFilterFunction().

llvm::BasicBlock* CgenState::filter_func_bb_

Definition at line 329 of file CgenState.h.

llvm::CallInst* CgenState::filter_func_call_

Definition at line 331 of file CgenState.h.

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

Definition at line 344 of file CgenState.h.

Referenced by CodeGenerator::codegenColVar(), and CodeGenerator::codegenRowId().

std::unordered_map<std::string, llvm::Value*> CgenState::geo_target_cache_

Definition at line 352 of file CgenState.h.

Referenced by CodeGenerator::codegenGeoOperator().

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

Definition at line 342 of file CgenState.h.

Referenced by CodeGenerator::resolveGroupedColumnReference().

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

Definition at line 332 of file CgenState.h.

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

Definition at line 349 of file CgenState.h.

Referenced by addInValuesBitmap().

llvm::IRBuilder CgenState::ir_builder_

Definition at line 335 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::codegenArrayExpr(), CodeGenerator::codegenBinOpWithOverflowForCPU(), CodeGenerator::codegenBufferArgs(), CodeGenerator::codegenCase(), CodeGenerator::codegenCast(), CodeGenerator::codegenCastBetweenIntTypes(), CodeGenerator::codegenCastBetweenIntTypesOverflowChecks(), CodeGenerator::codegenCastBetweenTimestamps(), CodeGenerator::codegenCastFromFp(), CodeGenerator::codegenCastToFp(), CodeGenerator::codegenColVar(), CodeGenerator::codegenDateTruncHighPrecisionTimestamps(), CodeGenerator::codegenDiv(), CodeGenerator::codegenExtractHighPrecisionTimestamps(), CodeGenerator::codegenFixedLengthColVar(), CodeGenerator::codegenFixedLengthColVarInWindow(), CodeGenerator::codegenFpArith(), CodeGenerator::codegenFunctionOper(), CodeGenerator::codegenFunctionOperCastArgs(), CodeGenerator::codegenFunctionOperNullArg(), CodeGenerator::codegenFunctionOperWithCustomTypeHandling(), CodeGenerator::codegenGeoArgs(), CodeGenerator::codegenGeoFunctionOperator(), CodeGenerator::codegenGeoLineStringArgs(), CodeGenerator::codegenGeoMultiPolygonArgs(), CodeGenerator::codegenGeoOperator(), CodeGenerator::codegenGeoPointArgs(), CodeGenerator::codegenGeoPolygonArgs(), CodeGenerator::codegenGeosConstructorCall(), CodeGenerator::codegenGeosPredicateCall(), CodeGenerator::codegenHoistedConstantsPlaceholders(), CodeGenerator::codegenIsNullNumber(), Executor::codegenJoinLoops(), CodeGenerator::codegenLogical(), CodeGenerator::codegenLogicalShortCircuit(), CodeGenerator::codegenMod(), CodeGenerator::codegenMul(), CodeGenerator::codegenOuterJoinNullPlaceholder(), CodeGenerator::codegenRowId(), CodeGenerator::codegenSkipOverflowCheckForNull(), CodeGenerator::codegenSub(), CodeGenerator::codegenUMinus(), CodeGenerator::codgenAdjustFixedEncNull(), ScalarCodeGenerator::compile(), anonymous_namespace{ResultSetReductionCodegen.cpp}::create_entry_block(), anonymous_namespace{ResultSetReductionInterpreterStubs.cpp}::create_stub_function(), emitCall(), emitErrorCheck(), CodeGenerator::endArgsNullcheck(), JoinLoop::evaluateOuterJoinCondition(), Executor::groupByColumnCodegen(), CodeGenerator::NullCheckCodegen::NullCheckCodegen(), CodeGenerator::posArg(), and CodeGenerator::toBool().

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

Definition at line 427 of file CgenState.h.

Referenced by getLiteralBufferUsage(), and getOrAddLiteral().

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

Definition at line 426 of file CgenState.h.

Referenced by getLiterals(), and getOrAddLiteral().

bool CgenState::needs_geos_
std::vector<llvm::Value*> CgenState::outer_join_match_found_per_level_
llvm::Function* CgenState::query_func_

Definition at line 356 of file CgenState.h.

Referenced by CodeGenerator::codegenHoistedConstantsLoads().

llvm::IRBuilder CgenState::query_func_entry_ir_builder_

Definition at line 357 of file CgenState.h.

Referenced by CodeGenerator::codegenHoistedConstantsLoads().

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

Definition at line 358 of file CgenState.h.

Referenced by CodeGenerator::codegenHoistedConstants().

llvm::BasicBlock* CgenState::row_func_bb_

Definition at line 328 of file CgenState.h.

llvm::CallInst* CgenState::row_func_call_

Definition at line 330 of file CgenState.h.

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

Definition at line 364 of file CgenState.h.

Referenced by CodeGenerator::codegenHoistedConstantsPlaceholders().

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

Definition at line 347 of file CgenState.h.

Referenced by Executor::addJoinLoopIterator(), and CodeGenerator::posArg().

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

Definition at line 343 of file CgenState.h.

Referenced by addStringConstant().

llvm::ValueToValueMapTy CgenState::vmap_

Definition at line 334 of file CgenState.h.

Referenced by CodeGenerator::link_udf_module(), and maybeCloneFunctionRecursive().


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