mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-15 02:41:59 +00:00
Less instantiations
This commit is contained in:
parent
e41a018a5f
commit
e2b8186d4b
@ -326,7 +326,8 @@ public:
|
||||
|
||||
#if USE_EMBEDDED_COMPILER
|
||||
|
||||
void compileAdd(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_ptr, const ValuesWithType & arguments) const override
|
||||
void compileAddImpl(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_ptr, const ValuesWithType & arguments) const
|
||||
requires(canBeNativeType<Numerator>() && canBeNativeType<Denominator>())
|
||||
{
|
||||
llvm::IRBuilder<> & b = static_cast<llvm::IRBuilder<> &>(builder);
|
||||
|
||||
@ -345,6 +346,12 @@ public:
|
||||
b.CreateStore(denominator_value_updated, denominator_ptr);
|
||||
}
|
||||
|
||||
void compileAdd(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_ptr, const ValuesWithType & arguments) const override
|
||||
{
|
||||
if constexpr(canBeNativeType<Numerator>() && canBeNativeType<Denominator>())
|
||||
compileAddImpl(builder, aggregate_data_ptr, arguments);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
@ -94,6 +94,20 @@ public:
|
||||
b.CreateStore(denominator_value_updated, denominator_ptr);
|
||||
}
|
||||
|
||||
void
|
||||
compileMerge(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_dst_ptr, llvm::Value * aggregate_data_src_ptr) const override
|
||||
{
|
||||
if constexpr (canBeNativeType<Weight>() && canBeNativeType<Numerator>() && canBeNativeType<Denominator>())
|
||||
Base::compileMergeImpl(builder, aggregate_data_dst_ptr, aggregate_data_src_ptr);
|
||||
}
|
||||
|
||||
llvm::Value * compileGetResult(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_ptr) const override
|
||||
{
|
||||
if constexpr (canBeNativeType<Weight>() && canBeNativeType<Numerator>() && canBeNativeType<Denominator>())
|
||||
return Base::compileGetResultImpl(builder, aggregate_data_ptr);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void compileAdd(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_ptr, const ValuesWithType & arguments) const override
|
||||
{
|
||||
if constexpr (canBeNativeType<Weight>() && canBeNativeType<Numerator>() && canBeNativeType<Denominator>())
|
||||
@ -110,7 +124,7 @@ bool allowTypes(const DataTypePtr& left, const DataTypePtr& right) noexcept
|
||||
|
||||
constexpr auto allow = [](WhichDataType t)
|
||||
{
|
||||
return t.isInt() || t.isUInt() || t.isFloat();
|
||||
return t.isInt() || t.isUInt() || t.isNativeFloat();
|
||||
};
|
||||
|
||||
return allow(l_dt) && allow(r_dt);
|
||||
|
@ -74,14 +74,12 @@ static inline llvm::Type * toNativeType(llvm::IRBuilderBase & builder)
|
||||
template <typename ToType>
|
||||
static inline DataTypePtr toNativeDataType()
|
||||
{
|
||||
if constexpr (std::is_same_v<ToType, Int8> || std::is_same_v<ToType, UInt8> ||
|
||||
static_assert(std::is_same_v<ToType, Int8> || std::is_same_v<ToType, UInt8> ||
|
||||
std::is_same_v<ToType, Int16> || std::is_same_v<ToType, UInt16> ||
|
||||
std::is_same_v<ToType, Int32> || std::is_same_v<ToType, UInt32> ||
|
||||
std::is_same_v<ToType, Int64> || std::is_same_v<ToType, UInt64> ||
|
||||
std::is_same_v<ToType, Float32> || std::is_same_v<ToType, Float64>)
|
||||
return std::make_shared<DataTypeNumber<ToType>>();
|
||||
|
||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "Invalid cast to native data type");
|
||||
std::is_same_v<ToType, Float32> || std::is_same_v<ToType, Float64>);
|
||||
return std::make_shared<DataTypeNumber<ToType>>();
|
||||
}
|
||||
|
||||
/// Cast LLVM value with type to bool
|
||||
|
Loading…
Reference in New Issue
Block a user