aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaksim Kita <kitaetoya@gmail.com>2023-08-15 19:37:55 +0300
committermaksim-kita <maksim-kita@yandex-team.com>2023-08-15 20:40:33 +0300
commitf096c967c8a4b645763f901c889ca0335a0e5412 (patch)
treeb8838f69df87c3061a0fa628b64be506c118b242
parent1fb1c163920fc3299aea6abc7ac014ce7752661c (diff)
downloadydb-f096c967c8a4b645763f901c889ca0335a0e5412.tar.gz
JIT interface refactoring
JIT interface refactoring Pull Request resolved: #330
-rw-r--r--ydb/core/kqp/runtime/kqp_compute.cpp2
-rw-r--r--ydb/core/kqp/runtime/kqp_read_table.cpp4
-rw-r--r--ydb/library/yql/minikql/codegen/codegen.h2
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_addmember.cpp2
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_aggrcount.cpp2
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_append.cpp6
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_apply.cpp2
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_callable.cpp18
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_chain1_map.cpp40
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_chain_map.cpp32
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_chopper.cpp40
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_coalesce.cpp2
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_collect.cpp12
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_combine.cpp50
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_condense.cpp20
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_condense1.cpp20
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_contains.cpp2
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_decimal_div.cpp24
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_decimal_mod.cpp4
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_decimal_mul.cpp30
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_dictitems.cpp18
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_discard.cpp22
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_element.cpp6
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_ensure.cpp2
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_enumerate.cpp4
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_exists.cpp2
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_extend.cpp6
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_filter.cpp80
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_flatmap.cpp70
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_flow.cpp34
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_fold.cpp2
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_fold1.cpp2
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_fromstring.cpp20
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_grace_join.cpp17
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_guess.cpp2
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_hasitems.cpp2
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_heap.cpp28
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_if.cpp8
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_ifpresent.cpp8
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_invoke.cpp2
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_iterator.cpp22
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_join.cpp18
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_join_dict.cpp4
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_lazy_list.cpp4
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_length.cpp2
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_listfromrange.cpp4
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_logical.cpp6
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_lookup.cpp2
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_map.cpp32
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_map_join.cpp56
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_multimap.cpp26
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_prepend.cpp6
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_reduce.cpp2
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_removemember.cpp2
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_reverse.cpp4
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_size.cpp6
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_skip.cpp8
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_source.cpp2
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_squeeze_to_list.cpp4
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_switch.cpp30
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_take.cpp8
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_timezone.cpp2
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_tobytes.cpp2
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_todict.cpp16
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_toindexdict.cpp4
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_tooptional.cpp4
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_tostring.cpp24
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_udf.cpp8
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_unwrap.cpp2
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_varitem.cpp2
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_visitall.cpp8
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_way.cpp2
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_while.cpp32
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_wide_chain_map.cpp4
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_wide_chopper.cpp4
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_wide_combine.cpp28
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_wide_condense.cpp2
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_wide_filter.cpp12
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_wide_map.cpp6
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_wide_top_sort.cpp12
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_withcontext.cpp4
-rw-r--r--ydb/library/yql/minikql/computation/mkql_computation_node_codegen.cpp172
-rw-r--r--ydb/library/yql/minikql/computation/mkql_computation_node_codegen.h138
-rw-r--r--ydb/library/yql/minikql/computation/mkql_computation_node_graph.cpp4
-rw-r--r--ydb/library/yql/minikql/computation/mkql_computation_node_holders.cpp14
-rw-r--r--ydb/library/yql/minikql/invoke_builtins/mkql_builtins_abs.cpp2
-rw-r--r--ydb/library/yql/minikql/invoke_builtins/mkql_builtins_add.cpp4
-rw-r--r--ydb/library/yql/minikql/invoke_builtins/mkql_builtins_byteat.cpp2
-rw-r--r--ydb/library/yql/minikql/invoke_builtins/mkql_builtins_codegen.cpp10
-rw-r--r--ydb/library/yql/minikql/invoke_builtins/mkql_builtins_compare.h8
-rw-r--r--ydb/library/yql/minikql/invoke_builtins/mkql_builtins_concat.cpp2
-rw-r--r--ydb/library/yql/minikql/invoke_builtins/mkql_builtins_convert.cpp46
-rw-r--r--ydb/library/yql/minikql/invoke_builtins/mkql_builtins_countbits.cpp4
-rw-r--r--ydb/library/yql/minikql/invoke_builtins/mkql_builtins_dec.cpp2
-rw-r--r--ydb/library/yql/minikql/invoke_builtins/mkql_builtins_div.cpp4
-rw-r--r--ydb/library/yql/minikql/invoke_builtins/mkql_builtins_equals.cpp12
-rw-r--r--ydb/library/yql/minikql/invoke_builtins/mkql_builtins_find.cpp4
-rw-r--r--ydb/library/yql/minikql/invoke_builtins/mkql_builtins_greater.cpp14
-rw-r--r--ydb/library/yql/minikql/invoke_builtins/mkql_builtins_greater_or_equal.cpp14
-rw-r--r--ydb/library/yql/minikql/invoke_builtins/mkql_builtins_impl.h8
-rw-r--r--ydb/library/yql/minikql/invoke_builtins/mkql_builtins_inc.cpp2
-rw-r--r--ydb/library/yql/minikql/invoke_builtins/mkql_builtins_invprestr.cpp4
-rw-r--r--ydb/library/yql/minikql/invoke_builtins/mkql_builtins_less.cpp14
-rw-r--r--ydb/library/yql/minikql/invoke_builtins/mkql_builtins_less_or_equal.cpp14
-rw-r--r--ydb/library/yql/minikql/invoke_builtins/mkql_builtins_max.cpp8
-rw-r--r--ydb/library/yql/minikql/invoke_builtins/mkql_builtins_min.cpp8
-rw-r--r--ydb/library/yql/minikql/invoke_builtins/mkql_builtins_minus.cpp2
-rw-r--r--ydb/library/yql/minikql/invoke_builtins/mkql_builtins_mod.cpp6
-rw-r--r--ydb/library/yql/minikql/invoke_builtins/mkql_builtins_mul.cpp2
-rw-r--r--ydb/library/yql/minikql/invoke_builtins/mkql_builtins_nanvl.cpp8
-rw-r--r--ydb/library/yql/minikql/invoke_builtins/mkql_builtins_not_equals.cpp12
-rw-r--r--ydb/library/yql/minikql/invoke_builtins/mkql_builtins_sub.cpp10
-rw-r--r--ydb/library/yql/minikql/invoke_builtins/mkql_builtins_substring.cpp4
-rw-r--r--ydb/library/yql/minikql/invoke_builtins/mkql_builtins_with.cpp4
-rw-r--r--ydb/library/yql/providers/yt/codec/codegen/yt_codec_cg.cpp16
-rw-r--r--ydb/library/yql/providers/yt/comp_nodes/yql_mkql_input.cpp6
-rw-r--r--ydb/library/yql/providers/yt/comp_nodes/yql_mkql_output.cpp6
117 files changed, 831 insertions, 834 deletions
diff --git a/ydb/core/kqp/runtime/kqp_compute.cpp b/ydb/core/kqp/runtime/kqp_compute.cpp
index 6645eb4250..bb973df45e 100644
--- a/ydb/core/kqp/runtime/kqp_compute.cpp
+++ b/ydb/core/kqp/runtime/kqp_compute.cpp
@@ -40,7 +40,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto predicate = GetNodeValue(Predicate, ctx, block);
const auto pass = CastInst::Create(Instruction::Trunc, predicate, Type::getInt1Ty(context), "bool", block);
diff --git a/ydb/core/kqp/runtime/kqp_read_table.cpp b/ydb/core/kqp/runtime/kqp_read_table.cpp
index 70f8759136..21c528df7f 100644
--- a/ydb/core/kqp/runtime/kqp_read_table.cpp
+++ b/ydb/core/kqp/runtime/kqp_read_table.cpp
@@ -247,7 +247,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
ICodegeneratorInlineWideNode::TGenerateResult DoGenGetValues(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto size = Representations.size();
Row.resize(size);
@@ -384,7 +384,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
ICodegeneratorInlineWideNode::TGenerateResult DoGenGetValues(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto size = Representations.size();
Block.resize(size);
diff --git a/ydb/library/yql/minikql/codegen/codegen.h b/ydb/library/yql/minikql/codegen/codegen.h
index 41326b6e0f..4b252c30e6 100644
--- a/ydb/library/yql/minikql/codegen/codegen.h
+++ b/ydb/library/yql/minikql/codegen/codegen.h
@@ -60,7 +60,7 @@ public:
virtual void AddGlobalMapping(TStringBuf name, const void* address) = 0;
virtual void TogglePerfJITEventListener() = 0;
- typedef std::unique_ptr<ICodegen> TPtr;
+ using TPtr = std::unique_ptr<ICodegen>;
static TPtr Make(ETarget target, ESanitize sanitize = ESanitize::Auto);
};
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_addmember.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_addmember.cpp
index 10205fd446..7cdfee695d 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_addmember.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_addmember.cpp
@@ -56,7 +56,7 @@ public:
if (Representations_.size() > CodegenArraysFallbackLimit)
return TBaseComputation::DoGenerateGetValue(ctx, block);
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto newSize = Representations_.size() + 1U;
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_aggrcount.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_aggrcount.cpp
index 2c934a95d4..c08aadfd84 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_aggrcount.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_aggrcount.cpp
@@ -24,7 +24,7 @@ public:
const auto check = IsExists(value, block);
if (Node->IsTemporaryValue())
ValueCleanup(Node->GetRepresentation(), value, ctx, block);
- return MakeBoolean(check, ctx.Codegen->GetContext(), block);
+ return MakeBoolean(check, ctx.Codegen.GetContext(), block);
}
#endif
};
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_append.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_append.cpp
index a8a73fe20d..c9499169c9 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_append.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_append.cpp
@@ -31,7 +31,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto factory = ctx.GetFactory();
@@ -53,7 +53,7 @@ public:
BranchInst::Create(work, done, check, block);
block = work;
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
const auto funType = FunctionType::get(left->getType(), {factory->getType(), left->getType(), right->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block);
const auto res = CallInst::Create(funType, funcPtr, {factory, left, right}, "res", block);
@@ -75,7 +75,7 @@ public:
block = done;
return result;
} else {
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
const auto funType = FunctionType::get(left->getType(), {factory->getType(), left->getType(), right->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block);
const auto res = CallInst::Create(funType, funcPtr, {factory, left, right}, "res", block);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_apply.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_apply.cpp
index e2635f7a05..9cdac227e2 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_apply.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_apply.cpp
@@ -144,7 +144,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
void DoGenerateGetValue(const TCodegenContext& ctx, Value* pointer, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto idxType = Type::getInt32Ty(context);
const auto valType = Type::getInt128Ty(context);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_callable.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_callable.cpp
index 665e76a40a..a163dd684d 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_callable.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_callable.cpp
@@ -82,19 +82,19 @@ private:
}
#ifndef MKQL_DISABLE_CODEGEN
- void GenerateFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void GenerateFunctions(NYql::NCodegen::ICodegen& codegen) final {
RunFunc = GenerateRun(codegen);
- codegen->ExportSymbol(RunFunc);
+ codegen.ExportSymbol(RunFunc);
}
- void FinalizeFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void FinalizeFunctions(NYql::NCodegen::ICodegen& codegen) final {
if (RunFunc)
- Run = reinterpret_cast<TRunPtr>(codegen->GetPointerToFunction(RunFunc));
+ Run = reinterpret_cast<TRunPtr>(codegen.GetPointerToFunction(RunFunc));
}
- Function* GenerateRun(const NYql::NCodegen::ICodegen::TPtr& codegen) const {
- auto& module = codegen->GetModule();
- auto& context = codegen->GetContext();
+ Function* GenerateRun(NYql::NCodegen::ICodegen& codegen) const {
+ auto& module = codegen.GetModule();
+ auto& context = codegen.GetContext();
const auto& name = TBaseComputation::MakeName("Run");
if (const auto f = module.getFunction(name.c_str()))
@@ -104,7 +104,7 @@ private:
const auto argsType = ArrayType::get(valueType, ArgNodes.size());
const auto contextType = GetCompContextType(context);
- const auto funcType = codegen->GetEffectiveTarget() != NYql::NCodegen::ETarget::Windows ?
+ const auto funcType = codegen.GetEffectiveTarget() != NYql::NCodegen::ETarget::Windows ?
FunctionType::get(valueType, {PointerType::getUnqual(contextType), PointerType::getUnqual(argsType)}, false):
FunctionType::get(Type::getVoidTy(context), {PointerType::getUnqual(valueType), PointerType::getUnqual(contextType), PointerType::getUnqual(argsType)}, false);
@@ -113,7 +113,7 @@ private:
auto args = ctx.Func->arg_begin();
- const auto resultArg = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? &*args++ : nullptr;
+ const auto resultArg = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? &*args++ : nullptr;
if (resultArg) {
resultArg->addAttr(Attribute::StructRet);
resultArg->addAttr(Attribute::NoAlias);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_chain1_map.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_chain1_map.cpp
index b86803392b..dab2cd4b5b 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_chain1_map.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_chain1_map.cpp
@@ -51,7 +51,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, Value* statePtr, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto codegenItemArg = dynamic_cast<ICodegeneratorExternalNode*>(ComputationNodes.ItemArg);
const auto codegenStateArg = dynamic_cast<ICodegeneratorExternalNode*>(ComputationNodes.StateArg);
@@ -221,9 +221,9 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
template<bool IsFirst>
- Function* GenerateMapper(const NYql::NCodegen::ICodegen::TPtr& codegen, const TString& name) const {
- auto& module = codegen->GetModule();
- auto& context = codegen->GetContext();
+ Function* GenerateMapper(NYql::NCodegen::ICodegen& codegen, const TString& name) const {
+ auto& module = codegen.GetModule();
+ auto& context = codegen.GetContext();
const auto newItem = IsFirst ? ComputationNodes.InitItem : ComputationNodes.UpdateItem;
const auto newState = IsFirst ? ComputationNodes.InitState : ComputationNodes.UpdateState;
@@ -238,7 +238,7 @@ public:
return f;
const auto valueType = Type::getInt128Ty(context);
- const auto containerType = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? static_cast<Type*>(PointerType::getUnqual(valueType)) : static_cast<Type*>(valueType);
+ const auto containerType = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? static_cast<Type*>(PointerType::getUnqual(valueType)) : static_cast<Type*>(valueType);
const auto contextType = GetCompContextType(context);
const auto statusType = IsStream ? Type::getInt32Ty(context) : Type::getInt1Ty(context);
const auto funcType = FunctionType::get(statusType, {PointerType::getUnqual(contextType), containerType, PointerType::getUnqual(valueType)}, false);
@@ -255,7 +255,7 @@ public:
const auto main = BasicBlock::Create(context, "main", ctx.Func);
auto block = main;
- const auto container = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
+ const auto container = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
new LoadInst(valueType, containerArg, "load_container", false, block) : static_cast<Value*>(containerArg);
const auto good = BasicBlock::Create(context, "good", ctx.Func);
@@ -330,18 +330,18 @@ private:
Own(ComputationNodes.StateArg);
}
#ifndef MKQL_DISABLE_CODEGEN
- void GenerateFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void GenerateFunctions(NYql::NCodegen::ICodegen& codegen) final {
MapFuncOne = GenerateMapper<true>(codegen, TBaseComputation::MakeName("Fetch_One"));
MapFuncTwo = GenerateMapper<false>(codegen, TBaseComputation::MakeName("Fetch_Two"));
- codegen->ExportSymbol(MapFuncOne);
- codegen->ExportSymbol(MapFuncTwo);
+ codegen.ExportSymbol(MapFuncOne);
+ codegen.ExportSymbol(MapFuncTwo);
}
- void FinalizeFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void FinalizeFunctions(NYql::NCodegen::ICodegen& codegen) final {
if (MapFuncOne)
- MapOne = reinterpret_cast<TChainMapPtr>(codegen->GetPointerToFunction(MapFuncOne));
+ MapOne = reinterpret_cast<TChainMapPtr>(codegen.GetPointerToFunction(MapFuncOne));
if (MapFuncTwo)
- MapTwo = reinterpret_cast<TChainMapPtr>(codegen->GetPointerToFunction(MapFuncTwo));
+ MapTwo = reinterpret_cast<TChainMapPtr>(codegen.GetPointerToFunction(MapFuncTwo));
}
#endif
};
@@ -387,7 +387,7 @@ public:
}
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto codegenItemArg = dynamic_cast<ICodegeneratorExternalNode*>(ComputationNodes.ItemArg);
const auto codegenStateArg = dynamic_cast<ICodegeneratorExternalNode*>(ComputationNodes.StateArg);
@@ -471,7 +471,7 @@ public:
const auto doFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TListChain1MapWrapper::MakeLazyList));
const auto ptrType = PointerType::getUnqual(StructType::get(context));
const auto self = CastInst::Create(Instruction::IntToPtr, ConstantInt::get(Type::getInt64Ty(context), uintptr_t(this)), ptrType, "self", block);
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
const auto funType = FunctionType::get(list->getType() , {self->getType(), ctx.Ctx->getType(), list->getType()}, false);
const auto doFuncPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(funType), "function", block);
const auto value = CallInst::Create(funType, doFuncPtr, {self, ctx.Ctx, list}, "value", block);
@@ -504,20 +504,20 @@ private:
}
#ifndef MKQL_DISABLE_CODEGEN
- void GenerateFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void GenerateFunctions(NYql::NCodegen::ICodegen& codegen) final {
TMutableCodegeneratorRootNode<TListChain1MapWrapper>::GenerateFunctions(codegen);
MapFuncOne = GenerateMapper<true>(codegen, TBaseComputation::MakeName("Next_One"));
MapFuncTwo = GenerateMapper<false>(codegen, TBaseComputation::MakeName("Next_Two"));
- codegen->ExportSymbol(MapFuncOne);
- codegen->ExportSymbol(MapFuncTwo);
+ codegen.ExportSymbol(MapFuncOne);
+ codegen.ExportSymbol(MapFuncTwo);
}
- void FinalizeFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void FinalizeFunctions(NYql::NCodegen::ICodegen& codegen) final {
TMutableCodegeneratorRootNode<TListChain1MapWrapper>::FinalizeFunctions(codegen);
if (MapFuncOne)
- MapOne = reinterpret_cast<TChainMapPtr>(codegen->GetPointerToFunction(MapFuncOne));
+ MapOne = reinterpret_cast<TChainMapPtr>(codegen.GetPointerToFunction(MapFuncOne));
if (MapFuncTwo)
- MapTwo = reinterpret_cast<TChainMapPtr>(codegen->GetPointerToFunction(MapFuncTwo));
+ MapTwo = reinterpret_cast<TChainMapPtr>(codegen.GetPointerToFunction(MapFuncTwo));
}
#endif
};
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_chain_map.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_chain_map.cpp
index 0cb8b678b1..af9fe58d16 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_chain_map.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_chain_map.cpp
@@ -44,7 +44,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, Value* statePtr, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto codegenItemArg = dynamic_cast<ICodegeneratorExternalNode*>(ComputationNodes.ItemArg);
const auto codegenStateArg = dynamic_cast<ICodegeneratorExternalNode*>(ComputationNodes.StateArg);
@@ -216,9 +216,9 @@ public:
{}
#ifndef MKQL_DISABLE_CODEGEN
- Function* GenerateMapper(const NYql::NCodegen::ICodegen::TPtr& codegen, const TString& name) const {
- auto& module = codegen->GetModule();
- auto& context = codegen->GetContext();
+ Function* GenerateMapper(NYql::NCodegen::ICodegen& codegen, const TString& name) const {
+ auto& module = codegen.GetModule();
+ auto& context = codegen.GetContext();
const auto codegenItemArg = dynamic_cast<ICodegeneratorExternalNode*>(ComputationNodes.ItemArg);
const auto codegenStateArg = dynamic_cast<ICodegeneratorExternalNode*>(ComputationNodes.StateArg);
@@ -230,7 +230,7 @@ public:
return f;
const auto valueType = Type::getInt128Ty(context);
- const auto containerType = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? static_cast<Type*>(PointerType::getUnqual(valueType)) : static_cast<Type*>(valueType);
+ const auto containerType = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? static_cast<Type*>(PointerType::getUnqual(valueType)) : static_cast<Type*>(valueType);
const auto contextType = GetCompContextType(context);
const auto statusType = IsStream ? Type::getInt32Ty(context) : Type::getInt1Ty(context);
const auto funcType = FunctionType::get(statusType, {PointerType::getUnqual(contextType), containerType, PointerType::getUnqual(valueType), PointerType::getUnqual(valueType)}, false);
@@ -248,7 +248,7 @@ public:
const auto main = BasicBlock::Create(context, "main", ctx.Func);
auto block = main;
- const auto container = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
+ const auto container = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
new LoadInst(valueType, containerArg, "load_container", false, block) : static_cast<Value*>(containerArg);
const auto init = BasicBlock::Create(context, "init", ctx.Func);
@@ -331,14 +331,14 @@ private:
Own(ComputationNodes.StateArg);
}
#ifndef MKQL_DISABLE_CODEGEN
- void GenerateFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void GenerateFunctions(NYql::NCodegen::ICodegen& codegen) final {
ChainMapFunc = GenerateMapper(codegen, TBaseComputation::MakeName("Fetch"));
- codegen->ExportSymbol(ChainMapFunc);
+ codegen.ExportSymbol(ChainMapFunc);
}
- void FinalizeFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void FinalizeFunctions(NYql::NCodegen::ICodegen& codegen) final {
if (ChainMapFunc)
- ChainMap = reinterpret_cast<TChainMapPtr>(codegen->GetPointerToFunction(ChainMapFunc));
+ ChainMap = reinterpret_cast<TChainMapPtr>(codegen.GetPointerToFunction(ChainMapFunc));
}
#endif
};
@@ -379,7 +379,7 @@ public:
}
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto codegenItemArg = dynamic_cast<ICodegeneratorExternalNode*>(ComputationNodes.ItemArg);
const auto codegenStateArg = dynamic_cast<ICodegeneratorExternalNode*>(ComputationNodes.StateArg);
@@ -454,7 +454,7 @@ public:
const auto doFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TListChainMapWrapper::MakeLazyList));
const auto ptrType = PointerType::getUnqual(StructType::get(context));
const auto self = CastInst::Create(Instruction::IntToPtr, ConstantInt::get(Type::getInt64Ty(context), uintptr_t(this)), ptrType, "self", block);
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
const auto funType = FunctionType::get(list->getType() , {self->getType(), ctx.Ctx->getType(), list->getType(), init->getType()}, false);
const auto doFuncPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(funType), "function", block);
const auto value = CallInst::Create(funType, doFuncPtr, {self, ctx.Ctx, list, init}, "value", block);
@@ -488,16 +488,16 @@ private:
}
#ifndef MKQL_DISABLE_CODEGEN
- void GenerateFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void GenerateFunctions(NYql::NCodegen::ICodegen& codegen) final {
TMutableCodegeneratorRootNode<TListChainMapWrapper>::GenerateFunctions(codegen);
ChainMapFunc = GenerateMapper(codegen, TBaseComputation::MakeName("Next"));
- codegen->ExportSymbol(ChainMapFunc);
+ codegen.ExportSymbol(ChainMapFunc);
}
- void FinalizeFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void FinalizeFunctions(NYql::NCodegen::ICodegen& codegen) final {
TMutableCodegeneratorRootNode<TListChainMapWrapper>::FinalizeFunctions(codegen);
if (ChainMapFunc)
- ChainMap = reinterpret_cast<TChainMapPtr>(codegen->GetPointerToFunction(ChainMapFunc));
+ ChainMap = reinterpret_cast<TChainMapPtr>(codegen.GetPointerToFunction(ChainMapFunc));
}
#endif
};
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_chopper.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_chopper.cpp
index 51eef29dd8..a27c803bdc 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_chopper.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_chopper.cpp
@@ -107,9 +107,9 @@ public:
}
#ifndef MKQL_DISABLE_CODEGEN
private:
- Function* GenerateHandler(const NYql::NCodegen::ICodegen::TPtr& codegen) const {
- auto& module = codegen->GetModule();
- auto& context = codegen->GetContext();
+ Function* GenerateHandler(NYql::NCodegen::ICodegen& codegen) const {
+ auto& module = codegen.GetModule();
+ auto& context = codegen.GetContext();
TStringStream out;
out << this->DebugString() << "::Handler_(" << static_cast<const void*>(this) << ").";
@@ -193,7 +193,7 @@ public:
MKQL_ENSURE(codegenKeyArg, "Key arg must be codegenerator node.");
MKQL_ENSURE(codegenInput, "Input arg must be codegenerator node.");
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto init = BasicBlock::Create(context, "init", ctx.Func);
const auto loop = BasicBlock::Create(context, "loop", ctx.Func);
@@ -525,23 +525,23 @@ private:
}
#ifndef MKQL_DISABLE_CODEGEN
- void GenerateFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void GenerateFunctions(NYql::NCodegen::ICodegen& codegen) final {
InputFunc = GenerateInput(codegen);
OutputFunc = GenerateOutput(codegen);
- codegen->ExportSymbol(InputFunc);
- codegen->ExportSymbol(OutputFunc);
+ codegen.ExportSymbol(InputFunc);
+ codegen.ExportSymbol(OutputFunc);
}
- void FinalizeFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void FinalizeFunctions(NYql::NCodegen::ICodegen& codegen) final {
if (InputFunc)
- InputPtr = reinterpret_cast<TInputPtr>(codegen->GetPointerToFunction(InputFunc));
+ InputPtr = reinterpret_cast<TInputPtr>(codegen.GetPointerToFunction(InputFunc));
if (OutputFunc)
- OutputPtr = reinterpret_cast<TOutputPtr>(codegen->GetPointerToFunction(OutputFunc));
+ OutputPtr = reinterpret_cast<TOutputPtr>(codegen.GetPointerToFunction(OutputFunc));
}
- Function* GenerateInput(const NYql::NCodegen::ICodegen::TPtr& codegen) const {
- auto& module = codegen->GetModule();
- auto& context = codegen->GetContext();
+ Function* GenerateInput(NYql::NCodegen::ICodegen& codegen) const {
+ auto& module = codegen.GetModule();
+ auto& context = codegen.GetContext();
const auto& name = MakeName("Input");
if (const auto f = module.getFunction(name.c_str()))
@@ -554,7 +554,7 @@ private:
MKQL_ENSURE(codegenKeyArg, "Key arg must be codegenerator node.");
const auto valueType = Type::getInt128Ty(context);
- const auto containerType = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? static_cast<Type*>(PointerType::getUnqual(valueType)) : static_cast<Type*>(valueType);
+ const auto containerType = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? static_cast<Type*>(PointerType::getUnqual(valueType)) : static_cast<Type*>(valueType);
const auto contextType = GetCompContextType(context);
const auto statusType = Type::getInt32Ty(context);
const auto stateType = Type::getInt8Ty(context);
@@ -576,7 +576,7 @@ private:
auto block = main;
- const auto container = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
+ const auto container = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
new LoadInst(valueType, containerArg, "load_container", false, block) : static_cast<Value*>(containerArg);
const auto first = new LoadInst(stateType, stateArg, "first", block);
@@ -631,9 +631,9 @@ private:
return ctx.Func;
}
- Function* GenerateOutput(const NYql::NCodegen::ICodegen::TPtr& codegen) const {
- auto& module = codegen->GetModule();
- auto& context = codegen->GetContext();
+ Function* GenerateOutput(NYql::NCodegen::ICodegen& codegen) const {
+ auto& module = codegen.GetModule();
+ auto& context = codegen.GetContext();
const auto& name = MakeName("Output");
if (const auto f = module.getFunction(name.c_str()))
@@ -648,7 +648,7 @@ private:
MKQL_ENSURE(codegenInput, "Input arg must be codegenerator node.");
const auto valueType = Type::getInt128Ty(context);
- const auto containerType = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? static_cast<Type*>(PointerType::getUnqual(valueType)) : static_cast<Type*>(valueType);
+ const auto containerType = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? static_cast<Type*>(PointerType::getUnqual(valueType)) : static_cast<Type*>(valueType);
const auto contextType = GetCompContextType(context);
const auto statusType = Type::getInt32Ty(context);
const auto stateType = Type::getInt8Ty(context);
@@ -676,7 +676,7 @@ private:
auto block = main;
- const auto input = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
+ const auto input = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
new LoadInst(valueType, inputArg, "load_input", false, block) : static_cast<Value*>(inputArg);
BranchInst::Create(loop, block);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_coalesce.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_coalesce.cpp
index a11c05f023..014ecc9771 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_coalesce.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_coalesce.cpp
@@ -27,7 +27,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto left = GetNodeValue(this->Left, ctx, block);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_collect.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_collect.cpp
index f2fd19c1d0..2a4e0bb1bc 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_collect.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_collect.cpp
@@ -26,7 +26,7 @@ public:
}
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto factory = ctx.GetFactory();
@@ -42,7 +42,7 @@ public:
const auto list = PHINode::Create(valueType, 2U, "list", work);
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
const auto funType = FunctionType::get(valueType, {factory->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, empty, PointerType::getUnqual(funType), "empty", block);
const auto first = CallInst::Create(funType, funcPtr, {factory}, "init", block);
@@ -69,7 +69,7 @@ public:
{
block = good;
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
const auto funType = FunctionType::get(valueType, {factory->getType(), list->getType(), item->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, append, PointerType::getUnqual(funType), "append", block);
const auto next = CallInst::Create(funType, funcPtr, {factory, list, item}, "next", block);
@@ -132,7 +132,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto factory = ctx.GetFactory();
@@ -154,7 +154,7 @@ public:
BranchInst::Create(work, done, null, block);
block = work;
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
const auto funType = FunctionType::get(seq->getType(), {factory->getType(), seq->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block);
const auto res = CallInst::Create(funType, funcPtr, {factory, seq}, "res", block);
@@ -173,7 +173,7 @@ public:
block = done;
return result;
} else {
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
const auto funType = FunctionType::get(seq->getType(), {factory->getType(), seq->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block);
const auto res = CallInst::Create(funType, funcPtr, {factory, seq}, "res", block);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_combine.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_combine.cpp
index 2493e51ccc..a13e92287a 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_combine.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_combine.cpp
@@ -244,7 +244,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, Value* statePtr, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto codegenItemArg = dynamic_cast<ICodegeneratorExternalNode*>(Nodes.ItemNode);
const auto codegenKeyArg = dynamic_cast<ICodegeneratorExternalNode*>(Nodes.KeyNode);
@@ -356,10 +356,10 @@ public:
const auto key = GetNodeValue(Nodes.KeyResultNode, ctx, block);
codegenKeyArg->CreateSetValue(ctx, block, key);
- const auto keyParam = NYql::NCodegen::ETarget::Windows == ctx.Codegen->GetEffectiveTarget() ?
+ const auto keyParam = NYql::NCodegen::ETarget::Windows == ctx.Codegen.GetEffectiveTarget() ?
new AllocaInst(key->getType(), 0U, "key_param", &main->back()) : key;
- if (NYql::NCodegen::ETarget::Windows == ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows == ctx.Codegen.GetEffectiveTarget()) {
new StoreInst(key, keyParam, block);
}
@@ -440,7 +440,7 @@ public:
}
Value* DoGenerateGetValue(const TCodegenContext& ctx, Value* statePtr, Value* currentPtr, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto statusType = Type::getInt32Ty(context);
const auto valueType = Type::getInt128Ty(context);
@@ -554,18 +554,18 @@ private:
return out.Str();
}
- void FinalizeFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void FinalizeFunctions(NYql::NCodegen::ICodegen& codegen) final {
if (EqualsFunc) {
- Equals = reinterpret_cast<TEqualsPtr>(codegen->GetPointerToFunction(EqualsFunc));
+ Equals = reinterpret_cast<TEqualsPtr>(codegen.GetPointerToFunction(EqualsFunc));
}
if (HashFunc) {
- Hash = reinterpret_cast<THashPtr>(codegen->GetPointerToFunction(HashFunc));
+ Hash = reinterpret_cast<THashPtr>(codegen.GetPointerToFunction(HashFunc));
}
}
- void GenerateFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
- codegen->ExportSymbol(HashFunc = GenerateHashFunction(codegen, MakeName<false>(), IsTuple, KeyTypes));
- codegen->ExportSymbol(EqualsFunc = GenerateEqualsFunction(codegen, MakeName<true>(), IsTuple, KeyTypes));
+ void GenerateFunctions(NYql::NCodegen::ICodegen& codegen) final {
+ codegen.ExportSymbol(HashFunc = GenerateHashFunction(codegen, MakeName<false>(), IsTuple, KeyTypes));
+ codegen.ExportSymbol(EqualsFunc = GenerateEqualsFunction(codegen, MakeName<true>(), IsTuple, KeyTypes));
}
#endif
};
@@ -688,27 +688,27 @@ private:
return out.Str();
}
- void GenerateFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
- codegen->ExportSymbol(CombineFunc = GenerateCombine(codegen));
- codegen->ExportSymbol(EqualsFunc = GenerateEqualsFunction(codegen, MakeFuncName<true>(), IsTuple, KeyTypes));
- codegen->ExportSymbol(HashFunc = GenerateHashFunction(codegen, MakeFuncName<false>(), IsTuple, KeyTypes));
+ void GenerateFunctions(NYql::NCodegen::ICodegen& codegen) final {
+ codegen.ExportSymbol(CombineFunc = GenerateCombine(codegen));
+ codegen.ExportSymbol(EqualsFunc = GenerateEqualsFunction(codegen, MakeFuncName<true>(), IsTuple, KeyTypes));
+ codegen.ExportSymbol(HashFunc = GenerateHashFunction(codegen, MakeFuncName<false>(), IsTuple, KeyTypes));
}
- void FinalizeFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void FinalizeFunctions(NYql::NCodegen::ICodegen& codegen) final {
if (CombineFunc) {
- Combine = reinterpret_cast<TCombinePtr>(codegen->GetPointerToFunction(CombineFunc));
+ Combine = reinterpret_cast<TCombinePtr>(codegen.GetPointerToFunction(CombineFunc));
}
if (EqualsFunc) {
- Equals = reinterpret_cast<TEqualsPtr>(codegen->GetPointerToFunction(EqualsFunc));
+ Equals = reinterpret_cast<TEqualsPtr>(codegen.GetPointerToFunction(EqualsFunc));
}
if (HashFunc) {
- Hash = reinterpret_cast<THashPtr>(codegen->GetPointerToFunction(HashFunc));
+ Hash = reinterpret_cast<THashPtr>(codegen.GetPointerToFunction(HashFunc));
}
}
- Function* GenerateCombine(const NYql::NCodegen::ICodegen::TPtr& codegen) const {
- auto& module = codegen->GetModule();
- auto& context = codegen->GetContext();
+ Function* GenerateCombine(NYql::NCodegen::ICodegen& codegen) const {
+ auto& module = codegen.GetModule();
+ auto& context = codegen.GetContext();
const auto codegenItemArg = dynamic_cast<ICodegeneratorExternalNode*>(Nodes.ItemNode);
const auto codegenKeyArg = dynamic_cast<ICodegeneratorExternalNode*>(Nodes.KeyNode);
@@ -725,7 +725,7 @@ private:
const auto valueType = Type::getInt128Ty(context);
const auto ptrValueType = PointerType::getUnqual(valueType);
const auto structPtrType = PointerType::getUnqual(StructType::get(context));
- const auto containerType = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? static_cast<Type*>(ptrValueType) : static_cast<Type*>(valueType);
+ const auto containerType = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? static_cast<Type*>(ptrValueType) : static_cast<Type*>(valueType);
const auto contextType = GetCompContextType(context);
const auto statusType = Type::getInt32Ty(context);
@@ -831,7 +831,7 @@ private:
const auto used = GetMemoryUsed(MemLimit, ctx, block);
- const auto stream = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
+ const auto stream = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
new LoadInst(valueType, containerArg, "load_container", false, block) : static_cast<Value*>(containerArg);
BranchInst::Create(loop, block);
@@ -851,10 +851,10 @@ private:
const auto key = GetNodeValue(Nodes.KeyResultNode, ctx, block);
codegenKeyArg->CreateSetValue(ctx, block, key);
- const auto keyParam = NYql::NCodegen::ETarget::Windows == ctx.Codegen->GetEffectiveTarget() ?
+ const auto keyParam = NYql::NCodegen::ETarget::Windows == ctx.Codegen.GetEffectiveTarget() ?
new AllocaInst(key->getType(), 0U, "key_param", &main->back()) : key;
- if (NYql::NCodegen::ETarget::Windows == ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows == ctx.Codegen.GetEffectiveTarget()) {
new StoreInst(key, keyParam, block);
}
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_condense.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_condense.cpp
index fb4c28e31e..2a99bfb9b0 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_condense.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_condense.cpp
@@ -78,7 +78,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, Value* statePtr, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto codegenItem = dynamic_cast<ICodegeneratorExternalNode*>(Item);
MKQL_ENSURE(codegenItem, "Item must be codegenerator node.");
@@ -326,20 +326,20 @@ private:
}
#ifndef MKQL_DISABLE_CODEGEN
- void GenerateFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void GenerateFunctions(NYql::NCodegen::ICodegen& codegen) final {
FetchFunc = GenerateFetch(codegen);
- codegen->ExportSymbol(FetchFunc);
+ codegen.ExportSymbol(FetchFunc);
}
- void FinalizeFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void FinalizeFunctions(NYql::NCodegen::ICodegen& codegen) final {
if (FetchFunc) {
- Fetch = reinterpret_cast<TFetchPtr>(codegen->GetPointerToFunction(FetchFunc));
+ Fetch = reinterpret_cast<TFetchPtr>(codegen.GetPointerToFunction(FetchFunc));
}
}
- Function* GenerateFetch(const NYql::NCodegen::ICodegen::TPtr& codegen) const {
- auto& module = codegen->GetModule();
- auto& context = codegen->GetContext();
+ Function* GenerateFetch(NYql::NCodegen::ICodegen& codegen) const {
+ auto& module = codegen.GetModule();
+ auto& context = codegen.GetContext();
const auto codegenItemArg = dynamic_cast<ICodegeneratorExternalNode*>(State.Item);
const auto codegenStateArg = dynamic_cast<ICodegeneratorExternalNode*>(State.State);
@@ -352,7 +352,7 @@ private:
return f;
const auto valueType = Type::getInt128Ty(context);
- const auto containerType = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? static_cast<Type*>(PointerType::getUnqual(valueType)) : static_cast<Type*>(valueType);
+ const auto containerType = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? static_cast<Type*>(PointerType::getUnqual(valueType)) : static_cast<Type*>(valueType);
const auto contextType = GetCompContextType(context);
const auto statusType = Type::getInt32Ty(context);
const auto stateType = Type::getInt8Ty(context);
@@ -371,7 +371,7 @@ private:
const auto main = BasicBlock::Create(context, "main", ctx.Func);
auto block = main;
- const auto container = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
+ const auto container = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
new LoadInst(valueType, containerArg, "load_container", false, block) : static_cast<Value*>(containerArg);
const auto state = new LoadInst(stateType, statePtr, "state", block);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_condense1.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_condense1.cpp
index dd666a2c4c..43cffed7cd 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_condense1.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_condense1.cpp
@@ -77,7 +77,7 @@ public:
}
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, Value* statePtr, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto codegenItem = dynamic_cast<ICodegeneratorExternalNode*>(Item);
MKQL_ENSURE(codegenItem, "Item must be codegenerator node.");
@@ -344,20 +344,20 @@ private:
}
#ifndef MKQL_DISABLE_CODEGEN
- void GenerateFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void GenerateFunctions(NYql::NCodegen::ICodegen& codegen) final {
FetchFunc = GenerateFetch(codegen);
- codegen->ExportSymbol(FetchFunc);
+ codegen.ExportSymbol(FetchFunc);
}
- void FinalizeFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void FinalizeFunctions(NYql::NCodegen::ICodegen& codegen) final {
if (FetchFunc) {
- Fetch = reinterpret_cast<TFetchPtr>(codegen->GetPointerToFunction(FetchFunc));
+ Fetch = reinterpret_cast<TFetchPtr>(codegen.GetPointerToFunction(FetchFunc));
}
}
- Function* GenerateFetch(const NYql::NCodegen::ICodegen::TPtr& codegen) const {
- auto& module = codegen->GetModule();
- auto& context = codegen->GetContext();
+ Function* GenerateFetch(NYql::NCodegen::ICodegen& codegen) const {
+ auto& module = codegen.GetModule();
+ auto& context = codegen.GetContext();
const auto codegenItemArg = dynamic_cast<ICodegeneratorExternalNode*>(State.Item);
const auto codegenStateArg = dynamic_cast<ICodegeneratorExternalNode*>(State.State);
@@ -370,7 +370,7 @@ private:
return f;
const auto valueType = Type::getInt128Ty(context);
- const auto containerType = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? static_cast<Type*>(PointerType::getUnqual(valueType)) : static_cast<Type*>(valueType);
+ const auto containerType = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? static_cast<Type*>(PointerType::getUnqual(valueType)) : static_cast<Type*>(valueType);
const auto contextType = GetCompContextType(context);
const auto statusType = Type::getInt32Ty(context);
const auto stateType = Type::getInt8Ty(context);
@@ -389,7 +389,7 @@ private:
const auto main = BasicBlock::Create(context, "main", ctx.Func);
auto block = main;
- const auto container = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
+ const auto container = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
new LoadInst(valueType, containerArg, "load_container", false, block) : static_cast<Value*>(containerArg);
const auto step = BasicBlock::Create(context, "step", ctx.Func);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_contains.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_contains.cpp
index 54e2e0293d..75c8cb4f02 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_contains.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_contains.cpp
@@ -23,7 +23,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valueType = Type::getInt128Ty(context);
const auto dict = GetNodeValue(Dict, ctx, block);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_decimal_div.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_decimal_div.cpp
index d7054da998..5452c572af 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_decimal_div.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_decimal_div.cpp
@@ -48,17 +48,17 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valType = Type::getInt128Ty(context);
const auto valTypePtr = PointerType::getUnqual(valType);
const auto name = "DecimalMulAndDivNormalMultiplier";
- ctx.Codegen->AddGlobalMapping(name, reinterpret_cast<const void*>(&DecimalMulAndDivNormalMultiplier));
- const auto fnType = NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget() ?
+ ctx.Codegen.AddGlobalMapping(name, reinterpret_cast<const void*>(&DecimalMulAndDivNormalMultiplier));
+ const auto fnType = NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget() ?
FunctionType::get(valType, { valType, valType, valType }, false):
FunctionType::get(Type::getVoidTy(context), { valTypePtr, valTypePtr, valTypePtr, valTypePtr }, false);
- const auto func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType);
+ const auto func = ctx.Codegen.GetModule().getOrInsertFunction(name, fnType);
const auto left = GetNodeValue(Left, ctx, block);
const auto right = GetNodeValue(Right, ctx, block);
@@ -79,7 +79,7 @@ public:
block = good;
Value* muldiv;
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
muldiv = CallInst::Create(func, { GetterForInt128(left, block), NDecimal::GenConstant(Divider, context), GetterForInt128(right, block) }, "mul_and_div", block);
} else {
const auto retPtr = new AllocaInst(valType, 0U, "ret_ptr", block);
@@ -108,7 +108,7 @@ public:
return result;
} else {
Value* muldiv;
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
muldiv = CallInst::Create(func, { GetterForInt128(left, block), NDecimal::GenConstant(Divider, context), GetterForInt128(right, block) }, "mul_and_div", block);
} else {
const auto retPtr = new AllocaInst(valType, 0U, "ret_ptr", block);
@@ -172,17 +172,17 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valType = Type::getInt128Ty(context);
const auto valTypePtr = PointerType::getUnqual(valType);
const auto name = "DecimalDiv";
- ctx.Codegen->AddGlobalMapping(name, reinterpret_cast<const void*>(&DecimalDiv));
- const auto fnType = NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget() ?
+ ctx.Codegen.AddGlobalMapping(name, reinterpret_cast<const void*>(&DecimalDiv));
+ const auto fnType = NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget() ?
FunctionType::get(valType, { valType, valType }, false):
FunctionType::get(Type::getVoidTy(context), { valTypePtr, valTypePtr, valTypePtr }, false);
- const auto func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType);
+ const auto func = ctx.Codegen.GetModule().getOrInsertFunction(name, fnType);
const auto left = GetNodeValue(Left, ctx, block);
const auto right = GetNodeValue(Right, ctx, block);
@@ -207,7 +207,7 @@ public:
static_cast<CastInst*>(new ZExtInst(GetterFor<TRight>(right, context, block), valType, "zext", block));
Value* div;
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
div = CallInst::Create(func, {GetterForInt128(left, block), cast}, "div", block);
} else {
const auto retPtr = new AllocaInst(valType, 0U, "ret_ptr", block);
@@ -229,7 +229,7 @@ public:
static_cast<CastInst*>(new SExtInst(GetterFor<TRight>(right, context, block), valType, "sext", block)):
static_cast<CastInst*>(new ZExtInst(GetterFor<TRight>(right, context, block), valType, "zext", block));
Value* div;
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
div = CallInst::Create(func, {GetterForInt128(left, block), cast}, "div", block);
} else {
const auto retPtr = new AllocaInst(valType, 0U, "ret_ptr", block);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_decimal_mod.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_decimal_mod.cpp
index 3dd8f06f8a..592fe6a249 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_decimal_mod.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_decimal_mod.cpp
@@ -34,7 +34,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valType = Type::getInt128Ty(context);
@@ -146,7 +146,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valType = Type::getInt128Ty(context);
const auto divider = NDecimal::GenConstant(Divider, context);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_decimal_mul.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_decimal_mul.cpp
index db4a8b3c60..1b7dad56ea 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_decimal_mul.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_decimal_mul.cpp
@@ -52,7 +52,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valType = Type::getInt128Ty(context);
const auto valTypePtr = PointerType::getUnqual(valType);
@@ -60,15 +60,15 @@ public:
const bool useMulAddDiv = Divider > 1;
const auto name = useMulAddDiv ? "DecimalMulAndDivNormalDivider" : "DecimalMul";
const auto fnType = useMulAddDiv ?
- NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget() ?
+ NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget() ?
FunctionType::get(valType, { valType, valType, valType }, false):
FunctionType::get(Type::getVoidTy(context), { valTypePtr, valTypePtr, valTypePtr, valTypePtr }, false):
- NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget() ?
+ NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget() ?
FunctionType::get(valType, { valType, valType}, false):
FunctionType::get(Type::getVoidTy(context), { valTypePtr, valTypePtr, valTypePtr }, false);
- ctx.Codegen->AddGlobalMapping(name, useMulAddDiv ? reinterpret_cast<const void*>(&DecimalMulAndDivNormalDivider) : reinterpret_cast<const void*>(&DecimalMul));
- const auto func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType);
+ ctx.Codegen.AddGlobalMapping(name, useMulAddDiv ? reinterpret_cast<const void*>(&DecimalMulAndDivNormalDivider) : reinterpret_cast<const void*>(&DecimalMul));
+ const auto func = ctx.Codegen.GetModule().getOrInsertFunction(name, fnType);
const auto left = GetNodeValue(Left, ctx, block);
const auto right = GetNodeValue(Right, ctx, block);
@@ -90,7 +90,7 @@ public:
Value* muldiv;
if (useMulAddDiv) {
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
muldiv = CallInst::Create(func, { GetterForInt128(left, block), GetterForInt128(right, block), NDecimal::GenConstant(Divider, context) }, "mul_and_div", block);
} else {
const auto retPtr = new AllocaInst(valType, 0U, "ret_ptr", block);
@@ -104,7 +104,7 @@ public:
muldiv = new LoadInst(valType, retPtr, "res", block);
}
} else {
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
muldiv = CallInst::Create(func, { GetterForInt128(left, block), GetterForInt128(right, block) }, "mul", block);
} else {
const auto retPtr = new AllocaInst(valType, 0U, "ret_ptr", block);
@@ -133,7 +133,7 @@ public:
} else {
Value* muldiv;
if (useMulAddDiv) {
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
muldiv = CallInst::Create(func, { GetterForInt128(left, block), GetterForInt128(right, block), NDecimal::GenConstant(Divider, context) }, "mul_and_div", block);
} else {
const auto retPtr = new AllocaInst(valType, 0U, "ret_ptr", block);
@@ -147,7 +147,7 @@ public:
muldiv = new LoadInst(valType, retPtr, "res", block);
}
} else {
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
muldiv = CallInst::Create(func, { GetterForInt128(left, block), GetterForInt128(right, block) }, "mul", block);
} else {
const auto retPtr = new AllocaInst(valType, 0U, "ret_ptr", block);
@@ -216,17 +216,17 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valType = Type::getInt128Ty(context);
const auto valTypePtr = PointerType::getUnqual(valType);
const auto name = "DecimalMul";
- ctx.Codegen->AddGlobalMapping(name, reinterpret_cast<const void*>(&DecimalMul));
- const auto fnType = NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget() ?
+ ctx.Codegen.AddGlobalMapping(name, reinterpret_cast<const void*>(&DecimalMul));
+ const auto fnType = NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget() ?
FunctionType::get(valType, { valType, valType }, false):
FunctionType::get(Type::getVoidTy(context), { valTypePtr, valTypePtr, valTypePtr }, false);
- const auto func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType);
+ const auto func = ctx.Codegen.GetModule().getOrInsertFunction(name, fnType);
const auto left = GetNodeValue(Left, ctx, block);
const auto right = GetNodeValue(Right, ctx, block);
@@ -250,7 +250,7 @@ public:
static_cast<CastInst*>(new SExtInst(GetterFor<TRight>(right, context, block), valType, "sext", block)):
static_cast<CastInst*>(new ZExtInst(GetterFor<TRight>(right, context, block), valType, "zext", block));
Value* mul;
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
mul = CallInst::Create(func, {GetterForInt128(left, block), cast}, "div", block);
} else {
const auto retPtr = new AllocaInst(valType, 0U, "ret_ptr", block);
@@ -280,7 +280,7 @@ public:
static_cast<CastInst*>(new SExtInst(GetterFor<TRight>(right, context, block), valType, "sext", block)):
static_cast<CastInst*>(new ZExtInst(GetterFor<TRight>(right, context, block), valType, "zext", block));
Value* mul;
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
mul = CallInst::Create(func, {GetterForInt128(left, block), cast}, "div", block);
} else {
const auto retPtr = new AllocaInst(valType, 0U, "ret_ptr", block);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_dictitems.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_dictitems.cpp
index ba0e8486cf..f497c75631 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_dictitems.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_dictitems.cpp
@@ -137,19 +137,19 @@ private:
}
#ifndef MKQL_DISABLE_CODEGEN
- void GenerateFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void GenerateFunctions(NYql::NCodegen::ICodegen& codegen) final {
NextFunc = GenerateNext(codegen);
- codegen->ExportSymbol(NextFunc);
+ codegen.ExportSymbol(NextFunc);
}
- void FinalizeFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void FinalizeFunctions(NYql::NCodegen::ICodegen& codegen) final {
if (NextFunc)
- Next = reinterpret_cast<TNextPtr>(codegen->GetPointerToFunction(NextFunc));
+ Next = reinterpret_cast<TNextPtr>(codegen.GetPointerToFunction(NextFunc));
}
- Function* GenerateNext(const NYql::NCodegen::ICodegen::TPtr& codegen) const {
- auto& module = codegen->GetModule();
- auto& context = codegen->GetContext();
+ Function* GenerateNext(NYql::NCodegen::ICodegen& codegen) const {
+ auto& module = codegen.GetModule();
+ auto& context = codegen.GetContext();
const auto& name = TBaseComputation::MakeName("Next");
if (const auto f = module.getFunction(name.c_str()))
@@ -158,7 +158,7 @@ private:
const auto valueType = Type::getInt128Ty(context);
const auto indexType = Type::getInt32Ty(context);
const auto pairType = ArrayType::get(valueType, 2U);
- const auto containerType = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? static_cast<Type*>(PointerType::getUnqual(valueType)) : static_cast<Type*>(valueType);
+ const auto containerType = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? static_cast<Type*>(PointerType::getUnqual(valueType)) : static_cast<Type*>(valueType);
const auto contextType = GetCompContextType(context);
const auto statusType = Type::getInt1Ty(context);
const auto funcType = FunctionType::get(statusType, {PointerType::getUnqual(contextType), containerType, PointerType::getUnqual(valueType)}, false);
@@ -175,7 +175,7 @@ private:
const auto main = BasicBlock::Create(context, "main", ctx.Func);
auto block = main;
- const auto container = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
+ const auto container = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
new LoadInst(valueType, containerArg, "load_container", false, block) : static_cast<Value*>(containerArg);
const auto good = BasicBlock::Create(context, "good", ctx.Func);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_discard.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_discard.cpp
index a94bbcc8ec..7b9dff2e62 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_discard.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_discard.cpp
@@ -26,7 +26,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto loop = BasicBlock::Create(context, "loop", ctx.Func);
const auto skip = BasicBlock::Create(context, "skip", ctx.Func);
@@ -75,7 +75,7 @@ public:
}
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto loop = BasicBlock::Create(context, "loop", ctx.Func);
const auto exit = BasicBlock::Create(context, "exit", ctx.Func);
@@ -148,26 +148,26 @@ private:
}
#ifndef MKQL_DISABLE_CODEGEN
- void GenerateFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void GenerateFunctions(NYql::NCodegen::ICodegen& codegen) final {
FetchFunc = GenerateFetch(codegen);
- codegen->ExportSymbol(FetchFunc);
+ codegen.ExportSymbol(FetchFunc);
}
- void FinalizeFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void FinalizeFunctions(NYql::NCodegen::ICodegen& codegen) final {
if (FetchFunc)
- Fetch = reinterpret_cast<TFetchPtr>(codegen->GetPointerToFunction(FetchFunc));
+ Fetch = reinterpret_cast<TFetchPtr>(codegen.GetPointerToFunction(FetchFunc));
}
- Function* GenerateFetch(const NYql::NCodegen::ICodegen::TPtr& codegen) const {
- auto& module = codegen->GetModule();
- auto& context = codegen->GetContext();
+ Function* GenerateFetch(NYql::NCodegen::ICodegen& codegen) const {
+ auto& module = codegen.GetModule();
+ auto& context = codegen.GetContext();
const auto& name = TBaseComputation::MakeName("Fetch");
if (const auto f = module.getFunction(name.c_str()))
return f;
const auto valueType = Type::getInt128Ty(context);
- const auto containerType = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? static_cast<Type*>(PointerType::getUnqual(valueType)) : static_cast<Type*>(valueType);
+ const auto containerType = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? static_cast<Type*>(PointerType::getUnqual(valueType)) : static_cast<Type*>(valueType);
const auto contextType = GetCompContextType(context);
const auto statusType = Type::getInt32Ty(context);
const auto funcType = FunctionType::get(statusType, {PointerType::getUnqual(contextType), containerType, PointerType::getUnqual(valueType)}, false);
@@ -184,7 +184,7 @@ private:
const auto main = BasicBlock::Create(context, "main", ctx.Func);
auto block = main;
- const auto container = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
+ const auto container = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
new LoadInst(valueType, containerArg, "load_container", false, block) : static_cast<Value*>(containerArg);
const auto loop = BasicBlock::Create(context, "loop", ctx.Func);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_element.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_element.cpp
index 0a92ecdf69..d6649a40a9 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_element.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_element.cpp
@@ -27,7 +27,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto array = GetNodeValue(Array, ctx, block);
const auto elementsType = PointerType::getUnqual(array->getType());
@@ -93,7 +93,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
void DoGenerateGetElement(const TCodegenContext& ctx, Value* pointer, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto array = GetNodeValue(Array, ctx, block);
const auto index = ConstantInt::get(Type::getInt32Ty(context), Index);
@@ -127,7 +127,7 @@ public:
return DoGenerateGetElement(ctx, pointer, block);
}
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto cache = GetNodeValue(Cache, ctx, block);
const auto fast = BasicBlock::Create(context, "fast", ctx.Func);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_ensure.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_ensure.cpp
index 23976b2290..c9e8d4c5c5 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_ensure.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_ensure.cpp
@@ -34,7 +34,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valueType = Type::getInt128Ty(context);
const auto predicate = GetNodeValue(Predicate, ctx, block);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_enumerate.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_enumerate.cpp
index db9efbe438..34639d7ec4 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_enumerate.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_enumerate.cpp
@@ -119,7 +119,7 @@ public:
}
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto list = GetNodeValue(List, ctx, block);
const auto startv = GetNodeValue(Start, ctx, block);
@@ -132,7 +132,7 @@ public:
const auto ptrType = PointerType::getUnqual(StructType::get(context));
const auto self = CastInst::Create(Instruction::IntToPtr, ConstantInt::get(Type::getInt64Ty(context), uintptr_t(this)), ptrType, "self", block);
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
const auto signature = FunctionType::get(list->getType(), {self->getType(), ctx.Ctx->getType(), list->getType(), start->getType(), step->getType()}, false);
const auto creator = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(signature), "creator", block);
const auto output = CallInst::Create(signature, creator, {self, ctx.Ctx, list, start, step}, "output", block);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_exists.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_exists.cpp
index cf9d6c8b53..7cffd75739 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_exists.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_exists.cpp
@@ -23,7 +23,7 @@ public:
const auto check = IsExists(value, block);
if (Node->IsTemporaryValue())
ValueCleanup(Node->GetRepresentation(), value, ctx, block);
- return MakeBoolean(check, ctx.Codegen->GetContext(), block);
+ return MakeBoolean(check, ctx.Codegen.GetContext(), block);
}
#endif
};
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_extend.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_extend.cpp
index 089c9e7bdf..63c353fbfd 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_extend.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_extend.cpp
@@ -105,7 +105,7 @@ public:
}
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, Value* statePtr, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valueType = Type::getInt128Ty(context);
const auto indexType = Type::getInt64Ty(context);
@@ -179,7 +179,7 @@ public:
}
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valueType = Type::getInt128Ty(context);
const auto sizeType = Type::getInt64Ty(context);
@@ -198,7 +198,7 @@ public:
const auto factory = ctx.GetFactory();
const auto func = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(IsStream ? &THolderFactory::ExtendStream : &THolderFactory::ExtendList<false>));
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
const auto funType = FunctionType::get(valueType, {factory->getType(), array->getType(), size->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block);
const auto res = CallInst::Create(funType, funcPtr, {factory, array, size}, "res", block);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_filter.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_filter.cpp
index f44420c7ba..0641165317 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_filter.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_filter.cpp
@@ -26,7 +26,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto codegenItem = dynamic_cast<ICodegeneratorExternalNode*>(Item);
MKQL_ENSURE(codegenItem, "Item must be codegenerator node.");
@@ -92,7 +92,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, Value* statePtr, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto codegenItem = dynamic_cast<ICodegeneratorExternalNode*>(Item);
MKQL_ENSURE(codegenItem, "Item must be codegenerator node.");
@@ -268,9 +268,9 @@ protected:
{}
#ifndef MKQL_DISABLE_CODEGEN
- Function* GenerateFilter(const NYql::NCodegen::ICodegen::TPtr& codegen, const TString& name) const {
- auto& module = codegen->GetModule();
- auto& context = codegen->GetContext();
+ Function* GenerateFilter(NYql::NCodegen::ICodegen& codegen, const TString& name) const {
+ auto& module = codegen.GetModule();
+ auto& context = codegen.GetContext();
const auto codegenItem = dynamic_cast<ICodegeneratorExternalNode*>(Item);
@@ -280,7 +280,7 @@ protected:
return f;
const auto valueType = Type::getInt128Ty(context);
- const auto containerType = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? static_cast<Type*>(PointerType::getUnqual(valueType)) : static_cast<Type*>(valueType);
+ const auto containerType = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? static_cast<Type*>(PointerType::getUnqual(valueType)) : static_cast<Type*>(valueType);
const auto contextType = GetCompContextType(context);
const auto statusType = IsStream ? Type::getInt32Ty(context) : Type::getInt1Ty(context);
const auto funcType = FunctionType::get(statusType, {PointerType::getUnqual(contextType), containerType, PointerType::getUnqual(valueType)}, false);
@@ -297,7 +297,7 @@ protected:
const auto main = BasicBlock::Create(context, "main", ctx.Func);
auto block = main;
- const auto container = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
+ const auto container = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
new LoadInst(valueType, containerArg, "load_container", false, block) : static_cast<Value*>(containerArg);
const auto loop = BasicBlock::Create(context, "loop", ctx.Func);
@@ -473,9 +473,9 @@ protected:
{}
#ifndef MKQL_DISABLE_CODEGEN
- Function* GenerateFilter(const NYql::NCodegen::ICodegen::TPtr& codegen, const TString& name) const {
- auto& module = codegen->GetModule();
- auto& context = codegen->GetContext();
+ Function* GenerateFilter(NYql::NCodegen::ICodegen& codegen, const TString& name) const {
+ auto& module = codegen.GetModule();
+ auto& context = codegen.GetContext();
const auto codegenItem = dynamic_cast<ICodegeneratorExternalNode*>(Item);
@@ -486,7 +486,7 @@ protected:
const auto valueType = Type::getInt128Ty(context);
const auto limitType = Type::getInt64Ty(context);
- const auto containerType = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? static_cast<Type*>(PointerType::getUnqual(valueType)) : static_cast<Type*>(valueType);
+ const auto containerType = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? static_cast<Type*>(PointerType::getUnqual(valueType)) : static_cast<Type*>(valueType);
const auto contextType = GetCompContextType(context);
const auto statusType = IsStream ? Type::getInt32Ty(context) : Type::getInt1Ty(context);
const auto funcType = FunctionType::get(statusType, {PointerType::getUnqual(contextType), containerType, PointerType::getUnqual(limitType), PointerType::getUnqual(valueType)}, false);
@@ -519,7 +519,7 @@ protected:
ReturnInst::Create(context, IsStream ? ConstantInt::get(statusType, static_cast<ui32>(NUdf::EFetchStatus::Finish)) : ConstantInt::getFalse(context), block);
block = init;
- const auto container = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
+ const auto container = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
new LoadInst(valueType, containerArg, "load_container", false, block) : static_cast<Value*>(containerArg);
BranchInst::Create(loop, block);
@@ -595,14 +595,14 @@ private:
DependsOn(Predicate);
}
#ifndef MKQL_DISABLE_CODEGEN
- void GenerateFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void GenerateFunctions(NYql::NCodegen::ICodegen& codegen) final {
FilterFunc = GenerateFilter(codegen, TBaseComputation::MakeName("Fetch"));
- codegen->ExportSymbol(FilterFunc);
+ codegen.ExportSymbol(FilterFunc);
}
- void FinalizeFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void FinalizeFunctions(NYql::NCodegen::ICodegen& codegen) final {
if (FilterFunc)
- Filter = reinterpret_cast<typename TBaseWrapper::TFilterPtr>(codegen->GetPointerToFunction(FilterFunc));
+ Filter = reinterpret_cast<typename TBaseWrapper::TFilterPtr>(codegen.GetPointerToFunction(FilterFunc));
}
#endif
};
@@ -632,14 +632,14 @@ private:
DependsOn(Predicate);
}
#ifndef MKQL_DISABLE_CODEGEN
- void GenerateFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void GenerateFunctions(NYql::NCodegen::ICodegen& codegen) final {
FilterFunc = GenerateFilter(codegen, TBaseComputation::MakeName("Fetch"));
- codegen->ExportSymbol(FilterFunc);
+ codegen.ExportSymbol(FilterFunc);
}
- void FinalizeFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void FinalizeFunctions(NYql::NCodegen::ICodegen& codegen) final {
if (FilterFunc)
- Filter = reinterpret_cast<typename TBaseWrapper::TFilterPtr>(codegen->GetPointerToFunction(FilterFunc));
+ Filter = reinterpret_cast<typename TBaseWrapper::TFilterPtr>(codegen.GetPointerToFunction(FilterFunc));
}
#endif
};
@@ -720,7 +720,7 @@ public:
}
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto codegenItem = dynamic_cast<ICodegeneratorExternalNode*>(Item);
MKQL_ENSURE(codegenItem, "Item must be codegenerator node.");
@@ -780,8 +780,8 @@ public:
const auto fnType = FunctionType::get(bits->getType(), {shr->getType()}, false);
const auto name = "MyAlloc";
- ctx.Codegen->AddGlobalMapping(name, reinterpret_cast<const void*>(&MyAlloc));
- const auto func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType);
+ ctx.Codegen.AddGlobalMapping(name, reinterpret_cast<const void*>(&MyAlloc));
+ const auto func = ctx.Codegen.GetModule().getOrInsertFunction(name, fnType);
const auto ptr = CallInst::Create(func, {shr}, "ptr", block);
bits->addIncoming(ptr, block);
BranchInst::Create(main, block);
@@ -952,8 +952,8 @@ public:
const auto fnType = FunctionType::get(Type::getVoidTy(context), {bits->getType(), shr->getType()}, false);
const auto name = "MyFree";
- ctx.Codegen->AddGlobalMapping(name, reinterpret_cast<const void*>(&MyFree));
- const auto func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType);
+ ctx.Codegen.AddGlobalMapping(name, reinterpret_cast<const void*>(&MyFree));
+ const auto func = ctx.Codegen.GetModule().getOrInsertFunction(name, fnType);
CallInst::Create(func, {bits, shr}, "", block);
out->addIncoming(output, block);
@@ -967,7 +967,7 @@ public:
const auto doFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TListFilterWrapper::MakeLazyList));
const auto ptrType = PointerType::getUnqual(StructType::get(context));
const auto self = CastInst::Create(Instruction::IntToPtr, ConstantInt::get(Type::getInt64Ty(context), uintptr_t(this)), ptrType, "self", block);
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
const auto funType = FunctionType::get(list->getType() , {self->getType(), ctx.Ctx->getType(), list->getType()}, false);
const auto doFuncPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(funType), "function", block);
const auto value = CallInst::Create(funType, doFuncPtr, {self, ctx.Ctx, list}, "value", block);
@@ -996,16 +996,16 @@ private:
DependsOn(Predicate);
}
#ifndef MKQL_DISABLE_CODEGEN
- void GenerateFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void GenerateFunctions(NYql::NCodegen::ICodegen& codegen) final {
TMutableCodegeneratorRootNode<TListFilterWrapper>::GenerateFunctions(codegen);
FilterFunc = GenerateFilter(codegen, TBaseComputation::MakeName("Next"));
- codegen->ExportSymbol(FilterFunc);
+ codegen.ExportSymbol(FilterFunc);
}
- void FinalizeFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void FinalizeFunctions(NYql::NCodegen::ICodegen& codegen) final {
TMutableCodegeneratorRootNode<TListFilterWrapper>::FinalizeFunctions(codegen);
if (FilterFunc)
- Filter = reinterpret_cast<typename TBaseWrapper::TFilterPtr>(codegen->GetPointerToFunction(FilterFunc));
+ Filter = reinterpret_cast<typename TBaseWrapper::TFilterPtr>(codegen.GetPointerToFunction(FilterFunc));
}
#endif
};
@@ -1083,7 +1083,7 @@ public:
}
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto codegenItem = dynamic_cast<ICodegeneratorExternalNode*>(Item);
MKQL_ENSURE(codegenItem, "Item must be codegenerator node.");
@@ -1145,8 +1145,8 @@ public:
const auto fnType = FunctionType::get(bits->getType(), {shr->getType()}, false);
const auto name = "MyAlloc";
- ctx.Codegen->AddGlobalMapping(name, reinterpret_cast<const void*>(&MyAlloc));
- const auto func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType);
+ ctx.Codegen.AddGlobalMapping(name, reinterpret_cast<const void*>(&MyAlloc));
+ const auto func = ctx.Codegen.GetModule().getOrInsertFunction(name, fnType);
const auto ptr = CallInst::Create(func, {shr}, "ptr", block);
bits->addIncoming(ptr, block);
BranchInst::Create(main, block);
@@ -1321,8 +1321,8 @@ public:
const auto fnType = FunctionType::get(Type::getVoidTy(context), {bits->getType(), shr->getType()}, false);
const auto name = "MyFree";
- ctx.Codegen->AddGlobalMapping(name, reinterpret_cast<const void*>(&MyFree));
- const auto func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType);
+ ctx.Codegen.AddGlobalMapping(name, reinterpret_cast<const void*>(&MyFree));
+ const auto func = ctx.Codegen.GetModule().getOrInsertFunction(name, fnType);
CallInst::Create(func, {bits, shr}, "", block);
out->addIncoming(output, block);
@@ -1336,7 +1336,7 @@ public:
const auto doFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TListFilterWithLimitWrapper::MakeLazyList));
const auto ptrType = PointerType::getUnqual(StructType::get(context));
const auto self = CastInst::Create(Instruction::IntToPtr, ConstantInt::get(Type::getInt64Ty(context), uintptr_t(this)), ptrType, "self", block);
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
const auto funType = FunctionType::get(list->getType() , {self->getType(), ctx.Ctx->getType(), list->getType(), limit->getType()}, false);
const auto doFuncPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(funType), "function", block);
const auto value = CallInst::Create(funType, doFuncPtr, {self, ctx.Ctx, list, limit}, "value", block);
@@ -1366,16 +1366,16 @@ private:
DependsOn(Predicate);
}
#ifndef MKQL_DISABLE_CODEGEN
- void GenerateFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void GenerateFunctions(NYql::NCodegen::ICodegen& codegen) final {
TMutableCodegeneratorRootNode<TListFilterWithLimitWrapper>::GenerateFunctions(codegen);
FilterFunc = GenerateFilter(codegen, TBaseComputation::MakeName("Next"));
- codegen->ExportSymbol(FilterFunc);
+ codegen.ExportSymbol(FilterFunc);
}
- void FinalizeFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void FinalizeFunctions(NYql::NCodegen::ICodegen& codegen) final {
TMutableCodegeneratorRootNode<TListFilterWithLimitWrapper>::FinalizeFunctions(codegen);
if (FilterFunc)
- Filter = reinterpret_cast<typename TBaseWrapper::TFilterPtr>(codegen->GetPointerToFunction(FilterFunc));
+ Filter = reinterpret_cast<typename TBaseWrapper::TFilterPtr>(codegen.GetPointerToFunction(FilterFunc));
}
#endif
};
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_flatmap.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_flatmap.cpp
index c9a327237b..bad00e1b3b 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_flatmap.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_flatmap.cpp
@@ -47,7 +47,7 @@ public:
const auto codegenInput = dynamic_cast<ICodegeneratorExternalNode*>(Input);
MKQL_ENSURE(codegenInput, "Input must be codegenerator node.");
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto init = BasicBlock::Create(context, "init", ctx.Func);
const auto next = BasicBlock::Create(context, "next", ctx.Func);
@@ -141,7 +141,7 @@ public:
const auto codegenInput = dynamic_cast<ICodegeneratorExternalNode*>(Input);
MKQL_ENSURE(codegenInput, "Input must be codegenerator node.");
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto init = BasicBlock::Create(context, "init", ctx.Func);
const auto next = BasicBlock::Create(context, "next", ctx.Func);
@@ -239,7 +239,7 @@ public:
const auto codegenInput = dynamic_cast<ICodegeneratorExternalNode*>(Input);
MKQL_ENSURE(codegenInput, "Input must be codegenerator node.");
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto init = BasicBlock::Create(context, "init", ctx.Func);
const auto next = BasicBlock::Create(context, "next", ctx.Func);
@@ -339,7 +339,7 @@ public:
const auto codegenInput = dynamic_cast<ICodegeneratorExternalNode*>(Input);
MKQL_ENSURE(codegenInput, "Input must be codegenerator node.");
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto init = BasicBlock::Create(context, "init", ctx.Func);
const auto next = BasicBlock::Create(context, "next", ctx.Func);
@@ -456,7 +456,7 @@ public:
}
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, Value* statePtr, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto init = BasicBlock::Create(context, "init", ctx.Func);
const auto next = BasicBlock::Create(context, "next", ctx.Func);
@@ -581,7 +581,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto codegenItem = dynamic_cast<ICodegeneratorExternalNode*>(Item);
MKQL_ENSURE(codegenItem, "Item must be codegenerator node.");
@@ -611,7 +611,7 @@ public:
}
Value* DoGenerateGetValue(const TCodegenContext& ctx, Value* currentPtr, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto statusType = Type::getInt32Ty(context);
const auto valueType = Type::getInt128Ty(context);
@@ -768,7 +768,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto loop = BasicBlock::Create(context, "loop", ctx.Func);
const auto work = BasicBlock::Create(context, "work", ctx.Func);
@@ -810,7 +810,7 @@ public:
}
Value* DoGenerateGetValue(const TCodegenContext& ctx, Value* currentPtr, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto statusType = Type::getInt32Ty(context);
const auto valueType = Type::getInt128Ty(context);
@@ -1158,9 +1158,9 @@ protected:
typename std::conditional_t<IsMultiRowPerItem, TStreamCodegenStatefulValue, TStreamCodegenValueStateless>,
typename std::conditional_t<IsMultiRowPerItem, TCustomListCodegenStatefulValue, TCustomListCodegenValue>>;
- Function* GenerateSimpleMapper(const NYql::NCodegen::ICodegen::TPtr& codegen, const TString& name) const {
- auto& module = codegen->GetModule();
- auto& context = codegen->GetContext();
+ Function* GenerateSimpleMapper(NYql::NCodegen::ICodegen& codegen, const TString& name) const {
+ auto& module = codegen.GetModule();
+ auto& context = codegen.GetContext();
const auto codegenItem = dynamic_cast<ICodegeneratorExternalNode*>(Item);
@@ -1170,7 +1170,7 @@ protected:
return f;
const auto valueType = Type::getInt128Ty(context);
- const auto containerType = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? static_cast<Type*>(PointerType::getUnqual(valueType)) : static_cast<Type*>(valueType);
+ const auto containerType = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? static_cast<Type*>(PointerType::getUnqual(valueType)) : static_cast<Type*>(valueType);
const auto contextType = GetCompContextType(context);
const auto statusType = IsInputStream ? Type::getInt32Ty(context) : Type::getInt1Ty(context);
const auto funcType = FunctionType::get(statusType, {PointerType::getUnqual(contextType), containerType, PointerType::getUnqual(valueType)}, false);
@@ -1187,7 +1187,7 @@ protected:
const auto main = BasicBlock::Create(context, "main", ctx.Func);
auto block = main;
- const auto container = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
+ const auto container = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
new LoadInst(valueType, containerArg, "load_container", false, block) : static_cast<Value*>(containerArg);
const auto loop = BasicBlock::Create(context, "loop", ctx.Func);
@@ -1228,9 +1228,9 @@ protected:
return ctx.Func;
}
- Function* GenerateMapper(const NYql::NCodegen::ICodegen::TPtr& codegen, const TString& name) const {
- auto& module = codegen->GetModule();
- auto& context = codegen->GetContext();
+ Function* GenerateMapper(NYql::NCodegen::ICodegen& codegen, const TString& name) const {
+ auto& module = codegen.GetModule();
+ auto& context = codegen.GetContext();
const auto codegenItem = dynamic_cast<ICodegeneratorExternalNode*>(Item);
@@ -1240,7 +1240,7 @@ protected:
return f;
const auto valueType = Type::getInt128Ty(context);
- const auto containerType = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? static_cast<Type*>(PointerType::getUnqual(valueType)) : static_cast<Type*>(valueType);
+ const auto containerType = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? static_cast<Type*>(PointerType::getUnqual(valueType)) : static_cast<Type*>(valueType);
const auto contextType = GetCompContextType(context);
const auto statusType = IsInputStream ? Type::getInt32Ty(context) : Type::getInt1Ty(context);
const auto stateType = ResultContainerOpt ? Type::getInt32Ty(context) : Type::getInt1Ty(context);
@@ -1259,7 +1259,7 @@ protected:
const auto main = BasicBlock::Create(context, "main", ctx.Func);
auto block = main;
- const auto container = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
+ const auto container = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
new LoadInst(valueType, containerArg, "load_container", false, block) : static_cast<Value*>(containerArg);
const auto zero = ConstantInt::get(valueType, 0);
@@ -1372,16 +1372,16 @@ private:
this->DependsOn(this->NewItem);
}
#ifndef MKQL_DISABLE_CODEGEN
- void GenerateFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void GenerateFunctions(NYql::NCodegen::ICodegen& codegen) final {
this->FlatMapFunc = IsMultiRowPerItem ?
this->GenerateMapper(codegen, TBaseComputation::MakeName("Fetch")):
this->GenerateSimpleMapper(codegen, TBaseComputation::MakeName("Fetch"));
- codegen->ExportSymbol(this->FlatMapFunc);
+ codegen.ExportSymbol(this->FlatMapFunc);
}
- void FinalizeFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void FinalizeFunctions(NYql::NCodegen::ICodegen& codegen) final {
if (this->FlatMapFunc)
- this->FlatMap = reinterpret_cast<typename TBaseWrapper::TFlatMapPtr>(codegen->GetPointerToFunction(this->FlatMapFunc));
+ this->FlatMap = reinterpret_cast<typename TBaseWrapper::TFlatMapPtr>(codegen.GetPointerToFunction(this->FlatMapFunc));
}
#endif
};
@@ -1442,7 +1442,7 @@ public:
}
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto codegenItem = dynamic_cast<ICodegeneratorExternalNode*>(this->Item);
MKQL_ENSURE(codegenItem, "Item must be codegenerator node.");
@@ -1496,8 +1496,8 @@ public:
const auto fnType = FunctionType::get(vector->getType(), {size->getType()}, false);
const auto name = "MyArrayAlloc";
- ctx.Codegen->AddGlobalMapping(name, reinterpret_cast<const void*>(&MyArrayAlloc));
- const auto func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType);
+ ctx.Codegen.AddGlobalMapping(name, reinterpret_cast<const void*>(&MyArrayAlloc));
+ const auto func = ctx.Codegen.GetModule().getOrInsertFunction(name, fnType);
const auto ptr = CallInst::Create(func, {size}, "ptr", block);
vector->addIncoming(ptr, block);
BranchInst::Create(main, block);
@@ -1566,14 +1566,14 @@ public:
const auto bytes = BinaryOperator::CreateShl(idx, ConstantInt::get(idx->getType(), 4), "bytes", block);
const auto fnType = FunctionType::get(Type::getVoidTy(context), {pType, pType, bytes->getType(), Type::getInt1Ty(context)}, false);
- const auto func = ctx.Codegen->GetModule().getOrInsertFunction("llvm.memcpy.p0i8.p0i8.i64", fnType);
+ const auto func = ctx.Codegen.GetModule().getOrInsertFunction("llvm.memcpy.p0i8.p0i8.i64", fnType);
CallInst::Create(func, {pdst, psrc, bytes, ConstantInt::getFalse(context)}, "", block);
} else {
const auto factory = ctx.GetFactory();
const auto func = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&THolderFactory::ExtendList<ResultContainerOpt>));
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
const auto funType = FunctionType::get(list->getType(), {factory->getType(), vector->getType(), index->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block);
res = CallInst::Create(funType, funcPtr, {factory, vector, index}, "res", block);
@@ -1593,8 +1593,8 @@ public:
const auto fnType = FunctionType::get(Type::getVoidTy(context), {vector->getType(), size->getType()}, false);
const auto name = "MyArrayFree";
- ctx.Codegen->AddGlobalMapping(name, reinterpret_cast<const void*>(&MyArrayFree));
- const auto func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType);
+ ctx.Codegen.AddGlobalMapping(name, reinterpret_cast<const void*>(&MyArrayFree));
+ const auto func = ctx.Codegen.GetModule().getOrInsertFunction(name, fnType);
CallInst::Create(func, {vector, size}, "", block);
map->addIncoming(res, block);
@@ -1608,7 +1608,7 @@ public:
const auto doFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TListFlatMapWrapper::MakeLazyList));
const auto ptrType = PointerType::getUnqual(StructType::get(context));
const auto self = CastInst::Create(Instruction::IntToPtr, ConstantInt::get(Type::getInt64Ty(context), uintptr_t(this)), ptrType, "self", block);
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
const auto funType = FunctionType::get(list->getType() , {self->getType(), ctx.Ctx->getType(), list->getType()}, false);
const auto doFuncPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(funType), "function", block);
const auto value = CallInst::Create(funType, doFuncPtr, {self, ctx.Ctx, list}, "value", block);
@@ -1636,18 +1636,18 @@ private:
this->DependsOn(this->NewItem);
}
#ifndef MKQL_DISABLE_CODEGEN
- void GenerateFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void GenerateFunctions(NYql::NCodegen::ICodegen& codegen) final {
TMutableCodegeneratorRootNode<TListFlatMapWrapper>::GenerateFunctions(codegen);
this->FlatMapFunc = IsMultiRowPerItem ?
this->GenerateMapper(codegen, TBaseComputation::MakeName("Next")):
this->GenerateSimpleMapper(codegen, TBaseComputation::MakeName("Next"));
- codegen->ExportSymbol(this->FlatMapFunc);
+ codegen.ExportSymbol(this->FlatMapFunc);
}
- void FinalizeFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void FinalizeFunctions(NYql::NCodegen::ICodegen& codegen) final {
TMutableCodegeneratorRootNode<TListFlatMapWrapper>::FinalizeFunctions(codegen);
if (this->FlatMapFunc)
- this->FlatMap = reinterpret_cast<typename TBaseWrapper::TFlatMapPtr>(codegen->GetPointerToFunction(this->FlatMapFunc));
+ this->FlatMap = reinterpret_cast<typename TBaseWrapper::TFlatMapPtr>(codegen.GetPointerToFunction(this->FlatMapFunc));
}
#endif
};
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_flow.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_flow.cpp
index 5d952a1269..dbe5925570 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_flow.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_flow.cpp
@@ -35,7 +35,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, Value* statePtr, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valueType = Type::getInt128Ty(context);
const auto init = BasicBlock::Create(context, "init", ctx.Func);
@@ -132,7 +132,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, Value* statePtr, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valueType = Type::getInt128Ty(context);
const auto main = BasicBlock::Create(context, "main", ctx.Func);
@@ -229,19 +229,19 @@ private:
this->DependsOn(Flow);
}
#ifndef MKQL_DISABLE_CODEGEN
- void GenerateFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void GenerateFunctions(NYql::NCodegen::ICodegen& codegen) final {
FetchFunc = GenerateFetcher(codegen);
- codegen->ExportSymbol(FetchFunc);
+ codegen.ExportSymbol(FetchFunc);
}
- void FinalizeFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void FinalizeFunctions(NYql::NCodegen::ICodegen& codegen) final {
if (FetchFunc)
- Fetch = reinterpret_cast<TStreamCodegenValue::TFetchPtr>(codegen->GetPointerToFunction(FetchFunc));
+ Fetch = reinterpret_cast<TStreamCodegenValue::TFetchPtr>(codegen.GetPointerToFunction(FetchFunc));
}
- Function* GenerateFetcher(const NYql::NCodegen::ICodegen::TPtr& codegen) const {
- auto& module = codegen->GetModule();
- auto& context = codegen->GetContext();
+ Function* GenerateFetcher(NYql::NCodegen::ICodegen& codegen) const {
+ auto& module = codegen.GetModule();
+ auto& context = codegen.GetContext();
const auto& name = TBaseComputation::MakeName("Fetch");
if (const auto f = module.getFunction(name.c_str()))
@@ -315,7 +315,7 @@ public:
}
#ifndef MKQL_DISABLE_CODEGEN
TGenerateResult DoGenGetValues(const TCodegenContext& ctx, Value* statePtr, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valueType = Type::getInt128Ty(context);
const auto indexType = Type::getInt32Ty(context);
const auto values = GetElementPtrInst::CreateInBounds(valueType, ctx.GetMutables(), {ConstantInt::get(indexType, TempStateIndex)}, "values", &ctx.Func->getEntryBlock().back());
@@ -453,19 +453,19 @@ private:
UdfTerminate(res.data());
}
#ifndef MKQL_DISABLE_CODEGEN
- void GenerateFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void GenerateFunctions(NYql::NCodegen::ICodegen& codegen) final {
WideFetchFunc = GenerateFetcher(codegen);
- codegen->ExportSymbol(WideFetchFunc);
+ codegen.ExportSymbol(WideFetchFunc);
}
- void FinalizeFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void FinalizeFunctions(NYql::NCodegen::ICodegen& codegen) final {
if (WideFetchFunc)
- WideFetch = reinterpret_cast<TStreamCodegenValue::TWideFetchPtr>(codegen->GetPointerToFunction(WideFetchFunc));
+ WideFetch = reinterpret_cast<TStreamCodegenValue::TWideFetchPtr>(codegen.GetPointerToFunction(WideFetchFunc));
}
- Function* GenerateFetcher(const NYql::NCodegen::ICodegen::TPtr& codegen) const {
- auto& module = codegen->GetModule();
- auto& context = codegen->GetContext();
+ Function* GenerateFetcher(NYql::NCodegen::ICodegen& codegen) const {
+ auto& module = codegen.GetModule();
+ auto& context = codegen.GetContext();
const auto& name = TBaseComputation::MakeName("WideFetch");
if (const auto f = module.getFunction(name.c_str()))
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_fold.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_fold.cpp
index e9380a2d3b..d3d00d8b3e 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_fold.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_fold.cpp
@@ -36,7 +36,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
llvm::Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto &context = ctx.Codegen->GetContext();
+ auto &context = ctx.Codegen.GetContext();
const auto codegenState = dynamic_cast<ICodegeneratorExternalNode*>(State);
const auto codegenItem = dynamic_cast<ICodegeneratorExternalNode*>(Item);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_fold1.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_fold1.cpp
index 9aca6f3ff7..e5f344a613 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_fold1.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_fold1.cpp
@@ -35,7 +35,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto &context = ctx.Codegen->GetContext();
+ auto &context = ctx.Codegen.GetContext();
const auto codegenState = dynamic_cast<ICodegeneratorExternalNode*>(State);
const auto codegenItem = dynamic_cast<ICodegeneratorExternalNode*>(Item);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_fromstring.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_fromstring.cpp
index c95e0db5a4..6afd780ffa 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_fromstring.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_fromstring.cpp
@@ -71,18 +71,18 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valType = Type::getInt128Ty(context);
const auto psType = Type::getInt8Ty(context);
const auto valTypePtr = PointerType::getUnqual(valType);
const auto name = "DecimalFromString";
- ctx.Codegen->AddGlobalMapping(name, reinterpret_cast<const void*>(&DecimalFromString));
- const auto fnType = NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget() ?
+ ctx.Codegen.AddGlobalMapping(name, reinterpret_cast<const void*>(&DecimalFromString));
+ const auto fnType = NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget() ?
FunctionType::get(valType, { valType, psType, psType }, false):
FunctionType::get(Type::getVoidTy(context), { valTypePtr, valTypePtr, psType, psType }, false);
- const auto func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType);
+ const auto func = ctx.Codegen.GetModule().getOrInsertFunction(name, fnType);
const auto zero = ConstantInt::get(valType, 0ULL);
const auto precision = ConstantInt::get(psType, Precision);
@@ -106,7 +106,7 @@ public:
}
Value* decimal;
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
decimal = CallInst::Create(func, { value, precision, scale }, "from_string", block);
} else {
const auto retPtr = new AllocaInst(valType, 0U, "ret_ptr", block);
@@ -191,18 +191,18 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valType = Type::getInt128Ty(context);
const auto slotType = Type::getInt32Ty(context);
const auto valTypePtr = PointerType::getUnqual(valType);
const auto name = "DataFromString";
- ctx.Codegen->AddGlobalMapping(name, reinterpret_cast<const void*>(&DataFromString));
- const auto fnType = NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget() ?
+ ctx.Codegen.AddGlobalMapping(name, reinterpret_cast<const void*>(&DataFromString));
+ const auto fnType = NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget() ?
FunctionType::get(valType, { valType, slotType }, false):
FunctionType::get(Type::getVoidTy(context), { valTypePtr, valTypePtr, slotType }, false);
- const auto func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType);
+ const auto func = ctx.Codegen.GetModule().getOrInsertFunction(name, fnType);
const auto zero = ConstantInt::get(valType, 0ULL);
const auto slot = ConstantInt::get(slotType, static_cast<ui32>(SchemeType));
@@ -222,7 +222,7 @@ public:
}
Value* data;
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
data = CallInst::Create(func, { value, slot }, "from_string", block);
} else {
const auto retPtr = new AllocaInst(valType, 0U, "ret_ptr", block);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_grace_join.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_grace_join.cpp
index 1224dfcd0b..8da7c7670b 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_grace_join.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_grace_join.cpp
@@ -643,7 +643,7 @@ class TGraceJoinWrapper : public TStatefulWideFlowCodegeneratorNode<TGraceJoinWr
}
#ifndef MKQL_DISABLE_CODEGEN
ICodegeneratorInlineWideNode::TGenerateResult DoGenGetValues(const TCodegenContext& ctx, Value* statePtr, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valueType = Type::getInt128Ty(context);
const auto indexType = Type::getInt32Ty(context);
@@ -823,7 +823,6 @@ EFetchResult TGraceJoinState::FetchValues(TComputationContext& ctx, NUdf::TUnbox
if (!SelfJoinSameKeys_) {
std::copy_n(LeftPacker->TupleHolder.begin(), LeftPacker->TotalColumnsNum, RightPacker->TupleHolder.begin());
}
-
} else {
resultRight = FlowRight->FetchValues(ctx, RightPacker->TuplePtrs.data());
}
@@ -882,7 +881,7 @@ EFetchResult TGraceJoinState::FetchValues(TComputationContext& ctx, NUdf::TUnbox
if ( SelfJoinSameKeys_ ) {
JoinedTablePtr->Join(*LeftPacker->TablePtr, *LeftPacker->TablePtr, JoinKind, *HaveMoreLeftRows, *HaveMoreRightRows);
} else {
- JoinedTablePtr->Join(*LeftPacker->TablePtr, *RightPacker->TablePtr, JoinKind, *HaveMoreLeftRows, *HaveMoreRightRows);
+ JoinedTablePtr->Join(*LeftPacker->TablePtr, *RightPacker->TablePtr, JoinKind, *HaveMoreLeftRows, *HaveMoreRightRows);
}
JoinedTablePtr->ResetIterator();
LeftPacker->EndTime = std::chrono::system_clock::now();
@@ -900,7 +899,7 @@ EFetchResult TGraceJoinState::FetchValues(TComputationContext& ctx, NUdf::TUnbox
IComputationNode* CreateGraceJoin(TCallable& callable, const TComputationNodeFactoryContext& ctx, bool isSelfJoin = false) {
- MKQL_ENSURE(callable.GetInputsCount() == 8, "Expected 8 args");
+ MKQL_ENSURE(callable.GetInputsCount() == 8, "Expected 8 args");
const auto leftFlowNode = callable.GetInput(0);
const auto rightFlowNode = callable.GetInput(1);
@@ -957,8 +956,7 @@ IComputationNode* CreateGraceJoin(TCallable& callable, const TComputationNodeFac
}
IComputationNode* WrapGraceJoin(TCallable& callable, const TComputationNodeFactoryContext& ctx) {
-
- MKQL_ENSURE(callable.GetInputsCount() == 8, "Expected 8 args");
+ MKQL_ENSURE(callable.GetInputsCount() == 8, "Expected 8 args");
const auto leftFlowNode = callable.GetInput(0);
const auto rightFlowNode = callable.GetInput(1);
@@ -1015,8 +1013,7 @@ IComputationNode* WrapGraceJoin(TCallable& callable, const TComputationNodeFacto
}
IComputationNode* WrapSelfJoin(TCallable& callable, const TComputationNodeFactoryContext& ctx) {
-
- MKQL_ENSURE(callable.GetInputsCount() == 7, "Expected 7 args");
+ MKQL_ENSURE(callable.GetInputsCount() == 7, "Expected 7 args");
const auto leftFlowNode = callable.GetInput(0);
const auto leftFlowComponents = GetWideComponents(AS_TYPE(TFlowType, leftFlowNode));
@@ -1059,9 +1056,9 @@ IComputationNode* WrapSelfJoin(TCallable& callable, const TComputationNodeFactor
rightKeyColumns.emplace_back(AS_VALUE(TDataLiteral, rightKeyColumnsNode->GetValue(i))->AsValue().Get<ui32>());
}
- MKQL_ENSURE(leftKeyColumns.size() == rightKeyColumns.size(), "Number of key columns for self join should be equal");
+ MKQL_ENSURE(leftKeyColumns.size() == rightKeyColumns.size(), "Number of key columns for self join should be equal");
-// MKQL_ENSURE(leftKeyColumns == rightKeyColumns, "Key columns for self join should be equal");
+// MKQL_ENSURE(leftKeyColumns == rightKeyColumns, "Key columns for self join should be equal");
rightRenames.reserve(rightRenamesNode->GetValuesCount());
for (ui32 i = 0; i < rightRenamesNode->GetValuesCount(); ++i) {
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_guess.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_guess.cpp
index 0eb5f6a00a..2642cbdb6b 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_guess.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_guess.cpp
@@ -36,7 +36,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
void DoGenerateGetValue(const TCodegenContext& ctx, Value* pointer, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valueType = Type::getInt128Ty(context);
const auto indexType = Type::getInt32Ty(context);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_hasitems.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_hasitems.cpp
index 3fb5f02ae8..4e7e307d78 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_hasitems.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_hasitems.cpp
@@ -29,7 +29,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto collection = GetNodeValue(Collection, ctx, block);
if constexpr (IsOptional) {
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_heap.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_heap.cpp
index c26f85abe0..a77136640f 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_heap.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_heap.cpp
@@ -52,7 +52,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valueType = Type::getInt128Ty(context);
@@ -84,7 +84,7 @@ public:
const auto idxType = Type::getInt32Ty(context);
Value* array = nullptr;
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
const auto funType = FunctionType::get(valueType, {fact->getType(), list->getType(), itemsPtr->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block);
array = CallInst::Create(funType, funcPtr, {fact, list, itemsPtr}, "array", block);
@@ -121,7 +121,7 @@ public:
#endif
private:
void Do(TComputationContext& ctx, NUdf::TUnboxedValuePod* begin, NUdf::TUnboxedValuePod* end) const {
- if (Comparator) {
+ if (ctx.ExecuteLLVM && Comparator) {
return Algorithm(begin, end, std::bind(Comparator, std::ref(ctx), std::placeholders::_1, std::placeholders::_2));
}
@@ -161,15 +161,15 @@ private:
return out.Str();
}
- void FinalizeFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void FinalizeFunctions(NYql::NCodegen::ICodegen& codegen) final {
if (CompareFunc) {
- Comparator = reinterpret_cast<TComparePtr>(codegen->GetPointerToFunction(CompareFunc));
+ Comparator = reinterpret_cast<TComparePtr>(codegen.GetPointerToFunction(CompareFunc));
}
}
- void GenerateFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void GenerateFunctions(NYql::NCodegen::ICodegen& codegen) final {
CompareFunc = GenerateCompareFunction(codegen, MakeName(), Left, Right, Compare);
- codegen->ExportSymbol(CompareFunc);
+ codegen.ExportSymbol(CompareFunc);
}
Function* CompareFunc = nullptr;
@@ -229,7 +229,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valueType = Type::getInt128Ty(context);
@@ -269,7 +269,7 @@ public:
const auto idxType = Type::getInt32Ty(context);
Value* array = nullptr;
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
const auto funType = FunctionType::get(valueType, {fact->getType(), list->getType(), itemsPtr->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block);
array = CallInst::Create(funType, funcPtr, {fact, list, itemsPtr}, "array", block);
@@ -307,7 +307,7 @@ public:
#endif
private:
void Do(TComputationContext& ctx, NUdf::TUnboxedValuePod* begin, NUdf::TUnboxedValuePod* nth, NUdf::TUnboxedValuePod* end) const {
- if (Comparator) {
+ if (ctx.ExecuteLLVM && Comparator) {
return Algorithm(begin, nth, end, std::bind(Comparator, std::ref(ctx), std::placeholders::_1, std::placeholders::_2));
}
@@ -349,15 +349,15 @@ private:
return out.Str();
}
- void FinalizeFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void FinalizeFunctions(NYql::NCodegen::ICodegen& codegen) final {
if (CompareFunc) {
- Comparator = reinterpret_cast<TComparePtr>(codegen->GetPointerToFunction(CompareFunc));
+ Comparator = reinterpret_cast<TComparePtr>(codegen.GetPointerToFunction(CompareFunc));
}
}
- void GenerateFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void GenerateFunctions(NYql::NCodegen::ICodegen& codegen) final {
CompareFunc = GenerateCompareFunction(codegen, MakeName(), Left, Right, Compare);
- codegen->ExportSymbol(CompareFunc);
+ codegen.ExportSymbol(CompareFunc);
}
Function* CompareFunc = nullptr;
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_if.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_if.cpp
index 4767b9b8ed..8b61744364 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_if.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_if.cpp
@@ -29,7 +29,7 @@ public:
}
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto then = BasicBlock::Create(context, "then", ctx.Func);
const auto elsb = BasicBlock::Create(context, "else", ctx.Func);
@@ -104,7 +104,7 @@ public:
}
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, Value* statePtr, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto init = BasicBlock::Create(context, "init", ctx.Func);
const auto test = BasicBlock::Create(context, "test", ctx.Func);
@@ -186,7 +186,7 @@ public:
}
#ifndef MKQL_DISABLE_CODEGEN
TGenerateResult DoGenGetValues(const TCodegenContext& ctx, Value* statePtr, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto init = BasicBlock::Create(context, "init", ctx.Func);
const auto test = BasicBlock::Create(context, "test", ctx.Func);
@@ -234,7 +234,7 @@ public:
std::generate_n(std::back_inserter(getters), right.second.size(), [&]() {
const auto i = idx++;
return [index, lget = left.second[i], rget = right.second[i]](const TCodegenContext& ctx, BasicBlock*& block) {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto then = BasicBlock::Create(context, "then", ctx.Func);
const auto elsb = BasicBlock::Create(context, "elsb", ctx.Func);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_ifpresent.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_ifpresent.cpp
index e017c7ea88..fa36453086 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_ifpresent.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_ifpresent.cpp
@@ -33,7 +33,7 @@ public:
}
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto codegenItem = dynamic_cast<ICodegeneratorExternalNode*>(Item);
MKQL_ENSURE(codegenItem, "Item must be codegenerator node.");
@@ -115,7 +115,7 @@ public:
}
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto codegenItem = dynamic_cast<ICodegeneratorExternalNode*>(Item);
MKQL_ENSURE(codegenItem, "Item must be codegenerator node.");
@@ -197,7 +197,7 @@ public:
}
#ifndef MKQL_DISABLE_CODEGEN
ICodegeneratorInlineWideNode::TGenerateResult DoGenGetValues(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto codegenItem = dynamic_cast<ICodegeneratorExternalNode*>(Item);
MKQL_ENSURE(codegenItem, "Item must be codegenerator node.");
@@ -245,7 +245,7 @@ public:
std::generate_n(std::back_inserter(getters), right.second.size(), [&]() {
const auto i = idx++;
return [codegenItem, lget = left.second[i], rget = right.second[i]](const TCodegenContext& ctx, BasicBlock*& block) {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto pres = BasicBlock::Create(context, "pres", ctx.Func);
const auto miss = BasicBlock::Create(context, "miss", ctx.Func);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_invoke.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_invoke.cpp
index 50e60d9296..c99842bf6c 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_invoke.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_invoke.cpp
@@ -27,7 +27,7 @@ protected:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenGetValue(const TCodegenContext& ctx, Value* arg, BasicBlock*& block) const {
if (IsOptional) {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto good = BasicBlock::Create(context, "good", ctx.Func);
const auto done = BasicBlock::Create(context, "done", ctx.Func);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_iterator.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_iterator.cpp
index 482105485f..55778f58e7 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_iterator.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_iterator.cpp
@@ -22,14 +22,14 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto value = GetNodeValue(List, ctx, block);
const auto factory = ctx.GetFactory();
const auto func = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&THolderFactory::CreateIteratorOverList));
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
const auto signature = FunctionType::get(value->getType(), {factory->getType(), value->getType()}, false);
const auto creator = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(signature), "creator", block);
const auto output = CallInst::Create(signature, creator, {factory, value}, "output", block);
@@ -68,14 +68,14 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto value = GetNodeValue(Stream, ctx, block);
const auto factory = ctx.GetFactory();
const auto func = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&THolderFactory::CreateForwardList));
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
const auto signature = FunctionType::get(value->getType(), {factory->getType(), value->getType()}, false);
const auto creator = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(signature), "creator", block);
const auto output = CallInst::Create(signature, creator, {factory, value}, "output", block);
@@ -183,19 +183,19 @@ private:
}
#ifndef MKQL_DISABLE_CODEGEN
- void GenerateFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void GenerateFunctions(NYql::NCodegen::ICodegen& codegen) final {
NextFunc = GenerateNext(codegen);
- codegen->ExportSymbol(NextFunc);
+ codegen.ExportSymbol(NextFunc);
}
- void FinalizeFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void FinalizeFunctions(NYql::NCodegen::ICodegen& codegen) final {
if (NextFunc)
- Next = reinterpret_cast<TCodegenIterator::TPtr>(codegen->GetPointerToFunction(NextFunc));
+ Next = reinterpret_cast<TCodegenIterator::TPtr>(codegen.GetPointerToFunction(NextFunc));
}
- Function* GenerateNext(const NYql::NCodegen::ICodegen::TPtr& codegen) const {
- auto& module = codegen->GetModule();
- auto& context = codegen->GetContext();
+ Function* GenerateNext(NYql::NCodegen::ICodegen& codegen) const {
+ auto& module = codegen.GetModule();
+ auto& context = codegen.GetContext();
const auto& name = TBaseComputation::MakeName("Next");
if (const auto f = module.getFunction(name.c_str()))
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_join.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_join.cpp
index dbb903565d..3bcc09b7e3 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_join.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_join.cpp
@@ -1157,7 +1157,7 @@ public:
}
#ifndef MKQL_DISABLE_CODEGEN
ICodegeneratorInlineWideNode::TGenerateResult DoGenGetValues(const TCodegenContext& ctx, Value* statePtr, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valueType = Type::getInt128Ty(context);
const auto indexType = Type::getInt32Ty(context);
@@ -1241,7 +1241,7 @@ private:
#ifdef MKQL_DISABLE_CODEGEN
state = ctx.HolderFactory.Create<TValue>(ctx, this, std::bind(&IComputationWideFlowNode::FetchValues, Flow, std::placeholders::_1, std::placeholders::_2));
#else
- state = Fetch && ctx.ExecuteLLVM ?
+ state = ctx.ExecuteLLVM && Fetch ?
ctx.HolderFactory.Create<TValue>(ctx, this, Fetch):
ctx.HolderFactory.Create<TValue>(ctx, this, std::bind(&IComputationWideFlowNode::FetchValues, Flow, std::placeholders::_1, std::placeholders::_2));
#endif
@@ -1275,14 +1275,14 @@ private:
Function* FetchFunc = nullptr;
- void FinalizeFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void FinalizeFunctions(NYql::NCodegen::ICodegen& codegen) final {
if (FetchFunc) {
- Fetch = reinterpret_cast<TFetchPtr>(codegen->GetPointerToFunction(FetchFunc));
+ Fetch = reinterpret_cast<TFetchPtr>(codegen.GetPointerToFunction(FetchFunc));
}
}
- void GenerateFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
- codegen->ExportSymbol(FetchFunc = GenerateFetchFunction(codegen));
+ void GenerateFunctions(NYql::NCodegen::ICodegen& codegen) final {
+ codegen.ExportSymbol(FetchFunc = GenerateFetchFunction(codegen));
}
TString MakeName() const {
@@ -1291,9 +1291,9 @@ private:
return out.Str();
}
- Function* GenerateFetchFunction(const NYql::NCodegen::ICodegen::TPtr& codegen) const {
- auto& module = codegen->GetModule();
- auto& context = codegen->GetContext();
+ Function* GenerateFetchFunction(NYql::NCodegen::ICodegen& codegen) const {
+ auto& module = codegen.GetModule();
+ auto& context = codegen.GetContext();
const auto& name = MakeName();
if (const auto f = module.getFunction(name.c_str()))
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_join_dict.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_join_dict.cpp
index 994ec3a7f7..f22a91884b 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_join_dict.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_join_dict.cpp
@@ -41,7 +41,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
void DoGenerateGetValue(const TCodegenContext& ctx, Value* pointer, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto joinFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TJoinDictWrapper::JoinDicts));
const auto joinFuncArg = ConstantInt::get(Type::getInt64Ty(context), (ui64)this);
@@ -49,7 +49,7 @@ public:
const auto one = GetNodeValue(Dict1, ctx, block);
const auto two = GetNodeValue(Dict2, ctx, block);
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
const auto joinFuncType = FunctionType::get(Type::getInt128Ty(context),
{ joinFuncArg->getType(), ctx.Ctx->getType(), one->getType(), two->getType() }, false);
const auto joinFuncPtr = CastInst::Create(Instruction::IntToPtr, joinFunc, PointerType::getUnqual(joinFuncType), "cast", block);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_lazy_list.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_lazy_list.cpp
index 2678c7f37c..f50e1000ac 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_lazy_list.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_lazy_list.cpp
@@ -33,7 +33,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto factory = ctx.GetFactory();
const auto func = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&THolderFactory::LazyList));
@@ -60,7 +60,7 @@ public:
block = wrap;
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
const auto funType = FunctionType::get(list->getType(), {factory->getType(), list->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block);
const auto res = CallInst::Create(funType, funcPtr, {factory, list}, "res", block);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_length.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_length.cpp
index db5266928c..cf8c1e5ae6 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_length.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_length.cpp
@@ -29,7 +29,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto collection = GetNodeValue(Collection, ctx, block);
if constexpr (IsOptional) {
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_listfromrange.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_listfromrange.cpp
index f1eeeb05af..975443fe3f 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_listfromrange.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_listfromrange.cpp
@@ -254,7 +254,7 @@ public:
}
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valueType = Type::getInt128Ty(context);
const auto startv = GetNodeValue(Start, ctx, block);
@@ -277,7 +277,7 @@ public:
const auto timezone = TzDate ? GetterForTimezone(context, startv, block) : ConstantInt::get(Type::getInt16Ty(context), 0);
const auto func = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TListFromRangeWrapper::MakeList));
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
const auto signature = FunctionType::get(valueType, {ctx.Ctx->getType(), start->getType(), end->getType(), step->getType(), timezone->getType()}, false);
const auto creator = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(signature), "creator", block);
const auto output = CallInst::Create(signature, creator, {ctx.Ctx, start, end, step, timezone}, "output", block);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_logical.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_logical.cpp
index 7a0f69777e..795f4d92bd 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_logical.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_logical.cpp
@@ -44,7 +44,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valueType = Type::getInt128Ty(context);
const auto left = GetNodeValue(this->Left, ctx, block);
@@ -116,7 +116,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valueType = Type::getInt128Ty(context);
const auto left = GetNodeValue(this->Left, ctx, block);
@@ -180,7 +180,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valueType = Type::getInt128Ty(context);
if (IsLeftOptional || IsRightOptional) {
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_lookup.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_lookup.cpp
index 9eeea71ce2..8ef161d424 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_lookup.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_lookup.cpp
@@ -26,7 +26,7 @@ public:
const auto dict = GetNodeValue(Dict, ctx, block);
GetNodeValue(pointer, Key, ctx, block);
- const auto keyp = new LoadInst(Type::getInt128Ty(ctx.Codegen->GetContext()), pointer, "key", block);
+ const auto keyp = new LoadInst(Type::getInt128Ty(ctx.Codegen.GetContext()), pointer, "key", block);
CallBoxedValueVirtualMethod<NUdf::TBoxedValueAccessor::EMethod::Lookup>(pointer, dict, ctx.Codegen, block, pointer);
ValueUnRef(Key->GetRepresentation(), keyp, ctx, block);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_map.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_map.cpp
index 66612e6cf0..02f4867f0c 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_map.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_map.cpp
@@ -29,7 +29,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto codegenItem = dynamic_cast<ICodegeneratorExternalNode*>(Item);
MKQL_ENSURE(codegenItem, "Item must be codegenerator node.");
@@ -185,9 +185,9 @@ protected:
{}
#ifndef MKQL_DISABLE_CODEGEN
- Function* GenerateMapper(const NYql::NCodegen::ICodegen::TPtr& codegen, const TString& name) const {
- auto& module = codegen->GetModule();
- auto& context = codegen->GetContext();
+ Function* GenerateMapper(NYql::NCodegen::ICodegen& codegen, const TString& name) const {
+ auto& module = codegen.GetModule();
+ auto& context = codegen.GetContext();
const auto codegenItem = dynamic_cast<ICodegeneratorExternalNode*>(Item);
@@ -197,7 +197,7 @@ protected:
return f;
const auto valueType = Type::getInt128Ty(context);
- const auto containerType = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? static_cast<Type*>(PointerType::getUnqual(valueType)) : static_cast<Type*>(valueType);
+ const auto containerType = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? static_cast<Type*>(PointerType::getUnqual(valueType)) : static_cast<Type*>(valueType);
const auto contextType = GetCompContextType(context);
const auto statusType = IsStream ? Type::getInt32Ty(context) : Type::getInt1Ty(context);
const auto funcType = FunctionType::get(statusType, {PointerType::getUnqual(contextType), containerType, PointerType::getUnqual(valueType)}, false);
@@ -214,7 +214,7 @@ protected:
const auto main = BasicBlock::Create(context, "main", ctx.Func);
auto block = main;
- const auto container = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
+ const auto container = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
new LoadInst(valueType, containerArg, "load_container", false, block) : static_cast<Value*>(containerArg);
const auto good = BasicBlock::Create(context, "good", ctx.Func);
@@ -278,14 +278,14 @@ private:
DependsOn(NewItem);
}
#ifndef MKQL_DISABLE_CODEGEN
- void GenerateFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void GenerateFunctions(NYql::NCodegen::ICodegen& codegen) final {
MapFunc = GenerateMapper(codegen, TBaseComputation::MakeName("Fetch"));
- codegen->ExportSymbol(MapFunc);
+ codegen.ExportSymbol(MapFunc);
}
- void FinalizeFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void FinalizeFunctions(NYql::NCodegen::ICodegen& codegen) final {
if (MapFunc)
- Map = reinterpret_cast<TMapPtr>(codegen->GetPointerToFunction(MapFunc));
+ Map = reinterpret_cast<TMapPtr>(codegen.GetPointerToFunction(MapFunc));
}
#endif
};
@@ -321,7 +321,7 @@ public:
}
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto codegenItem = dynamic_cast<ICodegeneratorExternalNode*>(Item);
MKQL_ENSURE(codegenItem, "Item must be codegenerator node.");
@@ -390,7 +390,7 @@ public:
const auto doFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TListMapWrapper::MakeLazyList));
const auto ptrType = PointerType::getUnqual(StructType::get(context));
const auto self = CastInst::Create(Instruction::IntToPtr, ConstantInt::get(Type::getInt64Ty(context), uintptr_t(this)), ptrType, "self", block);
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
const auto funType = FunctionType::get(list->getType() , {self->getType(), ctx.Ctx->getType(), list->getType()}, false);
const auto doFuncPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(funType), "function", block);
const auto value = CallInst::Create(funType, doFuncPtr, {self, ctx.Ctx, list}, "value", block);
@@ -419,16 +419,16 @@ private:
DependsOn(NewItem);
}
#ifndef MKQL_DISABLE_CODEGEN
- void GenerateFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void GenerateFunctions(NYql::NCodegen::ICodegen& codegen) final {
TMutableCodegeneratorRootNode<TListMapWrapper>::GenerateFunctions(codegen);
MapFunc = GenerateMapper(codegen, TBaseComputation::MakeName("Next"));
- codegen->ExportSymbol(MapFunc);
+ codegen.ExportSymbol(MapFunc);
}
- void FinalizeFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void FinalizeFunctions(NYql::NCodegen::ICodegen& codegen) final {
TMutableCodegeneratorRootNode<TListMapWrapper>::FinalizeFunctions(codegen);
if (MapFunc)
- Map = reinterpret_cast<TMapPtr>(codegen->GetPointerToFunction(MapFunc));
+ Map = reinterpret_cast<TMapPtr>(codegen.GetPointerToFunction(MapFunc));
}
#endif
};
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_map_join.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_map_join.cpp
index 3bae7d6ad0..ee3acdb85f 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_map_join.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_map_join.cpp
@@ -38,7 +38,7 @@ protected:
#ifndef MKQL_DISABLE_CODEGEN
Value* GenMakeKeysTuple(Value* keysPtr, const ICodegeneratorInlineWideNode::TGettersList& getters, const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto zero = ConstantInt::get(Type::getInt128Ty(context), 0);
const auto keys = getters[LeftKeyColumns.front()](ctx, block);
new StoreInst(keys, keysPtr, block);
@@ -47,7 +47,7 @@ protected:
}
Value* GenMakeKeysTuple(Value* keysPtr, const ICodegeneratorInlineWideNode::TGettersList& getters, Value* itemsPtr, const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto idxType = Type::getInt32Ty(context);
const auto zero = ConstantInt::get(Type::getInt128Ty(context), 0);
@@ -102,7 +102,7 @@ protected:
std::array<Value*, 2U> GenFillOutput(ui32 idx, const TCodegenContext& ctx, const TLeftSideSource& input, ICodegeneratorInlineWideNode::TGettersList& output) const {
GenFillLeftStruct(input, output);
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valueType = Type::getInt128Ty(context);
const auto zero = ConstantInt::get(valueType, 0);
@@ -133,7 +133,7 @@ protected:
const auto to = RightRenames[++i];
const auto kind = OutputRepresentations[to];
output[to] = [from, kind, item, pointer, placeholder, arrayType, valueType](const TCodegenContext& ctx, BasicBlock*& block) {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto index = ConstantInt::get(Type::getInt32Ty(context), from);
const auto pointerType = PointerType::getUnqual(arrayType);
@@ -301,7 +301,7 @@ public:
ICodegeneratorInlineWideNode::TGenerateResult DoGenGetValues(const TCodegenContext& ctx, Value* lookupPtr, BasicBlock*& block) const {
MKQL_ENSURE(!this->Dict->IsTemporaryValue(), "Dict can't be temporary");
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valueType = Type::getInt128Ty(context);
const auto resultType = Type::getInt32Ty(context);
@@ -471,7 +471,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
ICodegeneratorInlineWideNode::TGenerateResult DoGenGetValues(const TCodegenContext& ctx, Value* iteraratorPtr, Value* itemPtr, BasicBlock*& block) const {
MKQL_ENSURE(!this->Dict->IsTemporaryValue(), "Dict can't be temporary");
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto resultType = Type::getInt32Ty(context);
const auto valueType = Type::getInt128Ty(context);
@@ -699,7 +699,7 @@ protected:
}
#ifndef MKQL_DISABLE_CODEGEN
void GenFillLeftStruct(Value* left, Value* items, const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto idxType = Type::getInt32Ty(context);
const auto valType = Type::getInt128Ty(context);
const auto ptrType = PointerType::getUnqual(valType);
@@ -743,7 +743,7 @@ protected:
}
void GenFillRightStruct(Value* right, Value* items, const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto idxType = Type::getInt32Ty(context);
const auto valType = Type::getInt128Ty(context);
const auto ptrType = PointerType::getUnqual(valType);
@@ -787,7 +787,7 @@ protected:
}
Value* GenMakeKeysTuple(Value* keysPtr, Value* current, const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto idxType = Type::getInt32Ty(context);
const auto zero = ConstantInt::get(Type::getInt128Ty(context), 0);
@@ -807,7 +807,7 @@ protected:
}
Value* GenMakeKeysTuple(Value* keysPtr, Value* current, Value* itemsPtr, const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto idxType = Type::getInt32Ty(context);
const auto valueType = Type::getInt128Ty(context);
const auto zero = ConstantInt::get(valueType, 0);
@@ -1013,7 +1013,7 @@ public:
}
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valueType = Type::getInt128Ty(context);
const auto zero = ConstantInt::get(valueType, 0);
@@ -1136,7 +1136,7 @@ public:
}
Value* DoGenerateGetValue(const TCodegenContext& ctx, Value* currentPtr, Value* iteraratorPtr, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valueType = Type::getInt128Ty(context);
const auto zero = ConstantInt::get(valueType, 0);
@@ -1498,19 +1498,19 @@ private:
}
#ifndef MKQL_DISABLE_CODEGEN
- void GenerateFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void GenerateFunctions(NYql::NCodegen::ICodegen& codegen) final {
MapJoinFunc = RightKind == ERightKind::Many ? GenerateStatefulMapper(codegen) : GenerateMapper(codegen);
- codegen->ExportSymbol(MapJoinFunc);
+ codegen.ExportSymbol(MapJoinFunc);
}
- void FinalizeFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void FinalizeFunctions(NYql::NCodegen::ICodegen& codegen) final {
if (MapJoinFunc)
- MapJoin = reinterpret_cast<TMapJoinPtr>(codegen->GetPointerToFunction(MapJoinFunc));
+ MapJoin = reinterpret_cast<TMapJoinPtr>(codegen.GetPointerToFunction(MapJoinFunc));
}
- Function* GenerateMapper(const NYql::NCodegen::ICodegen::TPtr& codegen) const {
- auto& module = codegen->GetModule();
- auto& context = codegen->GetContext();
+ Function* GenerateMapper(NYql::NCodegen::ICodegen& codegen) const {
+ auto& module = codegen.GetModule();
+ auto& context = codegen.GetContext();
const auto& name = TBaseComputation::MakeName("Fetch");
if (const auto f = module.getFunction(name.c_str()))
@@ -1519,7 +1519,7 @@ private:
const auto valueType = Type::getInt128Ty(context);
const auto arrayType = ArrayType::get(valueType, this->OutputRepresentations.size());
const auto keysType = IsTuple ? ArrayType::get(valueType, this->LeftKeyColumns.size()) : nullptr;
- const auto containerType = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? static_cast<Type*>(PointerType::getUnqual(valueType)) : static_cast<Type*>(valueType);
+ const auto containerType = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? static_cast<Type*>(PointerType::getUnqual(valueType)) : static_cast<Type*>(valueType);
const auto contextType = GetCompContextType(context);
const auto idxType = Type::getInt32Ty(context);
const auto statusType = Type::getInt32Ty(context);
@@ -1538,10 +1538,10 @@ private:
const auto main = BasicBlock::Create(context, "main", ctx.Func);
auto block = main;
- const auto stream = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
+ const auto stream = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
new LoadInst(valueType, streamArg, "load_stream", false, block) : static_cast<Value*>(streamArg);
- const auto dict = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
+ const auto dict = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
new LoadInst(valueType, dictArg, "load_dict", false, block) : static_cast<Value*>(dictArg);
const auto zero = ConstantInt::get(valueType, 0);
@@ -1664,9 +1664,9 @@ private:
return ctx.Func;
}
- Function* GenerateStatefulMapper(const NYql::NCodegen::ICodegen::TPtr& codegen) const {
- auto& module = codegen->GetModule();
- auto& context = codegen->GetContext();
+ Function* GenerateStatefulMapper(NYql::NCodegen::ICodegen& codegen) const {
+ auto& module = codegen.GetModule();
+ auto& context = codegen.GetContext();
const auto& name = TBaseComputation::MakeName("Fetch");
if (const auto f = module.getFunction(name.c_str()))
@@ -1675,7 +1675,7 @@ private:
const auto valueType = Type::getInt128Ty(context);
const auto arrayType = ArrayType::get(valueType, this->OutputRepresentations.size());
const auto keysType = IsTuple ? ArrayType::get(valueType, this->LeftKeyColumns.size()) : nullptr;
- const auto containerType = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? static_cast<Type*>(PointerType::getUnqual(valueType)) : static_cast<Type*>(valueType);
+ const auto containerType = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? static_cast<Type*>(PointerType::getUnqual(valueType)) : static_cast<Type*>(valueType);
const auto contextType = GetCompContextType(context);
const auto idxType = Type::getInt32Ty(context);
const auto statusType = Type::getInt32Ty(context);
@@ -1696,10 +1696,10 @@ private:
const auto main = BasicBlock::Create(context, "main", ctx.Func);
auto block = main;
- const auto stream = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
+ const auto stream = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
new LoadInst(valueType, streamArg, "load_stream", false, block) : static_cast<Value*>(streamArg);
- const auto dict = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
+ const auto dict = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
new LoadInst(valueType, dictArg, "load_dict", false, block) : static_cast<Value*>(dictArg);
const auto zero = ConstantInt::get(valueType, 0);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_multimap.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_multimap.cpp
index 9ae50cdea2..96f1508795 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_multimap.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_multimap.cpp
@@ -39,7 +39,7 @@ public:
}
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, Value* statePtr, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto codegenItem = dynamic_cast<ICodegeneratorExternalNode*>(Item);
MKQL_ENSURE(codegenItem, "Item must be codegenerator node.");
@@ -208,7 +208,7 @@ public:
}
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto codegenItem = dynamic_cast<ICodegeneratorExternalNode*>(Item);
MKQL_ENSURE(codegenItem, "Item must be codegenerator node.");
@@ -282,7 +282,7 @@ public:
const auto doFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TListMultiMapWrapper::MakeLazyList));
const auto ptrType = PointerType::getUnqual(StructType::get(context));
const auto self = CastInst::Create(Instruction::IntToPtr, ConstantInt::get(Type::getInt64Ty(context), uintptr_t(this)), ptrType, "self", block);
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
const auto funType = FunctionType::get(list->getType() , {self->getType(), ctx.Ctx->getType(), list->getType()}, false);
const auto doFuncPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(funType), "function", block);
const auto value = CallInst::Create(funType, doFuncPtr, {self, ctx.Ctx, list}, "value", block);
@@ -310,21 +310,21 @@ private:
std::for_each(NewItems.cbegin(), NewItems.cend(), std::bind(&TListMultiMapWrapper::DependsOn, this, std::placeholders::_1));
}
#ifndef MKQL_DISABLE_CODEGEN
- void GenerateFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void GenerateFunctions(NYql::NCodegen::ICodegen& codegen) final {
TMutableCodegeneratorRootNode<TListMultiMapWrapper>::GenerateFunctions(codegen);
MapFunc = GenerateMapper(codegen, TBaseComputation::MakeName("Next"));
- codegen->ExportSymbol(MapFunc);
+ codegen.ExportSymbol(MapFunc);
}
- void FinalizeFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void FinalizeFunctions(NYql::NCodegen::ICodegen& codegen) final {
TMutableCodegeneratorRootNode<TListMultiMapWrapper>::FinalizeFunctions(codegen);
if (MapFunc)
- Map = reinterpret_cast<TMapPtr>(codegen->GetPointerToFunction(MapFunc));
+ Map = reinterpret_cast<TMapPtr>(codegen.GetPointerToFunction(MapFunc));
}
- Function* GenerateMapper(const NYql::NCodegen::ICodegen::TPtr& codegen, const TString& name) const {
- auto& module = codegen->GetModule();
- auto& context = codegen->GetContext();
+ Function* GenerateMapper(NYql::NCodegen::ICodegen& codegen, const TString& name) const {
+ auto& module = codegen.GetModule();
+ auto& context = codegen.GetContext();
const auto codegenItem = dynamic_cast<ICodegeneratorExternalNode*>(Item);
@@ -335,7 +335,7 @@ private:
const auto valueType = Type::getInt128Ty(context);
const auto positionType = Type::getInt64Ty(context);
- const auto containerType = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? static_cast<Type*>(PointerType::getUnqual(valueType)) : static_cast<Type*>(valueType);
+ const auto containerType = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? static_cast<Type*>(PointerType::getUnqual(valueType)) : static_cast<Type*>(valueType);
const auto contextType = GetCompContextType(context);
const auto statusType = Type::getInt1Ty(context);
const auto funcType = FunctionType::get(statusType, {PointerType::getUnqual(contextType), containerType, PointerType::getUnqual(positionType), PointerType::getUnqual(valueType)}, false);
@@ -353,7 +353,7 @@ private:
const auto main = BasicBlock::Create(context, "main", ctx.Func);
auto block = main;
- const auto container = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
+ const auto container = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
new LoadInst(valueType, containerArg, "load_container", false, block) : static_cast<Value*>(containerArg);
const auto position = new LoadInst(positionArg->getType()->getPointerElementType(), positionArg, "position", false, block);
@@ -448,7 +448,7 @@ public:
}
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, Value* statePtr, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valueType = Type::getInt128Ty(context);
const auto state = new LoadInst(valueType, statePtr, "state", block);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_prepend.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_prepend.cpp
index dad32d3326..280ce19128 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_prepend.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_prepend.cpp
@@ -31,7 +31,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto factory = ctx.GetFactory();
@@ -53,7 +53,7 @@ public:
BranchInst::Create(work, done, check, block);
block = work;
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
const auto funType = FunctionType::get(right->getType(), {factory->getType(), left->getType(), right->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block);
const auto res = CallInst::Create(funType, funcPtr, {factory, left, right}, "res", block);
@@ -75,7 +75,7 @@ public:
block = done;
return result;
} else {
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
const auto funType = FunctionType::get(right->getType(), {factory->getType(), left->getType(), right->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block);
const auto res = CallInst::Create(funType, funcPtr, {factory, left, right}, "res", block);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_reduce.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_reduce.cpp
index f2772a990d..a921dad4e6 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_reduce.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_reduce.cpp
@@ -47,7 +47,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto &context = ctx.Codegen->GetContext();
+ auto &context = ctx.Codegen.GetContext();
const auto codegenItem = dynamic_cast<ICodegeneratorExternalNode*>(Item);
const auto codegenState1 = dynamic_cast<ICodegeneratorExternalNode*>(State1);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_removemember.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_removemember.cpp
index 59f36dc2bd..c6bde20aba 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_removemember.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_removemember.cpp
@@ -53,7 +53,7 @@ public:
if (Representations.size() > CodegenArraysFallbackLimit)
return TBaseComputation::DoGenerateGetValue(ctx, block);
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto newSize = Representations.size() - 1U;
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_reverse.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_reverse.cpp
index 21076a9c4f..fd7cbefc65 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_reverse.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_reverse.cpp
@@ -23,7 +23,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto indexType = Type::getInt32Ty(context);
@@ -38,7 +38,7 @@ public:
const auto list = GetNodeValue(List, ctx, block);
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
const auto funType = FunctionType::get(list->getType(), {factory->getType(), builder->getType(), list->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block);
const auto result = CallInst::Create(funType, funcPtr, {factory, builder, list}, "result", block);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_size.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_size.cpp
index 74115e8cbb..88a88b6bf9 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_size.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_size.cpp
@@ -53,7 +53,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto data = GetNodeValue(this->Data, ctx, block);
@@ -107,8 +107,8 @@ public:
const auto fnType = FunctionType::get(Type::getVoidTy(context), {strptr->getType()}, false);
const auto name = "DeleteString";
- ctx.Codegen->AddGlobalMapping(name, reinterpret_cast<const void*>(&DeleteString));
- const auto func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType);
+ ctx.Codegen.AddGlobalMapping(name, reinterpret_cast<const void*>(&DeleteString));
+ const auto func = ctx.Codegen.GetModule().getOrInsertFunction(name, fnType);
CallInst::Create(func, {strptr}, "", block);
result->addIncoming(full, block);
BranchInst::Create(done, block);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_skip.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_skip.cpp
index 90e8c0639f..996a9d1d7e 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_skip.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_skip.cpp
@@ -37,7 +37,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, Value* statePtr, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valueType = Type::getInt128Ty(context);
@@ -146,7 +146,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
TGenerateResult DoGenGetValues(const TCodegenContext& ctx, Value* statePtr, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valueType = Type::getInt128Ty(context);
@@ -299,7 +299,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto factory = ctx.GetFactory();
const auto builder = ctx.GetBuilder();
@@ -310,7 +310,7 @@ public:
const auto cnt = GetNodeValue(Count, ctx, block);
const auto count = GetterFor<ui64>(cnt, context, block);
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
const auto funType = FunctionType::get(list->getType(), {factory->getType(), builder->getType(), list->getType(), count->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block);
const auto result = CallInst::Create(funType, funcPtr, {factory, builder, list, count}, "result", block);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_source.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_source.cpp
index 4939f3558a..d68ad0aaf0 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_source.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_source.cpp
@@ -51,7 +51,7 @@ public:
}
#ifndef MKQL_DISABLE_CODEGEN
TGenerateResult DoGenGetValues(const TCodegenContext& ctx, BasicBlock*&) const {
- return {ConstantInt::get(Type::getInt32Ty(ctx.Codegen->GetContext()), static_cast<i32>(EFetchResult::One)), {}};
+ return {ConstantInt::get(Type::getInt32Ty(ctx.Codegen.GetContext()), static_cast<i32>(EFetchResult::One)), {}};
}
#endif
private:
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_squeeze_to_list.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_squeeze_to_list.cpp
index 1b594bee99..1327e62df0 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_squeeze_to_list.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_squeeze_to_list.cpp
@@ -84,7 +84,7 @@ public:
};
Value* DoGenerateGetValue(const TCodegenContext& ctx, Value* statePtr, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valueType = Type::getInt128Ty(context);
const auto structPtrType = PointerType::getUnqual(StructType::get(context));
@@ -153,7 +153,7 @@ public:
const auto pull = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TState::Pull));
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
const auto pullType = FunctionType::get(valueType, {stateArg->getType(), ctx.Ctx->getType()}, false);
const auto pullPtr = CastInst::Create(Instruction::IntToPtr, pull, PointerType::getUnqual(pullType), "pull", block);
const auto list = CallInst::Create(pullType, pullPtr, {stateArg, ctx.Ctx}, "list", block);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_switch.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_switch.cpp
index af063d3321..84b4c53eec 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_switch.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_switch.cpp
@@ -273,9 +273,9 @@ private:
}
};
- Function* GenerateHandler(ui32 i, const NYql::NCodegen::ICodegen::TPtr& codegen) const {
- auto& module = codegen->GetModule();
- auto& context = codegen->GetContext();
+ Function* GenerateHandler(ui32 i, NYql::NCodegen::ICodegen& codegen) const {
+ auto& module = codegen.GetModule();
+ auto& context = codegen.GetContext();
TStringStream out;
out << this->DebugString() << "::Handler_" << i << "_(" << static_cast<const void*>(this) << ").";
@@ -304,7 +304,7 @@ private:
auto block = main;
- const auto placeholder = NYql::NCodegen::ETarget::Windows == ctx.Codegen->GetEffectiveTarget() ?
+ const auto placeholder = NYql::NCodegen::ETarget::Windows == ctx.Codegen.GetEffectiveTarget() ?
new AllocaInst(valueType, 0U, "placeholder", block) : nullptr;
const auto statePtr = GetElementPtrInst::CreateInBounds(valueType, ctx.GetMutables(), {ConstantInt::get(indexType, static_cast<const IComputationNode*>(this)->GetIndex())}, "state_ptr", block);
@@ -326,7 +326,7 @@ private:
const auto getFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TFlowState::Get));
Value* input;
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
const auto getType = FunctionType::get(valueType, {stateArg->getType(), pos->getType()}, false);
const auto getPtr = CastInst::Create(Instruction::IntToPtr, getFunc, PointerType::getUnqual(getType), "get", block);
input = CallInst::Create(getType, getPtr, {stateArg, pos}, "input", block);
@@ -373,7 +373,7 @@ private:
}
public:
Value* DoGenerateGetValue(const TCodegenContext& ctx, Value* statePtr, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valueType = Type::getInt128Ty(context);
const auto ptrValueType = PointerType::getUnqual(valueType);
@@ -791,19 +791,19 @@ private:
}
};
- void GenerateFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void GenerateFunctions(NYql::NCodegen::ICodegen& codegen) final {
SwitchFunc = GenerateSwitch(codegen);
- codegen->ExportSymbol(SwitchFunc);
+ codegen.ExportSymbol(SwitchFunc);
}
- void FinalizeFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void FinalizeFunctions(NYql::NCodegen::ICodegen& codegen) final {
if (SwitchFunc)
- Switch = reinterpret_cast<TSwitchPtr>(codegen->GetPointerToFunction(SwitchFunc));
+ Switch = reinterpret_cast<TSwitchPtr>(codegen.GetPointerToFunction(SwitchFunc));
}
- Function* GenerateSwitch(const NYql::NCodegen::ICodegen::TPtr& codegen) const {
- auto& module = codegen->GetModule();
- auto& context = codegen->GetContext();
+ Function* GenerateSwitch(NYql::NCodegen::ICodegen& codegen) const {
+ auto& module = codegen.GetModule();
+ auto& context = codegen.GetContext();
const auto& name = this->MakeName("Fetch");
if (const auto f = module.getFunction(name.c_str()))
@@ -812,7 +812,7 @@ private:
const auto valueType = Type::getInt128Ty(context);
const auto ptrValueType = PointerType::getUnqual(valueType);
const auto structPtrType = PointerType::getUnqual(StructType::get(context));
- const auto containerType = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? static_cast<Type*>(ptrValueType) : static_cast<Type*>(valueType);
+ const auto containerType = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? static_cast<Type*>(ptrValueType) : static_cast<Type*>(valueType);
const auto contextType = GetCompContextType(context);
const auto statusType = Type::getInt32Ty(context);
const auto indexType = Type::getInt32Ty(context);
@@ -881,7 +881,7 @@ private:
const auto used = GetMemoryUsed(MemLimit, ctx, block);
- const auto stream = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
+ const auto stream = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
new LoadInst(valueType, containerArg, "load_container", false, block) : static_cast<Value*>(containerArg);
BranchInst::Create(loop, block);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_take.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_take.cpp
index d47120a84b..41e6ba86c7 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_take.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_take.cpp
@@ -33,7 +33,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, Value* statePtr, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valueType = Type::getInt128Ty(context);
@@ -120,7 +120,7 @@ public:
}
#ifndef MKQL_DISABLE_CODEGEN
TGenerateResult DoGenGetValues(const TCodegenContext& ctx, Value* statePtr, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valueType = Type::getInt128Ty(context);
@@ -254,7 +254,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto factory = ctx.GetFactory();
const auto builder = ctx.GetBuilder();
@@ -265,7 +265,7 @@ public:
const auto cnt = GetNodeValue(Count, ctx, block);
const auto count = GetterFor<ui64>(cnt, context, block);
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
const auto funType = FunctionType::get(list->getType(), {factory->getType(), builder->getType(), list->getType(), count->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block);
const auto result = CallInst::Create(funType, funcPtr, {factory, builder, list, count}, "result", block);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_timezone.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_timezone.cpp
index 3d2129e53b..8838143650 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_timezone.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_timezone.cpp
@@ -105,7 +105,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto setz = BasicBlock::Create(context, "setz", ctx.Func);
const auto done = BasicBlock::Create(context, "done", ctx.Func);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_tobytes.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_tobytes.cpp
index 2bd88da4d3..29246ddce2 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_tobytes.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_tobytes.cpp
@@ -32,7 +32,7 @@ public:
const auto mask = ConstantInt::get(value->getType(), APInt(128, 2, two));
const auto result = BinaryOperator::CreateOr(BinaryOperator::CreateAnd(value, mask, "and", block), size, "or", block);
if constexpr (IsOptional)
- return SelectInst::Create(IsExists(value, block), result, GetEmpty(ctx.Codegen->GetContext()), "select", block);
+ return SelectInst::Create(IsExists(value, block), result, GetEmpty(ctx.Codegen.GetContext()), "select", block);
return result;
}
#endif
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_todict.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_todict.cpp
index 700391bf02..c26251ef04 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_todict.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_todict.cpp
@@ -943,7 +943,7 @@ public:
}
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, Value* statePtr, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto codegenItemArg = dynamic_cast<ICodegeneratorExternalNode*>(Item);
MKQL_ENSURE(codegenItemArg, "Item must be codegenerator node.");
@@ -1015,7 +1015,7 @@ public:
const auto build = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TState::Build));
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
const auto funType = FunctionType::get(valueType, {stateArg->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, build, PointerType::getUnqual(funType), "build", block);
const auto dict = CallInst::Create(funType, funcPtr, {stateArg}, "dict", block);
@@ -1136,7 +1136,7 @@ public:
}
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, Value* statePtr, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valueType = Type::getInt128Ty(context);
const auto structPtrType = PointerType::getUnqual(StructType::get(context));
@@ -1211,7 +1211,7 @@ public:
const auto build = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TState::Build));
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
const auto funType = FunctionType::get(valueType, {stateArg->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, build, PointerType::getUnqual(funType), "build", block);
const auto dict = CallInst::Create(funType, funcPtr, {stateArg}, "dict", block);
@@ -1454,7 +1454,7 @@ public:
}
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, Value* statePtr, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto codegenItemArg = dynamic_cast<ICodegeneratorExternalNode*>(Item);
MKQL_ENSURE(codegenItemArg, "Item must be codegenerator node.");
@@ -1527,7 +1527,7 @@ public:
const auto build = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TState::Build));
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
const auto funType = FunctionType::get(valueType, {stateArg->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, build, PointerType::getUnqual(funType), "build", block);
const auto dict = CallInst::Create(funType, funcPtr, {stateArg}, "dict", block);
@@ -1655,7 +1655,7 @@ public:
}
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, Value* statePtr, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valueType = Type::getInt128Ty(context);
const auto structPtrType = PointerType::getUnqual(StructType::get(context));
@@ -1732,7 +1732,7 @@ public:
const auto build = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TState::Build));
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
const auto funType = FunctionType::get(valueType, {stateArg->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, build, PointerType::getUnqual(funType), "build", block);
const auto dict = CallInst::Create(funType, funcPtr, {stateArg}, "dict", block);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_toindexdict.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_toindexdict.cpp
index e6d4a9434f..6593797cfd 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_toindexdict.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_toindexdict.cpp
@@ -23,7 +23,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto indexType = Type::getInt32Ty(context);
@@ -38,7 +38,7 @@ public:
const auto list = GetNodeValue(List, ctx, block);
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
const auto funType = FunctionType::get(list->getType(), {factory->getType(), builder->getType(), list->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block);
const auto result = CallInst::Create(funType, funcPtr, {factory, builder, list}, "result", block);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_tooptional.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_tooptional.cpp
index 56176251e5..25d275709c 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_tooptional.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_tooptional.cpp
@@ -33,7 +33,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
void DoGenerateGetValue(const TCodegenContext& ctx, Value* result, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valueType = Type::getInt128Ty(context);
const auto ptrType = PointerType::getUnqual(valueType);
@@ -129,7 +129,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
void DoGenerateGetValue(const TCodegenContext& ctx, Value* result, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valueType = Type::getInt128Ty(context);
const auto ptrType = PointerType::getUnqual(valueType);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_tostring.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_tostring.cpp
index c442692586..11ed1dc74f 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_tostring.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_tostring.cpp
@@ -57,18 +57,18 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valType = Type::getInt128Ty(context);
const auto psType = Type::getInt8Ty(context);
const auto valTypePtr = PointerType::getUnqual(valType);
const auto name = "DecimalToString";
- ctx.Codegen->AddGlobalMapping(name, reinterpret_cast<const void*>(&DecimalToString));
- const auto fnType = NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget() ?
+ ctx.Codegen.AddGlobalMapping(name, reinterpret_cast<const void*>(&DecimalToString));
+ const auto fnType = NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget() ?
FunctionType::get(valType, { valType, psType, psType }, false):
FunctionType::get(Type::getVoidTy(context), { valTypePtr, valTypePtr, psType, psType }, false);
- const auto func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType);
+ const auto func = ctx.Codegen.GetModule().getOrInsertFunction(name, fnType);
const auto fail = BasicBlock::Create(context, "fail", ctx.Func);
const auto nice = BasicBlock::Create(context, "nice", ctx.Func);
@@ -91,7 +91,7 @@ public:
block = call;
Value* string;
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
string = CallInst::Create(func, { GetterForInt128(value, block), precision, scale }, "to_string", block);
} else {
const auto retPtr = new AllocaInst(valType, 0U, "ret_ptr", block);
@@ -105,7 +105,7 @@ public:
const auto test = CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_EQ, string, zero, "test", block);
BranchInst::Create(fail, nice, test, block);
} else {
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
result = CallInst::Create(func, { GetterForInt128(value, block), precision, scale }, "to_string", block);
} else {
const auto retPtr = new AllocaInst(valType, 0U, "ret_ptr", block);
@@ -163,18 +163,18 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valType = Type::getInt128Ty(context);
const auto slotType = Type::getInt32Ty(context);
const auto valTypePtr = PointerType::getUnqual(valType);
const auto name = "DataToString";
- ctx.Codegen->AddGlobalMapping(name, reinterpret_cast<const void*>(&DataToString));
- const auto fnType = NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget() ?
+ ctx.Codegen.AddGlobalMapping(name, reinterpret_cast<const void*>(&DataToString));
+ const auto fnType = NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget() ?
FunctionType::get(valType, { valType, slotType }, false):
FunctionType::get(Type::getVoidTy(context), { valTypePtr, valTypePtr, slotType }, false);
- const auto func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType);
+ const auto func = ctx.Codegen.GetModule().getOrInsertFunction(name, fnType);
const auto zero = ConstantInt::get(valType, 0ULL);
const auto slot = ConstantInt::get(slotType, static_cast<ui32>(SchemeType));
@@ -192,7 +192,7 @@ public:
block = call;
Value* string;
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
string = CallInst::Create(func, { value, slot }, "to_string", block);
} else {
const auto retPtr = new AllocaInst(valType, 0U, "ret_ptr", block);
@@ -211,7 +211,7 @@ public:
return result;
} else {
Value* string;
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
string = CallInst::Create(func, { value, slot }, "to_string", block);
} else {
const auto retPtr = new AllocaInst(valType, 0U, "ret_ptr", block);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_udf.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_udf.cpp
index 19d27eac7c..61748ae6cd 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_udf.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_udf.cpp
@@ -27,9 +27,9 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
void CreateRun(const TCodegenContext& ctx, BasicBlock*& block, Value* result, Value* args) const final {
- ctx.Codegen->LoadBitCode(ModuleIR, ModuleIRUniqID);
+ ctx.Codegen.LoadBitCode(ModuleIR, ModuleIRUniqID);
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto type = Type::getInt128Ty(context);
YQL_ENSURE(result->getType() == PointerType::getUnqual(type));
@@ -40,7 +40,7 @@ public:
const auto builder = ctx.GetBuilder();
const auto funType = FunctionType::get(Type::getVoidTy(context), {boxed->getType(), result->getType(), builder->getType(), args->getType()}, false);
- const auto runFunc = ctx.Codegen->GetModule().getOrInsertFunction(llvm::StringRef(FunctionName.data(), FunctionName.size()), funType);
+ const auto runFunc = ctx.Codegen.GetModule().getOrInsertFunction(llvm::StringRef(FunctionName.data(), FunctionName.size()), funType);
CallInst::Create(runFunc, {boxed, result, builder, args}, "", block);
}
#endif
@@ -79,7 +79,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
void DoGenerateGetValue(const TCodegenContext& ctx, Value* pointer, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
GetNodeValue(pointer, RunConfigNode, ctx, block);
const auto conf = new LoadInst(Type::getInt128Ty(context), pointer, "conf", block);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_unwrap.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_unwrap.cpp
index 15ed4a0df1..09caba5307 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_unwrap.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_unwrap.cpp
@@ -29,7 +29,7 @@ public:
}
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, Value* value, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto kill = BasicBlock::Create(context, "kill", ctx.Func);
const auto good = BasicBlock::Create(context, "good", ctx.Func);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_varitem.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_varitem.cpp
index d4e097e84b..43111ad9ba 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_varitem.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_varitem.cpp
@@ -32,7 +32,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
void DoGenerateGetValue(const TCodegenContext& ctx, Value* pointer, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valueType = Type::getInt128Ty(context);
const auto indexType = Type::getInt32Ty(context);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_visitall.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_visitall.cpp
index 767ef11dfc..2762dd841c 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_visitall.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_visitall.cpp
@@ -28,7 +28,7 @@ public:
}
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto done = BasicBlock::Create(context, "done", ctx.Func);
@@ -95,7 +95,7 @@ public:
}
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, Value* statePtr, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto init = BasicBlock::Create(context, "init", ctx.Func);
const auto work = BasicBlock::Create(context, "work", ctx.Func);
@@ -190,7 +190,7 @@ public:
}
#ifndef MKQL_DISABLE_CODEGEN
TGenerateResult DoGenGetValues(const TCodegenContext& ctx, Value* statePtr, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto init = BasicBlock::Create(context, "init", ctx.Func);
const auto work = BasicBlock::Create(context, "work", ctx.Func);
@@ -255,7 +255,7 @@ public:
slice.reserve(allGetters.size());
std::transform(allGetters.begin(), allGetters.end(), std::back_inserter(slice), [j = idx++](TGettersList& list) { return std::move(list[j]);});
return [index, slice = std::move(slice)](const TCodegenContext& ctx, BasicBlock*& block) {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto stub = BasicBlock::Create(context, "stub", ctx.Func);
const auto done = BasicBlock::Create(context, "done", ctx.Func);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_way.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_way.cpp
index 1071b8b780..ebb87ae398 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_way.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_way.cpp
@@ -34,7 +34,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valueType = Type::getInt128Ty(context);
const auto indexType = Type::getInt32Ty(context);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_while.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_while.cpp
index ad13b194aa..6f0e84ed5c 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_while.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_while.cpp
@@ -47,7 +47,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, Value* statePtr, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto codegenItem = dynamic_cast<ICodegeneratorExternalNode*>(Item);
MKQL_ENSURE(codegenItem, "Item must be codegenerator node.");
@@ -303,9 +303,9 @@ protected:
{}
#ifndef MKQL_DISABLE_CODEGEN
- Function* GenerateFilter(const NYql::NCodegen::ICodegen::TPtr& codegen, const TString& name) const {
- auto& module = codegen->GetModule();
- auto& context = codegen->GetContext();
+ Function* GenerateFilter(NYql::NCodegen::ICodegen& codegen, const TString& name) const {
+ auto& module = codegen.GetModule();
+ auto& context = codegen.GetContext();
const auto codegenItem = dynamic_cast<ICodegeneratorExternalNode*>(Item);
@@ -315,7 +315,7 @@ protected:
return f;
const auto valueType = Type::getInt128Ty(context);
- const auto containerType = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? static_cast<Type*>(PointerType::getUnqual(valueType)) : static_cast<Type*>(valueType);
+ const auto containerType = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? static_cast<Type*>(PointerType::getUnqual(valueType)) : static_cast<Type*>(valueType);
const auto contextType = GetCompContextType(context);
const auto statusType = IsStream ? Type::getInt32Ty(context) : Type::getInt1Ty(context);
const auto funcType = FunctionType::get(statusType, {PointerType::getUnqual(contextType), containerType, PointerType::getUnqual(valueType), PointerType::getUnqual(valueType)}, false);
@@ -333,7 +333,7 @@ protected:
const auto main = BasicBlock::Create(context, "main", ctx.Func);
auto block = main;
- const auto container = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
+ const auto container = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
new LoadInst(valueType, containerArg, "load_container", false, block) : static_cast<Value*>(containerArg);
const auto good = BasicBlock::Create(context, "good", ctx.Func);
@@ -434,14 +434,14 @@ private:
this->DependsOn(this->Predicate);
}
#ifndef MKQL_DISABLE_CODEGEN
- void GenerateFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void GenerateFunctions(NYql::NCodegen::ICodegen& codegen) final {
this->FilterFunc = this->GenerateFilter(codegen, TBaseComputation::MakeName("Fetch"));
- codegen->ExportSymbol(this->FilterFunc);
+ codegen.ExportSymbol(this->FilterFunc);
}
- void FinalizeFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void FinalizeFunctions(NYql::NCodegen::ICodegen& codegen) final {
if (this->FilterFunc)
- this->Filter = reinterpret_cast<typename TBaseWrapper::TFilterPtr>(codegen->GetPointerToFunction(this->FilterFunc));
+ this->Filter = reinterpret_cast<typename TBaseWrapper::TFilterPtr>(codegen.GetPointerToFunction(this->FilterFunc));
}
#endif
};
@@ -498,7 +498,7 @@ public:
}
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto codegenItem = dynamic_cast<ICodegeneratorExternalNode*>(this->Item);
MKQL_ENSURE(codegenItem, "Item must be codegenerator node.");
@@ -608,7 +608,7 @@ public:
const auto doFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TListWhileWrapper::MakeLazyList));
const auto ptrType = PointerType::getUnqual(StructType::get(context));
const auto self = CastInst::Create(Instruction::IntToPtr, ConstantInt::get(Type::getInt64Ty(context), uintptr_t(this)), ptrType, "self", block);
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
const auto funType = FunctionType::get(list->getType() , {self->getType(), ctx.Ctx->getType(), list->getType()}, false);
const auto doFuncPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(funType), "function", block);
const auto value = CallInst::Create(funType, doFuncPtr, {self, ctx.Ctx, list}, "value", block);
@@ -637,16 +637,16 @@ private:
this->DependsOn(this->Predicate);
}
#ifndef MKQL_DISABLE_CODEGEN
- void GenerateFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void GenerateFunctions(NYql::NCodegen::ICodegen& codegen) final {
TMutableCodegeneratorRootNode<TListWhileWrapper<SkipOrTake, Inclusive>>::GenerateFunctions(codegen);
this->FilterFunc = this->GenerateFilter(codegen, TBaseComputation::MakeName("Next"));
- codegen->ExportSymbol(this->FilterFunc);
+ codegen.ExportSymbol(this->FilterFunc);
}
- void FinalizeFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void FinalizeFunctions(NYql::NCodegen::ICodegen& codegen) final {
TMutableCodegeneratorRootNode<TListWhileWrapper<SkipOrTake, Inclusive>>::FinalizeFunctions(codegen);
if (this->FilterFunc)
- this->Filter = reinterpret_cast<typename TBaseWrapper::TFilterPtr>(codegen->GetPointerToFunction(this->FilterFunc));
+ this->Filter = reinterpret_cast<typename TBaseWrapper::TFilterPtr>(codegen.GetPointerToFunction(this->FilterFunc));
}
#endif
};
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_wide_chain_map.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_wide_chain_map.cpp
index 2c22c09859..0308821d09 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_wide_chain_map.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_wide_chain_map.cpp
@@ -46,7 +46,7 @@ public:
}
#ifndef MKQL_DISABLE_CODEGEN
ICodegeneratorInlineWideNode::TGenerateResult DoGenGetValues(const TCodegenContext& ctx, Value* statePtr, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto flagType = Type::getInt1Ty(context);
const auto flagPtr = new AllocaInst(flagType, 0U, "flag_ptr", &ctx.Func->getEntryBlock().back());
@@ -110,7 +110,7 @@ public:
result.emplace_back([output = Outputs[i]] (const TCodegenContext& ctx, BasicBlock*& block) { return GetNodeValue(output, ctx, block); });
else
result.emplace_back([this, i, source = getres.second, flagPtr, flagType] (const TCodegenContext& ctx, BasicBlock*& block) {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto init = BasicBlock::Create(context, "init", ctx.Func);
const auto next = BasicBlock::Create(context, "next", ctx.Func);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_wide_chopper.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_wide_chopper.cpp
index 3b142e56a8..ab946a7916 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_wide_chopper.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_wide_chopper.cpp
@@ -129,7 +129,7 @@ private:
}
#ifndef MKQL_DISABLE_CODEGEN
TGenerateResult DoGenGetValuesInput(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto load = BasicBlock::Create(context, "load", ctx.Func);
const auto work = BasicBlock::Create(context, "work", ctx.Func);
@@ -193,7 +193,7 @@ public:
TGenerateResult DoGenGetValues(const TCodegenContext& ctx, Value* statePtr, BasicBlock*& block) const {
EnsureDynamicCast<IWideFlowProxyCodegeneratorNode*>(Input)->SetGenerator(std::bind(&TWideChopperWrapper::DoGenGetValuesInput, this, _1, _2));
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto init = BasicBlock::Create(context, "init", ctx.Func);
const auto loop = BasicBlock::Create(context, "loop", ctx.Func);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_wide_combine.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_wide_combine.cpp
index d0460ccf85..68447f79f8 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_wide_combine.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_wide_combine.cpp
@@ -387,7 +387,7 @@ public:
}
#ifndef MKQL_DISABLE_CODEGEN
ICodegeneratorInlineWideNode::TGenerateResult DoGenGetValues(const TCodegenContext& ctx, Value* statePtr, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valueType = Type::getInt128Ty(context);
const auto ptrValueType = PointerType::getUnqual(valueType);
@@ -695,18 +695,18 @@ private:
return out.Str();
}
- void FinalizeFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void FinalizeFunctions(NYql::NCodegen::ICodegen& codegen) final {
if (EqualsFunc) {
- Equals = reinterpret_cast<TEqualsPtr>(codegen->GetPointerToFunction(EqualsFunc));
+ Equals = reinterpret_cast<TEqualsPtr>(codegen.GetPointerToFunction(EqualsFunc));
}
if (HashFunc) {
- Hash = reinterpret_cast<THashPtr>(codegen->GetPointerToFunction(HashFunc));
+ Hash = reinterpret_cast<THashPtr>(codegen.GetPointerToFunction(HashFunc));
}
}
- void GenerateFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
- codegen->ExportSymbol(HashFunc = GenerateHashFunction(codegen, MakeName<false>(), KeyTypes));
- codegen->ExportSymbol(EqualsFunc = GenerateEqualsFunction(codegen, MakeName<true>(), KeyTypes));
+ void GenerateFunctions(NYql::NCodegen::ICodegen& codegen) final {
+ codegen.ExportSymbol(HashFunc = GenerateHashFunction(codegen, MakeName<false>(), KeyTypes));
+ codegen.ExportSymbol(EqualsFunc = GenerateEqualsFunction(codegen, MakeName<true>(), KeyTypes));
}
#endif
};
@@ -762,7 +762,7 @@ public:
}
#ifndef MKQL_DISABLE_CODEGEN
ICodegeneratorInlineWideNode::TGenerateResult DoGenGetValues(const TCodegenContext& ctx, Value* statePtr, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valueType = Type::getInt128Ty(context);
const auto ptrValueType = PointerType::getUnqual(valueType);
@@ -1030,18 +1030,18 @@ private:
return out.Str();
}
- void FinalizeFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void FinalizeFunctions(NYql::NCodegen::ICodegen& codegen) final {
if (EqualsFunc) {
- Equals = reinterpret_cast<TEqualsPtr>(codegen->GetPointerToFunction(EqualsFunc));
+ Equals = reinterpret_cast<TEqualsPtr>(codegen.GetPointerToFunction(EqualsFunc));
}
if (HashFunc) {
- Hash = reinterpret_cast<THashPtr>(codegen->GetPointerToFunction(HashFunc));
+ Hash = reinterpret_cast<THashPtr>(codegen.GetPointerToFunction(HashFunc));
}
}
- void GenerateFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
- codegen->ExportSymbol(HashFunc = GenerateHashFunction(codegen, MakeName<false>(), KeyTypes));
- codegen->ExportSymbol(EqualsFunc = GenerateEqualsFunction(codegen, MakeName<true>(), KeyTypes));
+ void GenerateFunctions(NYql::NCodegen::ICodegen& codegen) final {
+ codegen.ExportSymbol(HashFunc = GenerateHashFunction(codegen, MakeName<false>(), KeyTypes));
+ codegen.ExportSymbol(EqualsFunc = GenerateEqualsFunction(codegen, MakeName<true>(), KeyTypes));
}
#endif
};
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_wide_condense.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_wide_condense.cpp
index a8cce738e2..66e13153d5 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_wide_condense.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_wide_condense.cpp
@@ -106,7 +106,7 @@ public:
}
#ifndef MKQL_DISABLE_CODEGEN
ICodegeneratorInlineWideNode::TGenerateResult DoGenGetValues(const TCodegenContext& ctx, Value* statePtr, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto init = BasicBlock::Create(context, "init", ctx.Func);
const auto next = BasicBlock::Create(context, "next", ctx.Func);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_wide_filter.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_wide_filter.cpp
index 76e1324d8c..a9bf2284af 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_wide_filter.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_wide_filter.cpp
@@ -51,7 +51,7 @@ protected:
std::conditional_t<ReplaceOriginalGetter, ICodegeneratorInlineWideNode::TGettersList, const ICodegeneratorInlineWideNode::TGettersList>& getters,
BasicBlock*& block) const {
if (FilterByField)
- return CastInst::Create(Instruction::Trunc, getters[*FilterByField](ctx, block), Type::getInt1Ty(ctx.Codegen->GetContext()), "predicate", block);
+ return CastInst::Create(Instruction::Trunc, getters[*FilterByField](ctx, block), Type::getInt1Ty(ctx.Codegen.GetContext()), "predicate", block);
for (auto i = 0U; i < Items.size(); ++i)
if (Predicate == Items[i] || Items[i]->GetDependencesCount() > 0U) {
@@ -61,7 +61,7 @@ protected:
}
const auto pred = GetNodeValue(Predicate, ctx, block);
- return CastInst::Create(Instruction::Trunc, pred, Type::getInt1Ty(ctx.Codegen->GetContext()), "predicate", block);
+ return CastInst::Create(Instruction::Trunc, pred, Type::getInt1Ty(ctx.Codegen.GetContext()), "predicate", block);
}
#endif
IComputationWideFlowNode* const Flow;
@@ -98,7 +98,7 @@ public:
}
#ifndef MKQL_DISABLE_CODEGEN
TGenerateResult DoGenGetValues(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto loop = BasicBlock::Create(context, "loop", ctx.Func);
@@ -169,7 +169,7 @@ public:
}
#ifndef MKQL_DISABLE_CODEGEN
TGenerateResult DoGenGetValues(const TCodegenContext& ctx, Value* statePtr, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto init = BasicBlock::Create(context, "init", ctx.Func);
const auto test = BasicBlock::Create(context, "test", ctx.Func);
@@ -272,7 +272,7 @@ public:
}
#ifndef MKQL_DISABLE_CODEGEN
ICodegeneratorInlineWideNode::TGenerateResult DoGenGetValues(const TCodegenContext& ctx, Value* statePtr, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto resultType = Type::getInt32Ty(context);
@@ -354,7 +354,7 @@ public:
}
#ifndef MKQL_DISABLE_CODEGEN
ICodegeneratorInlineWideNode::TGenerateResult DoGenGetValues(const TCodegenContext& ctx, Value* statePtr, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto resultType = Type::getInt32Ty(context);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_wide_map.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_wide_map.cpp
index 4ca15daf5e..09f7383492 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_wide_map.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_wide_map.cpp
@@ -32,7 +32,7 @@ public:
}
#ifndef MKQL_DISABLE_CODEGEN
TGenerateResult DoGenGetValues(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto codegenItem = dynamic_cast<ICodegeneratorExternalNode*>(Item);
MKQL_ENSURE(codegenItem, "Item must be codegenerator node.");
@@ -123,7 +123,7 @@ public:
}
#ifndef MKQL_DISABLE_CODEGEN
TGenerateResult DoGenGetValues(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valueType = Type::getInt128Ty(context);
@@ -205,7 +205,7 @@ public:
}
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto getres = GetNodeValues(Flow, ctx, block);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_wide_top_sort.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_wide_top_sort.cpp
index 80969cfd78..d4e67db3a0 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_wide_top_sort.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_wide_top_sort.cpp
@@ -312,14 +312,14 @@ public:
}
#ifndef MKQL_DISABLE_CODEGEN
ICodegeneratorInlineWideNode::TGenerateResult DoGenGetValues(const TCodegenContext& ctx, Value* statePtr, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valueType = Type::getInt128Ty(context);
const auto ptrValueType = PointerType::getUnqual(valueType);
const auto structPtrType = PointerType::getUnqual(StructType::get(context));
const auto contextType = GetCompContextType(context);
const auto statusType = Type::getInt32Ty(context);
- const auto indexType = Type::getInt32Ty(ctx.Codegen->GetContext());
+ const auto indexType = Type::getInt32Ty(ctx.Codegen.GetContext());
TLLVMFieldsStructureState<HasCount> stateFields(context);
const auto stateType = StructType::get(context, stateFields.GetFieldsArray());
@@ -543,15 +543,15 @@ private:
return out.Str();
}
- void FinalizeFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void FinalizeFunctions(NYql::NCodegen::ICodegen& codegen) final {
if (CompareFunc) {
- Compare = reinterpret_cast<TComparePtr>(codegen->GetPointerToFunction(CompareFunc));
+ Compare = reinterpret_cast<TComparePtr>(codegen.GetPointerToFunction(CompareFunc));
}
}
- void GenerateFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final {
+ void GenerateFunctions(NYql::NCodegen::ICodegen& codegen) final {
if (!HasComplexType) {
- codegen->ExportSymbol(CompareFunc = GenerateCompareFunction(codegen, MakeName(), KeyTypes));
+ codegen.ExportSymbol(CompareFunc = GenerateCompareFunction(codegen, MakeName(), KeyTypes));
}
}
#endif
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_withcontext.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_withcontext.cpp
index 4ffac7caca..f5714b5181 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_withcontext.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_withcontext.cpp
@@ -107,7 +107,7 @@ public:
}
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, Value* statePtr, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valueType = Type::getInt128Ty(context);
const auto structPtrType = PointerType::getUnqual(StructType::get(context));
@@ -189,7 +189,7 @@ public:
ICodegeneratorInlineWideNode::TGenerateResult DoGenGetValues(const TCodegenContext& ctx, Value* statePtr, BasicBlock*& block) const {
Cerr << Flow->DebugString() << Endl;
Y_FAIL("bad");
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valueType = Type::getInt128Ty(context);
const auto indexType = Type::getInt32Ty(context);
diff --git a/ydb/library/yql/minikql/computation/mkql_computation_node_codegen.cpp b/ydb/library/yql/minikql/computation/mkql_computation_node_codegen.cpp
index 9f18e27c39..59f16277bd 100644
--- a/ydb/library/yql/minikql/computation/mkql_computation_node_codegen.cpp
+++ b/ydb/library/yql/minikql/computation/mkql_computation_node_codegen.cpp
@@ -71,7 +71,7 @@ Type* GetCompContextType(LLVMContext &context) {
Value* TCodegenContext::GetFactory() const {
if (!Factory) {
- auto& context = Codegen->GetContext();
+ auto& context = Codegen.GetContext();
const auto indexType = Type::getInt32Ty(context);
const auto ptrType = PointerType::getUnqual(StructType::get(context));
if (Func->getEntryBlock().empty()) {
@@ -87,7 +87,7 @@ Value* TCodegenContext::GetFactory() const {
Value* TCodegenContext::GetStat() const {
if (!Stat) {
- auto& context = Codegen->GetContext();
+ auto& context = Codegen.GetContext();
const auto indexType = Type::getInt32Ty(context);
const auto ptrType = PointerType::getUnqual(StructType::get(context));
if (Func->getEntryBlock().empty()) {
@@ -103,7 +103,7 @@ Value* TCodegenContext::GetStat() const {
Value* TCodegenContext::GetMutables() const {
if (!Mutables) {
- auto& context = Codegen->GetContext();
+ auto& context = Codegen.GetContext();
const auto indexType = Type::getInt32Ty(context);
const auto ptrType = PointerType::getUnqual(Type::getInt128Ty(context));
if (Func->getEntryBlock().empty()) {
@@ -119,7 +119,7 @@ Value* TCodegenContext::GetMutables() const {
Value* TCodegenContext::GetBuilder() const {
if (!Builder) {
- auto& context = Codegen->GetContext();
+ auto& context = Codegen.GetContext();
const auto indexType = Type::getInt32Ty(context);
const auto ptrType = PointerType::getUnqual(StructType::get(context));
if (Func->getEntryBlock().empty()) {
@@ -133,9 +133,9 @@ Value* TCodegenContext::GetBuilder() const {
return Builder;
}
-Function* GenerateCompareFunction(const NYql::NCodegen::ICodegen::TPtr& codegen, const TString& name, IComputationExternalNode* left,
+Function* GenerateCompareFunction(NYql::NCodegen::ICodegen& codegen, const TString& name, IComputationExternalNode* left,
IComputationExternalNode* right, IComputationNode* compare) {
- auto& module = codegen->GetModule();
+ auto& module = codegen.GetModule();
if (const auto f = module.getFunction(name.c_str()))
return f;
@@ -144,13 +144,13 @@ Function* GenerateCompareFunction(const NYql::NCodegen::ICodegen::TPtr& codegen,
MKQL_ENSURE(codegenLeft, "Left must be codegenerator node.");
MKQL_ENSURE(codegenRight, "Right must be codegenerator node.");
- auto& context = codegen->GetContext();
+ auto& context = codegen.GetContext();
const auto valueType = Type::getInt128Ty(context);
const auto ptrType = PointerType::getUnqual(valueType);
const auto returnType = Type::getInt1Ty(context);
const auto contextType = GetCompContextType(context);
- const auto funcType = codegen->GetEffectiveTarget() != NYql::NCodegen::ETarget::Windows ?
+ const auto funcType = codegen.GetEffectiveTarget() != NYql::NCodegen::ETarget::Windows ?
FunctionType::get(returnType, {PointerType::getUnqual(contextType), valueType, valueType}, false):
FunctionType::get(returnType, {PointerType::getUnqual(contextType), ptrType, ptrType}, false);
@@ -201,7 +201,7 @@ Value* GetterFor(NUdf::EDataSlot slot, Value* value, LLVMContext &context, Basic
namespace {
Value* GetMarkFromUnboxed(Value* value, const TCodegenContext& ctx, BasicBlock* block) {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto type8 = Type::getInt8Ty(context);
if (value->getType()->isPointerTy()) {
@@ -223,7 +223,7 @@ Value* GetMarkFromUnboxed(Value* value, const TCodegenContext& ctx, BasicBlock*
template<bool BoxedOrString>
Value* GetPointerFromUnboxed(Value* value, const TCodegenContext& ctx, BasicBlock* block) {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto type32 = Type::getInt32Ty(context);
const auto type64 = Type::getInt64Ty(context);
@@ -261,7 +261,7 @@ Value* GenEqualsFunction(NUdf::EDataSlot slot, Value* lv, Value* rv, TCodegenCon
template <>
Value* GenEqualsFunction<false>(NUdf::EDataSlot slot, Value* lv, Value* rv, TCodegenContext& ctx, BasicBlock*& block) {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto& info = NUdf::GetDataTypeInfo(slot);
@@ -300,7 +300,7 @@ Value* GenEqualsFunction<false>(NUdf::EDataSlot slot, Value* lv, Value* rv, TCod
template <>
Value* GenEqualsFunction<true>(NUdf::EDataSlot slot, Value* lv, Value* rv, TCodegenContext& ctx, BasicBlock*& block) {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto tiny = BasicBlock::Create(context, "tiny", ctx.Func);
const auto test = BasicBlock::Create(context, "test", ctx.Func);
@@ -340,7 +340,7 @@ Value* GenCompareFunction(NUdf::EDataSlot slot, Value* lv, Value* rv, TCodegenCo
template <>
Value* GenCompareFunction<false>(NUdf::EDataSlot slot, Value* lv, Value* rv, TCodegenContext& ctx, BasicBlock*& block) {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto& info = NUdf::GetDataTypeInfo(slot);
@@ -429,7 +429,7 @@ Value* GenCompareFunction<false>(NUdf::EDataSlot slot, Value* lv, Value* rv, TCo
template <>
Value* GenCompareFunction<true>(NUdf::EDataSlot slot, Value* lv, Value* rv, TCodegenContext& ctx, BasicBlock*& block) {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto tiny = BasicBlock::Create(context, "tiny", ctx.Func);
const auto side = BasicBlock::Create(context, "side", ctx.Func);
@@ -509,7 +509,7 @@ Value* GenHashFunction(NUdf::EDataSlot slot, Value* value, TCodegenContext& ctx,
template <>
Value* GenHashFunction<false>(NUdf::EDataSlot slot, Value* value, TCodegenContext& ctx, BasicBlock*& block) {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto& info = NUdf::GetDataTypeInfo(slot);
@@ -565,7 +565,7 @@ Value* GenHashFunction<false>(NUdf::EDataSlot slot, Value* value, TCodegenContex
template <>
Value* GenHashFunction<true>(NUdf::EDataSlot slot, Value* value, TCodegenContext& ctx, BasicBlock*& block) {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto tiny = BasicBlock::Create(context, "tiny", ctx.Func);
const auto test = BasicBlock::Create(context, "test", ctx.Func);
@@ -600,17 +600,17 @@ Value* LoadIfPointer(Value* value, BasicBlock* block) {
}
-Function* GenerateEqualsFunction(const NYql::NCodegen::ICodegen::TPtr& codegen, const TString& name, bool isTuple, const TKeyTypes& types) {
- auto& module = codegen->GetModule();
+Function* GenerateEqualsFunction(NYql::NCodegen::ICodegen& codegen, const TString& name, bool isTuple, const TKeyTypes& types) {
+ auto& module = codegen.GetModule();
if (const auto f = module.getFunction(name.c_str()))
return f;
- auto& context = codegen->GetContext();
+ auto& context = codegen.GetContext();
const auto valueType = Type::getInt128Ty(context);
const auto ptrType = PointerType::getUnqual(valueType);
const auto returnType = Type::getInt1Ty(context);
- const auto funcType = codegen->GetEffectiveTarget() != NYql::NCodegen::ETarget::Windows ?
+ const auto funcType = codegen.GetEffectiveTarget() != NYql::NCodegen::ETarget::Windows ?
FunctionType::get(returnType, {valueType, valueType}, false):
FunctionType::get(returnType, {ptrType, ptrType}, false);
@@ -729,17 +729,17 @@ Function* GenerateEqualsFunction(const NYql::NCodegen::ICodegen::TPtr& codegen,
return ctx.Func;
}
-Function* GenerateHashFunction(const NYql::NCodegen::ICodegen::TPtr& codegen, const TString& name, bool isTuple, const TKeyTypes& types) {
- auto& module = codegen->GetModule();
+Function* GenerateHashFunction(NYql::NCodegen::ICodegen& codegen, const TString& name, bool isTuple, const TKeyTypes& types) {
+ auto& module = codegen.GetModule();
if (const auto f = module.getFunction(name.c_str()))
return f;
- auto& context = codegen->GetContext();
+ auto& context = codegen.GetContext();
const auto valueType = Type::getInt128Ty(context);
const auto ptrType = PointerType::getUnqual(valueType);
const auto returnType = Type::getInt64Ty(context);
- const auto funcType = codegen->GetEffectiveTarget() != NYql::NCodegen::ETarget::Windows ?
+ const auto funcType = codegen.GetEffectiveTarget() != NYql::NCodegen::ETarget::Windows ?
FunctionType::get(returnType, {valueType}, false):
FunctionType::get(returnType, {ptrType}, false);
@@ -818,12 +818,12 @@ Function* GenerateHashFunction(const NYql::NCodegen::ICodegen::TPtr& codegen, co
return ctx.Func;
}
-Function* GenerateEqualsFunction(const NYql::NCodegen::ICodegen::TPtr& codegen, const TString& name, const TKeyTypes& types) {
- auto& module = codegen->GetModule();
+Function* GenerateEqualsFunction(NYql::NCodegen::ICodegen& codegen, const TString& name, const TKeyTypes& types) {
+ auto& module = codegen.GetModule();
if (const auto f = module.getFunction(name.c_str()))
return f;
- auto& context = codegen->GetContext();
+ auto& context = codegen.GetContext();
const auto valueType = Type::getInt128Ty(context);
const auto elementsType = ArrayType::get(valueType, types.size());
const auto ptrType = PointerType::getUnqual(elementsType);
@@ -877,12 +877,12 @@ Function* GenerateEqualsFunction(const NYql::NCodegen::ICodegen::TPtr& codegen,
return ctx.Func;
}
-Function* GenerateHashFunction(const NYql::NCodegen::ICodegen::TPtr& codegen, const TString& name, const TKeyTypes& types) {
- auto& module = codegen->GetModule();
+Function* GenerateHashFunction(NYql::NCodegen::ICodegen& codegen, const TString& name, const TKeyTypes& types) {
+ auto& module = codegen.GetModule();
if (const auto f = module.getFunction(name.c_str()))
return f;
- auto& context = codegen->GetContext();
+ auto& context = codegen.GetContext();
const auto valueType = Type::getInt128Ty(context);
const auto elementsType = ArrayType::get(valueType, types.size());
const auto ptrType = PointerType::getUnqual(elementsType);
@@ -926,12 +926,12 @@ Function* GenerateHashFunction(const NYql::NCodegen::ICodegen::TPtr& codegen, co
return ctx.Func;
}
-Function* GenerateCompareFunction(const NYql::NCodegen::ICodegen::TPtr& codegen, const TString& name, const TKeyTypes& types) {
- auto& module = codegen->GetModule();
+Function* GenerateCompareFunction(NYql::NCodegen::ICodegen& codegen, const TString& name, const TKeyTypes& types) {
+ auto& module = codegen.GetModule();
if (const auto f = module.getFunction(name.c_str()))
return f;
- auto& context = codegen->GetContext();
+ auto& context = codegen.GetContext();
const auto valueType = Type::getInt128Ty(context);
const auto elementsType = ArrayType::get(valueType, types.size());
const auto ptrType = PointerType::getUnqual(elementsType);
@@ -992,7 +992,7 @@ Function* GenerateCompareFunction(const NYql::NCodegen::ICodegen::TPtr& codegen,
}
void GenInvalidate(const TCodegenContext& ctx, const std::vector<std::pair<ui32, EValueRepresentation>>& invalidationSet, BasicBlock*& block) {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto indexType = Type::getInt32Ty(context);
const auto valueType = Type::getInt128Ty(context);
const auto values = ctx.GetMutables();
@@ -1009,7 +1009,7 @@ TUnboxedImmutableCodegeneratorNode::TUnboxedImmutableCodegeneratorNode(TMemoryUs
{}
Value* TUnboxedImmutableCodegeneratorNode::CreateGetValue(const TCodegenContext& ctx, BasicBlock*&) const {
- return ConstantInt::get(Type::getInt128Ty(ctx.Codegen->GetContext()), APInt(128, 2, reinterpret_cast<const uint64_t*>(&UnboxedValue)));
+ return ConstantInt::get(Type::getInt128Ty(ctx.Codegen.GetContext()), APInt(128, 2, reinterpret_cast<const uint64_t*>(&UnboxedValue)));
}
TUnboxedImmutableRunCodegeneratorNode::TUnboxedImmutableRunCodegeneratorNode(TMemoryUsageInfo* memInfo, NUdf::TUnboxedValue&& value)
@@ -1043,24 +1043,24 @@ TString TExternalCodegeneratorRootNode::MakeName(const TString& method) const {
return out.Str();
}
-void TExternalCodegeneratorRootNode::FinalizeFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) {
+void TExternalCodegeneratorRootNode::FinalizeFunctions(NYql::NCodegen::ICodegen& codegen) {
if (GetValueFunc)
- GetFunction = reinterpret_cast<TGetPtr>(codegen->GetPointerToFunction(GetValueFunc));
+ GetFunction = reinterpret_cast<TGetPtr>(codegen.GetPointerToFunction(GetValueFunc));
if (SetValueFunc)
- SetFunction = reinterpret_cast<TSetPtr>(codegen->GetPointerToFunction(SetValueFunc));
+ SetFunction = reinterpret_cast<TSetPtr>(codegen.GetPointerToFunction(SetValueFunc));
}
-void TExternalCodegeneratorRootNode::GenerateFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) {
+void TExternalCodegeneratorRootNode::GenerateFunctions(NYql::NCodegen::ICodegen& codegen) {
GetValueFunc = GenerateGetValue(codegen);
SetValueFunc = GenerateSetValue(codegen);
- codegen->ExportSymbol(GetValueFunc);
- codegen->ExportSymbol(SetValueFunc);
+ codegen.ExportSymbol(GetValueFunc);
+ codegen.ExportSymbol(SetValueFunc);
}
-Function* TExternalCodegeneratorRootNode::GenerateGetValue(const NYql::NCodegen::ICodegen::TPtr& codegen) {
- auto& module = codegen->GetModule();
- auto& context = codegen->GetContext();
+Function* TExternalCodegeneratorRootNode::GenerateGetValue(NYql::NCodegen::ICodegen& codegen) {
+ auto& module = codegen.GetModule();
+ auto& context = codegen.GetContext();
const auto& name = MakeName("Get");
if (const auto f = module.getFunction(name.c_str()))
return f;
@@ -1068,7 +1068,7 @@ Function* TExternalCodegeneratorRootNode::GenerateGetValue(const NYql::NCodegen:
const auto valueType = Type::getInt128Ty(context);
const auto contextType = GetCompContextType(context);
- const auto funcType = codegen->GetEffectiveTarget() != NYql::NCodegen::ETarget::Windows ?
+ const auto funcType = codegen.GetEffectiveTarget() != NYql::NCodegen::ETarget::Windows ?
FunctionType::get(valueType, {PointerType::getUnqual(contextType)}, false):
FunctionType::get(Type::getVoidTy(context), {PointerType::getUnqual(valueType), PointerType::getUnqual(contextType)}, false);
@@ -1076,7 +1076,7 @@ Function* TExternalCodegeneratorRootNode::GenerateGetValue(const NYql::NCodegen:
ctx.Func = cast<Function>(module.getOrInsertFunction(name.c_str(), funcType).getCallee());
auto args = ctx.Func->arg_begin();
- if (codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows) {
+ if (codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows) {
auto& firstArg = *args++;
firstArg.addAttr(Attribute::StructRet);
firstArg.addAttr(Attribute::NoAlias);
@@ -1088,7 +1088,7 @@ Function* TExternalCodegeneratorRootNode::GenerateGetValue(const NYql::NCodegen:
const auto get = CreateGetValue(ctx, main);
- if (codegen->GetEffectiveTarget() != NYql::NCodegen::ETarget::Windows) {
+ if (codegen.GetEffectiveTarget() != NYql::NCodegen::ETarget::Windows) {
ReturnInst::Create(context, get, main);
} else {
new StoreInst(get, &*--args, main);
@@ -1098,16 +1098,16 @@ Function* TExternalCodegeneratorRootNode::GenerateGetValue(const NYql::NCodegen:
return ctx.Func;
}
-Function* TExternalCodegeneratorRootNode::GenerateSetValue(const NYql::NCodegen::ICodegen::TPtr& codegen) {
- auto& module = codegen->GetModule();
- auto& context = codegen->GetContext();
+Function* TExternalCodegeneratorRootNode::GenerateSetValue(NYql::NCodegen::ICodegen& codegen) {
+ auto& module = codegen.GetModule();
+ auto& context = codegen.GetContext();
const auto& name = MakeName("Set");
if (const auto f = module.getFunction(name.c_str()))
return f;
const auto intType = Type::getInt128Ty(context);
const auto contextType = GetCompContextType(context);
- const auto valueType = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
+ const auto valueType = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
(Type*)PointerType::getUnqual(intType) : (Type*)intType;
const auto funcType = FunctionType::get(Type::getVoidTy(context), {PointerType::getUnqual(contextType), valueType}, false);
@@ -1122,7 +1122,7 @@ Function* TExternalCodegeneratorRootNode::GenerateSetValue(const NYql::NCodegen:
const auto valueArg = &*++args;
- if (codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows) {
+ if (codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows) {
const auto value = new LoadInst(valueArg->getType()->getPointerElementType(), valueArg, "load_value", main);
CreateSetValue(ctx, main, value);
} else {
@@ -1144,7 +1144,7 @@ Value* TExternalCodegeneratorNode::CreateGetValue(const TCodegenContext& ctx, Ba
}
MKQL_ENSURE(!Getter, "Wrong LLVM function generation order.");
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto indexType = Type::getInt32Ty(context);
const auto valueType = Type::getInt128Ty(context);
const auto valuePtr = GetElementPtrInst::CreateInBounds(valueType, ctx.GetMutables(), {ConstantInt::get(indexType, ValueIndex)}, "value_ptr", block);
@@ -1155,7 +1155,7 @@ Value* TExternalCodegeneratorNode::CreateGetValue(const TCodegenContext& ctx, Ba
Value* TExternalCodegeneratorNode::CreateRefValue(const TCodegenContext& ctx, BasicBlock*& block) const {
CreateInvalidate(ctx, block);
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto indexType = Type::getInt32Ty(context);
const auto valueType = Type::getInt128Ty(context);
const auto values = ctx.GetMutables();
@@ -1164,7 +1164,7 @@ Value* TExternalCodegeneratorNode::CreateRefValue(const TCodegenContext& ctx, Ba
}
void TExternalCodegeneratorNode::CreateSetValue(const TCodegenContext& ctx, BasicBlock*& block, Value* value) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto indexType = Type::getInt32Ty(context);
const auto valueType = Type::getInt128Ty(context);
const auto values = ctx.GetMutables();
@@ -1201,7 +1201,7 @@ void TExternalCodegeneratorNode::CreateSetValue(const TCodegenContext& ctx, Basi
}
Value* TExternalCodegeneratorNode::CreateSwapValue(const TCodegenContext& ctx, BasicBlock*& block, Value* value) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto indexType = Type::getInt32Ty(context);
const auto valueType = Type::getInt128Ty(context);
const auto values = ctx.GetMutables();
@@ -1422,7 +1422,7 @@ template<> Type* GetTypeFor<float>(LLVMContext &context) { return Type::getFloa
template<> Type* GetTypeFor<double>(LLVMContext &context) { return Type::getDoubleTy(context); }
void AddRefBoxed(Value* value, const TCodegenContext& ctx, BasicBlock*& block) {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto load = value->getType()->isPointerTy() ? new LoadInst(value->getType()->getPointerElementType(), value, "load", block) : value;
const auto half = CastInst::Create(Instruction::Trunc, load, Type::getInt64Ty(context), "half", block);
const auto counterType = Type::getInt32Ty(context);
@@ -1454,7 +1454,7 @@ void AddRefBoxed(Value* value, const TCodegenContext& ctx, BasicBlock*& block) {
}
void UnRefBoxed(Value* value, const TCodegenContext& ctx, BasicBlock*& block) {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto load = value->getType()->isPointerTy() ? new LoadInst(value->getType()->getPointerElementType(), value, "load", block) : value;
const auto half = CastInst::Create(Instruction::Trunc, load, Type::getInt64Ty(context), "half", block);
const auto counterType = Type::getInt32Ty(context);
@@ -1488,8 +1488,8 @@ void UnRefBoxed(Value* value, const TCodegenContext& ctx, BasicBlock*& block) {
const auto fnType = FunctionType::get(Type::getVoidTy(context), {boxptr->getType()}, false);
const auto name = "DeleteBoxed";
- ctx.Codegen->AddGlobalMapping(name, reinterpret_cast<const void*>(&DeleteBoxed));
- const auto func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType).getCallee();
+ ctx.Codegen.AddGlobalMapping(name, reinterpret_cast<const void*>(&DeleteBoxed));
+ const auto func = ctx.Codegen.GetModule().getOrInsertFunction(name, fnType).getCallee();
CallInst::Create(fnType, func, {boxptr}, "", block);
BranchInst::Create(live, block);
@@ -1497,7 +1497,7 @@ void UnRefBoxed(Value* value, const TCodegenContext& ctx, BasicBlock*& block) {
}
void CleanupBoxed(Value* value, const TCodegenContext& ctx, BasicBlock*& block) {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto load = value->getType()->isPointerTy() ? new LoadInst(value->getType()->getPointerElementType(), value, "load", block) : value;
const auto half = CastInst::Create(Instruction::Trunc, load, Type::getInt64Ty(context), "half", block);
const auto counterType = Type::getInt32Ty(context);
@@ -1516,8 +1516,8 @@ void CleanupBoxed(Value* value, const TCodegenContext& ctx, BasicBlock*& block)
const auto fnType = FunctionType::get(Type::getVoidTy(context), {boxptr->getType()}, false);
const auto name = "DeleteBoxed";
- ctx.Codegen->AddGlobalMapping(name, reinterpret_cast<const void*>(&DeleteBoxed));
- const auto func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType).getCallee();
+ ctx.Codegen.AddGlobalMapping(name, reinterpret_cast<const void*>(&DeleteBoxed));
+ const auto func = ctx.Codegen.GetModule().getOrInsertFunction(name, fnType).getCallee();
CallInst::Create(fnType, func, {boxptr}, "", block);
BranchInst::Create(live, block);
@@ -1527,7 +1527,7 @@ void CleanupBoxed(Value* value, const TCodegenContext& ctx, BasicBlock*& block)
template<bool IncOrDec>
void ChangeRefUnboxed(Value* value, const TCodegenContext& ctx, BasicBlock*& block) {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto type8 = Type::getInt8Ty(context);
const auto type32 = Type::getInt32Ty(context);
@@ -1588,7 +1588,7 @@ void ChangeRefUnboxed(Value* value, const TCodegenContext& ctx, BasicBlock*& blo
template<bool Decrement>
void CheckRefUnboxed(Value* value, const TCodegenContext& ctx, BasicBlock*& block) {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto type8 = Type::getInt8Ty(context);
const auto type32 = Type::getInt32Ty(context);
@@ -1638,8 +1638,8 @@ void CheckRefUnboxed(Value* value, const TCodegenContext& ctx, BasicBlock*& bloc
const auto fnType = FunctionType::get(Type::getVoidTy(context), {strptr->getType()}, false);
const auto name = "DeleteString";
- ctx.Codegen->AddGlobalMapping(name, reinterpret_cast<const void*>(&DeleteString));
- const auto func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType).getCallee();
+ ctx.Codegen.AddGlobalMapping(name, reinterpret_cast<const void*>(&DeleteString));
+ const auto func = ctx.Codegen.GetModule().getOrInsertFunction(name, fnType).getCallee();
CallInst::Create(fnType, func, {strptr}, "", block);
BranchInst::Create(nope, block);
}
@@ -1680,8 +1680,8 @@ void CheckRefUnboxed(Value* value, const TCodegenContext& ctx, BasicBlock*& bloc
const auto fnType = FunctionType::get(Type::getVoidTy(context), {boxptr->getType()}, false);
const auto name = "DeleteBoxed";
- ctx.Codegen->AddGlobalMapping(name, reinterpret_cast<const void*>(&DeleteBoxed));
- const auto func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType).getCallee();
+ ctx.Codegen.AddGlobalMapping(name, reinterpret_cast<const void*>(&DeleteBoxed));
+ const auto func = ctx.Codegen.GetModule().getOrInsertFunction(name, fnType).getCallee();
CallInst::Create(fnType, func, {boxptr}, "", block);
BranchInst::Create(nope, block);
@@ -1690,9 +1690,9 @@ void CheckRefUnboxed(Value* value, const TCodegenContext& ctx, BasicBlock*& bloc
block = nope;
}
#ifdef MAKE_UNBOXED_VALUE_LLVM_REFCOUNTION_FUNCTIONS
-Function* GenRefCountFunction(const char* label, void (*func)(Value*, const TCodegenContext&, BasicBlock*&), Type* type, const NYql::NCodegen::ICodegen::TPtr& codegen) {
- auto& module = codegen->GetModule();
- auto& context = codegen->GetContext();
+Function* GenRefCountFunction(const char* label, void (*func)(Value*, const TCodegenContext&, BasicBlock*&), Type* type, NYql::NCodegen::ICodegen& codegen) {
+ auto& module = codegen.GetModule();
+ auto& context = codegen.GetContext();
const auto name = TString(label) += (type->isPointerTy() ? "Ptr" : "Val");
if (const auto f = module.getFunction(name.c_str()))
return f;
@@ -1785,7 +1785,7 @@ void ValueRelease(EValueRepresentation kind, Value* pointer, const TCodegenConte
}
std::pair<Value*, Value*> GetVariantParts(Value* variant, const TCodegenContext& ctx, BasicBlock*& block) {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto type = Type::getInt32Ty(context);
const auto lshr = BinaryOperator::CreateLShr(variant, ConstantInt::get(variant->getType(), 122), "lshr", block);
@@ -1833,7 +1833,7 @@ std::pair<Value*, Value*> GetVariantParts(Value* variant, const TCodegenContext&
}
Value* MakeVariant(Value* item, Value* variant, const TCodegenContext& ctx, BasicBlock*& block) {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto boxed = BasicBlock::Create(context, "boxed", ctx.Func);
const auto embed = BasicBlock::Create(context, "embed", ctx.Func);
@@ -1867,7 +1867,7 @@ Value* MakeVariant(Value* item, Value* variant, const TCodegenContext& ctx, Basi
const auto factory = ctx.GetFactory();
const auto func = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&THolderFactory::CreateBoxedVariantHolder));
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
const auto signature = FunctionType::get(item->getType(), {factory->getType(), item->getType(), variant->getType()}, false);
const auto creator = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(signature), "creator", block);
const auto output = CallInst::Create(signature, creator, {factory, item, variant}, "output", block);
@@ -1893,14 +1893,14 @@ Value* GetNodeValue(IComputationNode* node, const TCodegenContext& ctx, BasicBlo
if (const auto codegen = dynamic_cast<ICodegeneratorInlineNode*>(node))
return codegen->CreateGetValue(ctx, block);
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto ptr = ConstantInt::get(Type::getInt64Ty(context), intptr_t(node));
const auto ptrType = PointerType::getUnqual(StructType::get(context));
const auto nodeThis = CastInst::Create(Instruction::IntToPtr, ptr, ptrType, "node_this", block);
const auto valueType = Type::getInt128Ty(context);
const auto retPtr = new AllocaInst(valueType, 0U, "return_ptr", &ctx.Func->getEntryBlock().back());
- const auto funType = ctx.Codegen->GetEffectiveTarget() != NYql::NCodegen::ETarget::Windows ?
+ const auto funType = ctx.Codegen.GetEffectiveTarget() != NYql::NCodegen::ETarget::Windows ?
FunctionType::get(Type::getVoidTy(context), {retPtr->getType(), nodeThis->getType(), ctx.Ctx->getType()}, false):
FunctionType::get(Type::getVoidTy(context), {nodeThis->getType(), retPtr->getType(), ctx.Ctx->getType()}, false);
const auto ptrFunType = PointerType::getUnqual(funType);
@@ -1911,7 +1911,7 @@ Value* GetNodeValue(IComputationNode* node, const TCodegenContext& ctx, BasicBlo
const auto elem = GetElementPtrInst::CreateInBounds(ptrFunType, table, {ConstantInt::get(Type::getInt64Ty(context), GetMethodIndex(&IComputationNode::GetValue))}, "element", block);
const auto func = new LoadInst(ptrFunType, elem, "func", false, block);
- if (ctx.Codegen->GetEffectiveTarget() != NYql::NCodegen::ETarget::Windows) {
+ if (ctx.Codegen.GetEffectiveTarget() != NYql::NCodegen::ETarget::Windows) {
CallInst::Create(funType, func, {retPtr, nodeThis, ctx.Ctx}, "", block);
} else {
CallInst::Create(funType, func, {nodeThis, retPtr, ctx.Ctx}, "", block);
@@ -1930,12 +1930,12 @@ void GetNodeValue(Value* value, IComputationNode* node, const TCodegenContext& c
return;
}
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto ptr = ConstantInt::get(Type::getInt64Ty(context), intptr_t(node));
const auto ptrType = PointerType::getUnqual(StructType::get(context));
const auto nodeThis = CastInst::Create(Instruction::IntToPtr, ptr, ptrType, "node_this", block);
- const auto funType = ctx.Codegen->GetEffectiveTarget() != NYql::NCodegen::ETarget::Windows ?
+ const auto funType = ctx.Codegen.GetEffectiveTarget() != NYql::NCodegen::ETarget::Windows ?
FunctionType::get(Type::getVoidTy(context), {value->getType(), nodeThis->getType(), ctx.Ctx->getType()}, false):
FunctionType::get(Type::getVoidTy(context), {nodeThis->getType(), value->getType(), ctx.Ctx->getType()}, false);
const auto ptrFunType = PointerType::getUnqual(funType);
@@ -1946,7 +1946,7 @@ void GetNodeValue(Value* value, IComputationNode* node, const TCodegenContext& c
const auto elem = GetElementPtrInst::CreateInBounds(ptrFunType, table, {ConstantInt::get(Type::getInt64Ty(context), GetMethodIndex(&IComputationNode::GetValue))}, "element", block);
const auto func = new LoadInst(ptrFunType, elem, "func", false, block);
- if (ctx.Codegen->GetEffectiveTarget() != NYql::NCodegen::ETarget::Windows) {
+ if (ctx.Codegen.GetEffectiveTarget() != NYql::NCodegen::ETarget::Windows) {
CallInst::Create(funType, func, {value, nodeThis, ctx.Ctx}, "", block);
} else {
CallInst::Create(funType, func, {nodeThis, value, ctx.Ctx}, "", block);
@@ -1960,11 +1960,11 @@ ICodegeneratorInlineWideNode::TGenerateResult GetNodeValues(IComputationWideFlow
}
Value* GenNewArray(const TCodegenContext& ctx, Value* size, Value* items, BasicBlock* block) {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto fact = ctx.GetFactory();
const auto func = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&THolderFactory::CreateDirectArrayHolder));
const auto valueType = Type::getInt128Ty(context);
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
const auto funType = FunctionType::get(valueType, {fact->getType(), size->getType(), items->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block);
return CallInst::Create(funType, funcPtr, {fact, size, items}, "array", block);
@@ -1982,7 +1982,7 @@ Value* GetMemoryUsed(ui64 limit, const TCodegenContext& ctx, BasicBlock* block)
return nullptr;
}
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto fact = ctx.GetFactory();
const auto func = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&THolderFactory::GetMemoryUsed));
const auto funType = FunctionType::get(Type::getInt64Ty(context), {fact->getType()}, false);
@@ -1992,7 +1992,7 @@ Value* GetMemoryUsed(ui64 limit, const TCodegenContext& ctx, BasicBlock* block)
template <bool TrackRss>
Value* CheckAdjustedMemLimit(ui64 limit, Value* init, const TCodegenContext& ctx, BasicBlock*& block) {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
if (!limit || !init) {
return ConstantInt::getFalse(context);
@@ -2040,7 +2040,7 @@ template Value* CheckAdjustedMemLimit<false>(ui64 limit, Value* init, const TCod
template Value* CheckAdjustedMemLimit<true>(ui64 limit, Value* init, const TCodegenContext& ctx, BasicBlock*& block);
Value* WrapArgumentForWindows(Value* arg, const TCodegenContext& ctx, BasicBlock* block) {
- if (ctx.Codegen->GetEffectiveTarget() != NYql::NCodegen::ETarget::Windows) {
+ if (ctx.Codegen.GetEffectiveTarget() != NYql::NCodegen::ETarget::Windows) {
return arg;
}
diff --git a/ydb/library/yql/minikql/computation/mkql_computation_node_codegen.h b/ydb/library/yql/minikql/computation/mkql_computation_node_codegen.h
index fe9db52682..8639a5287a 100644
--- a/ydb/library/yql/minikql/computation/mkql_computation_node_codegen.h
+++ b/ydb/library/yql/minikql/computation/mkql_computation_node_codegen.h
@@ -85,9 +85,9 @@ using namespace llvm;
Type* GetCompContextType(LLVMContext &context);
struct TCodegenContext {
- TCodegenContext(const NYql::NCodegen::ICodegen::TPtr& codegen) : Codegen(codegen) {}
+ TCodegenContext(NYql::NCodegen::ICodegen& codegen) : Codegen(codegen) {}
- const NYql::NCodegen::ICodegen::TPtr& Codegen;
+ NYql::NCodegen::ICodegen& Codegen;
Function* Func = nullptr;
Argument* Ctx = nullptr;
bool AlwaysInline = false;
@@ -109,8 +109,8 @@ using TGeneratorPtr = Value* (*)(Value *const * args, const TCodegenContext& ctx
class ICodegeneratorRootNode {
public:
virtual ~ICodegeneratorRootNode() {}
- virtual void GenerateFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) = 0;
- virtual void FinalizeFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) = 0;
+ virtual void GenerateFunctions(NYql::NCodegen::ICodegen& codegen) = 0;
+ virtual void FinalizeFunctions(NYql::NCodegen::ICodegen& codegen) = 0;
};
class ICodegeneratorInlineNode {
@@ -178,8 +178,8 @@ inline uintptr_t GetMethodPtr(Method method) {
Value* WrapArgumentForWindows(Value* arg, const TCodegenContext& ctx, BasicBlock* block);
template<NUdf::TBoxedValueAccessor::EMethod Method>
-Value* CallBoxedValueVirtualMethod(Type* returnType, Value* value, const NYql::NCodegen::ICodegen::TPtr& codegen, BasicBlock* block) {
- auto& context = codegen->GetContext();
+Value* CallBoxedValueVirtualMethod(Type* returnType, Value* value, NYql::NCodegen::ICodegen& codegen, BasicBlock* block) {
+ auto& context = codegen.GetContext();
const auto data = CastInst::Create(Instruction::Trunc, value, Type::getInt64Ty(context), "data", block);
const auto ptrStructType = PointerType::getUnqual(StructType::get(context));
@@ -199,14 +199,14 @@ Value* CallBoxedValueVirtualMethod(Type* returnType, Value* value, const NYql::N
}
template<NUdf::TBoxedValueAccessor::EMethod Method>
-void CallBoxedValueVirtualMethod(Value* output, Value* value, const NYql::NCodegen::ICodegen::TPtr& codegen, BasicBlock* block) {
- auto& context = codegen->GetContext();
+void CallBoxedValueVirtualMethod(Value* output, Value* value, NYql::NCodegen::ICodegen& codegen, BasicBlock* block) {
+ auto& context = codegen.GetContext();
const auto data = CastInst::Create(Instruction::Trunc, value, Type::getInt64Ty(context), "data", block);
const auto ptrStructType = PointerType::getUnqual(StructType::get(context));
const auto boxed = CastInst::Create(Instruction::IntToPtr, data, ptrStructType, "boxed", block);
- const auto funType = (codegen->GetEffectiveTarget() != NYql::NCodegen::ETarget::Windows) ?
+ const auto funType = (codegen.GetEffectiveTarget() != NYql::NCodegen::ETarget::Windows) ?
FunctionType::get(Type::getVoidTy(context), {output->getType(), boxed->getType()}, false):
FunctionType::get(Type::getVoidTy(context), {boxed->getType(), output->getType()}, false);
const auto ptrFunType = PointerType::getUnqual(funType);
@@ -217,7 +217,7 @@ void CallBoxedValueVirtualMethod(Value* output, Value* value, const NYql::NCodeg
const auto elem = GetElementPtrInst::CreateInBounds(ptrFunType, table, {ConstantInt::get(Type::getInt64Ty(context), GetMethodPtrIndex(NUdf::TBoxedValueAccessor::GetMethodPtr<Method>()))}, "element", block);
const auto func = new LoadInst(ptrFunType, elem, "func", false, block);
- if (codegen->GetEffectiveTarget() != NYql::NCodegen::ETarget::Windows) {
+ if (codegen.GetEffectiveTarget() != NYql::NCodegen::ETarget::Windows) {
CallInst::Create(funType, func, {output, boxed}, "", block);
} else {
CallInst::Create(funType, func, {boxed, output}, "", block);
@@ -225,14 +225,14 @@ void CallBoxedValueVirtualMethod(Value* output, Value* value, const NYql::NCodeg
}
template<NUdf::TBoxedValueAccessor::EMethod Method>
-void CallBoxedValueVirtualMethod(Value* output, Value* value, const NYql::NCodegen::ICodegen::TPtr& codegen, BasicBlock* block, Value* argument) {
- auto& context = codegen->GetContext();
+void CallBoxedValueVirtualMethod(Value* output, Value* value, NYql::NCodegen::ICodegen& codegen, BasicBlock* block, Value* argument) {
+ auto& context = codegen.GetContext();
const auto data = CastInst::Create(Instruction::Trunc, value, Type::getInt64Ty(context), "data", block);
const auto ptrStructType = PointerType::getUnqual(StructType::get(context));
const auto boxed = CastInst::Create(Instruction::IntToPtr, data, ptrStructType, "boxed", block);
- const auto funType = (codegen->GetEffectiveTarget() != NYql::NCodegen::ETarget::Windows) ?
+ const auto funType = (codegen.GetEffectiveTarget() != NYql::NCodegen::ETarget::Windows) ?
FunctionType::get(Type::getVoidTy(context), {output->getType(), boxed->getType(), argument->getType()}, false):
FunctionType::get(Type::getVoidTy(context), {boxed->getType(), output->getType(), argument->getType()}, false);
const auto ptrFunType = PointerType::getUnqual(funType);
@@ -243,7 +243,7 @@ void CallBoxedValueVirtualMethod(Value* output, Value* value, const NYql::NCodeg
const auto elem = GetElementPtrInst::CreateInBounds(ptrFunType, table, {ConstantInt::get(Type::getInt64Ty(context), GetMethodPtrIndex(NUdf::TBoxedValueAccessor::GetMethodPtr<Method>()))}, "element", block);
const auto func = new LoadInst(ptrFunType, elem, "func", false, block);
- if (codegen->GetEffectiveTarget() != NYql::NCodegen::ETarget::Windows) {
+ if (codegen.GetEffectiveTarget() != NYql::NCodegen::ETarget::Windows) {
CallInst::Create(funType, func, {output, boxed, argument}, "", block);
} else {
CallInst::Create(funType, func, {boxed, output, argument}, "", block);
@@ -251,8 +251,8 @@ void CallBoxedValueVirtualMethod(Value* output, Value* value, const NYql::NCodeg
}
template<NUdf::TBoxedValueAccessor::EMethod Method>
-Value* CallBoxedValueVirtualMethod(Type* returnType, Value* value, const NYql::NCodegen::ICodegen::TPtr& codegen, BasicBlock* block, Value* argument) {
- auto& context = codegen->GetContext();
+Value* CallBoxedValueVirtualMethod(Type* returnType, Value* value, NYql::NCodegen::ICodegen& codegen, BasicBlock* block, Value* argument) {
+ auto& context = codegen.GetContext();
const auto data = CastInst::Create(Instruction::Trunc, value, Type::getInt64Ty(context), "data", block);
const auto ptrStructType = PointerType::getUnqual(StructType::get(context));
@@ -272,14 +272,14 @@ Value* CallBoxedValueVirtualMethod(Type* returnType, Value* value, const NYql::N
}
template<NUdf::TBoxedValueAccessor::EMethod Method>
-void CallBoxedValueVirtualMethod(Value* output, Value* value, const NYql::NCodegen::ICodegen::TPtr& codegen, BasicBlock* block, Value* arg1, Value* arg2) {
- auto& context = codegen->GetContext();
+void CallBoxedValueVirtualMethod(Value* output, Value* value, NYql::NCodegen::ICodegen& codegen, BasicBlock* block, Value* arg1, Value* arg2) {
+ auto& context = codegen.GetContext();
const auto data = CastInst::Create(Instruction::Trunc, value, Type::getInt64Ty(context), "data", block);
const auto ptrStructType = PointerType::getUnqual(StructType::get(context));
const auto boxed = CastInst::Create(Instruction::IntToPtr, data, ptrStructType, "boxed", block);
- const auto funType = (codegen->GetEffectiveTarget() != NYql::NCodegen::ETarget::Windows) ?
+ const auto funType = (codegen.GetEffectiveTarget() != NYql::NCodegen::ETarget::Windows) ?
FunctionType::get(Type::getVoidTy(context), {output->getType(), boxed->getType(), arg1->getType(), arg2->getType()}, false):
FunctionType::get(Type::getVoidTy(context), {boxed->getType(), output->getType(), arg1->getType(), arg2->getType()}, false);
const auto ptrFunType = PointerType::getUnqual(funType);
@@ -290,7 +290,7 @@ void CallBoxedValueVirtualMethod(Value* output, Value* value, const NYql::NCodeg
const auto elem = GetElementPtrInst::CreateInBounds(ptrFunType, table, {ConstantInt::get(Type::getInt64Ty(context), GetMethodPtrIndex(NUdf::TBoxedValueAccessor::GetMethodPtr<Method>()))}, "element", block);
const auto func = new LoadInst(ptrFunType, elem, "func", false, block);
- if (codegen->GetEffectiveTarget() != NYql::NCodegen::ETarget::Windows) {
+ if (codegen.GetEffectiveTarget() != NYql::NCodegen::ETarget::Windows) {
CallInst::Create(funType, func, {output, boxed, arg1, arg2}, "", block);
} else {
CallInst::Create(funType, func, {boxed, output, arg1, arg2}, "", block);
@@ -298,8 +298,8 @@ void CallBoxedValueVirtualMethod(Value* output, Value* value, const NYql::NCodeg
}
template<NUdf::TBoxedValueAccessor::EMethod Method>
-Value* CallBoxedValueVirtualMethod(Type* returnType, Value* value, const NYql::NCodegen::ICodegen::TPtr& codegen, BasicBlock* block, Value* arg1, Value* arg2) {
- auto& context = codegen->GetContext();
+Value* CallBoxedValueVirtualMethod(Type* returnType, Value* value, NYql::NCodegen::ICodegen& codegen, BasicBlock* block, Value* arg1, Value* arg2) {
+ auto& context = codegen.GetContext();
const auto data = CastInst::Create(Instruction::Trunc, value, Type::getInt64Ty(context), "data", block);
const auto ptrStructType = PointerType::getUnqual(StructType::get(context));
@@ -319,11 +319,11 @@ Value* CallBoxedValueVirtualMethod(Type* returnType, Value* value, const NYql::N
}
template<typename Method>
-Value* CallUnaryUnboxedValueFunction(Method method, Type* result, Value* arg, const NYql::NCodegen::ICodegen::TPtr& codegen, BasicBlock* block)
+Value* CallUnaryUnboxedValueFunction(Method method, Type* result, Value* arg, NYql::NCodegen::ICodegen& codegen, BasicBlock* block)
{
- auto& context = codegen->GetContext();
+ auto& context = codegen.GetContext();
const auto doFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(method));
- if (NYql::NCodegen::ETarget::Windows != codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != codegen.GetEffectiveTarget()) {
const auto funType = FunctionType::get(result, {arg->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(funType), "ptr", block);
const auto call = CallInst::Create(funType, funcPtr, {arg}, "call", block);
@@ -349,11 +349,11 @@ Value* CallUnaryUnboxedValueFunction(Method method, Type* result, Value* arg, co
}
template<typename Method>
-Value* CallBinaryUnboxedValueFunction(Method method, Type* result, Value* left, Value* right, const NYql::NCodegen::ICodegen::TPtr& codegen, BasicBlock* block)
+Value* CallBinaryUnboxedValueFunction(Method method, Type* result, Value* left, Value* right, NYql::NCodegen::ICodegen& codegen, BasicBlock* block)
{
- auto& context = codegen->GetContext();
+ auto& context = codegen.GetContext();
const auto doFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(method));
- if (NYql::NCodegen::ETarget::Windows != codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != codegen.GetEffectiveTarget()) {
const auto funType = FunctionType::get(result, {left->getType(), right->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(funType), "ptr", block);
const auto call = CallInst::Create(funType, funcPtr, {left, right}, "call", block);
@@ -401,19 +401,19 @@ struct TNoCodegen {};
ICodegeneratorInlineWideNode::TGenerateResult GetNodeValues(IComputationWideFlowNode* node, const TCodegenContext& ctx, BasicBlock*& block);
Function* GenerateCompareFunction(
- const NYql::NCodegen::ICodegen::TPtr& codegen,
+ NYql::NCodegen::ICodegen& codegen,
const TString& name,
IComputationExternalNode* left,
IComputationExternalNode* right,
IComputationNode* compare
);
-Function* GenerateEqualsFunction(const NYql::NCodegen::ICodegen::TPtr& codegen, const TString& name, bool isTuple, const TKeyTypes& types);
-Function* GenerateHashFunction(const NYql::NCodegen::ICodegen::TPtr& codegen, const TString& name, bool isTuple, const TKeyTypes& types);
+Function* GenerateEqualsFunction(NYql::NCodegen::ICodegen& codegen, const TString& name, bool isTuple, const TKeyTypes& types);
+Function* GenerateHashFunction(NYql::NCodegen::ICodegen& codegen, const TString& name, bool isTuple, const TKeyTypes& types);
-Function* GenerateEqualsFunction(const NYql::NCodegen::ICodegen::TPtr& codegen, const TString& name, const TKeyTypes& types);
-Function* GenerateHashFunction(const NYql::NCodegen::ICodegen::TPtr& codegen, const TString& name, const TKeyTypes& types);
-Function* GenerateCompareFunction(const NYql::NCodegen::ICodegen::TPtr& codegen, const TString& name, const TKeyTypes& types);
+Function* GenerateEqualsFunction(NYql::NCodegen::ICodegen& codegen, const TString& name, const TKeyTypes& types);
+Function* GenerateHashFunction(NYql::NCodegen::ICodegen& codegen, const TString& name, const TKeyTypes& types);
+Function* GenerateCompareFunction(NYql::NCodegen::ICodegen& codegen, const TString& name, const TKeyTypes& types);
template <typename TDerived>
class TDecoratorCodegeneratorNode: public TDecoratorComputationNode<TDerived>, public ICodegeneratorInlineNode
@@ -432,7 +432,7 @@ protected:
const auto arg = GetNodeValue(this->Node, ctx, block);
const auto value = static_cast<const TDerived*>(this)->DoGenerateGetValue(ctx, arg, block);
if (value->getType()->isPointerTy()) {
- const auto load = new LoadInst(Type::getInt128Ty(ctx.Codegen->GetContext()), value, "load", block);
+ const auto load = new LoadInst(Type::getInt128Ty(ctx.Codegen.GetContext()), value, "load", block);
ValueRelease(this->Node->GetRepresentation(), load, ctx, block);
return load;
} else {
@@ -457,7 +457,7 @@ protected:
Value* CreateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const final {
const auto value = static_cast<const TDerived*>(this)->DoGenerateGetValue(ctx, block);
if (value->getType()->isPointerTy()) {
- const auto load = new LoadInst(Type::getInt128Ty(ctx.Codegen->GetContext()), value, "load", block);
+ const auto load = new LoadInst(Type::getInt128Ty(ctx.Codegen.GetContext()), value, "load", block);
ValueRelease(static_cast<const IComputationNode*>(this)->GetRepresentation(), load, ctx, block);
return load;
} else {
@@ -490,7 +490,7 @@ protected:
{}
Value* CreateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const final {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valueType = Type::getInt128Ty(context);
const auto statePtr = GetElementPtrInst::CreateInBounds(valueType, ctx.GetMutables(), {ConstantInt::get(Type::getInt32Ty(context), static_cast<const IComputationNode*>(this)->GetIndex())}, "state_ptr", block);
@@ -515,7 +515,7 @@ protected:
{}
TGenerateResult GenGetValues(const TCodegenContext& ctx, BasicBlock*& block) const final {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valueType = Type::getInt128Ty(context);
const auto statePtr = GetElementPtrInst::CreateInBounds(valueType, ctx.GetMutables(), {ConstantInt::get(Type::getInt32Ty(context), static_cast<const IComputationNode*>(this)->GetIndex())}, "state_ptr", block);
return static_cast<const TDerived*>(this)->DoGenGetValues(ctx, statePtr, block);
@@ -532,7 +532,7 @@ protected:
{}
Value* CreateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const final {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valueType = Type::getInt128Ty(context);
const auto statePtr = GetElementPtrInst::CreateInBounds(valueType, ctx.GetMutables(), {ConstantInt::get(Type::getInt32Ty(context), static_cast<const IComputationNode*>(this)->GetIndex())}, "state_ptr", block);
@@ -561,7 +561,7 @@ protected:
{}
TGenerateResult GenGetValues(const TCodegenContext& ctx, BasicBlock*& block) const final {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valueType = Type::getInt128Ty(context);
const auto statePtr = GetElementPtrInst::CreateInBounds(valueType, ctx.GetMutables(), {ConstantInt::get(Type::getInt32Ty(context), static_cast<const IComputationNode*>(this)->GetIndex())}, "state_ptr", block);
return static_cast<const TDerived*>(this)->DoGenGetValues(ctx, statePtr, block);
@@ -578,7 +578,7 @@ protected:
{}
TGenerateResult GenGetValues(const TCodegenContext& ctx, BasicBlock*& block) const final {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
auto idx = static_cast<const IComputationNode*>(this)->GetIndex();
const auto valueType = Type::getInt128Ty(context);
const auto firstPtr = GetElementPtrInst::CreateInBounds(valueType, ctx.GetMutables(), {ConstantInt::get(Type::getInt32Ty(context), idx)}, "first_ptr", block);
@@ -597,7 +597,7 @@ protected:
{}
Value* CreateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const final {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
auto idx = static_cast<const IComputationNode*>(this)->GetIndex();
const auto valueType = Type::getInt128Ty(context);
const auto firstPtr = GetElementPtrInst::CreateInBounds(valueType, ctx.GetMutables(), {ConstantInt::get(Type::getInt32Ty(context), idx)}, "first_ptr", block);
@@ -631,7 +631,7 @@ protected:
const auto value = static_cast<const TDerived*>(this)->DoGenerateGetValue(ctx, block);
if (value->getType()->isPointerTy()) {
ValueRelease(static_cast<const IComputationNode*>(this)->GetRepresentation(), value, ctx, block);
- const auto load = new LoadInst(Type::getInt128Ty(ctx.Codegen->GetContext()), value, "load", block);
+ const auto load = new LoadInst(Type::getInt128Ty(ctx.Codegen.GetContext()), value, "load", block);
return load;
} else {
return value;
@@ -654,9 +654,9 @@ protected:
: TBase(mutables, kind)
{}
- Function* GenerateInternalGetValue(const NYql::NCodegen::ICodegen::TPtr& codegen) const {
- auto& module = codegen->GetModule();
- auto& context = codegen->GetContext();
+ Function* GenerateInternalGetValue(NYql::NCodegen::ICodegen& codegen) const {
+ auto& module = codegen.GetModule();
+ auto& context = codegen.GetContext();
const auto& name = MakeName();
if (const auto f = module.getFunction(name.c_str()))
return f;
@@ -681,7 +681,7 @@ protected:
const auto newValue = static_cast<const TDerived*>(this)->DoGenerateGetValue(ctx, block);
if (newValue->getType()->isPointerTy()) {
ValueRelease(this->GetRepresentation(), newValue, ctx, block);
- const auto load = new LoadInst(Type::getInt128Ty(ctx.Codegen->GetContext()), newValue, "load", block);
+ const auto load = new LoadInst(Type::getInt128Ty(ctx.Codegen.GetContext()), newValue, "load", block);
return load;
} else {
return newValue;
@@ -693,7 +693,7 @@ protected:
}
Value* MakeGetValueBody(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto indexType = Type::getInt32Ty(context);
const auto valueType = Type::getInt128Ty(context);
const auto valuePtr = GetElementPtrInst::CreateInBounds(valueType, ctx.GetMutables(), {ConstantInt::get(indexType, this->ValueIndex)}, "value_ptr", block);
@@ -744,9 +744,9 @@ protected:
: TBase(mutables, kind)
{}
- Function* GenerateInternalGetValue(const NYql::NCodegen::ICodegen::TPtr& codegen) const {
- auto& module = codegen->GetModule();
- auto& context = codegen->GetContext();
+ Function* GenerateInternalGetValue(NYql::NCodegen::ICodegen& codegen) const {
+ auto& module = codegen.GetModule();
+ auto& context = codegen.GetContext();
const auto& name = MakeName();
if (const auto f = module.getFunction(name.c_str()))
return f;
@@ -770,7 +770,7 @@ protected:
Value* CreateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const final {
if (*this->Stateless) {
- const auto type = Type::getInt128Ty(ctx.Codegen->GetContext());
+ const auto type = Type::getInt128Ty(ctx.Codegen.GetContext());
const auto pointer = ctx.Func->getEntryBlock().empty() ?
new AllocaInst(type, 0U, "output", &ctx.Func->getEntryBlock()):
new AllocaInst(type, 0U, "output", &ctx.Func->getEntryBlock().back());
@@ -786,7 +786,7 @@ protected:
}
Value* MakeGetValueBody(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto indexType = Type::getInt32Ty(context);
const auto valueType = Type::getInt128Ty(context);
const auto valuePtr = GetElementPtrInst::CreateInBounds(valueType, ctx.GetMutables(), {ConstantInt::get(indexType, this->ValueIndex)}, "value_ptr", block);
@@ -825,13 +825,13 @@ protected:
public:
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto type = Type::getInt128Ty(context);
const auto ptrType = PointerType::getUnqual(StructType::get(context));
static_assert(std::is_same<std::invoke_result_t<decltype(&TDerived::DoCalculate), TDerived, TComputationContext&>, NUdf::TUnboxedValuePod>(), "DoCalculate must return pod!");
const auto doFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TDerived::DoCalculate));
const auto self = CastInst::Create(Instruction::IntToPtr, ConstantInt::get(Type::getInt64Ty(context), uintptr_t(this)), ptrType, "self", block);
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
const auto funType = FunctionType::get(type, {self->getType(), ctx.Ctx->getType()}, false);
const auto doFuncPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(funType), "function", block);
const auto value = CallInst::Create(funType, doFuncPtr, {self, ctx.Ctx}, "value", block);
@@ -879,9 +879,9 @@ private:
return out.Str();
}
- Function* GenerateGetValue(const NYql::NCodegen::ICodegen::TPtr& codegen) {
- auto& module = codegen->GetModule();
- auto& context = codegen->GetContext();
+ Function* GenerateGetValue(NYql::NCodegen::ICodegen& codegen) {
+ auto& module = codegen.GetModule();
+ auto& context = codegen.GetContext();
if constexpr (PreventReGeneration) {
if (const auto& name = TDerived::MakeName(); module.getFunction(name.c_str()))
@@ -895,7 +895,7 @@ private:
const auto valueType = Type::getInt128Ty(context);
const auto contextType = GetCompContextType(context);
- const auto funcType = codegen->GetEffectiveTarget() != NYql::NCodegen::ETarget::Windows ?
+ const auto funcType = codegen.GetEffectiveTarget() != NYql::NCodegen::ETarget::Windows ?
FunctionType::get(valueType, {PointerType::getUnqual(contextType)}, false):
FunctionType::get(Type::getVoidTy(context) , {PointerType::getUnqual(valueType), PointerType::getUnqual(contextType)}, false);
@@ -903,7 +903,7 @@ private:
ctx.Func = cast<Function>(module.getOrInsertFunction(name.c_str(), funcType).getCallee());
auto args = ctx.Func->arg_begin();
- if (codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows) {
+ if (codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows) {
auto& firstArg = *args++;
firstArg.addAttr(Attribute::StructRet);
firstArg.addAttr(Attribute::NoAlias);
@@ -915,7 +915,7 @@ private:
const auto get = this->CreateGetValue(ctx, main);
- if (codegen->GetEffectiveTarget() != NYql::NCodegen::ETarget::Windows) {
+ if (codegen.GetEffectiveTarget() != NYql::NCodegen::ETarget::Windows) {
ReturnInst::Create(context, get, main);
} else {
new StoreInst(get, &*--args, main);
@@ -925,14 +925,14 @@ private:
return ctx.Func;
}
protected:
- void FinalizeFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) override {
+ void FinalizeFunctions(NYql::NCodegen::ICodegen& codegen) override {
if (GetFunc)
- GetFunction = reinterpret_cast<TGetPtr>(codegen->GetPointerToFunction(GetFunc));
+ GetFunction = reinterpret_cast<TGetPtr>(codegen.GetPointerToFunction(GetFunc));
}
- void GenerateFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) override {
+ void GenerateFunctions(NYql::NCodegen::ICodegen& codegen) override {
if (GetFunc = GenerateGetValue(codegen))
- codegen->ExportSymbol(GetFunc);
+ codegen.ExportSymbol(GetFunc);
}
private:
using TGetPtr = NUdf::TUnboxedValuePod (*)(TComputationContext* ctx);
@@ -991,11 +991,11 @@ private:
TString MakeName(const TString& method) const;
- void FinalizeFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final;
- void GenerateFunctions(const NYql::NCodegen::ICodegen::TPtr& codegen) final;
+ void FinalizeFunctions(NYql::NCodegen::ICodegen& codegen) final;
+ void GenerateFunctions(NYql::NCodegen::ICodegen& codegen) final;
- Function* GenerateGetValue(const NYql::NCodegen::ICodegen::TPtr& codegen);
- Function* GenerateSetValue(const NYql::NCodegen::ICodegen::TPtr& codegen);
+ Function* GenerateGetValue(NYql::NCodegen::ICodegen& codegen);
+ Function* GenerateSetValue(NYql::NCodegen::ICodegen& codegen);
using TGetPtr = NUdf::TUnboxedValuePod (*)(TComputationContext* ctx);
diff --git a/ydb/library/yql/minikql/computation/mkql_computation_node_graph.cpp b/ydb/library/yql/minikql/computation/mkql_computation_node_graph.cpp
index 454a53b9a4..89ca1b4a95 100644
--- a/ydb/library/yql/minikql/computation/mkql_computation_node_graph.cpp
+++ b/ydb/library/yql/minikql/computation/mkql_computation_node_graph.cpp
@@ -818,7 +818,7 @@ public:
for (auto it = nodes.crbegin(); nodes.crend() != it; ++it) {
if (const auto codegen = dynamic_cast<ICodegeneratorRootNode*>(it->Get())) {
try {
- codegen->GenerateFunctions(Codegen);
+ codegen->GenerateFunctions(*Codegen);
hasCode = true;
} catch (const TNoCodegen&) {
hasCode = false;
@@ -887,7 +887,7 @@ public:
ui64 count = 0U;
for (const auto& node : nodes) {
if (const auto codegen = dynamic_cast<ICodegeneratorRootNode*>(node.Get())) {
- codegen->FinalizeFunctions(Codegen);
+ codegen->FinalizeFunctions(*Codegen);
++count;
}
}
diff --git a/ydb/library/yql/minikql/computation/mkql_computation_node_holders.cpp b/ydb/library/yql/minikql/computation/mkql_computation_node_holders.cpp
index 036e10d911..30a97c32e5 100644
--- a/ydb/library/yql/minikql/computation/mkql_computation_node_holders.cpp
+++ b/ydb/library/yql/minikql/computation/mkql_computation_node_holders.cpp
@@ -244,7 +244,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, Value* arg, BasicBlock*& block) const {
- return MakeOptional(ctx.Codegen->GetContext(), arg, block);
+ return MakeOptional(ctx.Codegen.GetContext(), arg, block);
}
#endif
};
@@ -667,7 +667,7 @@ public:
if (ValueNodes.size() > CodegenArraysFallbackLimit)
return TBaseComputation::DoGenerateGetValue(ctx, block);
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valType = Type::getInt128Ty(context);
const auto idxType = Type::getInt32Ty(context);
@@ -710,12 +710,12 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valueType = Type::getInt128Ty(context);
const auto factory = ctx.GetFactory();
const auto func = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&THolderFactory::GetEmptyContainer));
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
const auto funType = FunctionType::get(valueType, {factory->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block);
const auto res = CallInst::Create(funType, funcPtr, {factory}, "res", block);
@@ -2816,7 +2816,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
const auto value = GetNodeValue(ItemNode, ctx, block);
- return MakeVariant(value, ConstantInt::get(Type::getInt32Ty(ctx.Codegen->GetContext()), Index), ctx, block);
+ return MakeVariant(value, ConstantInt::get(Type::getInt32Ty(ctx.Codegen.GetContext()), Index), ctx, block);
}
#endif
private:
@@ -4057,7 +4057,7 @@ Value* GenerateCheckNotUniqueBoxed(Value* value, LLVMContext& context, Function*
}
Value* TContainerCacheOnContext::GenNewArray(ui64 sz, Value* items, const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valueType = Type::getInt128Ty(context);
const auto arrayType = ArrayType::get(valueType, sz);
const auto pointerType = PointerType::getUnqual(arrayType);
@@ -4115,7 +4115,7 @@ Value* TContainerCacheOnContext::GenNewArray(ui64 sz, Value* items, const TCodeg
const auto func = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&THolderFactory::CreateDirectArrayHolder));
const auto size = ConstantInt::get(Type::getInt64Ty(context), sz);
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
const auto funType = FunctionType::get(valueType, {fact->getType(), size->getType(), items->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block);
const auto array = CallInst::Create(funType, funcPtr, {fact, size, items}, "array", block);
diff --git a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_abs.cpp b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_abs.cpp
index a3f76e0800..7d8f5b25c3 100644
--- a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_abs.cpp
+++ b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_abs.cpp
@@ -35,7 +35,7 @@ struct TAbs : public TSimpleArithmeticUnary<TInput, TOutput, TAbs<TInput, TOutpu
return arg;
if (std::is_floating_point<TInput>()) {
- auto& module = ctx.Codegen->GetModule();
+ auto& module = ctx.Codegen.GetModule();
const auto fnType = FunctionType::get(arg->getType(), {arg->getType()}, false);
const auto& name = GetFuncNameForType<TInput>("llvm.fabs");
const auto func = module.getOrInsertFunction(name, fnType).getCallee();
diff --git a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_add.cpp b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_add.cpp
index de8ac53030..12400d82a4 100644
--- a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_add.cpp
+++ b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_add.cpp
@@ -49,7 +49,7 @@ struct TDecimalAdd {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto& bounds = NDecimal::GenBounds<Precision>(context);
const auto l = GetterForInt128(left, block);
@@ -122,7 +122,7 @@ struct TDateTimeAddT {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto lhs = GenToScaledDate<TLeft>(GetterFor<TLeft>(left, context, block), context, block);
const auto rhs = GenToScaledDate<TRight>(GetterFor<TRight>(right, context, block), context, block);
const auto add = BinaryOperator::CreateAdd(lhs, rhs, "add", block);
diff --git a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_byteat.cpp b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_byteat.cpp
index dfe99e667f..542159735a 100644
--- a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_byteat.cpp
+++ b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_byteat.cpp
@@ -35,7 +35,7 @@ struct TByteAt {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto type = Type::getInt8Ty(context);
const auto embType = FixedVectorType::get(type, 16);
const auto cast = CastInst::Create(Instruction::BitCast, left, embType, "cast", block);
diff --git a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_codegen.cpp b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_codegen.cpp
index b086d250a6..62f9ba9430 100644
--- a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_codegen.cpp
+++ b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_codegen.cpp
@@ -15,7 +15,7 @@ Value* GenerateUnaryWithoutCheck(Value* arg, const TCodegenContext& ctx, BasicBl
}
Value* GenerateUnaryWithCheck(Value* arg, const TCodegenContext& ctx, BasicBlock*& block, TUnaryGenFunc generator) {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valType = Type::getInt128Ty(context);
const auto zero = ConstantInt::get(valType, 0ULL);
@@ -39,7 +39,7 @@ Value* GenerateUnaryWithCheck(Value* arg, const TCodegenContext& ctx, BasicBlock
template<bool CheckLeft, bool CheckRight>
Value* GenerateBinary(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block, TBinaryGenFunc generator) {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valType = Type::getInt128Ty(context);
const auto zero = ConstantInt::get(valType, 0ULL);
@@ -86,7 +86,7 @@ Value* GenerateBinary(Value* left, Value* right, const TCodegenContext& ctx, Bas
}
Value* GenerateAggregate(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block, TBinaryGenFunc generator) {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valType = Type::getInt128Ty(context);
const auto zero = ConstantInt::get(valType, 0ULL);
@@ -117,7 +117,7 @@ Value* GenerateAggregate(Value* left, Value* right, const TCodegenContext& ctx,
}
Value* GenerateCompareAggregate(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block, TBinaryGenFunc generator, CmpInst::Predicate predicate) {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valType = Type::getInt128Ty(context);
const auto zero = ConstantInt::get(valType, 0ULL);
@@ -150,7 +150,7 @@ Value* GenerateCompareAggregate(Value* left, Value* right, const TCodegenContext
template<bool CheckFirst>
Value* GenerateTernary(Value* first, Value* second, Value* third, const TCodegenContext& ctx, BasicBlock*& block, TTernaryGenFunc generator) {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valType = Type::getInt128Ty(context);
diff --git a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_compare.h b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_compare.h
index 0542d1f1a1..5b371b86bc 100644
--- a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_compare.h
+++ b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_compare.h
@@ -15,7 +15,7 @@ struct TCompareArithmeticBinary : public TArithmeticConstraintsBinary<TLeft, TRi
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto lhs = GetterFor<TLeft>(left, context, block);
const auto rhs = GetterFor<TRight>(right, context, block);
const auto res = TImpl::Gen(lhs, rhs, ctx, block);
@@ -37,7 +37,7 @@ struct TCompareArithmeticBinaryWithTimezone : public TArithmeticConstraintsBinar
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto lhs = GetterFor<TLeft>(left, context, block);
const auto rhs = GetterFor<TRight>(right, context, block);
const auto equals = CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_EQ, lhs, rhs, "equals", block);
@@ -58,7 +58,7 @@ struct TSelectArithmeticBinaryCopyTimezone : public TArithmeticConstraintsBinary
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto lhs = GetterFor<TType>(left, context, block);
const auto rhs = GetterFor<TType>(right, context, block);
const auto result = SelectInst::Create(TImpl::Gen(lhs, rhs, ctx, block), left, right, "result", block);
@@ -79,7 +79,7 @@ struct TSelectArithmeticBinaryWithTimezone : public TArithmeticConstraintsBinary
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto lhs = GetterFor<TType>(left, context, block);
const auto rhs = GetterFor<TType>(right, context, block);
const auto equals = CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_EQ, lhs, rhs, "equals", block);
diff --git a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_concat.cpp b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_concat.cpp
index 239956bfa9..543d9b2f9c 100644
--- a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_concat.cpp
+++ b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_concat.cpp
@@ -16,7 +16,7 @@ struct TConcat {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- return CallBinaryUnboxedValueFunction(&ConcatStrings, Type::getInt128Ty(ctx.Codegen->GetContext()), left, right, ctx.Codegen, block);
+ return CallBinaryUnboxedValueFunction(&ConcatStrings, Type::getInt128Ty(ctx.Codegen.GetContext()), left, right, ctx.Codegen, block);
}
#endif
};
diff --git a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_convert.cpp b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_convert.cpp
index 14016edadd..22cd7a2ba5 100644
--- a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_convert.cpp
+++ b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_convert.cpp
@@ -38,13 +38,13 @@ struct TFloatToIntegralImpl {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Gen(Value* arg, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
- auto& module = ctx.Codegen->GetModule();
+ auto& context = ctx.Codegen.GetContext();
+ auto& module = ctx.Codegen.GetModule();
const auto val = GetterFor<TIn>(arg, context, block);
const auto type = Type::getInt32Ty(context);
const auto fnType = FunctionType::get(type, {val->getType()}, false);
const auto name = std::is_same<TIn, float>() ? "MyFloatClassify" : "MyDoubleClassify";
- ctx.Codegen->AddGlobalMapping(name, reinterpret_cast<const void*>(static_cast<int(*)(TIn)>(&std::fpclassify)));
+ ctx.Codegen.AddGlobalMapping(name, reinterpret_cast<const void*>(static_cast<int(*)(TIn)>(&std::fpclassify)));
const auto func = module.getOrInsertFunction(name, fnType).getCallee();
const auto classify = CallInst::Create(fnType, func, {val}, "fpclassify", block);
@@ -105,13 +105,13 @@ struct TFloatToIntegralImpl<TIn, bool> {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Gen(Value* arg, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
- auto& module = ctx.Codegen->GetModule();
+ auto& context = ctx.Codegen.GetContext();
+ auto& module = ctx.Codegen.GetModule();
const auto val = GetterFor<TIn>(arg, context, block);
const auto type = Type::getInt32Ty(context);
const auto fnType = FunctionType::get(type, {val->getType()}, false);
const auto name = std::is_same<TIn, float>() ? "MyFloatClassify" : "MyDoubleClassify";
- ctx.Codegen->AddGlobalMapping(name, reinterpret_cast<const void*>(static_cast<int(*)(TIn)>(&std::fpclassify)));
+ ctx.Codegen.AddGlobalMapping(name, reinterpret_cast<const void*>(static_cast<int(*)(TIn)>(&std::fpclassify)));
const auto func = module.getOrInsertFunction(name, fnType).getCallee();
const auto classify = CallInst::Create(fnType, func, {val}, "fpclassify", block);
@@ -195,7 +195,7 @@ struct TWideToShort : public TArithmeticConstraintsUnary<TInput, TOutput> {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* arg, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto val = GetterFor<TInput>(arg, context, block);
const auto lb = ConstantInt::get(val->getType(), LowerBound);
const auto ub = ConstantInt::get(val->getType(), UpperBound);
@@ -220,7 +220,7 @@ struct TConvert : public TArithmeticConstraintsUnary<TInput, TOutput> {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* arg, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto val = GetterFor<TInput>(arg, context, block);
const auto res = StaticCast<TInput, TOutput>(val, context, block);
const auto wide = SetterFor<TOutput>(res, context, block);
@@ -239,7 +239,7 @@ struct TScaleUp : public TArithmeticConstraintsUnary<TInput, TOutput> {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* arg, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto val = GetterFor<TInput>(arg, context, block);
const auto cast = StaticCast<TInput, TOutput>(val, context, block);
const auto mul = BinaryOperator::CreateMul(ConstantInt::get(cast->getType(), Multiplier), cast, "mul", block);
@@ -282,7 +282,7 @@ struct TDatetimeScaleUp : public TArithmeticConstraintsUnary<TInput, TOutput> {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* arg, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto val = GetterFor<TInput>(arg, context, block);
const auto cast = StaticCast<TInput, TOutput>(val, context, block);
const auto mul = BinaryOperator::CreateMul(ConstantInt::get(cast->getType(), TScale<TInput, TOutput>::Modifier), cast, "mul", block);
@@ -316,7 +316,7 @@ struct TDatetimeScaleDown : public TArithmeticConstraintsUnary<TInput, TOutput>
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* arg, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto val = GetterFor<TInput>(arg, context, block);
const auto div = BinaryOperator::CreateUDiv(val, ConstantInt::get(val->getType(), TScale<TOutput, TInput>::Modifier), "div", block);
const auto cast = StaticCast<TInput, TOutput>(div, context, block);
@@ -397,7 +397,7 @@ struct TJsonToJsonDocumentConvert {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* json, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto functionAddress = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(JsonToJsonDocument));
const auto functionType = FunctionType::get(json->getType(), {json->getType()}, /* isVarArg */ false);
const auto functionPtr = CastInst::Create(Instruction::IntToPtr, functionAddress, PointerType::getUnqual(functionType), "func", block);
@@ -420,7 +420,7 @@ struct TJsonDocumentToJsonConvert {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* jsonDocument, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto functionAddress = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(JsonDocumentToJson));
const auto functionType = FunctionType::get(jsonDocument->getType(), {jsonDocument->getType()}, /* isVarArg */ false);
const auto functionPtr = CastInst::Create(Instruction::IntToPtr, functionAddress, PointerType::getUnqual(functionType), "func", block);
@@ -442,7 +442,7 @@ struct TConvertFromIntegral {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* arg, const TCodegenContext& ctx, BasicBlock*& block)
{
- const auto val = GetterFor<TInput>(arg, ctx.Codegen->GetContext(), block);
+ const auto val = GetterFor<TInput>(arg, ctx.Codegen.GetContext(), block);
const auto ext = CastInst::Create(std::is_signed<TInput>() ? Instruction::SExt : Instruction::ZExt, val, arg->getType(), "ext", block);
return SetterForInt128(ext, block);
}
@@ -461,7 +461,7 @@ struct TConvertToIntegral {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* arg, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto val = GetterForInt128(arg, block);
const auto cut = CastInst::Create(Instruction::Trunc, val, GetTypeFor<TOutput>(context), "cut", block);
const auto full = SetterFor<TOutput>(cut, context, block);
@@ -500,21 +500,21 @@ void GenFP(PHINode* result, Value* val, const TCodegenContext& ctx, BasicBlock*
template<>
void GenFP<float, 0>(PHINode* result, Value* val, const TCodegenContext& ctx, BasicBlock* done, BasicBlock*& block) {
- const auto cast = CastInst::Create(Instruction::SIToFP, val, GetTypeFor<float>(ctx.Codegen->GetContext()), "cast", block);
+ const auto cast = CastInst::Create(Instruction::SIToFP, val, GetTypeFor<float>(ctx.Codegen.GetContext()), "cast", block);
result->addIncoming(cast, block);
BranchInst::Create(done, block);
}
template<>
void GenFP<double, 0>(PHINode* result, Value* val, const TCodegenContext& ctx, BasicBlock* done, BasicBlock*& block) {
- const auto cast = CastInst::Create(Instruction::SIToFP, val, GetTypeFor<double>(ctx.Codegen->GetContext()), "cast", block);
+ const auto cast = CastInst::Create(Instruction::SIToFP, val, GetTypeFor<double>(ctx.Codegen.GetContext()), "cast", block);
result->addIncoming(cast, block);
BranchInst::Create(done, block);
}
template<typename TOutput, ui8 Scale>
void GenFP(PHINode* result, Value* val, const TCodegenContext& ctx, BasicBlock* done, BasicBlock*& block) {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto& str = ToString(Scale);
const auto stop = BasicBlock::Create(context, (TString("stop_") += str).c_str(), ctx.Func);
const auto step = BasicBlock::Create(context, (TString("step_") += str).c_str(), ctx.Func);
@@ -527,7 +527,7 @@ void GenFP(PHINode* result, Value* val, const TCodegenContext& ctx, BasicBlock*
BranchInst::Create(step, stop, nul, block);
block = stop;
- const auto cast = CastInst::Create(Instruction::SIToFP, val, GetTypeFor<TOutput>(ctx.Codegen->GetContext()), "cast", block);
+ const auto cast = CastInst::Create(Instruction::SIToFP, val, GetTypeFor<TOutput>(ctx.Codegen.GetContext()), "cast", block);
const auto divf = BinaryOperator::CreateFDiv(cast, ConstantFP::get(GetTypeFor<TOutput>(context), static_cast<TOutput>(NYql::NDecimal::GetDivider<Scale>())), "divf", block);
result->addIncoming(divf, block);
BranchInst::Create(done, block);
@@ -557,7 +557,7 @@ struct TToFP {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* arg, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto val = GetterForInt128(arg, block);
@@ -615,7 +615,7 @@ struct TScaleUp {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* arg, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto val = GetterForInt128(arg, block);
const auto mul = BinaryOperator::CreateMul(val, GenConstant(NYql::NDecimal::GetDivider<Scale>(), context), "mul", block);
const auto res = SelectInst::Create(GenIsNormal(val, context, block), mul, val, "result", block);
@@ -634,7 +634,7 @@ struct TScaleDown {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* arg, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto val = GetterForInt128(arg, block);
const auto divider = GenConstant(NYql::NDecimal::GetDivider<Scale>() >> 1, context);
@@ -692,7 +692,7 @@ struct TCheckBounds {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* arg, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto val = GetterForInt128(arg, block);
diff --git a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_countbits.cpp b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_countbits.cpp
index 8b11f9eb6f..23f269d3b1 100644
--- a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_countbits.cpp
+++ b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_countbits.cpp
@@ -17,8 +17,8 @@ struct TCountBits : public TSimpleArithmeticUnary<TInput, TOutput, TCountBits<TI
#ifndef MKQL_DISABLE_CODEGEN
static Value* Gen(Value* arg, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
- auto& module = ctx.Codegen->GetModule();
+ auto& context = ctx.Codegen.GetContext();
+ auto& module = ctx.Codegen.GetModule();
const auto fnType = FunctionType::get(arg->getType(), {arg->getType()}, false);
const auto& name = GetFuncNameForType<TInput>("llvm.ctpop");
const auto func = module.getOrInsertFunction(name, fnType).getCallee();
diff --git a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_dec.cpp b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_dec.cpp
index c88a568103..06bfa421ec 100644
--- a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_dec.cpp
+++ b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_dec.cpp
@@ -40,7 +40,7 @@ struct TDecimalDec {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* arg, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto& bounds = NDecimal::GenBounds<Precision, true, false>(context);
const auto val = GetterForInt128(arg, block);
diff --git a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_div.cpp b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_div.cpp
index 18a76503bb..9470bdc01b 100644
--- a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_div.cpp
+++ b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_div.cpp
@@ -48,7 +48,7 @@ struct TIntegralDiv {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto lv = StaticCast<TLeft, TOutput>(GetterFor<TLeft>(left, context, block), context, block);
const auto rv = StaticCast<TRight, TOutput>(GetterFor<TRight>(right, context, block), context, block);
const auto type = Type::getInt128Ty(context);
@@ -106,7 +106,7 @@ struct TNumDivInterval {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto lv = StaticCast<TLeft, TOutput>(GetterFor<TLeft>(left, context, block), context, block);
const auto rv = StaticCast<TRight, TOutput>(GetterFor<TRight>(right, context, block), context, block);
const auto type = Type::getInt128Ty(context);
diff --git a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_equals.cpp b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_equals.cpp
index f4f7b3675c..63116f33bc 100644
--- a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_equals.cpp
+++ b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_equals.cpp
@@ -152,7 +152,7 @@ struct TEquals : public TCompareArithmeticBinary<TLeft, TRight, TEquals<TLeft, T
#ifndef MKQL_DISABLE_CODEGEN
static Value* Gen(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- return GenEquals<TLeft, TRight, Aggr>(left, right, ctx.Codegen->GetContext(), block);
+ return GenEquals<TLeft, TRight, Aggr>(left, right, ctx.Codegen.GetContext(), block);
}
#endif
};
@@ -177,7 +177,7 @@ struct TDiffDateEquals : public TCompareArithmeticBinary<TLeft, TRight, TDiffDat
#ifndef MKQL_DISABLE_CODEGEN
static Value* Gen(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
return std::is_same<TLeft, TRight>::value ?
GenEquals<TLeft, TRight, Aggr>(left, right, context, block):
GenEquals<TScaledDate, TScaledDate, Aggr>(GenToScaledDate<TLeft>(left, context, block), GenToScaledDate<TRight>(right, context, block), context, block);
@@ -203,7 +203,7 @@ struct TAggrTzDateEquals : public TArithmeticConstraintsBinary<TLeft, TRight, bo
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto lhs = GetterFor<TLeft>(left, context, block);
const auto rhs = GetterFor<TRight>(right, context, block);
const auto ltz = GetterForTimezone(context, left, block);
@@ -224,7 +224,7 @@ struct TCustomEquals : public TAggrEquals {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto res = CallBinaryUnboxedValueFunction(&CompareCustoms<Slot>, Type::getInt32Ty(context), left, right, ctx.Codegen, block);
const auto comp = CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_EQ, res, ConstantInt::get(res->getType(), 0), "equals", block);
ValueCleanup(EValueRepresentation::String, left, ctx, block);
@@ -244,7 +244,7 @@ struct TDecimalEquals {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto l = GetterForInt128(left, block);
const auto r = GetterForInt128(right, block);
const auto good = NDecimal::GenIsComparable(l, context, block);
@@ -265,7 +265,7 @@ struct TDecimalAggrEquals : public TAggrEquals {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto l = GetterForInt128(left, block);
const auto r = GetterForInt128(right, block);
const auto eq = GenEqualsIntegral(l, r, block);
diff --git a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_find.cpp b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_find.cpp
index 15893dad47..aece421d61 100644
--- a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_find.cpp
+++ b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_find.cpp
@@ -25,7 +25,7 @@ struct TFind {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* string, Value* sub, Value* p, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto doFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(Find<Reverse>));
const auto pos = PosOptional ?
SelectInst::Create(
@@ -34,7 +34,7 @@ struct TFind {
StaticCast<ui32, std::string_view::size_type>(GetterFor<ui32>(p, context, block), context, block),
"pos", block):
StaticCast<ui32, std::string_view::size_type>(GetterFor<ui32>(p, context, block), context, block);
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
const auto funType = FunctionType::get(string->getType(), {string->getType(), sub->getType(), pos->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(funType), "func", block);
const auto result = CallInst::Create(funType, funcPtr, {string, sub, pos}, "find", block);
diff --git a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_greater.cpp b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_greater.cpp
index 2e7a66e36d..4bcf8b07ed 100644
--- a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_greater.cpp
+++ b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_greater.cpp
@@ -145,7 +145,7 @@ struct TGreater : public TCompareArithmeticBinary<TLeft, TRight, TGreater<TLeft,
#ifndef MKQL_DISABLE_CODEGEN
static Value* Gen(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- return GenGreater<TLeft, TRight, Aggr>(left, right, ctx.Codegen->GetContext(), block);
+ return GenGreater<TLeft, TRight, Aggr>(left, right, ctx.Codegen.GetContext(), block);
}
#endif
};
@@ -170,7 +170,7 @@ struct TDiffDateGreater : public TCompareArithmeticBinary<TLeft, TRight, TDiffDa
#ifndef MKQL_DISABLE_CODEGEN
static Value* Gen(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
return std::is_same<TLeft, TRight>::value ?
GenGreater<TLeft, TRight, Aggr>(left, right, context, block):
GenGreater<TScaledDate, TScaledDate, Aggr>(GenToScaledDate<TLeft>(left, context, block), GenToScaledDate<TRight>(right, context, block), context, block);
@@ -200,12 +200,12 @@ struct TAggrTzDateGreater : public TCompareArithmeticBinaryWithTimezone<TLeft, T
#ifndef MKQL_DISABLE_CODEGEN
static Value* Gen(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- return GenGreater<TLeft, TRight, Aggr>(left, right, ctx.Codegen->GetContext(), block);
+ return GenGreater<TLeft, TRight, Aggr>(left, right, ctx.Codegen.GetContext(), block);
}
static Value* GenTz(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- return GenGreater<ui16, ui16, Aggr>(left, right, ctx.Codegen->GetContext(), block);
+ return GenGreater<ui16, ui16, Aggr>(left, right, ctx.Codegen.GetContext(), block);
}
#endif
};
@@ -219,7 +219,7 @@ struct TCustomGreater : public TAggrGreater {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto res = CallBinaryUnboxedValueFunction(&CompareCustoms<Slot>, Type::getInt32Ty(context), left, right, ctx.Codegen, block);
const auto comp = CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_SGT, res, ConstantInt::get(res->getType(), 0), "greater", block);
ValueCleanup(EValueRepresentation::String, left, ctx, block);
@@ -239,7 +239,7 @@ struct TDecimalGreater {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto l = GetterForInt128(left, block);
const auto r = GetterForInt128(right, block);
const auto lok = NDecimal::GenIsComparable(l, context, block);
@@ -262,7 +262,7 @@ struct TDecimalAggrGreater : public TAggrGreater {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto l = GetterForInt128(left, block);
const auto r = GetterForInt128(right, block);
const auto gt = GenGreaterSigned(l, r, block);
diff --git a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_greater_or_equal.cpp b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_greater_or_equal.cpp
index a97af279a1..6a8e80c2da 100644
--- a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_greater_or_equal.cpp
+++ b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_greater_or_equal.cpp
@@ -145,7 +145,7 @@ struct TGreaterOrEqual : public TCompareArithmeticBinary<TLeft, TRight, TGreater
#ifndef MKQL_DISABLE_CODEGEN
static Value* Gen(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- return GenGreaterOrEqual<TLeft, TRight, Aggr>(left, right, ctx.Codegen->GetContext(), block);
+ return GenGreaterOrEqual<TLeft, TRight, Aggr>(left, right, ctx.Codegen.GetContext(), block);
}
#endif
};
@@ -170,7 +170,7 @@ struct TDiffDateGreaterOrEqual : public TCompareArithmeticBinary<TLeft, TRight,
#ifndef MKQL_DISABLE_CODEGEN
static Value* Gen(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
return std::is_same<TLeft, TRight>::value ?
GenGreaterOrEqual<TLeft, TRight, Aggr>(left, right, context, block):
GenGreaterOrEqual<TScaledDate, TScaledDate, Aggr>(GenToScaledDate<TLeft>(left, context, block), GenToScaledDate<TRight>(right, context, block), context, block);
@@ -200,12 +200,12 @@ struct TAggrTzDateGreaterOrEqual : public TCompareArithmeticBinaryWithTimezone<T
#ifndef MKQL_DISABLE_CODEGEN
static Value* Gen(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- return GenGreaterOrEqual<TLeft, TRight, Aggr>(left, right, ctx.Codegen->GetContext(), block);
+ return GenGreaterOrEqual<TLeft, TRight, Aggr>(left, right, ctx.Codegen.GetContext(), block);
}
static Value* GenTz(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- return GenGreaterOrEqual<ui16, ui16, Aggr>(left, right, ctx.Codegen->GetContext(), block);
+ return GenGreaterOrEqual<ui16, ui16, Aggr>(left, right, ctx.Codegen.GetContext(), block);
}
#endif
};
@@ -219,7 +219,7 @@ struct TCustomGreaterOrEqual : public TAggrGreaterOrEqual {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto res = CallBinaryUnboxedValueFunction(&CompareCustoms<Slot>, Type::getInt32Ty(context), left, right, ctx.Codegen, block);
const auto comp = CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_SGE, res, ConstantInt::get(res->getType(), 0), "greater_or_equal", block);
ValueCleanup(EValueRepresentation::String, left, ctx, block);
@@ -239,7 +239,7 @@ struct TDecimalGreaterOrEqual {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto l = GetterForInt128(left, block);
const auto r = GetterForInt128(right, block);
const auto lok = NDecimal::GenIsComparable(l, context, block);
@@ -262,7 +262,7 @@ struct TDecimalAggrGreaterOrEqual : public TAggrGreaterOrEqual {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto l = GetterForInt128(left, block);
const auto r = GetterForInt128(right, block);
const auto ge = GenGreaterOrEqualSigned(l, r, block);
diff --git a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_impl.h b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_impl.h
index b26ad630d3..06ad5acdaa 100644
--- a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_impl.h
+++ b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_impl.h
@@ -144,7 +144,7 @@ struct TSimpleArithmeticUnary : public TArithmeticConstraintsSame<TInput, TOutpu
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* arg, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto val = GetterFor<TInput>(arg, context, block);
const auto res = TImpl::Gen(val, ctx, block);
const auto wide = SetterFor<TOutput>(res, context, block);
@@ -162,7 +162,7 @@ struct TSimpleArithmeticBinary : public TArithmeticConstraintsBinary<TLeft, TRig
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto lhs = StaticCast<TLeft, TOutput>(GetterFor<TLeft>(left, context, block), context, block);
const auto rhs = StaticCast<TRight, TOutput>(GetterFor<TRight>(right, context, block), context, block);
const auto res = TImpl::Gen(lhs, rhs, ctx, block);
@@ -181,7 +181,7 @@ struct TShiftArithmeticBinary : public TArithmeticConstraintsSame<TInput, TOutpu
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto lhs = GetterFor<TInput>(left, context, block);
const auto rhs = CastInst::Create(Instruction::Trunc, right, Type::getInt8Ty(context), "bits", block);
const auto res = TImpl::Gen(lhs, rhs, ctx, block);
@@ -984,7 +984,7 @@ struct TBinaryKernelExecs<TInput1, TInput2, TOutput, TFunc, false> : TBinaryKern
continue;
}
}
-
+
arrow::BitUtil::ClearBit(resValid, i + resArr.offset);
}
} else {
diff --git a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_inc.cpp b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_inc.cpp
index 323cfb0357..b210c50b6a 100644
--- a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_inc.cpp
+++ b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_inc.cpp
@@ -40,7 +40,7 @@ struct TDecimalInc {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* arg, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto& bounds = NDecimal::GenBounds<Precision, false, true>(context);
const auto val = GetterForInt128(arg, block);
diff --git a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_invprestr.cpp b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_invprestr.cpp
index 902a868c21..03f19f2382 100644
--- a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_invprestr.cpp
+++ b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_invprestr.cpp
@@ -43,7 +43,7 @@ struct TInversePresortString {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* arg, const TCodegenContext& ctx, BasicBlock*& block)
{
- return CallUnaryUnboxedValueFunction(&Presort, Type::getInt128Ty(ctx.Codegen->GetContext()), arg, ctx.Codegen, block);
+ return CallUnaryUnboxedValueFunction(&Presort, Type::getInt128Ty(ctx.Codegen.GetContext()), arg, ctx.Codegen, block);
}
#endif
};
@@ -58,7 +58,7 @@ struct TInverseString {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* arg, const TCodegenContext& ctx, BasicBlock*& block)
{
- return CallUnaryUnboxedValueFunction(&Inverse, Type::getInt128Ty(ctx.Codegen->GetContext()), arg, ctx.Codegen, block);
+ return CallUnaryUnboxedValueFunction(&Inverse, Type::getInt128Ty(ctx.Codegen.GetContext()), arg, ctx.Codegen, block);
}
#endif
};
diff --git a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_less.cpp b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_less.cpp
index 47b5c83964..3f43da404e 100644
--- a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_less.cpp
+++ b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_less.cpp
@@ -145,7 +145,7 @@ struct TLess : public TCompareArithmeticBinary<TLeft, TRight, TLess<TLeft, TRigh
#ifndef MKQL_DISABLE_CODEGEN
static Value* Gen(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- return GenLess<TLeft, TRight, Aggr>(left, right, ctx.Codegen->GetContext(), block);
+ return GenLess<TLeft, TRight, Aggr>(left, right, ctx.Codegen.GetContext(), block);
}
#endif
};
@@ -170,7 +170,7 @@ struct TDiffDateLess : public TCompareArithmeticBinary<TLeft, TRight, TDiffDateL
#ifndef MKQL_DISABLE_CODEGEN
static Value* Gen(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
return std::is_same<TLeft, TRight>::value ?
GenLess<TLeft, TRight, Aggr>(left, right, context, block):
GenLess<TScaledDate, TScaledDate, Aggr>(GenToScaledDate<TLeft>(left, context, block), GenToScaledDate<TRight>(right, context, block), context, block);
@@ -200,12 +200,12 @@ struct TAggrTzDateLess : public TCompareArithmeticBinaryWithTimezone<TLeft, TRig
#ifndef MKQL_DISABLE_CODEGEN
static Value* Gen(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- return GenLess<TLeft, TRight, Aggr>(left, right, ctx.Codegen->GetContext(), block);
+ return GenLess<TLeft, TRight, Aggr>(left, right, ctx.Codegen.GetContext(), block);
}
static Value* GenTz(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- return GenLess<ui16, ui16, Aggr>(left, right, ctx.Codegen->GetContext(), block);
+ return GenLess<ui16, ui16, Aggr>(left, right, ctx.Codegen.GetContext(), block);
}
#endif
};
@@ -219,7 +219,7 @@ struct TCustomLess : public TAggrLess {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto res = CallBinaryUnboxedValueFunction(&CompareCustoms<Slot>, Type::getInt32Ty(context), left, right, ctx.Codegen, block);
const auto comp = CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_SLT, res, ConstantInt::get(res->getType(), 0), "less", block);
ValueCleanup(EValueRepresentation::String, left, ctx, block);
@@ -239,7 +239,7 @@ struct TDecimalLess {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto l = GetterForInt128(left, block);
const auto r = GetterForInt128(right, block);
const auto lok = NDecimal::GenIsComparable(l, context, block);
@@ -262,7 +262,7 @@ struct TDecimalAggrLess : public TAggrLess {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto l = GetterForInt128(left, block);
const auto r = GetterForInt128(right, block);
const auto ls = GenLessSigned(l, r, block);
diff --git a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_less_or_equal.cpp b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_less_or_equal.cpp
index dd9d26ed82..fcbb722df8 100644
--- a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_less_or_equal.cpp
+++ b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_less_or_equal.cpp
@@ -145,7 +145,7 @@ struct TLessOrEqual : public TCompareArithmeticBinary<TLeft, TRight, TLessOrEqua
#ifndef MKQL_DISABLE_CODEGEN
static Value* Gen(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- return GenLessOrEqual<TLeft, TRight, Aggr>(left, right, ctx.Codegen->GetContext(), block);
+ return GenLessOrEqual<TLeft, TRight, Aggr>(left, right, ctx.Codegen.GetContext(), block);
}
#endif
};
@@ -170,7 +170,7 @@ struct TDiffDateLessOrEqual : public TCompareArithmeticBinary<TLeft, TRight, TDi
#ifndef MKQL_DISABLE_CODEGEN
static Value* Gen(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
return std::is_same<TLeft, TRight>::value ?
GenLessOrEqual<TLeft, TRight, Aggr>(left, right, context, block):
GenLessOrEqual<TScaledDate, TScaledDate, Aggr>(GenToScaledDate<TLeft>(left, context, block), GenToScaledDate<TRight>(right, context, block), context, block);
@@ -200,12 +200,12 @@ struct TAggrTzDateLessOrEqual : public TCompareArithmeticBinaryWithTimezone<TLef
#ifndef MKQL_DISABLE_CODEGEN
static Value* Gen(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- return GenLessOrEqual<TLeft, TRight, Aggr>(left, right, ctx.Codegen->GetContext(), block);
+ return GenLessOrEqual<TLeft, TRight, Aggr>(left, right, ctx.Codegen.GetContext(), block);
}
static Value* GenTz(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- return GenLessOrEqual<ui16, ui16, Aggr>(left, right, ctx.Codegen->GetContext(), block);
+ return GenLessOrEqual<ui16, ui16, Aggr>(left, right, ctx.Codegen.GetContext(), block);
}
#endif
};
@@ -219,7 +219,7 @@ struct TCustomLessOrEqual : public TAggrLessOrEqual {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto res = CallBinaryUnboxedValueFunction(&CompareCustoms<Slot>, Type::getInt32Ty(context), left, right, ctx.Codegen, block);
const auto comp = CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_SLE, res, ConstantInt::get(res->getType(), 0), "less_or_equal", block);
ValueCleanup(EValueRepresentation::String, left, ctx, block);
@@ -239,7 +239,7 @@ struct TDecimalLessOrEqual {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto l = GetterForInt128(left, block);
const auto r = GetterForInt128(right, block);
const auto lok = NDecimal::GenIsComparable(l, context, block);
@@ -262,7 +262,7 @@ struct TDecimalAggrLessOrEqual : public TAggrLessOrEqual {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto l = GetterForInt128(left, block);
const auto r = GetterForInt128(right, block);
const auto le = GenLessOrEqualSigned(l, r, block);
diff --git a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_max.cpp b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_max.cpp
index 8b5b7f4a3e..5ab743bf53 100644
--- a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_max.cpp
+++ b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_max.cpp
@@ -29,8 +29,8 @@ struct TMax : public TSimpleArithmeticBinary<TLeft, TRight, TOutput, TMax<TLeft,
static Value* Gen(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
if constexpr (std::is_floating_point<TOutput>()) {
- auto& context = ctx.Codegen->GetContext();
- auto& module = ctx.Codegen->GetModule();
+ auto& context = ctx.Codegen.GetContext();
+ auto& module = ctx.Codegen.GetModule();
const auto fnType = FunctionType::get(GetTypeFor<TOutput>(context), {left->getType(), right->getType()}, false);
const auto& name = GetFuncNameForType<TOutput>("llvm.maxnum");
const auto func = module.getOrInsertFunction(name, fnType).getCallee();
@@ -118,7 +118,7 @@ struct TDecimalMax {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto next = BasicBlock::Create(context, "next", ctx.Func);
const auto good = BasicBlock::Create(context, "good", ctx.Func);
@@ -180,7 +180,7 @@ struct TCustomMax {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto res = CallBinaryUnboxedValueFunction(&CompareCustoms<Slot>, Type::getInt32Ty(context), left, right, ctx.Codegen, block);
const auto comp = CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_SLT, res, ConstantInt::get(res->getType(), 0), "less", block);
const auto min = SelectInst::Create(comp, left, right, "min", block);
diff --git a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_min.cpp b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_min.cpp
index 483d18aa89..9d85b84f74 100644
--- a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_min.cpp
+++ b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_min.cpp
@@ -29,8 +29,8 @@ struct TMin : public TSimpleArithmeticBinary<TLeft, TRight, TOutput, TMin<TLeft,
static Value* Gen(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
if constexpr (std::is_floating_point<TOutput>()) {
- auto& context = ctx.Codegen->GetContext();
- auto& module = ctx.Codegen->GetModule();
+ auto& context = ctx.Codegen.GetContext();
+ auto& module = ctx.Codegen.GetModule();
const auto fnType = FunctionType::get(GetTypeFor<TOutput>(context), {left->getType(), right->getType()}, false);
const auto& name = GetFuncNameForType<TOutput>("llvm.minnum");
const auto func = module.getOrInsertFunction(name, fnType).getCallee();
@@ -77,7 +77,7 @@ struct TDecimalMin {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto next = BasicBlock::Create(context, "next", ctx.Func);
const auto good = BasicBlock::Create(context, "good", ctx.Func);
@@ -179,7 +179,7 @@ struct TCustomMin {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto res = CallBinaryUnboxedValueFunction(&CompareCustoms<Slot>, Type::getInt32Ty(context), left, right, ctx.Codegen, block);
const auto comp = CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_SGT, res, ConstantInt::get(res->getType(), 0), "greater", block);
const auto max = SelectInst::Create(comp, left, right, "max", block);
diff --git a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_minus.cpp b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_minus.cpp
index 2ab6f62891..4253be8619 100644
--- a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_minus.cpp
+++ b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_minus.cpp
@@ -33,7 +33,7 @@ struct TDecimalMinus {
static Value* Generate(Value* arg, const TCodegenContext& ctx, BasicBlock*& block)
{
const auto val = GetterForInt128(arg, block);
- const auto ok = NDecimal::GenIsComparable(val, ctx.Codegen->GetContext(), block);
+ const auto ok = NDecimal::GenIsComparable(val, ctx.Codegen.GetContext(), block);
const auto neg = BinaryOperator::CreateNeg(val, "neg", block);
const auto res = SelectInst::Create(ok, SetterForInt128(neg, block), arg, "result", block);
return res;
diff --git a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_mod.cpp b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_mod.cpp
index 57a54defa1..c9ee042ddd 100644
--- a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_mod.cpp
+++ b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_mod.cpp
@@ -19,8 +19,8 @@ struct TMod : public TSimpleArithmeticBinary<TLeft, TRight, TOutput, TMod<TLeft,
#ifndef MKQL_DISABLE_CODEGEN
static Value* Gen(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- ctx.Codegen->AddGlobalMapping("fmod", reinterpret_cast<const void*>(static_cast<double(*)(double, double)>(&std::fmod)));
- ctx.Codegen->AddGlobalMapping("fmodf", reinterpret_cast<const void*>(static_cast<float(*)(float, float)>(&std::fmod)));
+ ctx.Codegen.AddGlobalMapping("fmod", reinterpret_cast<const void*>(static_cast<double(*)(double, double)>(&std::fmod)));
+ ctx.Codegen.AddGlobalMapping("fmodf", reinterpret_cast<const void*>(static_cast<float(*)(float, float)>(&std::fmod)));
return BinaryOperator::CreateFRem(left, right, "frem", block);
}
#endif
@@ -49,7 +49,7 @@ struct TIntegralMod {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto lv = StaticCast<TLeft, TOutput>(GetterFor<TLeft>(left, context, block), context, block);
const auto rv = StaticCast<TRight, TOutput>(GetterFor<TRight>(right, context, block), context, block);
const auto type = Type::getInt128Ty(context);
diff --git a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_mul.cpp b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_mul.cpp
index 0b0ab631a6..311bbd5a86 100644
--- a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_mul.cpp
+++ b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_mul.cpp
@@ -44,7 +44,7 @@ struct TNumMulInterval {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto lhs = StaticCast<TLeft, i64>(GetterFor<TLeft>(left, context, block), context, block);
const auto rhs = StaticCast<TRight, i64>(GetterFor<TRight>(right, context, block), context, block);
const auto mul = BinaryOperator::CreateMul(lhs, rhs, "mul", block);
diff --git a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_nanvl.cpp b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_nanvl.cpp
index 7dbe9a24df..ddc12b8ece 100644
--- a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_nanvl.cpp
+++ b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_nanvl.cpp
@@ -31,12 +31,12 @@ struct TNanvl {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
- auto& module = ctx.Codegen->GetModule();
+ auto& context = ctx.Codegen.GetContext();
+ auto& module = ctx.Codegen.GetModule();
const auto val = GetterFor<TLeft>(left, context, block);
const auto fnType = FunctionType::get(Type::getInt1Ty(context), {val->getType()}, false);
const auto name = std::is_same<TLeft, float>() ? "MyFloatIsNan" : "MyDoubleIsNan";
- ctx.Codegen->AddGlobalMapping(name, reinterpret_cast<const void*>(static_cast<bool(*)(TLeft)>(&std::isnan)));
+ ctx.Codegen.AddGlobalMapping(name, reinterpret_cast<const void*>(static_cast<bool(*)(TLeft)>(&std::isnan)));
const auto func = module.getOrInsertFunction(name, fnType).getCallee();
const auto isnan = CallInst::Create(fnType, func, {val}, "isnan", block);
@@ -63,7 +63,7 @@ struct TDecimalNanvl {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto good = NDecimal::GenIsComparable(GetterForInt128(left, block), context, block);
const auto sel = SelectInst::Create(good, left, right, "sel", block);
return sel;
diff --git a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_not_equals.cpp b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_not_equals.cpp
index 79726e7d42..013a393384 100644
--- a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_not_equals.cpp
+++ b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_not_equals.cpp
@@ -152,7 +152,7 @@ struct TNotEquals : public TCompareArithmeticBinary<TLeft, TRight, TNotEquals<TL
#ifndef MKQL_DISABLE_CODEGEN
static Value* Gen(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- return GenNotEquals<TLeft, TRight, Aggr>(left, right, ctx.Codegen->GetContext(), block);
+ return GenNotEquals<TLeft, TRight, Aggr>(left, right, ctx.Codegen.GetContext(), block);
}
#endif
};
@@ -177,7 +177,7 @@ struct TDiffDateNotEquals : public TCompareArithmeticBinary<TLeft, TRight, TDiff
#ifndef MKQL_DISABLE_CODEGEN
static Value* Gen(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
return std::is_same<TLeft, TRight>::value ?
GenNotEquals<TLeft, TRight, Aggr>(left, right, context, block):
GenNotEquals<TScaledDate, TScaledDate, Aggr>(GenToScaledDate<TLeft>(left, context, block), GenToScaledDate<TRight>(right, context, block), context, block);
@@ -203,7 +203,7 @@ struct TAggrTzDateNotEquals : public TArithmeticConstraintsBinary<TLeft, TRight,
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto lhs = GetterFor<TLeft>(left, context, block);
const auto rhs = GetterFor<TRight>(right, context, block);
const auto ltz = GetterForTimezone(context, left, block);
@@ -224,7 +224,7 @@ struct TCustomNotEquals : public TAggrNotEquals {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto res = CallBinaryUnboxedValueFunction(&CompareCustoms<Slot>, Type::getInt32Ty(context), left, right, ctx.Codegen, block);
const auto comp = CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_NE, res, ConstantInt::get(res->getType(), 0), "not_equals", block);
ValueCleanup(EValueRepresentation::String, left, ctx, block);
@@ -244,7 +244,7 @@ struct TDecimalNotEquals {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto l = GetterForInt128(left, block);
const auto r = GetterForInt128(right, block);
const auto bad = NDecimal::GenIsNonComparable(r, context, block);
@@ -265,7 +265,7 @@ struct TDecimalAggrNotEquals : public TAggrNotEquals {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto l = GetterForInt128(left, block);
const auto r = GetterForInt128(right, block);
const auto neq = GenNotEqualsIntegral(l, r, block);
diff --git a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_sub.cpp b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_sub.cpp
index bfd8e0782b..8ed438d9c2 100644
--- a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_sub.cpp
+++ b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_sub.cpp
@@ -47,7 +47,7 @@ struct TDecimalSub {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto& bounds = NDecimal::GenBounds<Precision>(context);
const auto l = GetterForInt128(left, block);
@@ -109,7 +109,7 @@ struct TDiffDateTimeSub {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto lhs = GenToScaledDate<std::make_signed_t<TLeft>>(GetterFor<TLeft>(left, context, block), context, block);
const auto rhs = GenToScaledDate<std::make_signed_t<TRight>>(GetterFor<TRight>(right, context, block), context, block);
const auto sub = BinaryOperator::CreateSub(lhs, rhs, "sub", block);
@@ -135,7 +135,7 @@ struct TSameDateTimeSub {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto lhs = GetterFor<TLeft>(left, context, block);
const auto rhs = GetterFor<TRight>(right, context, block);
const auto sub = BinaryOperator::CreateSub(lhs, rhs, "sub", block);
@@ -161,7 +161,7 @@ struct TIntervalSubInterval {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto lhs = GetterFor<TLeft>(left, context, block);
const auto rhs = GetterFor<TRight>(right, context, block);
const auto sub = BinaryOperator::CreateSub(lhs, rhs, "sub", block);
@@ -198,7 +198,7 @@ struct TAnyDateTimeSubIntervalT {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* left, Value* right, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto lhs = GenToScaledDate<TLeft>(GetterFor<TLeft>(left, context, block), context, block);
const auto rhs = GenToScaledDate<TRight>(GetterFor<TRight>(right, context, block), context, block);
const auto sub = BinaryOperator::CreateSub(lhs, rhs, "sub", block);
diff --git a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_substring.cpp b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_substring.cpp
index 41359df6ce..6411f57817 100644
--- a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_substring.cpp
+++ b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_substring.cpp
@@ -19,7 +19,7 @@ struct TSubString {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* string, Value* st, Value* cn, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto doFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(SubString));
const auto start = StartOptional ?
SelectInst::Create(
@@ -35,7 +35,7 @@ struct TSubString {
GetterFor<ui32>(cn, context, block), "count", block
):
GetterFor<ui32>(cn, context, block);
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
const auto funType = FunctionType::get(string->getType(), {string->getType(), start->getType(), count->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(funType), "func", block);
const auto result = CallInst::Create(funType, funcPtr, {string, start, count}, "substring", block);
diff --git a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_with.cpp b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_with.cpp
index 058a643f7e..723bff5cab 100644
--- a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_with.cpp
+++ b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_with.cpp
@@ -27,9 +27,9 @@ struct TStringWith {
#ifndef MKQL_DISABLE_CODEGEN
static Value* Generate(Value* string, Value* sub, const TCodegenContext& ctx, BasicBlock*& block)
{
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto doFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(StringFunc));
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
+ if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) {
const auto funType = FunctionType::get(string->getType(), {string->getType(), sub->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(funType), "func", block);
const auto result = CallInst::Create(funType, funcPtr, {string, sub}, "has", block);
diff --git a/ydb/library/yql/providers/yt/codec/codegen/yt_codec_cg.cpp b/ydb/library/yql/providers/yt/codec/codegen/yt_codec_cg.cpp
index 382c1ef6f2..5c6ac18149 100644
--- a/ydb/library/yql/providers/yt/codec/codegen/yt_codec_cg.cpp
+++ b/ydb/library/yql/providers/yt/codec/codegen/yt_codec_cg.cpp
@@ -107,7 +107,7 @@ public:
static_cast<Value*>(new AllocaInst(valueType, 0U, "elemPtr", Block_));
if constexpr (!Flat) {
- CallBoxedValueVirtualMethod<NUdf::TBoxedValueAccessor::EMethod::GetElement>(elemPtr, value, Codegen_, Block_, index);
+ CallBoxedValueVirtualMethod<NUdf::TBoxedValueAccessor::EMethod::GetElement>(elemPtr, value, *Codegen_, Block_, index);
}
bool isOptional;
@@ -188,7 +188,7 @@ public:
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, funcAddr, PointerType::getUnqual(funType), "ptr", Block_);
CallInst::Create(funType, funcPtr, { typeConst, elemPtr, buf }, "", Block_);
}
- TCodegenContext ctx(Codegen_);
+ TCodegenContext ctx(*Codegen_);
ctx.Func = Func_;
if constexpr (Flat)
ValueCleanup(EValueRepresentation::Any, elemPtr, ctx, Block_);
@@ -366,7 +366,7 @@ public:
CallInst::Create(module.getFunction("WriteString"), { buf, bytePtr, size }, "", Block_);
}
- TCodegenContext ctx(Codegen_);
+ TCodegenContext ctx(*Codegen_);
ctx.Func = Func_;
if constexpr (Flat)
ValueCleanup(EValueRepresentation::String, elemPtr, ctx, Block_);
@@ -430,7 +430,7 @@ public:
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, funcAddr, PointerType::getUnqual(funType), "ptr", Block_);
CallInst::Create(funType, funcPtr, { typeConst, elemPtr, buf }, "", Block_);
- TCodegenContext ctx(Codegen_);
+ TCodegenContext ctx(*Codegen_);
ctx.Func = Func_;
if constexpr (Flat)
ValueCleanup(EValueRepresentation::Any, elemPtr, ctx, Block_);
@@ -529,7 +529,7 @@ public:
APInt defInt(128, bits);
const auto defValData = ConstantInt::get(valueType, defInt);
new StoreInst(defValData, elemPtr, Block_);
- TCodegenContext ctx(Codegen_);
+ TCodegenContext ctx(*Codegen_);
ctx.Func = Func_;
ValueAddRef(EValueRepresentation::Any, elemPtr, ctx, Block_);
BranchInst::Create(done, Block_);
@@ -883,7 +883,7 @@ private:
auto varType = static_cast<TVariantType*>(type);
const auto isOneByte = ConstantInt::get(Type::getInt8Ty(context), varType->GetAlternativesCount() < 256);
const auto data = CallInst::Create(module.getFunction("ReadVariantData"), { buf, isOneByte }, "data", Block_);
-
+
std::function<TType*(size_t)> getType;
std::function<void(size_t, size_t)> genLR = [&] (size_t l, size_t r){
size_t m = (l + r) >> 1;
@@ -920,7 +920,7 @@ private:
};
} else {
auto structType = static_cast<TStructType*>(varType->GetUnderlyingType());
-
+
const std::vector<size_t>* reorder = nullptr;
if (auto cookie = structType->GetCookie()) {
reorder = ((const std::vector<size_t>*)cookie);
@@ -978,7 +978,7 @@ private:
Block_ = done;
return;
}
-
+
YQL_ENSURE(false, "Unsupported type for skip: " << type->GetKindAsStr());
}
diff --git a/ydb/library/yql/providers/yt/comp_nodes/yql_mkql_input.cpp b/ydb/library/yql/providers/yt/comp_nodes/yql_mkql_input.cpp
index d0acf1a212..69e6e9bce5 100644
--- a/ydb/library/yql/providers/yt/comp_nodes/yql_mkql_input.cpp
+++ b/ydb/library/yql/providers/yt/comp_nodes/yql_mkql_input.cpp
@@ -200,7 +200,7 @@ public:
}
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, Value* statePtr, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valueType = Type::getInt128Ty(context);
const auto structPtrType = PointerType::getUnqual(StructType::get(context));
@@ -274,7 +274,7 @@ public:
}
#ifndef MKQL_DISABLE_CODEGEN
ICodegeneratorInlineWideNode::TGenerateResult DoGenGetValues(const TCodegenContext& ctx, Value* statePtr, Value* currentPtr, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valueType = Type::getInt128Ty(context);
const auto arrayType = ArrayType::get(valueType, Width);
@@ -343,7 +343,7 @@ public:
getters.reserve(Width);
for (ui32 i = 0U; i < Width; ++i) {
getters.emplace_back([i, placeholder, pointerType, valueType, arrayType](const TCodegenContext& ctx, BasicBlock*& block) {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto current = new LoadInst(valueType, placeholder, (TString("current_") += ToString(i)).c_str(), block);
const auto integer = GetterFor<ui64>(current, context, block);
const auto pointer = CastInst::Create(Instruction::IntToPtr, integer, pointerType, (TString("pointer_") += ToString(i)).c_str(), block);
diff --git a/ydb/library/yql/providers/yt/comp_nodes/yql_mkql_output.cpp b/ydb/library/yql/providers/yt/comp_nodes/yql_mkql_output.cpp
index d09f985648..6cffb5179e 100644
--- a/ydb/library/yql/providers/yt/comp_nodes/yql_mkql_output.cpp
+++ b/ydb/library/yql/providers/yt/comp_nodes/yql_mkql_output.cpp
@@ -23,7 +23,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, Value* item, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
if (true /*|| TODO: !Writer.GenAddRow(item, ctx, block)*/) {
const auto addFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TYtOutputWrapper::AddRowImpl));
const auto selfArg = ConstantInt::get(Type::getInt64Ty(context), ui64(this));
@@ -61,7 +61,7 @@ public:
}
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto item = GetNodeValue(Flow, ctx, block);
@@ -134,7 +134,7 @@ public:
}
#ifndef MKQL_DISABLE_CODEGEN
TGenerateResult DoGenGetValues(const TCodegenContext& ctx, BasicBlock*& block) const {
- auto& context = ctx.Codegen->GetContext();
+ auto& context = ctx.Codegen.GetContext();
const auto valueType = Type::getInt128Ty(context);
const auto indexType = Type::getInt32Ty(context);