MCPcopy Create free account
hub / github.com/apache/impala / GetLoweredType

Method GetLoweredType

be/src/codegen/codegen-anyval.cc:44–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42const char* CodegenAnyVal::LLVM_COLLECTIONVAL_NAME = "struct.impala_udf::CollectionVal";
43
44llvm::Type* CodegenAnyVal::GetLoweredType(LlvmCodeGen* cg, const ColumnType& type) {
45 switch (type.type) {
46 case TYPE_BOOLEAN: // i16
47#ifndef __aarch64__
48 return cg->i16_type();
49#else
50 return cg->i64_type();
51#endif
52 case TYPE_TINYINT: // i16
53#ifndef __aarch64__
54 return cg->i16_type();
55#else
56 return cg->i64_type();
57#endif
58 case TYPE_SMALLINT: // i32
59#ifndef __aarch64__
60 return cg->i32_type();
61#else
62 return cg->i64_type();
63#endif
64 case TYPE_INT: // i64
65 return cg->i64_type();
66 case TYPE_BIGINT: // { i8, i64 }
67#ifndef __aarch64__
68 return llvm::StructType::get(cg->i8_type(), cg->i64_type());
69#else
70 return llvm::ArrayType::get(cg->i64_type(), 2);
71#endif
72 case TYPE_FLOAT: // i64
73 return cg->i64_type();
74 case TYPE_DOUBLE: // { i8, double }
75#ifndef __aarch64__
76 return llvm::StructType::get(cg->i8_type(), cg->double_type());
77#else
78 return llvm::ArrayType::get(cg->i64_type(), 2);
79#endif
80 case TYPE_STRING: // { i64, i8* }
81 case TYPE_VARCHAR: // { i64, i8* }
82 case TYPE_CHAR: // Uses StringVal, so same as STRING/VARCHAR.
83 case TYPE_FIXED_UDA_INTERMEDIATE: // { i64, i8* }
84 case TYPE_ARRAY: // CollectionVal has same memory layout as StringVal.
85 case TYPE_MAP: // CollectionVal has same memory layout as StringVal.
86 case TYPE_STRUCT: // StructVal has same memory layout as StringVal.
87#ifndef __aarch64__
88 return llvm::StructType::get(cg->i64_type(), cg->ptr_type());
89#else
90 return llvm::ArrayType::get(cg->i64_type(), 2);
91#endif
92 case TYPE_TIMESTAMP: // { i64, i64 }
93#ifndef __aarch64__
94 return llvm::StructType::get(cg->i64_type(), cg->i64_type());
95#else
96 return llvm::ArrayType::get(cg->i64_type(), 2);
97#endif
98 case TYPE_DECIMAL: // %"struct.impala_udf::DecimalVal" (isn't lowered)
99 // = { {i8}, [15 x i8], {i128} }
100 return cg->GetNamedType(LLVM_DECIMALVAL_NAME);
101 case TYPE_DATE: // i64

Callers

nothing calls this directly

Calls 7

i16_typeMethod · 0.80
i64_typeMethod · 0.80
i32_typeMethod · 0.80
i8_typeMethod · 0.80
double_typeMethod · 0.80
ptr_typeMethod · 0.80
GetNamedTypeMethod · 0.80

Tested by

no test coverage detected