| 230 | } |
| 231 | |
| 232 | llvm::Value* CodegenAnyVal::GetIsNull(const char* name) const { |
| 233 | switch (type_.type) { |
| 234 | case TYPE_BIGINT: |
| 235 | case TYPE_DOUBLE: { |
| 236 | // Lowered type is of form { i8, * }. Get the i8 value. |
| 237 | // On aarch64, Lowered type is of form { i64, * } |
| 238 | llvm::Value* is_null = builder_->CreateExtractValue(value_, 0); |
| 239 | #ifndef __aarch64__ |
| 240 | DCHECK(is_null->getType() == codegen_->i8_type()); |
| 241 | #else |
| 242 | DCHECK(is_null->getType() == codegen_->i64_type()); |
| 243 | #endif |
| 244 | return builder_->CreateTrunc(is_null, codegen_->bool_type(), name); |
| 245 | } |
| 246 | case TYPE_DECIMAL: { |
| 247 | // Lowered type is of the form { {i8}, ... } |
| 248 | uint32_t idxs[] = {0, 0}; |
| 249 | llvm::Value* is_null_i8 = builder_->CreateExtractValue(value_, idxs); |
| 250 | DCHECK(is_null_i8->getType() == codegen_->i8_type()); |
| 251 | return builder_->CreateTrunc(is_null_i8, codegen_->bool_type(), name); |
| 252 | } |
| 253 | case TYPE_STRING: |
| 254 | case TYPE_VARCHAR: |
| 255 | case TYPE_CHAR: |
| 256 | case TYPE_FIXED_UDA_INTERMEDIATE: |
| 257 | case TYPE_TIMESTAMP: |
| 258 | case TYPE_ARRAY: |
| 259 | case TYPE_MAP: |
| 260 | case TYPE_STRUCT: { |
| 261 | // Lowered type is of form { i64, *}. Get the first byte of the i64 value. |
| 262 | llvm::Value* v = builder_->CreateExtractValue(value_, 0); |
| 263 | DCHECK(v->getType() == codegen_->i64_type()); |
| 264 | return builder_->CreateTrunc(v, codegen_->bool_type(), name); |
| 265 | } |
| 266 | case TYPE_BOOLEAN: |
| 267 | case TYPE_TINYINT: |
| 268 | case TYPE_SMALLINT: |
| 269 | case TYPE_INT: |
| 270 | case TYPE_DATE: |
| 271 | case TYPE_FLOAT: |
| 272 | // Lowered type is an integer. Get the first byte. |
| 273 | return builder_->CreateTrunc(value_, codegen_->bool_type(), name); |
| 274 | default: |
| 275 | DCHECK(false); |
| 276 | return NULL; |
| 277 | } |
| 278 | } |
| 279 | |
| 280 | void CodegenAnyVal::SetIsNull(llvm::Value* is_null) { |
| 281 | switch(type_.type) { |
no test coverage detected