diff options
author | vvvv <[email protected]> | 2025-01-15 11:23:27 +0300 |
---|---|---|
committer | vvvv <[email protected]> | 2025-01-15 11:46:46 +0300 |
commit | 350e1ae88774a5c2d9c9bf63bc4bfedcb9d44b03 (patch) | |
tree | 6c99f143a03fb0e45790b74bb951d4b451348b99 | |
parent | 230b2bd8262d16de167b0bd9c761c271182a8582 (diff) |
Drop broken windows LLVM support
commit_hash:fc1f44ff256c759953b54e2ccac3277dc66c1165
49 files changed, 327 insertions, 1154 deletions
diff --git a/yql/essentials/minikql/comp_nodes/mkql_append.cpp b/yql/essentials/minikql/comp_nodes/mkql_append.cpp index 41436b09855..82894c6d108 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_append.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_append.cpp @@ -53,44 +53,20 @@ public: BranchInst::Create(work, done, check, block); block = work; - 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); - result->addIncoming(res, block); - } else { - const auto retPtr = new AllocaInst(left->getType(), 0U, "ret_ptr", block); - const auto itemPtr = new AllocaInst(right->getType(), 0U, "item_ptr", block); - new StoreInst(left, retPtr, block); - new StoreInst(right, itemPtr, block); - const auto funType = FunctionType::get(Type::getVoidTy(context), {factory->getType(), retPtr->getType(), retPtr->getType(), itemPtr->getType()}, false); - const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block); - CallInst::Create(funType, funcPtr, {factory, retPtr, retPtr, itemPtr}, "", block); - const auto res = new LoadInst(left->getType(), retPtr, "res", block); - result->addIncoming(res, block); - } + 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); + result->addIncoming(res, block); BranchInst::Create(done, block); block = done; return result; } else { - 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); - return res; - } else { - const auto retPtr = new AllocaInst(left->getType(), 0U, "ret_ptr", block); - const auto itemPtr = new AllocaInst(right->getType(), 0U, "item_ptr", block); - new StoreInst(left, retPtr, block); - new StoreInst(right, itemPtr, block); - const auto funType = FunctionType::get(Type::getVoidTy(context), {factory->getType(), retPtr->getType(), retPtr->getType(), itemPtr->getType()}, false); - const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block); - CallInst::Create(funType, funcPtr, {factory, retPtr, retPtr, itemPtr}, "", block); - const auto res = new LoadInst(left->getType(), retPtr, "res", block); - return res; - } + 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); + return res; } } #endif diff --git a/yql/essentials/minikql/comp_nodes/mkql_block_compress.cpp b/yql/essentials/minikql/comp_nodes/mkql_block_compress.cpp index 3db1e34a4c8..74e0dca0d1d 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_block_compress.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_block_compress.cpp @@ -51,15 +51,12 @@ public: auto& context = ctx.Codegen.GetContext(); const auto valueType = Type::getInt128Ty(context); - const auto ptrValueType = PointerType::getUnqual(valueType); const auto statusType = Type::getInt32Ty(context); const auto bitmapType = Type::getInt8Ty(context); const auto name = "GetBitmapScalarValue"; ctx.Codegen.AddGlobalMapping(name, reinterpret_cast<const void*>(&GetBitmapScalarValue)); - const auto getBitmapType = NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget() ? - FunctionType::get(bitmapType, { valueType }, false): - FunctionType::get(bitmapType, { ptrValueType }, false); + const auto getBitmapType = FunctionType::get(bitmapType, { valueType }, false); const auto getBitmap = ctx.Codegen.GetModule().getOrInsertFunction(name, getBitmapType); const auto work = BasicBlock::Create(context, "work", ctx.Func); @@ -83,7 +80,7 @@ public: block = test; const auto bitmapValue = getres.second[BitmapIndex_](ctx, block); - const auto bitmap = CallInst::Create(getBitmap, { WrapArgumentForWindows(bitmapValue, ctx, block) }, "bitmap", block); + const auto bitmap = CallInst::Create(getBitmap, { bitmapValue }, "bitmap", block); ValueCleanup(EValueRepresentation::Any, bitmapValue, ctx, block); @@ -156,7 +153,6 @@ public: auto& context = ctx.Codegen.GetContext(); const auto valueType = Type::getInt128Ty(context); - const auto ptrValueType = PointerType::getUnqual(valueType); const auto statusType = Type::getInt32Ty(context); const auto sizeType = Type::getInt64Ty(context); @@ -167,9 +163,7 @@ public: const auto name = "GetBitmapPopCountCount"; ctx.Codegen.AddGlobalMapping(name, reinterpret_cast<const void*>(&GetBitmapPopCountCount)); - const auto getPopCountType = NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget() ? - FunctionType::get(sizeType, { valueType }, false): - FunctionType::get(sizeType, { ptrValueType }, false); + const auto getPopCountType = FunctionType::get(sizeType, { valueType }, false); const auto getPopCount = ctx.Codegen.GetModule().getOrInsertFunction(name, getPopCountType); const auto loop = BasicBlock::Create(context, "loop", ctx.Func); @@ -191,7 +185,7 @@ public: block = work; const auto bitmapValue = getres.second[BitmapIndex_](ctx, block); - const auto pops = CallInst::Create(getPopCount, { WrapArgumentForWindows(bitmapValue, ctx, block) }, "pops", block); + const auto pops = CallInst::Create(getPopCount, { bitmapValue }, "pops", block); ValueCleanup(EValueRepresentation::Any, bitmapValue, ctx, block); @@ -413,7 +407,7 @@ public: block = good; const auto bitmap = getres.second[BitmapIndex_](ctx, block); - const auto bitmapArg = WrapArgumentForWindows(bitmap, ctx, block); + const auto bitmapArg = bitmap; const auto stepType = Type::getInt8Ty(context); const auto checkFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TState::Check)); diff --git a/yql/essentials/minikql/comp_nodes/mkql_block_skiptake.cpp b/yql/essentials/minikql/comp_nodes/mkql_block_skiptake.cpp index f5671b2635f..2496b75ca60 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_block_skiptake.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_block_skiptake.cpp @@ -51,7 +51,6 @@ public: const auto indexType = Type::getInt64Ty(context); const auto valueType = Type::getInt128Ty(context); - const auto ptrValueType = PointerType::getUnqual(valueType); const auto atTop = &ctx.Func->getEntryBlock().back(); @@ -64,9 +63,7 @@ public: const auto name = "GetBlockCount"; ctx.Codegen.AddGlobalMapping(name, reinterpret_cast<const void*>(&GetBlockCount)); - const auto getCountType = NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget() ? - FunctionType::get(indexType, { valueType }, false): - FunctionType::get(indexType, { ptrValueType }, false); + const auto getCountType = FunctionType::get(indexType, { valueType }, false); const auto getCount = ctx.Codegen.GetModule().getOrInsertFunction(name, getCountType); const auto init = BasicBlock::Create(context, "init", ctx.Func); @@ -119,7 +116,7 @@ public: block = test; const auto countValue = getres.second.back()(ctx, block); - const auto height = CallInst::Create(getCount, { WrapArgumentForWindows(countValue, ctx, block) }, "height", block); + const auto height = CallInst::Create(getCount, { countValue }, "height", block); ValueCleanup(EValueRepresentation::Any, countValue, ctx, block); @@ -272,7 +269,6 @@ public: const auto indexType = Type::getInt64Ty(context); const auto valueType = Type::getInt128Ty(context); - const auto ptrValueType = PointerType::getUnqual(valueType); const auto atTop = &ctx.Func->getEntryBlock().back(); @@ -285,9 +281,7 @@ public: const auto name = "GetBlockCount"; ctx.Codegen.AddGlobalMapping(name, reinterpret_cast<const void*>(&GetBlockCount)); - const auto getCountType = NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget() ? - FunctionType::get(indexType, { valueType }, false): - FunctionType::get(indexType, { ptrValueType }, false); + const auto getCountType = FunctionType::get(indexType, { valueType }, false); const auto getCount = ctx.Codegen.GetModule().getOrInsertFunction(name, getCountType); const auto init = BasicBlock::Create(context, "init", ctx.Func); @@ -332,7 +326,7 @@ public: block = good; const auto countValue = getres.second.back()(ctx, block); - const auto height = CallInst::Create(getCount, { WrapArgumentForWindows(countValue, ctx, block) }, "height", block); + const auto height = CallInst::Create(getCount, { countValue }, "height", block); ValueCleanup(EValueRepresentation::Any, countValue, ctx, block); diff --git a/yql/essentials/minikql/comp_nodes/mkql_blocks.cpp b/yql/essentials/minikql/comp_nodes/mkql_blocks.cpp index f269264fa23..5947cb7a161 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_blocks.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_blocks.cpp @@ -557,7 +557,6 @@ public: const auto width = Types_.size(); const auto valueType = Type::getInt128Ty(context); - const auto ptrValueType = PointerType::getUnqual(valueType); const auto statusType = Type::getInt32Ty(context); const auto indexType = Type::getInt64Ty(context); const auto arrayType = ArrayType::get(valueType, width); @@ -575,9 +574,7 @@ public: const auto name = "GetBlockCount"; ctx.Codegen.AddGlobalMapping(name, reinterpret_cast<const void*>(&GetBlockCount)); - const auto getCountType = NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget() ? - FunctionType::get(indexType, { valueType }, false): - FunctionType::get(indexType, { ptrValueType }, false); + const auto getCountType = FunctionType::get(indexType, { valueType }, false); const auto getCount = ctx.Codegen.GetModule().getOrInsertFunction(name, getCountType); const auto make = BasicBlock::Create(context, "make", ctx.Func); @@ -633,7 +630,7 @@ public: block = good; const auto countValue = getres.second.back()(ctx, block); - const auto height = CallInst::Create(getCount, { WrapArgumentForWindows(countValue, ctx, block) }, "height", block); + const auto height = CallInst::Create(getCount, { countValue }, "height", block); ValueCleanup(EValueRepresentation::Any, countValue, ctx, block); @@ -867,18 +864,9 @@ public: const auto self = CastInst::Create(Instruction::IntToPtr, ConstantInt::get(Type::getInt64Ty(context), uintptr_t(this)), ptrType, "self", block); const auto asScalarFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TAsScalarWrapper::AsScalar)); - if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) { - const auto asScalarType = FunctionType::get(Type::getInt128Ty(context), {self->getType(), value->getType(), ctx.Ctx->getType()}, false); - const auto asScalarFuncPtr = CastInst::Create(Instruction::IntToPtr, asScalarFunc, PointerType::getUnqual(asScalarType), "function", block); - return CallInst::Create(asScalarType, asScalarFuncPtr, {self, value, ctx.Ctx}, "scalar", block); - } else { - const auto valuePtr = new AllocaInst(value->getType(), 0U, "value", block); - new StoreInst(value, valuePtr, block); - const auto asScalarType = FunctionType::get(Type::getVoidTy(context), {self->getType(), valuePtr->getType(), valuePtr->getType(), ctx.Ctx->getType()}, false); - const auto asScalarFuncPtr = CastInst::Create(Instruction::IntToPtr, asScalarFunc, PointerType::getUnqual(asScalarType), "function", block); - CallInst::Create(asScalarType, asScalarFuncPtr, {self, valuePtr, valuePtr, ctx.Ctx}, "", block); - return new LoadInst(value->getType(), valuePtr, "result", block); - } + const auto asScalarType = FunctionType::get(Type::getInt128Ty(context), {self->getType(), value->getType(), ctx.Ctx->getType()}, false); + const auto asScalarFuncPtr = CastInst::Create(Instruction::IntToPtr, asScalarFunc, PointerType::getUnqual(asScalarType), "function", block); + return CallInst::Create(asScalarType, asScalarFuncPtr, {self, value, ctx.Ctx}, "scalar", block); } #endif private: @@ -932,20 +920,9 @@ public: const auto self = CastInst::Create(Instruction::IntToPtr, ConstantInt::get(Type::getInt64Ty(context), uintptr_t(this)), ptrType, "self", block); const auto replicateFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TReplicateScalarWrapper::Replicate)); - if (NYql::NCodegen::ETarget::Windows != ctx.Codegen.GetEffectiveTarget()) { - const auto replicateType = FunctionType::get(Type::getInt128Ty(context), {self->getType(), value->getType(), count->getType(), ctx.Ctx->getType()}, false); - const auto replicateFuncPtr = CastInst::Create(Instruction::IntToPtr, replicateFunc, PointerType::getUnqual(replicateType), "function", block); - return CallInst::Create(replicateType, replicateFuncPtr, {self, value, count, ctx.Ctx}, "replicate", block); - } else { - const auto valuePtr = new AllocaInst(value->getType(), 0U, "value", block); - const auto countPtr = new AllocaInst(count->getType(), 0U, "count", block); - new StoreInst(value, valuePtr, block); - new StoreInst(count, countPtr, block); - const auto replicateType = FunctionType::get(Type::getVoidTy(context), {self->getType(), valuePtr->getType(), valuePtr->getType(), countPtr->getType(), ctx.Ctx->getType()}, false); - const auto replicateFuncPtr = CastInst::Create(Instruction::IntToPtr, replicateFunc, PointerType::getUnqual(replicateType), "function", block); - CallInst::Create(replicateType, replicateFuncPtr, {self, valuePtr, valuePtr, countPtr, ctx.Ctx}, "", block); - return new LoadInst(value->getType(), valuePtr, "result", block); - } + const auto replicateType = FunctionType::get(Type::getInt128Ty(context), {self->getType(), value->getType(), count->getType(), ctx.Ctx->getType()}, false); + const auto replicateFuncPtr = CastInst::Create(Instruction::IntToPtr, replicateFunc, PointerType::getUnqual(replicateType), "function", block); + return CallInst::Create(replicateType, replicateFuncPtr, {self, value, count, ctx.Ctx}, "replicate", block); } #endif private: diff --git a/yql/essentials/minikql/comp_nodes/mkql_callable.cpp b/yql/essentials/minikql/comp_nodes/mkql_callable.cpp index 4f49d4e4fef..76f703137f0 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_callable.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_callable.cpp @@ -104,24 +104,16 @@ private: const auto argsType = ArrayType::get(valueType, ArgNodes.size()); const auto contextType = GetCompContextType(context); - 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); + const auto funcType = + FunctionType::get(valueType, {PointerType::getUnqual(contextType), PointerType::getUnqual(argsType)}, false); TCodegenContext ctx(codegen); ctx.Func = cast<Function>(module.getOrInsertFunction(name.c_str(), funcType).getCallee()); DISubprogramAnnotator annotator(ctx, ctx.Func); - auto args = ctx.Func->arg_begin(); - const auto resultArg = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? &*args++ : nullptr; - if (resultArg) { - resultArg->addAttr(Attribute::StructRet); - resultArg->addAttr(Attribute::NoAlias); - } - ctx.Ctx = &*args; const auto argsPtr = &*++args; @@ -140,12 +132,7 @@ private: const auto result = GetNodeValue(ResultNode, ctx, block); - if (resultArg) { - new StoreInst(result, resultArg, block); - ReturnInst::Create(context, block); - } else { - ReturnInst::Create(context, result, block); - } + ReturnInst::Create(context, result, block); return ctx.Func; } diff --git a/yql/essentials/minikql/comp_nodes/mkql_chain1_map.cpp b/yql/essentials/minikql/comp_nodes/mkql_chain1_map.cpp index c12d9917c59..56c4b8c9acf 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_chain1_map.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_chain1_map.cpp @@ -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 = 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); @@ -257,8 +257,7 @@ public: const auto main = BasicBlock::Create(context, "main", ctx.Func); auto block = main; - const auto container = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? - new LoadInst(valueType, containerArg, "load_container", false, block) : static_cast<Value*>(containerArg); + const auto container = static_cast<Value*>(containerArg); const auto good = BasicBlock::Create(context, "good", ctx.Func); const auto done = BasicBlock::Create(context, "done", ctx.Func); @@ -473,20 +472,10 @@ 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()) { - 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); - map->addIncoming(value, block); - } else { - const auto resultPtr = new AllocaInst(list->getType(), 0U, "return", block); - new StoreInst(list, resultPtr, block); - const auto funType = FunctionType::get(Type::getVoidTy(context), {self->getType(), resultPtr->getType(), ctx.Ctx->getType(), resultPtr->getType()}, false); - const auto doFuncPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(funType), "function", block); - CallInst::Create(funType, doFuncPtr, {self, resultPtr, ctx.Ctx, resultPtr}, "", block); - const auto value = new LoadInst(list->getType(), resultPtr, "value", block); - map->addIncoming(value, block); - } + 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); + map->addIncoming(value, block); BranchInst::Create(done, block); } diff --git a/yql/essentials/minikql/comp_nodes/mkql_chain_map.cpp b/yql/essentials/minikql/comp_nodes/mkql_chain_map.cpp index e0d9ff1f130..00038783800 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_chain_map.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_chain_map.cpp @@ -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 = 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); @@ -250,8 +250,7 @@ public: const auto main = BasicBlock::Create(context, "main", ctx.Func); auto block = main; - const auto container = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? - new LoadInst(valueType, containerArg, "load_container", false, block) : static_cast<Value*>(containerArg); + const auto container = static_cast<Value*>(containerArg); const auto init = BasicBlock::Create(context, "init", ctx.Func); const auto work = BasicBlock::Create(context, "work", ctx.Func); @@ -456,22 +455,10 @@ 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()) { - 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); - map->addIncoming(value, block); - } else { - const auto resultPtr = new AllocaInst(list->getType(), 0U, "return", block); - const auto initPtr = new AllocaInst(init->getType(), 0U, "init", block); - new StoreInst(list, resultPtr, block); - new StoreInst(init, initPtr, block); - const auto funType = FunctionType::get(Type::getVoidTy(context), {self->getType(), resultPtr->getType(), ctx.Ctx->getType(), resultPtr->getType(), initPtr->getType()}, false); - const auto doFuncPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(funType), "function", block); - CallInst::Create(funType, doFuncPtr, {self, resultPtr, ctx.Ctx, resultPtr, initPtr}, "", block); - const auto value = new LoadInst(list->getType(), resultPtr, "value", block); - map->addIncoming(value, block); - } + 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); + map->addIncoming(value, block); BranchInst::Create(done, block); } diff --git a/yql/essentials/minikql/comp_nodes/mkql_chopper.cpp b/yql/essentials/minikql/comp_nodes/mkql_chopper.cpp index f3b5aecf0bc..eb93380e182 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_chopper.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_chopper.cpp @@ -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 = static_cast<Type*>(valueType); const auto contextType = GetCompContextType(context); const auto statusType = Type::getInt32Ty(context); const auto stateType = Type::getInt8Ty(context); @@ -578,8 +578,7 @@ private: auto block = main; - const auto container = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? - new LoadInst(valueType, containerArg, "load_container", false, block) : static_cast<Value*>(containerArg); + const auto container = static_cast<Value*>(containerArg); const auto first = new LoadInst(stateType, stateArg, "first", block); const auto reload = CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_EQ, first, ConstantInt::get(stateType, ui8(EState::Next)), "reload", block); @@ -650,7 +649,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 = static_cast<Type*>(valueType); const auto contextType = GetCompContextType(context); const auto statusType = Type::getInt32Ty(context); const auto stateType = Type::getInt8Ty(context); @@ -680,8 +679,7 @@ private: auto block = main; - const auto input = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? - new LoadInst(valueType, inputArg, "load_input", false, block) : static_cast<Value*>(inputArg); + const auto input = static_cast<Value*>(inputArg); BranchInst::Create(loop, block); diff --git a/yql/essentials/minikql/comp_nodes/mkql_collect.cpp b/yql/essentials/minikql/comp_nodes/mkql_collect.cpp index 836bb272605..ad23aeb4499 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_collect.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_collect.cpp @@ -42,19 +42,10 @@ public: const auto list = PHINode::Create(valueType, 2U, "list", work); - 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); - list->addIncoming(first, block); - } else { - const auto ptr = new AllocaInst(valueType, 0U, "ptr", block); - const auto funType = FunctionType::get(Type::getVoidTy(context), {factory->getType(), ptr->getType()}, false); - const auto funcPtr = CastInst::Create(Instruction::IntToPtr, empty, PointerType::getUnqual(funType), "empty", block); - CallInst::Create(funType, funcPtr, {factory, ptr}, "", block); - const auto first = new LoadInst(valueType, ptr, "init", block); - list->addIncoming(first, block); - } + 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); + list->addIncoming(first, block); BranchInst::Create(work, block); @@ -69,22 +60,10 @@ public: { block = good; - 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); - list->addIncoming(next, block); - } else { - const auto retPtr = new AllocaInst(list->getType(), 0U, "ret_ptr", block); - const auto itemPtr = new AllocaInst(item->getType(), 0U, "item_ptr", block); - new StoreInst(list, retPtr, block); - new StoreInst(item, itemPtr, block); - const auto funType = FunctionType::get(Type::getVoidTy(context), {factory->getType(), retPtr->getType(), retPtr->getType(), itemPtr->getType()}, false); - const auto funcPtr = CastInst::Create(Instruction::IntToPtr, append, PointerType::getUnqual(funType), "append", block); - CallInst::Create(funType, funcPtr, {factory, retPtr, retPtr, itemPtr}, "", block); - const auto next = new LoadInst(list->getType(), retPtr, "next", block); - list->addIncoming(next, block); - } + 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); + list->addIncoming(next, block); BranchInst::Create(work, block); } @@ -154,39 +133,19 @@ public: BranchInst::Create(work, done, null, block); block = work; - 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); - result->addIncoming(res, block); - } else { - const auto ptr = new AllocaInst(seq->getType(), 0U, "ptr", block); - new StoreInst(seq, ptr, block); - const auto funType = FunctionType::get(Type::getVoidTy(context), {factory->getType(), ptr->getType(), ptr->getType()}, false); - const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block); - CallInst::Create(funType, funcPtr, {factory, ptr, ptr}, "", block); - const auto res = new LoadInst(seq->getType(), ptr, "res", block); - result->addIncoming(res, block); - } + 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); + result->addIncoming(res, block); BranchInst::Create(done, block); block = done; return result; } else { - 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); - return res; - } else { - const auto ptr = new AllocaInst(seq->getType(), 0U, "ptr", block); - new StoreInst(seq, ptr, block); - const auto funType = FunctionType::get(Type::getVoidTy(context), {factory->getType(), ptr->getType(), ptr->getType()}, false); - const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block); - CallInst::Create(funType, funcPtr, {factory, ptr, ptr}, "", block); - const auto res = new LoadInst(seq->getType(), ptr, "res", block); - return res; - } + 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); + return res; } } #endif diff --git a/yql/essentials/minikql/comp_nodes/mkql_combine.cpp b/yql/essentials/minikql/comp_nodes/mkql_combine.cpp index dffe2e1c5aa..cc618593bcb 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_combine.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_combine.cpp @@ -354,12 +354,7 @@ public: const auto key = GetNodeValue(Nodes.KeyResultNode, ctx, block); codegenKeyArg->CreateSetValue(ctx, block, key); - 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()) { - new StoreInst(key, keyParam, block); - } + const auto keyParam = key; const auto atFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TState::At)); const auto atType = FunctionType::get(ptrValueType, {stateArg->getType(), keyParam->getType()}, false); @@ -722,7 +717,7 @@ private: const auto valueType = Type::getInt128Ty(context); const auto ptrValueType = PointerType::getUnqual(valueType); - const auto containerType = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? static_cast<Type*>(ptrValueType) : static_cast<Type*>(valueType); + const auto containerType = static_cast<Type*>(valueType); const auto contextType = GetCompContextType(context); const auto statusType = Type::getInt32Ty(context); @@ -830,8 +825,7 @@ private: const auto used = GetMemoryUsed(MemLimit, ctx, block); - const auto stream = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? - new LoadInst(valueType, containerArg, "load_container", false, block) : static_cast<Value*>(containerArg); + const auto stream = static_cast<Value*>(containerArg); BranchInst::Create(loop, block); @@ -850,12 +844,7 @@ private: const auto key = GetNodeValue(Nodes.KeyResultNode, ctx, block); codegenKeyArg->CreateSetValue(ctx, block, key); - 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()) { - new StoreInst(key, keyParam, block); - } + const auto keyParam = key; const auto atFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TState::At)); const auto atType = FunctionType::get(ptrValueType, {stateArg->getType(), keyParam->getType()}, false); diff --git a/yql/essentials/minikql/comp_nodes/mkql_condense.cpp b/yql/essentials/minikql/comp_nodes/mkql_condense.cpp index f7c26232735..ff729dbbed6 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_condense.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_condense.cpp @@ -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 = static_cast<Type*>(valueType); const auto contextType = GetCompContextType(context); const auto statusType = Type::getInt32Ty(context); const auto stateType = Type::getInt8Ty(context); @@ -373,8 +373,7 @@ private: const auto main = BasicBlock::Create(context, "main", ctx.Func); auto block = main; - const auto container = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? - new LoadInst(valueType, containerArg, "load_container", false, block) : static_cast<Value*>(containerArg); + const auto container = static_cast<Value*>(containerArg); const auto state = new LoadInst(stateType, statePtr, "state", block); diff --git a/yql/essentials/minikql/comp_nodes/mkql_condense1.cpp b/yql/essentials/minikql/comp_nodes/mkql_condense1.cpp index 1cf679ed07f..a573b480720 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_condense1.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_condense1.cpp @@ -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 = static_cast<Type*>(valueType); const auto contextType = GetCompContextType(context); const auto statusType = Type::getInt32Ty(context); const auto stateType = Type::getInt8Ty(context); @@ -391,8 +391,7 @@ private: const auto main = BasicBlock::Create(context, "main", ctx.Func); auto block = main; - const auto container = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? - new LoadInst(valueType, containerArg, "load_container", false, block) : static_cast<Value*>(containerArg); + const auto container = static_cast<Value*>(containerArg); const auto step = BasicBlock::Create(context, "step", ctx.Func); const auto none = BasicBlock::Create(context, "none", ctx.Func); diff --git a/yql/essentials/minikql/comp_nodes/mkql_decimal_div.cpp b/yql/essentials/minikql/comp_nodes/mkql_decimal_div.cpp index 394ddbc4f51..be561df7e3f 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_decimal_div.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_decimal_div.cpp @@ -46,13 +46,11 @@ public: 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() ? - FunctionType::get(valType, { valType, valType, valType }, false): - FunctionType::get(Type::getVoidTy(context), { valTypePtr, valTypePtr, valTypePtr, valTypePtr }, false); + const auto fnType = + FunctionType::get(valType, { valType, valType, valType }, false); const auto func = ctx.Codegen.GetModule().getOrInsertFunction(name, fnType); const auto left = GetNodeValue(Left, ctx, block); @@ -73,20 +71,7 @@ public: block = good; - Value* muldiv; - 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); - const auto arg1Ptr = new AllocaInst(valType, 0U, "arg1", block); - const auto arg2Ptr = new AllocaInst(valType, 0U, "arg2", block); - const auto arg3Ptr = new AllocaInst(valType, 0U, "arg3", block); - new StoreInst(GetterForInt128(left, block), arg1Ptr, block); - new StoreInst(NDecimal::GenConstant(Divider, context), arg2Ptr, block); - new StoreInst(GetterForInt128(right, block), arg3Ptr, block); - CallInst::Create(func, { retPtr, arg1Ptr, arg2Ptr, arg3Ptr }, "", block); - muldiv = new LoadInst(valType, retPtr, "res", block); - } + const auto muldiv = CallInst::Create(func, { GetterForInt128(left, block), NDecimal::GenConstant(Divider, context), GetterForInt128(right, block) }, "mul_and_div", block); const auto ok = NDecimal::GenInBounds(muldiv, NDecimal::GenConstant(-Bound, context), NDecimal::GenConstant(+Bound, context), block); const auto nan = NDecimal::GenIsNonComparable(muldiv, context, block); @@ -102,20 +87,7 @@ public: block = done; return result; } else { - Value* muldiv; - 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); - const auto arg1Ptr = new AllocaInst(valType, 0U, "arg1", block); - const auto arg2Ptr = new AllocaInst(valType, 0U, "arg2", block); - const auto arg3Ptr = new AllocaInst(valType, 0U, "arg3", block); - new StoreInst(GetterForInt128(left, block), arg1Ptr, block); - new StoreInst(NDecimal::GenConstant(Divider, context), arg2Ptr, block); - new StoreInst(GetterForInt128(right, block), arg3Ptr, block); - CallInst::Create(func, { retPtr, arg1Ptr, arg2Ptr, arg3Ptr }, "", block); - muldiv = new LoadInst(valType, retPtr, "res", block); - } + const auto muldiv = CallInst::Create(func, { GetterForInt128(left, block), NDecimal::GenConstant(Divider, context), GetterForInt128(right, block) }, "mul_and_div", block); const auto ok = NDecimal::GenInBounds(muldiv, NDecimal::GenConstant(-Bound, context), NDecimal::GenConstant(+Bound, context), block); const auto nan = NDecimal::GenIsNonComparable(muldiv, context, block); @@ -168,13 +140,11 @@ public: 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() ? - FunctionType::get(valType, { valType, valType }, false): - FunctionType::get(Type::getVoidTy(context), { valTypePtr, valTypePtr, valTypePtr }, false); + const auto fnType = + FunctionType::get(valType, { valType, valType }, false); const auto func = ctx.Codegen.GetModule().getOrInsertFunction(name, fnType); const auto left = GetNodeValue(Left, ctx, block); @@ -199,19 +169,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()) { - div = CallInst::Create(func, {GetterForInt128(left, block), cast}, "div", block); - } else { - const auto retPtr = new AllocaInst(valType, 0U, "ret_ptr", block); - const auto arg1Ptr = new AllocaInst(valType, 0U, "arg1", block); - const auto arg2Ptr = new AllocaInst(valType, 0U, "arg2", block); - new StoreInst(GetterForInt128(left, block), arg1Ptr, block); - new StoreInst(cast, arg2Ptr, block); - CallInst::Create(func, { retPtr, arg1Ptr, arg2Ptr }, "", block); - div = new LoadInst(valType, retPtr, "res", block); - } - + const auto div = CallInst::Create(func, {GetterForInt128(left, block), cast}, "div", block); result->addIncoming(SetterForInt128(div, block), block); BranchInst::Create(done, block); @@ -221,18 +179,7 @@ public: const auto cast = std::is_signed<TRight>() ? 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()) { - div = CallInst::Create(func, {GetterForInt128(left, block), cast}, "div", block); - } else { - const auto retPtr = new AllocaInst(valType, 0U, "ret_ptr", block); - const auto arg1Ptr = new AllocaInst(valType, 0U, "arg1", block); - const auto arg2Ptr = new AllocaInst(valType, 0U, "arg2", block); - new StoreInst(GetterForInt128(left, block), arg1Ptr, block); - new StoreInst(cast, arg2Ptr, block); - CallInst::Create(func, { retPtr, arg1Ptr, arg2Ptr }, "", block); - div = new LoadInst(valType, retPtr, "res", block); - } + const auto div = CallInst::Create(func, {GetterForInt128(left, block), cast}, "div", block); return SetterForInt128(div, block); } } diff --git a/yql/essentials/minikql/comp_nodes/mkql_decimal_mul.cpp b/yql/essentials/minikql/comp_nodes/mkql_decimal_mul.cpp index a92f8fa8791..80dd95b79e7 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_decimal_mul.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_decimal_mul.cpp @@ -47,17 +47,12 @@ public: auto& context = ctx.Codegen.GetContext(); const auto valType = Type::getInt128Ty(context); - const auto valTypePtr = PointerType::getUnqual(valType); const bool useMulAddDiv = Divider > 1; const auto name = useMulAddDiv ? "DecimalMulAndDivNormalDivider" : "DecimalMul"; const auto fnType = useMulAddDiv ? - 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() ? - FunctionType::get(valType, { valType, valType}, false): - FunctionType::get(Type::getVoidTy(context), { valTypePtr, valTypePtr, valTypePtr }, false); + FunctionType::get(valType, { valType, valType, valType }, false): + FunctionType::get(valType, { valType, valType}, 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); @@ -82,31 +77,9 @@ public: Value* muldiv; if (useMulAddDiv) { - 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); - const auto arg1Ptr = new AllocaInst(valType, 0U, "arg1", block); - const auto arg2Ptr = new AllocaInst(valType, 0U, "arg2", block); - const auto arg3Ptr = new AllocaInst(valType, 0U, "arg3", block); - new StoreInst(GetterForInt128(left, block), arg1Ptr, block); - new StoreInst(GetterForInt128(right, block), arg2Ptr, block); - new StoreInst(NDecimal::GenConstant(Divider, context), arg3Ptr, block); - CallInst::Create(func, { retPtr, arg1Ptr, arg2Ptr, arg3Ptr }, "", block); - muldiv = new LoadInst(valType, retPtr, "res", block); - } + muldiv = CallInst::Create(func, { GetterForInt128(left, block), GetterForInt128(right, block), NDecimal::GenConstant(Divider, context) }, "mul_and_div", block); } else { - 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); - const auto arg1Ptr = new AllocaInst(valType, 0U, "arg1", block); - const auto arg2Ptr = new AllocaInst(valType, 0U, "arg2", block); - new StoreInst(GetterForInt128(left, block), arg1Ptr, block); - new StoreInst(GetterForInt128(right, block), arg2Ptr, block); - CallInst::Create(func, { retPtr, arg1Ptr, arg2Ptr }, "", block); - muldiv = new LoadInst(valType, retPtr, "res", block); - } + muldiv = CallInst::Create(func, { GetterForInt128(left, block), GetterForInt128(right, block) }, "mul", block); } const auto ok = NDecimal::GenInBounds(muldiv, NDecimal::GenConstant(-Bound, context), NDecimal::GenConstant(+Bound, context), block); @@ -125,31 +98,9 @@ public: } else { Value* muldiv; if (useMulAddDiv) { - 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); - const auto arg1Ptr = new AllocaInst(valType, 0U, "arg1", block); - const auto arg2Ptr = new AllocaInst(valType, 0U, "arg2", block); - const auto arg3Ptr = new AllocaInst(valType, 0U, "arg3", block); - new StoreInst(GetterForInt128(left, block), arg1Ptr, block); - new StoreInst(GetterForInt128(right, block), arg2Ptr, block); - new StoreInst(NDecimal::GenConstant(Divider, context), arg3Ptr, block); - CallInst::Create(func, { retPtr, arg1Ptr, arg2Ptr, arg3Ptr }, "", block); - muldiv = new LoadInst(valType, retPtr, "res", block); - } + muldiv = CallInst::Create(func, { GetterForInt128(left, block), GetterForInt128(right, block), NDecimal::GenConstant(Divider, context) }, "mul_and_div", block); } else { - 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); - const auto arg1Ptr = new AllocaInst(valType, 0U, "arg1", block); - const auto arg2Ptr = new AllocaInst(valType, 0U, "arg2", block); - new StoreInst(GetterForInt128(left, block), arg1Ptr, block); - new StoreInst(GetterForInt128(right, block), arg2Ptr, block); - CallInst::Create(func, { retPtr, arg1Ptr, arg2Ptr }, "", block); - muldiv = new LoadInst(valType, retPtr, "res", block); - } + muldiv = CallInst::Create(func, { GetterForInt128(left, block), GetterForInt128(right, block) }, "mul", block); } const auto ok = NDecimal::GenInBounds(muldiv, NDecimal::GenConstant(-Bound, context), NDecimal::GenConstant(+Bound, context), block); @@ -206,13 +157,11 @@ public: 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() ? - FunctionType::get(valType, { valType, valType }, false): - FunctionType::get(Type::getVoidTy(context), { valTypePtr, valTypePtr, valTypePtr }, false); + const auto fnType = + FunctionType::get(valType, { valType, valType }, false); const auto func = ctx.Codegen.GetModule().getOrInsertFunction(name, fnType); const auto left = GetNodeValue(Left, ctx, block); @@ -236,18 +185,7 @@ public: const auto cast = std::is_signed<TRight>() ? 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()) { - mul = CallInst::Create(func, {GetterForInt128(left, block), cast}, "div", block); - } else { - const auto retPtr = new AllocaInst(valType, 0U, "ret_ptr", block); - const auto arg1Ptr = new AllocaInst(valType, 0U, "arg1", block); - const auto arg2Ptr = new AllocaInst(valType, 0U, "arg2", block); - new StoreInst(GetterForInt128(left, block), arg1Ptr, block); - new StoreInst(cast, arg2Ptr, block); - CallInst::Create(func, { retPtr, arg1Ptr, arg2Ptr }, "", block); - mul = new LoadInst(valType, retPtr, "res", block); - } + const auto mul = CallInst::Create(func, {GetterForInt128(left, block), cast}, "div", block); const auto ok = NDecimal::GenInBounds(mul, NDecimal::GenConstant(-Bound, context), NDecimal::GenConstant(+Bound, context), block); const auto nan = NDecimal::GenIsNonComparable(mul, context, block); @@ -266,18 +204,7 @@ public: const auto cast = std::is_signed<TRight>() ? 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()) { - mul = CallInst::Create(func, {GetterForInt128(left, block), cast}, "div", block); - } else { - const auto retPtr = new AllocaInst(valType, 0U, "ret_ptr", block); - const auto arg1Ptr = new AllocaInst(valType, 0U, "arg1", block); - const auto arg2Ptr = new AllocaInst(valType, 0U, "arg2", block); - new StoreInst(GetterForInt128(left, block), arg1Ptr, block); - new StoreInst(cast, arg2Ptr, block); - CallInst::Create(func, { retPtr, arg1Ptr, arg2Ptr }, "", block); - mul = new LoadInst(valType, retPtr, "res", block); - } + const auto mul = CallInst::Create(func, {GetterForInt128(left, block), cast}, "div", block); const auto ok = NDecimal::GenInBounds(mul, NDecimal::GenConstant(-Bound, context), NDecimal::GenConstant(+Bound, context), block); const auto nan = NDecimal::GenIsNonComparable(mul, context, block); diff --git a/yql/essentials/minikql/comp_nodes/mkql_dictitems.cpp b/yql/essentials/minikql/comp_nodes/mkql_dictitems.cpp index 54d839e9c74..8790089972d 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_dictitems.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_dictitems.cpp @@ -159,7 +159,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 = 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); @@ -178,8 +178,7 @@ private: const auto main = BasicBlock::Create(context, "main", ctx.Func); auto block = main; - const auto container = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? - new LoadInst(valueType, containerArg, "load_container", false, block) : static_cast<Value*>(containerArg); + const auto container = static_cast<Value*>(containerArg); const auto good = BasicBlock::Create(context, "good", ctx.Func); const auto done = BasicBlock::Create(context, "done", ctx.Func); diff --git a/yql/essentials/minikql/comp_nodes/mkql_discard.cpp b/yql/essentials/minikql/comp_nodes/mkql_discard.cpp index 1fbbf6ac61a..969f0297312 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_discard.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_discard.cpp @@ -167,7 +167,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 = 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); @@ -185,8 +185,7 @@ private: const auto main = BasicBlock::Create(context, "main", ctx.Func); auto block = main; - const auto container = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? - new LoadInst(valueType, containerArg, "load_container", false, block) : static_cast<Value*>(containerArg); + const auto container = static_cast<Value*>(containerArg); const auto loop = BasicBlock::Create(context, "loop", ctx.Func); diff --git a/yql/essentials/minikql/comp_nodes/mkql_enumerate.cpp b/yql/essentials/minikql/comp_nodes/mkql_enumerate.cpp index 9905e97d1ac..61887fe000e 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_enumerate.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_enumerate.cpp @@ -133,20 +133,10 @@ 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()) { - 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); - return output; - } else { - const auto place = new AllocaInst(list->getType(), 0U, "place", block); - new StoreInst(list, place, block); - const auto signature = FunctionType::get(Type::getVoidTy(context), {self->getType(), place->getType(), ctx.Ctx->getType(), place->getType(), start->getType(), step->getType()}, false); - const auto creator = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(signature), "creator", block); - CallInst::Create(signature, creator, {self, place, ctx.Ctx, place, start, step}, "", block); - const auto output = new LoadInst(list->getType(), place, "output", block); - return output; - } + 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); + return output; } #endif private: diff --git a/yql/essentials/minikql/comp_nodes/mkql_extend.cpp b/yql/essentials/minikql/comp_nodes/mkql_extend.cpp index 75033de49dd..1be59576c0a 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_extend.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_extend.cpp @@ -566,19 +566,10 @@ 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()) { - 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); - return res; - } else { - const auto retPtr = new AllocaInst(valueType, 0U, "ret_ptr", block); - const auto funType = FunctionType::get(Type::getVoidTy(context), {factory->getType(), retPtr->getType(), array->getType(), size->getType()}, false); - const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block); - CallInst::Create(funType, funcPtr, {factory, retPtr, array, size}, "", block); - const auto res = new LoadInst(valueType, retPtr, "res", block); - return res; - } + 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); + return res; } #endif private: diff --git a/yql/essentials/minikql/comp_nodes/mkql_filter.cpp b/yql/essentials/minikql/comp_nodes/mkql_filter.cpp index 5e8993db578..55edc59f3f1 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_filter.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_filter.cpp @@ -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 = 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); @@ -299,8 +299,7 @@ protected: const auto main = BasicBlock::Create(context, "main", ctx.Func); auto block = main; - const auto container = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? - new LoadInst(valueType, containerArg, "load_container", false, block) : static_cast<Value*>(containerArg); + const auto container = static_cast<Value*>(containerArg); const auto loop = BasicBlock::Create(context, "loop", ctx.Func); const auto good = BasicBlock::Create(context, "good", ctx.Func); @@ -488,7 +487,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 = 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); @@ -523,8 +522,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 ? - new LoadInst(valueType, containerArg, "load_container", false, block) : static_cast<Value*>(containerArg); + const auto container = static_cast<Value*>(containerArg); BranchInst::Create(loop, block); block = loop; @@ -971,20 +969,10 @@ 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()) { - 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); - out->addIncoming(value, block); - } else { - const auto resultPtr = new AllocaInst(list->getType(), 0U, "return", block); - new StoreInst(list, resultPtr, block); - const auto funType = FunctionType::get(Type::getVoidTy(context), {self->getType(), resultPtr->getType(), ctx.Ctx->getType(), resultPtr->getType()}, false); - const auto doFuncPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(funType), "function", block); - CallInst::Create(funType, doFuncPtr, {self, resultPtr, ctx.Ctx, resultPtr}, "", block); - const auto value = new LoadInst(list->getType(), resultPtr, "value", block); - out->addIncoming(value, block); - } + 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); + out->addIncoming(value, block); BranchInst::Create(done, block); } @@ -1340,20 +1328,10 @@ 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()) { - 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); - out->addIncoming(value, block); - } else { - const auto resultPtr = new AllocaInst(list->getType(), 0U, "return", block); - new StoreInst(list, resultPtr, block); - const auto funType = FunctionType::get(Type::getVoidTy(context), {self->getType(), resultPtr->getType(), ctx.Ctx->getType(), resultPtr->getType(), limit->getType()}, false); - const auto doFuncPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(funType), "function", block); - CallInst::Create(funType, doFuncPtr, {self, resultPtr, ctx.Ctx, resultPtr, limit}, "", block); - const auto value = new LoadInst(list->getType(), resultPtr, "value", block); - out->addIncoming(value, block); - } + 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); + out->addIncoming(value, block); BranchInst::Create(done, block); } diff --git a/yql/essentials/minikql/comp_nodes/mkql_flatmap.cpp b/yql/essentials/minikql/comp_nodes/mkql_flatmap.cpp index dc1d9a7472f..0e53e650ac6 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_flatmap.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_flatmap.cpp @@ -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 = 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); @@ -1189,8 +1189,7 @@ protected: const auto main = BasicBlock::Create(context, "main", ctx.Func); auto block = main; - const auto container = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? - new LoadInst(valueType, containerArg, "load_container", false, block) : static_cast<Value*>(containerArg); + const auto container = static_cast<Value*>(containerArg); const auto loop = BasicBlock::Create(context, "loop", ctx.Func); const auto good = BasicBlock::Create(context, "good", ctx.Func); @@ -1242,7 +1241,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 = 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); @@ -1263,8 +1262,7 @@ protected: const auto main = BasicBlock::Create(context, "main", ctx.Func); auto block = main; - const auto container = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? - new LoadInst(valueType, containerArg, "load_container", false, block) : static_cast<Value*>(containerArg); + const auto container = static_cast<Value*>(containerArg); const auto zero = ConstantInt::get(valueType, 0); @@ -1578,17 +1576,9 @@ public: const auto func = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&THolderFactory::ExtendList<ResultContainerOpt>)); - 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); - } else { - const auto retPtr = new AllocaInst(list->getType(), 0U, "ret_ptr", block); - const auto funType = FunctionType::get(Type::getVoidTy(context), {factory->getType(), retPtr->getType(), vector->getType(), index->getType()}, false); - const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block); - CallInst::Create(funType, funcPtr, {factory, retPtr, vector, index}, "", block); - res = new LoadInst(list->getType(), retPtr, "res", block); - } + 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); } map->addIncoming(res, block); BranchInst::Create(free, done, heap, block); @@ -1613,20 +1603,10 @@ 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()) { - 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); - map->addIncoming(value, block); - } else { - const auto resultPtr = new AllocaInst(list->getType(), 0U, "return", block); - new StoreInst(list, resultPtr, block); - const auto funType = FunctionType::get(Type::getVoidTy(context), {self->getType(), resultPtr->getType(), ctx.Ctx->getType(), resultPtr->getType()}, false); - const auto doFuncPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(funType), "function", block); - CallInst::Create(funType, doFuncPtr, {self, resultPtr, ctx.Ctx, resultPtr}, "", block); - const auto value = new LoadInst(list->getType(), resultPtr, "value", block); - map->addIncoming(value, block); - } + 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); + map->addIncoming(value, block); BranchInst::Create(done, block); } diff --git a/yql/essentials/minikql/comp_nodes/mkql_fromstring.cpp b/yql/essentials/minikql/comp_nodes/mkql_fromstring.cpp index d208343cc2a..7b8c0fe0a6f 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_fromstring.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_fromstring.cpp @@ -78,13 +78,11 @@ public: 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() ? - FunctionType::get(valType, { valType, psType, psType }, false): - FunctionType::get(Type::getVoidTy(context), { valTypePtr, valTypePtr, psType, psType }, false); + const auto fnType = + FunctionType::get(valType, { valType, psType, psType }, false); const auto func = ctx.Codegen.GetModule().getOrInsertFunction(name, fnType); const auto zero = ConstantInt::get(valType, 0ULL); @@ -108,15 +106,7 @@ public: block = call; } - Value* decimal; - 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); - new StoreInst(value, retPtr, block); - CallInst::Create(func, { retPtr, retPtr, precision, scale }, "", block); - decimal = new LoadInst(valType, retPtr, "res", block); - } + const auto decimal = CallInst::Create(func, { value, precision, scale }, "from_string", block); if (Data->IsTemporaryValue()) ValueCleanup(Data->GetRepresentation(), value, ctx, block); @@ -198,13 +188,11 @@ public: 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() ? - FunctionType::get(valType, { valType, slotType }, false): - FunctionType::get(Type::getVoidTy(context), { valTypePtr, valTypePtr, slotType }, false); + const auto fnType = + FunctionType::get(valType, { valType, slotType }, false); const auto func = ctx.Codegen.GetModule().getOrInsertFunction(name, fnType); const auto zero = ConstantInt::get(valType, 0ULL); @@ -224,15 +212,7 @@ public: block = call; } - Value* data; - 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); - new StoreInst(value, retPtr, block); - CallInst::Create(func, { retPtr, retPtr, slot }, "", block); - data = new LoadInst(valType, retPtr, "res", block); - } + Value* data = CallInst::Create(func, { value, slot }, "from_string", block); if (Data->IsTemporaryValue()) ValueCleanup(Data->GetRepresentation(), value, ctx, block); diff --git a/yql/essentials/minikql/comp_nodes/mkql_heap.cpp b/yql/essentials/minikql/comp_nodes/mkql_heap.cpp index 74fa51806a8..260223a0f36 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_heap.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_heap.cpp @@ -84,18 +84,9 @@ public: const auto idxType = Type::getInt32Ty(context); Value* array = nullptr; - 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); - } else { - const auto arrayPtr = new AllocaInst(valueType, 0U, "array_ptr", block); - new StoreInst(list, arrayPtr, block); - const auto funType = FunctionType::get(Type::getVoidTy(context), {fact->getType(), arrayPtr->getType(), arrayPtr->getType(), itemsPtr->getType()}, false); - const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block); - CallInst::Create(funType, funcPtr, {fact, arrayPtr, arrayPtr, itemsPtr}, "", block); - array = new LoadInst(valueType, arrayPtr, "array", block); - } + 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); result->addIncoming(array, block); @@ -269,18 +260,9 @@ public: const auto idxType = Type::getInt32Ty(context); Value* array = nullptr; - 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); - } else { - const auto arrayPtr = new AllocaInst(valueType, 0U, "array_ptr", block); - new StoreInst(list, arrayPtr, block); - const auto funType = FunctionType::get(Type::getVoidTy(context), {fact->getType(), arrayPtr->getType(), arrayPtr->getType(), itemsPtr->getType()}, false); - const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block); - CallInst::Create(funType, funcPtr, {fact, arrayPtr, arrayPtr, itemsPtr}, "", block); - array = new LoadInst(valueType, arrayPtr, "array", block); - } + 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); result->addIncoming(array, block); diff --git a/yql/essentials/minikql/comp_nodes/mkql_iterator.cpp b/yql/essentials/minikql/comp_nodes/mkql_iterator.cpp index dcd9d351cfa..b413d1cbca8 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_iterator.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_iterator.cpp @@ -30,20 +30,10 @@ public: const auto factory = ctx.GetFactory(); const auto func = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&THolderFactory::CreateIteratorOverList)); - 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); - return output; - } else { - const auto place = new AllocaInst(value->getType(), 0U, "place", block); - new StoreInst(value, place, block); - const auto signature = FunctionType::get(Type::getVoidTy(context), {factory->getType(), place->getType(), place->getType()}, false); - const auto creator = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(signature), "creator", block); - CallInst::Create(signature, creator, {factory, place, place}, "", block); - const auto output = new LoadInst(value->getType(), place, "output", block); - return output; - } + 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); + return output; } #endif private: @@ -76,20 +66,10 @@ public: const auto factory = ctx.GetFactory(); const auto func = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&THolderFactory::CreateForwardList)); - 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); - return output; - } else { - const auto place = new AllocaInst(value->getType(), 0U, "place", block); - new StoreInst(value, place, block); - const auto signature = FunctionType::get(Type::getVoidTy(context), {factory->getType(), place->getType(), place->getType()}, false); - const auto creator = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(signature), "creator", block); - CallInst::Create(signature, creator, {factory, place, place}, "", block); - const auto output = new LoadInst(value->getType(), place, "output", block); - return output; - } + 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); + return output; } #endif private: diff --git a/yql/essentials/minikql/comp_nodes/mkql_join_dict.cpp b/yql/essentials/minikql/comp_nodes/mkql_join_dict.cpp index b93970b6466..127e32a0ebf 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_join_dict.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_join_dict.cpp @@ -49,27 +49,12 @@ public: const auto one = GetNodeValue(Dict1, ctx, block); const auto two = GetNodeValue(Dict2, ctx, block); - 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); - const auto join = CallInst::Create(joinFuncType, joinFuncPtr, { joinFuncArg, ctx.Ctx, one, two }, "join", block); - AddRefBoxed(join, ctx, block); - new StoreInst(join, pointer, block); - } else { - const auto onePtr = new AllocaInst(one->getType(), 0U, "one_ptr", block); - const auto twoPtr = new AllocaInst(two->getType(), 0U, "two_ptr", block); - new StoreInst(one, onePtr, block); - new StoreInst(two, twoPtr, block); - - const auto joinFuncType = FunctionType::get(Type::getVoidTy(context), - { joinFuncArg->getType(), pointer->getType(), ctx.Ctx->getType(), onePtr->getType(), twoPtr->getType() }, false); - - const auto joinFuncPtr = CastInst::Create(Instruction::IntToPtr, joinFunc, PointerType::getUnqual(joinFuncType), "cast", block); - CallInst::Create(joinFuncType, joinFuncPtr, { joinFuncArg, pointer, ctx.Ctx, onePtr, twoPtr }, "", block); - const auto join = new LoadInst(Type::getInt128Ty(context), pointer, "join", block); - AddRefBoxed(join, ctx, block); - } + 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); + const auto join = CallInst::Create(joinFuncType, joinFuncPtr, { joinFuncArg, ctx.Ctx, one, two }, "join", block); + AddRefBoxed(join, ctx, block); + new StoreInst(join, pointer, block); } #endif private: diff --git a/yql/essentials/minikql/comp_nodes/mkql_lazy_list.cpp b/yql/essentials/minikql/comp_nodes/mkql_lazy_list.cpp index f7d04055582..f19ac809a42 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_lazy_list.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_lazy_list.cpp @@ -60,20 +60,10 @@ public: block = wrap; - 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); - lazy->addIncoming(res, block); - } else { - const auto retPtr = new AllocaInst(list->getType(), 0U, "ret_ptr", block); - new StoreInst(list, retPtr, block); - const auto funType = FunctionType::get(Type::getVoidTy(context), {factory->getType(), retPtr->getType(), retPtr->getType()}, false); - const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block); - CallInst::Create(funType, funcPtr, {factory, retPtr, retPtr}, "", block); - const auto res = new LoadInst(list->getType(), retPtr, "res", block); - lazy->addIncoming(res, block); - } + 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); + lazy->addIncoming(res, block); BranchInst::Create(done, block); diff --git a/yql/essentials/minikql/comp_nodes/mkql_listfromrange.cpp b/yql/essentials/minikql/comp_nodes/mkql_listfromrange.cpp index 1e374c4dcca..fab157dafbf 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_listfromrange.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_listfromrange.cpp @@ -279,19 +279,10 @@ 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()) { - 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); - return output; - } else { - const auto place = new AllocaInst(valueType, 0U, "place", block); - const auto signature = FunctionType::get(Type::getVoidTy(context), {place->getType(), 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); - CallInst::Create(signature, creator, {place, ctx.Ctx, start, end, step, timezone}, "", block); - const auto output = new LoadInst(valueType, place, "output", block); - return output; - } + 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); + return output; } #endif private: diff --git a/yql/essentials/minikql/comp_nodes/mkql_map.cpp b/yql/essentials/minikql/comp_nodes/mkql_map.cpp index 690b68228b2..ff014286e83 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_map.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_map.cpp @@ -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 = 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); @@ -216,8 +216,7 @@ protected: const auto main = BasicBlock::Create(context, "main", ctx.Func); auto block = main; - const auto container = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? - new LoadInst(valueType, containerArg, "load_container", false, block) : static_cast<Value*>(containerArg); + const auto container = static_cast<Value*>(containerArg); const auto good = BasicBlock::Create(context, "good", ctx.Func); const auto done = BasicBlock::Create(context, "done", ctx.Func); @@ -392,20 +391,10 @@ 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()) { - 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); - map->addIncoming(value, block); - } else { - const auto resultPtr = new AllocaInst(list->getType(), 0U, "return", block); - new StoreInst(list, resultPtr, block); - const auto funType = FunctionType::get(Type::getVoidTy(context), {self->getType(), resultPtr->getType(), ctx.Ctx->getType(), resultPtr->getType()}, false); - const auto doFuncPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(funType), "function", block); - CallInst::Create(funType, doFuncPtr, {self, resultPtr, ctx.Ctx, resultPtr}, "", block); - const auto value = new LoadInst(list->getType(), resultPtr, "value", block); - map->addIncoming(value, block); - } + 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); + map->addIncoming(value, block); BranchInst::Create(done, block); } diff --git a/yql/essentials/minikql/comp_nodes/mkql_map_join.cpp b/yql/essentials/minikql/comp_nodes/mkql_map_join.cpp index 05de9fafc6d..9cdb16e855f 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_map_join.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_map_join.cpp @@ -1544,7 +1544,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 = 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, containerType, PointerType::getUnqual(valueType)}, false); @@ -1564,11 +1564,9 @@ private: const auto main = BasicBlock::Create(context, "main", ctx.Func); auto block = main; - const auto stream = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? - new LoadInst(valueType, streamArg, "load_stream", false, block) : static_cast<Value*>(streamArg); + const auto stream = static_cast<Value*>(streamArg); - const auto dict = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? - new LoadInst(valueType, dictArg, "load_dict", false, block) : static_cast<Value*>(dictArg); + const auto dict = static_cast<Value*>(dictArg); const auto zero = ConstantInt::get(valueType, 0); const auto fsok = ConstantInt::get(statusType, static_cast<ui32>(NUdf::EFetchStatus::Ok)); @@ -1701,7 +1699,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 = 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, containerType, PointerType::getUnqual(valueType), PointerType::getUnqual(valueType), PointerType::getUnqual(valueType)}, false); @@ -1723,11 +1721,9 @@ private: const auto main = BasicBlock::Create(context, "main", ctx.Func); auto block = main; - const auto stream = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? - new LoadInst(valueType, streamArg, "load_stream", false, block) : static_cast<Value*>(streamArg); + const auto stream = static_cast<Value*>(streamArg); - const auto dict = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? - new LoadInst(valueType, dictArg, "load_dict", false, block) : static_cast<Value*>(dictArg); + const auto dict = static_cast<Value*>(dictArg); const auto zero = ConstantInt::get(valueType, 0); const auto fsok = ConstantInt::get(statusType, static_cast<ui32>(NUdf::EFetchStatus::Ok)); diff --git a/yql/essentials/minikql/comp_nodes/mkql_multimap.cpp b/yql/essentials/minikql/comp_nodes/mkql_multimap.cpp index c9fad3198fd..3a3f24e3742 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_multimap.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_multimap.cpp @@ -282,20 +282,10 @@ 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()) { - 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); - map->addIncoming(value, block); - } else { - const auto resultPtr = new AllocaInst(list->getType(), 0U, "return", block); - new StoreInst(list, resultPtr, block); - const auto funType = FunctionType::get(Type::getVoidTy(context), {self->getType(), resultPtr->getType(), ctx.Ctx->getType(), resultPtr->getType()}, false); - const auto doFuncPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(funType), "function", block); - CallInst::Create(funType, doFuncPtr, {self, resultPtr, ctx.Ctx, resultPtr}, "", block); - const auto value = new LoadInst(list->getType(), resultPtr, "value", block); - map->addIncoming(value, block); - } + 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); + map->addIncoming(value, block); BranchInst::Create(done, block); } @@ -335,7 +325,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 = 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); @@ -355,8 +345,7 @@ private: const auto main = BasicBlock::Create(context, "main", ctx.Func); auto block = main; - const auto container = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? - new LoadInst(valueType, containerArg, "load_container", false, block) : static_cast<Value*>(containerArg); + const auto container = static_cast<Value*>(containerArg); const auto position = new LoadInst(positionType, positionArg, "position", false, block); diff --git a/yql/essentials/minikql/comp_nodes/mkql_prepend.cpp b/yql/essentials/minikql/comp_nodes/mkql_prepend.cpp index 334197d4889..0b29d724f3b 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_prepend.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_prepend.cpp @@ -53,44 +53,20 @@ public: BranchInst::Create(work, done, check, block); block = work; - 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); - result->addIncoming(res, block); - } else { - const auto retPtr = new AllocaInst(right->getType(), 0U, "ret_ptr", block); - const auto itemPtr = new AllocaInst(left->getType(), 0U, "item_ptr", block); - new StoreInst(right, retPtr, block); - new StoreInst(left, itemPtr, block); - const auto funType = FunctionType::get(Type::getVoidTy(context), {factory->getType(), retPtr->getType(), itemPtr->getType(), retPtr->getType()}, false); - const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block); - CallInst::Create(funType, funcPtr, {factory, retPtr, itemPtr, retPtr}, "", block); - const auto res = new LoadInst(right->getType(), retPtr, "res", block); - result->addIncoming(res, block); - } + 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); + result->addIncoming(res, block); BranchInst::Create(done, block); block = done; return result; } else { - 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); - return res; - } else { - const auto retPtr = new AllocaInst(right->getType(), 0U, "ret_ptr", block); - const auto itemPtr = new AllocaInst(left->getType(), 0U, "item_ptr", block); - new StoreInst(right, retPtr, block); - new StoreInst(left, itemPtr, block); - const auto funType = FunctionType::get(Type::getVoidTy(context), {factory->getType(), retPtr->getType(), itemPtr->getType(), retPtr->getType()}, false); - const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block); - CallInst::Create(funType, funcPtr, {factory, retPtr, itemPtr, retPtr}, "", block); - const auto res = new LoadInst(right->getType(), retPtr, "res", block); - return res; - } + 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); + return res; } } #endif diff --git a/yql/essentials/minikql/comp_nodes/mkql_reverse.cpp b/yql/essentials/minikql/comp_nodes/mkql_reverse.cpp index 6549b03dfd7..692595f3a4e 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_reverse.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_reverse.cpp @@ -38,20 +38,10 @@ public: const auto list = GetNodeValue(List, ctx, block); - 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); - return result; - } else { - const auto retPtr = new AllocaInst(list->getType(), 0U, "ret_ptr", block); - new StoreInst(list, retPtr, block); - const auto funType = FunctionType::get(Type::getVoidTy(context), {factory->getType(), retPtr->getType(), builder->getType(), retPtr->getType()}, false); - const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block); - CallInst::Create(funType, funcPtr, {factory, retPtr, builder, retPtr}, "", block); - const auto result = new LoadInst(list->getType(), retPtr, "result", block); - return result; - } + 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); + return result; } #endif private: diff --git a/yql/essentials/minikql/comp_nodes/mkql_skip.cpp b/yql/essentials/minikql/comp_nodes/mkql_skip.cpp index ad9b43ebac6..9f33a1ae154 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_skip.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_skip.cpp @@ -262,20 +262,10 @@ public: const auto cnt = GetNodeValue(Count, ctx, block); const auto count = GetterFor<ui64>(cnt, context, block); - 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); - return result; - } else { - const auto retPtr = new AllocaInst(list->getType(), 0U, "ret_ptr", block); - new StoreInst(list, retPtr, block); - const auto funType = FunctionType::get(Type::getVoidTy(context), {factory->getType(), retPtr->getType(), builder->getType(), retPtr->getType(), count->getType()}, false); - const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block); - CallInst::Create(funType, funcPtr, {factory, retPtr, builder, retPtr, count}, "", block); - const auto result = new LoadInst(list->getType(), retPtr, "result", block); - return result; - } + 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); + return result; } #endif diff --git a/yql/essentials/minikql/comp_nodes/mkql_squeeze_to_list.cpp b/yql/essentials/minikql/comp_nodes/mkql_squeeze_to_list.cpp index 9a3e257c2c7..ca5e0cf547c 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_squeeze_to_list.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_squeeze_to_list.cpp @@ -140,7 +140,7 @@ public: const auto push = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TState::Put)); - const auto arg = WrapArgumentForWindows(item, ctx, block); + const auto arg = item; const auto pushType = FunctionType::get(Type::getInt1Ty(context), {stateArg->getType(), arg->getType()}, false); const auto pushPtr = CastInst::Create(Instruction::IntToPtr, push, PointerType::getUnqual(pushType), "push", block); @@ -152,21 +152,11 @@ public: const auto pull = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TState::Pull)); - 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); - UnRefBoxed(state, ctx, block); - result->addIncoming(list, block); - } else { - const auto ptr = new AllocaInst(valueType, 0U, "ptr", block); - const auto pullType = FunctionType::get(Type::getVoidTy(context), {stateArg->getType(), ptr->getType(), ctx.Ctx->getType()}, false); - const auto pullPtr = CastInst::Create(Instruction::IntToPtr, pull, PointerType::getUnqual(pullType), "pull", block); - CallInst::Create(pullType, pullPtr, {stateArg, ptr, ctx.Ctx}, "", block); - const auto list = new LoadInst(valueType, ptr, "list", block); - UnRefBoxed(state, ctx, block); - result->addIncoming(list, block); - } + 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); + UnRefBoxed(state, ctx, block); + result->addIncoming(list, block); new StoreInst(GetFinish(context), statePtr, block); BranchInst::Create(over, block); diff --git a/yql/essentials/minikql/comp_nodes/mkql_switch.cpp b/yql/essentials/minikql/comp_nodes/mkql_switch.cpp index 1dab916ca87..f8c9c2e4602 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_switch.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_switch.cpp @@ -304,9 +304,6 @@ private: auto block = main; - 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); const auto state = new LoadInst(valueType, statePtr, "state", block); const auto half = CastInst::Create(Instruction::Trunc, state, Type::getInt64Ty(context), "half", block); @@ -326,17 +323,9 @@ private: const auto getFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TFlowState::Get)); - Value* input; - 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); - } else { - const auto getType = FunctionType::get(Type::getVoidTy(context), {stateArg->getType(), placeholder->getType(), pos->getType()}, false); - const auto getPtr = CastInst::Create(Instruction::IntToPtr, getFunc, PointerType::getUnqual(getType), "get", block); - CallInst::Create(getType, getPtr, {stateArg, placeholder, pos}, "", block); - input = new LoadInst(valueType, placeholder, "input", block); - } + const auto getType = FunctionType::get(valueType, {stateArg->getType(), pos->getType()}, false); + const auto getPtr = CastInst::Create(Instruction::IntToPtr, getFunc, PointerType::getUnqual(getType), "get", block); + const auto input = CallInst::Create(getType, getPtr, {stateArg, pos}, "input", block); const auto special = SwitchInst::Create(input, good, 2U, block); special->addCase(GetYield(context), back); @@ -469,7 +458,7 @@ public: block = good; const auto addFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TFlowState::Add)); - const auto addArg = WrapArgumentForWindows(item, ctx, block); + const auto addArg = item; const auto addType = FunctionType::get(Type::getVoidTy(context), {stateArg->getType(), addArg->getType()}, false); const auto addPtr = CastInst::Create(Instruction::IntToPtr, addFunc, PointerType::getUnqual(addType), "add", block); CallInst::Create(addType, addPtr, {stateArg, addArg}, "", block); @@ -812,7 +801,7 @@ private: const auto valueType = Type::getInt128Ty(context); const auto ptrValueType = PointerType::getUnqual(valueType); - const auto containerType = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? static_cast<Type*>(ptrValueType) : static_cast<Type*>(valueType); + const auto containerType = static_cast<Type*>(valueType); const auto contextType = GetCompContextType(context); const auto statusType = Type::getInt32Ty(context); const auto indexType = Type::getInt32Ty(context); @@ -883,8 +872,7 @@ private: const auto used = GetMemoryUsed(MemLimit, ctx, block); - const auto stream = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? - new LoadInst(valueType, containerArg, "load_container", false, block) : static_cast<Value*>(containerArg); + const auto stream = static_cast<Value*>(containerArg); BranchInst::Create(loop, block); diff --git a/yql/essentials/minikql/comp_nodes/mkql_take.cpp b/yql/essentials/minikql/comp_nodes/mkql_take.cpp index 3e19ee2932d..f2e9bc7023d 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_take.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_take.cpp @@ -265,20 +265,10 @@ public: const auto cnt = GetNodeValue(Count, ctx, block); const auto count = GetterFor<ui64>(cnt, context, block); - 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); - return result; - } else { - const auto retPtr = new AllocaInst(list->getType(), 0U, "ret_ptr", block); - new StoreInst(list, retPtr, block); - const auto funType = FunctionType::get(Type::getVoidTy(context), {factory->getType(), retPtr->getType(), builder->getType(), retPtr->getType(), count->getType()}, false); - const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block); - CallInst::Create(funType, funcPtr, {factory, retPtr, builder, retPtr, count}, "", block); - const auto result = new LoadInst(list->getType(), retPtr, "result", block); - return result; - } + 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); + return result; } #endif private: diff --git a/yql/essentials/minikql/comp_nodes/mkql_todict.cpp b/yql/essentials/minikql/comp_nodes/mkql_todict.cpp index 0ac6b83a11e..10d0b4609c0 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_todict.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_todict.cpp @@ -1065,7 +1065,7 @@ public: const auto insert = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TState::Insert)); - const auto keyArg = WrapArgumentForWindows(key, ctx, block); + const auto keyArg = key; const auto insType = FunctionType::get(Type::getVoidTy(context), {stateArg->getType(), keyArg->getType()}, false); const auto insPtr = CastInst::Create(Instruction::IntToPtr, insert, PointerType::getUnqual(insType), "insert", block); @@ -1077,21 +1077,11 @@ public: const auto build = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TState::Build)); - 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); - UnRefBoxed(state, ctx, block); - result->addIncoming(dict, block); - } else { - const auto ptr = new AllocaInst(valueType, 0U, "ptr", block); - const auto funType = FunctionType::get(Type::getVoidTy(context), {stateArg->getType(), ptr->getType()}, false); - const auto funcPtr = CastInst::Create(Instruction::IntToPtr, build, PointerType::getUnqual(funType), "build", block); - CallInst::Create(funType, funcPtr, {stateArg, ptr}, "", block); - const auto dict = new LoadInst(valueType, ptr, "dict", block); - UnRefBoxed(state, ctx, block); - result->addIncoming(dict, block); - } + 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); + UnRefBoxed(state, ctx, block); + result->addIncoming(dict, block); new StoreInst(item, statePtr, block); BranchInst::Create(over, block); @@ -1262,7 +1252,7 @@ public: const auto insert = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TState::Insert)); - const auto keyArg = WrapArgumentForWindows(key, ctx, block); + const auto keyArg = key; const auto insType = FunctionType::get(Type::getVoidTy(context), {stateArg->getType(), keyArg->getType()}, false); const auto insPtr = CastInst::Create(Instruction::IntToPtr, insert, PointerType::getUnqual(insType), "insert", block); @@ -1274,21 +1264,11 @@ public: const auto build = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TState::Build)); - 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); - UnRefBoxed(state, ctx, block); - result->addIncoming(dict, block); - } else { - const auto ptr = new AllocaInst(valueType, 0U, "ptr", block); - const auto funType = FunctionType::get(Type::getVoidTy(context), {stateArg->getType(), ptr->getType()}, false); - const auto funcPtr = CastInst::Create(Instruction::IntToPtr, build, PointerType::getUnqual(funType), "build", block); - CallInst::Create(funType, funcPtr, {stateArg, ptr}, "", block); - const auto dict = new LoadInst(valueType, ptr, "dict", block); - UnRefBoxed(state, ctx, block); - result->addIncoming(dict, block); - } + 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); + UnRefBoxed(state, ctx, block); + result->addIncoming(dict, block); new StoreInst(GetFinish(context), statePtr, block); BranchInst::Create(over, block); @@ -1580,8 +1560,8 @@ public: const auto insert = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TState::Insert)); - const auto keyArg = WrapArgumentForWindows(key, ctx, block); - const auto payloadArg = WrapArgumentForWindows(payload, ctx, block); + const auto keyArg = key; + const auto payloadArg = payload; const auto insType = FunctionType::get(Type::getVoidTy(context), {stateArg->getType(), keyArg->getType(), payloadArg->getType()}, false); const auto insPtr = CastInst::Create(Instruction::IntToPtr, insert, PointerType::getUnqual(insType), "insert", block); @@ -1593,21 +1573,11 @@ public: const auto build = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TState::Build)); - 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); - UnRefBoxed(state, ctx, block); - result->addIncoming(dict, block); - } else { - const auto ptr = new AllocaInst(valueType, 0U, "ptr", block); - const auto funType = FunctionType::get(Type::getVoidTy(context), {stateArg->getType(), ptr->getType()}, false); - const auto funcPtr = CastInst::Create(Instruction::IntToPtr, build, PointerType::getUnqual(funType), "build", block); - CallInst::Create(funType, funcPtr, {stateArg, ptr}, "", block); - const auto dict = new LoadInst(valueType, ptr, "dict", block); - UnRefBoxed(state, ctx, block); - result->addIncoming(dict, block); - } + 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); + UnRefBoxed(state, ctx, block); + result->addIncoming(dict, block); new StoreInst(item, statePtr, block); BranchInst::Create(over, block); @@ -1785,8 +1755,8 @@ public: const auto insert = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TState::Insert)); - const auto keyArg = WrapArgumentForWindows(key, ctx, block); - const auto payloadArg = WrapArgumentForWindows(payload, ctx, block); + const auto keyArg = key; + const auto payloadArg = payload; const auto insType = FunctionType::get(Type::getVoidTy(context), {stateArg->getType(), keyArg->getType(), payloadArg->getType()}, false); const auto insPtr = CastInst::Create(Instruction::IntToPtr, insert, PointerType::getUnqual(insType), "insert", block); @@ -1798,21 +1768,11 @@ public: const auto build = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TState::Build)); - 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); - UnRefBoxed(state, ctx, block); - result->addIncoming(dict, block); - } else { - const auto ptr = new AllocaInst(valueType, 0U, "ptr", block); - const auto funType = FunctionType::get(Type::getVoidTy(context), {stateArg->getType(), ptr->getType()}, false); - const auto funcPtr = CastInst::Create(Instruction::IntToPtr, build, PointerType::getUnqual(funType), "build", block); - CallInst::Create(funType, funcPtr, {stateArg, ptr}, "", block); - const auto dict = new LoadInst(valueType, ptr, "dict", block); - UnRefBoxed(state, ctx, block); - result->addIncoming(dict, block); - } + 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); + UnRefBoxed(state, ctx, block); + result->addIncoming(dict, block); new StoreInst(GetFinish(context), statePtr, block); BranchInst::Create(over, block); diff --git a/yql/essentials/minikql/comp_nodes/mkql_toindexdict.cpp b/yql/essentials/minikql/comp_nodes/mkql_toindexdict.cpp index 978446be08d..2bf6be67053 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_toindexdict.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_toindexdict.cpp @@ -38,20 +38,10 @@ public: const auto list = GetNodeValue(List, ctx, block); - 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); - return result; - } else { - const auto retPtr = new AllocaInst(list->getType(), 0U, "ret_ptr", block); - new StoreInst(list, retPtr, block); - const auto funType = FunctionType::get(Type::getVoidTy(context), {factory->getType(), retPtr->getType(), builder->getType(), retPtr->getType()}, false); - const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block); - CallInst::Create(funType, funcPtr, {factory, retPtr, builder, retPtr}, "", block); - const auto result = new LoadInst(list->getType(), retPtr, "result", block); - return result; - } + 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); + return result; } #endif private: diff --git a/yql/essentials/minikql/comp_nodes/mkql_tostring.cpp b/yql/essentials/minikql/comp_nodes/mkql_tostring.cpp index b7155f01ffa..130aaf00c5e 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_tostring.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_tostring.cpp @@ -64,13 +64,11 @@ public: 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() ? - FunctionType::get(valType, { valType, psType, psType }, false): - FunctionType::get(Type::getVoidTy(context), { valTypePtr, valTypePtr, psType, psType }, false); + const auto fnType = + FunctionType::get(valType, { valType, psType, psType }, false); const auto func = ctx.Codegen.GetModule().getOrInsertFunction(name, fnType); const auto fail = BasicBlock::Create(context, "fail", ctx.Func); @@ -93,29 +91,14 @@ public: block = call; - Value* string; - 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); - new StoreInst(GetterForInt128(value, block), retPtr, block); - CallInst::Create(func, { retPtr, retPtr, precision, scale }, "", block); - string = new LoadInst(valType, retPtr, "res", block); - } + const auto string = CallInst::Create(func, { GetterForInt128(value, block), precision, scale }, "to_string", block); res->addIncoming(string, block); 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()) { - result = CallInst::Create(func, { GetterForInt128(value, block), precision, scale }, "to_string", block); - } else { - const auto retPtr = new AllocaInst(valType, 0U, "ret_ptr", block); - new StoreInst(GetterForInt128(value, block), retPtr, block); - CallInst::Create(func, { retPtr, retPtr, precision, scale }, "", block); - result = new LoadInst(valType, retPtr, "res", block); - } + result = CallInst::Create(func, { GetterForInt128(value, block), precision, scale }, "to_string", block); const auto test = CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_EQ, result, zero, "test", block); BranchInst::Create(fail, nice, test, block); @@ -170,13 +153,11 @@ public: 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() ? - FunctionType::get(valType, { valType, slotType }, false): - FunctionType::get(Type::getVoidTy(context), { valTypePtr, valTypePtr, slotType }, false); + const auto fnType = + FunctionType::get(valType, { valType, slotType }, false); const auto func = ctx.Codegen.GetModule().getOrInsertFunction(name, fnType); const auto zero = ConstantInt::get(valType, 0ULL); @@ -194,15 +175,7 @@ public: block = call; - Value* string; - 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); - new StoreInst(value, retPtr, block); - CallInst::Create(func, { retPtr, retPtr, slot }, "", block); - string = new LoadInst(valType, retPtr, "res", block); - } + const auto string = CallInst::Create(func, { value, slot }, "to_string", block); if (Data->IsTemporaryValue()) ValueCleanup(Data->GetRepresentation(), value, ctx, block); @@ -213,15 +186,7 @@ public: block = done; return result; } else { - Value* string; - 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); - new StoreInst(value, retPtr, block); - CallInst::Create(func, { retPtr, retPtr, slot}, "", block); - string = new LoadInst(valType, retPtr, "res", block); - } + const auto string = CallInst::Create(func, { value, slot }, "to_string", block); if (Data->IsTemporaryValue()) ValueCleanup(Data->GetRepresentation(), value, ctx, block); diff --git a/yql/essentials/minikql/comp_nodes/mkql_while.cpp b/yql/essentials/minikql/comp_nodes/mkql_while.cpp index 907af8f6252..233abf7e896 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_while.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_while.cpp @@ -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 = 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); @@ -335,8 +335,7 @@ protected: const auto main = BasicBlock::Create(context, "main", ctx.Func); auto block = main; - const auto container = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? - new LoadInst(valueType, containerArg, "load_container", false, block) : static_cast<Value*>(containerArg); + const auto container = static_cast<Value*>(containerArg); const auto good = BasicBlock::Create(context, "good", ctx.Func); const auto stop = BasicBlock::Create(context, "stop", ctx.Func); @@ -610,20 +609,10 @@ 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()) { - 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); - out->addIncoming(value, block); - } else { - const auto resultPtr = new AllocaInst(list->getType(), 0U, "return", block); - new StoreInst(list, resultPtr, block); - const auto funType = FunctionType::get(Type::getVoidTy(context), {self->getType(), resultPtr->getType(), ctx.Ctx->getType(), resultPtr->getType()}, false); - const auto doFuncPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(funType), "function", block); - CallInst::Create(funType, doFuncPtr, {self, resultPtr, ctx.Ctx, resultPtr}, "", block); - const auto value = new LoadInst(list->getType(), resultPtr, "value", block); - out->addIncoming(value, block); - } + 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); + out->addIncoming(value, block); BranchInst::Create(done, block); } diff --git a/yql/essentials/minikql/computation/mkql_computation_node_codegen.cpp b/yql/essentials/minikql/computation/mkql_computation_node_codegen.cpp index 7379efe3f5c..d0e4ea7871d 100644 --- a/yql/essentials/minikql/computation/mkql_computation_node_codegen.cpp +++ b/yql/essentials/minikql/computation/mkql_computation_node_codegen.cpp @@ -137,13 +137,11 @@ Function* GenerateCompareFunction(NYql::NCodegen::ICodegen& codegen, const TStri 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 ? - FunctionType::get(returnType, {PointerType::getUnqual(contextType), valueType, valueType}, false): - FunctionType::get(returnType, {PointerType::getUnqual(contextType), ptrType, ptrType}, false); + const auto funcType = + FunctionType::get(returnType, {PointerType::getUnqual(contextType), valueType, valueType}, false); TCodegenContext ctx(codegen); ctx.AlwaysInline = true; @@ -602,12 +600,10 @@ Function* GenerateEqualsFunction(NYql::NCodegen::ICodegen& codegen, const TStrin 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 ? - FunctionType::get(returnType, {valueType, valueType}, false): - FunctionType::get(returnType, {ptrType, ptrType}, false); + const auto funcType = + FunctionType::get(returnType, {valueType, valueType}, false); TCodegenContext ctx(codegen); ctx.AlwaysInline = true; @@ -733,12 +729,10 @@ Function* GenerateHashFunction(NYql::NCodegen::ICodegen& codegen, const TString& 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 ? - FunctionType::get(returnType, {valueType}, false): - FunctionType::get(returnType, {ptrType}, false); + const auto funcType = + FunctionType::get(returnType, {valueType}, false); TCodegenContext ctx(codegen); ctx.AlwaysInline = true; @@ -1069,9 +1063,8 @@ Function* TExternalCodegeneratorRootNode::GenerateGetValue(NYql::NCodegen::ICode const auto valueType = Type::getInt128Ty(context); const auto contextType = GetCompContextType(context); - 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); + const auto funcType = + FunctionType::get(valueType, {PointerType::getUnqual(contextType)}, false); TCodegenContext ctx(codegen); ctx.Func = cast<Function>(module.getOrInsertFunction(name.c_str(), funcType).getCallee()); @@ -1079,25 +1072,13 @@ Function* TExternalCodegeneratorRootNode::GenerateGetValue(NYql::NCodegen::ICode DISubprogramAnnotator annotator(ctx, ctx.Func); auto args = ctx.Func->arg_begin(); - if (codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows) { - auto& firstArg = *args++; - firstArg.addAttr(Attribute::StructRet); - firstArg.addAttr(Attribute::NoAlias); - } - auto main = BasicBlock::Create(context, "main", ctx.Func); ctx.Ctx = &*args; ctx.Ctx->addAttr(Attribute::NonNull); const auto get = CreateGetValue(ctx, main); - if (codegen.GetEffectiveTarget() != NYql::NCodegen::ETarget::Windows) { - ReturnInst::Create(context, get, main); - } else { - new StoreInst(get, &*--args, main); - ReturnInst::Create(context, main); - } - + ReturnInst::Create(context, get, main); return ctx.Func; } @@ -1110,8 +1091,7 @@ Function* TExternalCodegeneratorRootNode::GenerateSetValue(NYql::NCodegen::ICode const auto intType = Type::getInt128Ty(context); const auto contextType = GetCompContextType(context); - const auto valueType = codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? - (Type*)PointerType::getUnqual(intType) : (Type*)intType; + const auto valueType = (Type*)intType; const auto funcType = FunctionType::get(Type::getVoidTy(context), {PointerType::getUnqual(contextType), valueType}, false); TCodegenContext ctx(codegen); @@ -1127,12 +1107,7 @@ Function* TExternalCodegeneratorRootNode::GenerateSetValue(NYql::NCodegen::ICode const auto valueArg = &*++args; - if (codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows) { - const auto value = new LoadInst(valueArg->getType(), valueArg, "load_value", main); - CreateSetValue(ctx, main, value); - } else { - CreateSetValue(ctx, main, valueArg); - } + CreateSetValue(ctx, main, valueArg); ReturnInst::Create(context, main); return ctx.Func; } @@ -1893,20 +1868,10 @@ 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()) { - 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); - result->addIncoming(output, block); - } else { - const auto place = new AllocaInst(item->getType(), 0U, "place", block); - new StoreInst(item, place, block); - const auto signature = FunctionType::get(Type::getVoidTy(context), {factory->getType(), place->getType(), place->getType(), variant->getType()}, false); - const auto creator = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(signature), "creator", block); - CallInst::Create(signature, creator, {factory, place, place, variant}, "", block); - const auto output = new LoadInst(item->getType(), place, "output", block); - result->addIncoming(output, block); - } + 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); + result->addIncoming(output, block); BranchInst::Create(done, block); } @@ -1926,9 +1891,8 @@ Value* GetNodeValue(IComputationNode* node, const TCodegenContext& ctx, BasicBlo 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 ? - 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 funType = + FunctionType::get(Type::getVoidTy(context), {retPtr->getType(), nodeThis->getType(), ctx.Ctx->getType()}, false); const auto ptrFunType = PointerType::getUnqual(funType); const auto tableType = PointerType::getUnqual(ptrFunType); const auto nodeVTable = CastInst::Create(Instruction::IntToPtr, ptr, PointerType::getUnqual(tableType), "node_vtable", block); @@ -1937,11 +1901,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) { - CallInst::Create(funType, func, {retPtr, nodeThis, ctx.Ctx}, "", block); - } else { - CallInst::Create(funType, func, {nodeThis, retPtr, ctx.Ctx}, "", block); - } + CallInst::Create(funType, func, {retPtr, nodeThis, ctx.Ctx}, "", block); ValueRelease(node->GetRepresentation(), retPtr, ctx, block); const auto result = new LoadInst(valueType, retPtr, "return", false, block); @@ -1961,9 +1921,9 @@ void GetNodeValue(Value* value, IComputationNode* node, const TCodegenContext& c 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 ? - 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 funType = + FunctionType::get(Type::getVoidTy(context), {value->getType(), nodeThis->getType(), ctx.Ctx->getType()}, false); + const auto ptrFunType = PointerType::getUnqual(funType); const auto tableType = PointerType::getUnqual(ptrFunType); const auto nodeVTable = CastInst::Create(Instruction::IntToPtr, ptr, PointerType::getUnqual(tableType), "node_vtable", block); @@ -1972,11 +1932,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) { - CallInst::Create(funType, func, {value, nodeThis, ctx.Ctx}, "", block); - } else { - CallInst::Create(funType, func, {nodeThis, value, ctx.Ctx}, "", block); - } + CallInst::Create(funType, func, {value, nodeThis, ctx.Ctx}, "", block); } ICodegeneratorInlineWideNode::TGenerateResult GetNodeValues(IComputationWideFlowNode* node, const TCodegenContext& ctx, BasicBlock*& block) { @@ -1990,17 +1946,9 @@ Value* GenNewArray(const TCodegenContext& ctx, Value* size, Value* items, BasicB 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()) { - 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); - } else { - const auto resultPtr = new AllocaInst(valueType, 0U, "return", block); - const auto funType = FunctionType::get(Type::getVoidTy(context), {fact->getType(), resultPtr->getType(), size->getType(), items->getType()}, false); - const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block); - CallInst::Create(funType, funcPtr, {fact, resultPtr, size, items}, "", block); - return new LoadInst(valueType, resultPtr, "array", block); - } + 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); } Value* GetMemoryUsed(ui64 limit, const TCodegenContext& ctx, BasicBlock* block) { @@ -2064,16 +2012,6 @@ Value* CheckAdjustedMemLimit(ui64 limit, Value* init, const TCodegenContext& ctx template Value* CheckAdjustedMemLimit<false>(ui64 limit, Value* init, const TCodegenContext& ctx, BasicBlock*& block); 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) { - return arg; - } - - const auto newArg = new AllocaInst(arg->getType(), 0, "argument", block); - new StoreInst(arg, newArg, block); - return newArg; -} - Value* CallBoxedValueVirtualMethodImpl(uintptr_t methodPtr, Type* returnType, Value* value, NYql::NCodegen::ICodegen& codegen, BasicBlock* block) { auto& context = codegen.GetContext(); @@ -2101,9 +2039,8 @@ void CallBoxedValueVirtualMethodImpl(uintptr_t methodPtr, Value* output, Value* 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) ? - FunctionType::get(Type::getVoidTy(context), {output->getType(), boxed->getType()}, false): - FunctionType::get(Type::getVoidTy(context), {boxed->getType(), output->getType()}, false); + const auto funType = + FunctionType::get(Type::getVoidTy(context), {output->getType(), boxed->getType()}, false); const auto ptrFunType = PointerType::getUnqual(funType); const auto tableType = PointerType::getUnqual(ptrFunType); const auto vTable = CastInst::Create(Instruction::IntToPtr, data, PointerType::getUnqual(tableType), "vtable", block); @@ -2112,11 +2049,7 @@ void CallBoxedValueVirtualMethodImpl(uintptr_t methodPtr, Value* output, Value* const auto elem = GetElementPtrInst::CreateInBounds(ptrFunType, table, {ConstantInt::get(Type::getInt64Ty(context), GetMethodPtrIndex(methodPtr))}, "element", block); const auto func = new LoadInst(ptrFunType, elem, "func", false, block); - if (codegen.GetEffectiveTarget() != NYql::NCodegen::ETarget::Windows) { - CallInst::Create(funType, func, {output, boxed}, "", block); - } else { - CallInst::Create(funType, func, {boxed, output}, "", block); - } + CallInst::Create(funType, func, {output, boxed}, "", block); } void CallBoxedValueVirtualMethodImpl(uintptr_t methodPtr, Value* output, Value* value, NYql::NCodegen::ICodegen& codegen, BasicBlock* block, Value* argument) { @@ -2126,9 +2059,8 @@ void CallBoxedValueVirtualMethodImpl(uintptr_t methodPtr, Value* output, Value* 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) ? - 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 funType = + FunctionType::get(Type::getVoidTy(context), {output->getType(), boxed->getType(), argument->getType()}, false); const auto ptrFunType = PointerType::getUnqual(funType); const auto tableType = PointerType::getUnqual(ptrFunType); const auto vTable = CastInst::Create(Instruction::IntToPtr, data, PointerType::getUnqual(tableType), "vtable", block); @@ -2137,11 +2069,7 @@ void CallBoxedValueVirtualMethodImpl(uintptr_t methodPtr, Value* output, Value* const auto elem = GetElementPtrInst::CreateInBounds(ptrFunType, table, {ConstantInt::get(Type::getInt64Ty(context), GetMethodPtrIndex(methodPtr))}, "element", block); const auto func = new LoadInst(ptrFunType, elem, "func", false, block); - if (codegen.GetEffectiveTarget() != NYql::NCodegen::ETarget::Windows) { - CallInst::Create(funType, func, {output, boxed, argument}, "", block); - } else { - CallInst::Create(funType, func, {boxed, output, argument}, "", block); - } + CallInst::Create(funType, func, {output, boxed, argument}, "", block); } Value* CallBoxedValueVirtualMethodImpl(uintptr_t methodPtr, Type* returnType, Value* value, NYql::NCodegen::ICodegen& codegen, BasicBlock* block, Value* argument) { @@ -2171,9 +2099,8 @@ void CallBoxedValueVirtualMethodImpl(uintptr_t methodPtr, Value* output, Value* 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) ? - 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 funType = + FunctionType::get(Type::getVoidTy(context), {output->getType(), boxed->getType(), arg1->getType(), arg2->getType()}, false); const auto ptrFunType = PointerType::getUnqual(funType); const auto tableType = PointerType::getUnqual(ptrFunType); const auto vTable = CastInst::Create(Instruction::IntToPtr, data, PointerType::getUnqual(tableType), "vtable", block); @@ -2182,11 +2109,7 @@ void CallBoxedValueVirtualMethodImpl(uintptr_t methodPtr, Value* output, Value* const auto elem = GetElementPtrInst::CreateInBounds(ptrFunType, table, {ConstantInt::get(Type::getInt64Ty(context), GetMethodPtrIndex(methodPtr))}, "element", block); const auto func = new LoadInst(ptrFunType, elem, "func", false, block); - 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); - } + CallInst::Create(funType, func, {output, boxed, arg1, arg2}, "", block); } Value* CallBoxedValueVirtualMethodImpl(uintptr_t methodPtr, Type* returnType, Value* value, NYql::NCodegen::ICodegen& codegen, BasicBlock* block, Value* arg1, Value* arg2) { @@ -2212,59 +2135,19 @@ Value* CallBoxedValueVirtualMethodImpl(uintptr_t methodPtr, Type* returnType, Va Value* CallUnaryUnboxedValueFunctionImpl(uintptr_t methodPtr, Type* result, Value* arg, NYql::NCodegen::ICodegen& codegen, BasicBlock* block) { auto& context = codegen.GetContext(); const auto doFunc = ConstantInt::get(Type::getInt64Ty(context), methodPtr); - 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); - return call; - } else { - const auto ptrArg = new AllocaInst(arg->getType(), 0U, "arg", block); - new StoreInst(arg, ptrArg, block); - - if (Type::getInt128Ty(context) == result) { - const auto ptrResult = new AllocaInst(result, 0U, "result", block); - const auto funType = FunctionType::get(Type::getVoidTy(context), {ptrResult->getType(), ptrArg->getType()}, false); - const auto funcPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(funType), "ptr", block); - CallInst::Create(funType, funcPtr, {ptrResult, ptrArg}, "", block); - const auto res = new LoadInst(result, ptrResult, "res", block); - return res; - } else { - const auto funType = FunctionType::get(result, {ptrArg->getType()}, false); - const auto funcPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(funType), "ptr", block); - const auto call = CallInst::Create(funType, funcPtr, {ptrArg}, "call", block); - return call; - } - } + 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); + return call; } Value* CallBinaryUnboxedValueFunctionImpl(uintptr_t methodPtr, Type* result, Value* left, Value* right, NYql::NCodegen::ICodegen& codegen, BasicBlock* block) { auto& context = codegen.GetContext(); const auto doFunc = ConstantInt::get(Type::getInt64Ty(context), methodPtr); - 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); - return call; - } else { - const auto ptrLeft = new AllocaInst(left->getType(), 0U, "left", block); - const auto ptrRight = new AllocaInst(right->getType(), 0U, "right", block); - new StoreInst(left, ptrLeft, block); - new StoreInst(right, ptrRight, block); - - if (Type::getInt128Ty(context) == result) { - const auto ptrResult = new AllocaInst(result, 0U, "result", block); - const auto funType = FunctionType::get(Type::getVoidTy(context), {ptrResult->getType(), ptrLeft->getType(), ptrRight->getType()}, false); - const auto funcPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(funType), "ptr", block); - CallInst::Create(funType, funcPtr, {ptrResult, ptrLeft, ptrRight}, "", block); - const auto res = new LoadInst(result, ptrResult, "res", block); - return res; - } else { - const auto funType = FunctionType::get(result, {ptrLeft->getType(), ptrRight->getType()}, false); - const auto funcPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(funType), "ptr", block); - const auto call = CallInst::Create(funType, funcPtr, {ptrLeft, ptrRight}, "call", block); - return call; - } - } + 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); + return call; } Y_NO_INLINE Value* TDecoratorCodegeneratorNodeBase::CreateGetValueImpl(IComputationNode* node, @@ -2541,19 +2424,10 @@ Y_NO_INLINE Value* TMutableCodegeneratorFallbackNodeBase::DoGenerateGetValueImpl const auto ptrType = PointerType::getUnqual(StructType::get(context)); const auto doFunc = ConstantInt::get(Type::getInt64Ty(context), methodPtr); const auto self = CastInst::Create(Instruction::IntToPtr, ConstantInt::get(Type::getInt64Ty(context), thisPtr), ptrType, "self", block); - 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); - return value; - } else { - const auto resultPtr = new AllocaInst(type, 0U, "return", block); - const auto funType = FunctionType::get(Type::getVoidTy(context), {self->getType(), resultPtr->getType(), ctx.Ctx->getType()}, false); - const auto doFuncPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(funType), "function", block); - CallInst::Create(funType, doFuncPtr, {self, resultPtr, ctx.Ctx}, "", block); - const auto value = new LoadInst(type, resultPtr, "value", block); - return value; - } + 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); + return value; } Y_NO_INLINE Function* TCodegeneratorRootNodeBase::GenerateGetValueImpl( @@ -2567,9 +2441,8 @@ Y_NO_INLINE Function* TCodegeneratorRootNodeBase::GenerateGetValueImpl( const auto valueType = Type::getInt128Ty(context); const auto contextType = GetCompContextType(context); - 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); + const auto funcType = + FunctionType::get(valueType, {PointerType::getUnqual(contextType)}, false); TCodegenContext ctx(codegen); ctx.Func = cast<Function>(module.getOrInsertFunction(name.c_str(), funcType).getCallee()); @@ -2577,25 +2450,13 @@ Y_NO_INLINE Function* TCodegeneratorRootNodeBase::GenerateGetValueImpl( DISubprogramAnnotator annotator(ctx, ctx.Func); auto args = ctx.Func->arg_begin(); - if (codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows) { - auto& firstArg = *args++; - firstArg.addAttr(Attribute::StructRet); - firstArg.addAttr(Attribute::NoAlias); - } - auto main = BasicBlock::Create(context, "main", ctx.Func); ctx.Ctx = &*args; ctx.Ctx->addAttr(Attribute::NonNull); const auto get = gen->CreateGetValue(ctx, main); - if (codegen.GetEffectiveTarget() != NYql::NCodegen::ETarget::Windows) { - ReturnInst::Create(context, get, main); - } else { - new StoreInst(get, &*--args, main); - ReturnInst::Create(context, main); - } - + ReturnInst::Create(context, get, main); return ctx.Func; } diff --git a/yql/essentials/minikql/computation/mkql_computation_node_codegen.h.txt b/yql/essentials/minikql/computation/mkql_computation_node_codegen.h.txt index ebd63455ebb..8835b3b6518 100644 --- a/yql/essentials/minikql/computation/mkql_computation_node_codegen.h.txt +++ b/yql/essentials/minikql/computation/mkql_computation_node_codegen.h.txt @@ -173,8 +173,6 @@ public: virtual void CreateRun(const TCodegenContext& ctx, BasicBlock*& block, Value* result, Value* args) const = 0; }; -Value* WrapArgumentForWindows(Value* arg, const TCodegenContext& ctx, BasicBlock* block); - Value* CallBoxedValueVirtualMethodImpl(uintptr_t methodPtr, Type* returnType, Value* value, NYql::NCodegen::ICodegen& codegen, BasicBlock* block); template<NUdf::TBoxedValueAccessor::EMethod Method> diff --git a/yql/essentials/minikql/computation/mkql_computation_node_graph.cpp b/yql/essentials/minikql/computation/mkql_computation_node_graph.cpp index f9209ad2397..e1a79dff5b1 100644 --- a/yql/essentials/minikql/computation/mkql_computation_node_graph.cpp +++ b/yql/essentials/minikql/computation/mkql_computation_node_graph.cpp @@ -814,8 +814,8 @@ public: : Codegen((NYql::NCodegen::ICodegen::IsCodegenAvailable() && opts.OptLLVM != "OFF") || GetEnv(TString("MKQL_FORCE_USE_LLVM")) ? NYql::NCodegen::ICodegen::MakeShared(NYql::NCodegen::ETarget::Native) : NYql::NCodegen::ICodegen::TPtr()) #endif { - /// TODO: Enable JIT for AARCH64 -#if defined(__aarch64__) + /// TODO: Enable JIT for AARCH64/Win +#if defined(__aarch64__) || defined(_win_) Codegen = {}; #endif diff --git a/yql/essentials/minikql/computation/mkql_computation_node_holders_codegen.cpp b/yql/essentials/minikql/computation/mkql_computation_node_holders_codegen.cpp index 3fe7772ba9d..cead70dec0a 100644 --- a/yql/essentials/minikql/computation/mkql_computation_node_holders_codegen.cpp +++ b/yql/essentials/minikql/computation/mkql_computation_node_holders_codegen.cpp @@ -126,21 +126,12 @@ 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()) { - 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); - AddRefBoxed(array, ctx, block); - result->addIncoming(array, block); - new StoreInst(array, tpsecond, block); - } else { - const auto funType = FunctionType::get(Type::getVoidTy(context), {fact->getType(), tpsecond->getType(), size->getType(), items->getType()}, false); - const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block); - CallInst::Create(funType, funcPtr, {fact, tpsecond, size, items}, "", block); - const auto array = new LoadInst(valueType, tpsecond, "array", block); - AddRefBoxed(array, ctx, block); - result->addIncoming(array, block); - } + 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); + AddRefBoxed(array, ctx, block); + result->addIncoming(array, block); + new StoreInst(array, tpsecond, block); BranchInst::Create(exit, block); } @@ -189,19 +180,10 @@ public: const auto factory = ctx.GetFactory(); const auto func = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&THolderFactory::GetEmptyContainerLazy)); - 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); - return res; - } else { - const auto retPtr = new AllocaInst(valueType, 0U, "ret_ptr", block); - const auto funType = FunctionType::get(Type::getVoidTy(context), {factory->getType(), retPtr->getType()}, false); - const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block); - CallInst::Create(funType, funcPtr, {factory, retPtr}, "", block); - const auto res = new LoadInst(valueType, retPtr, "res", block); - return res; - } + 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); + return res; } #endif private: diff --git a/yql/essentials/minikql/invoke_builtins/mkql_builtins_find.cpp b/yql/essentials/minikql/invoke_builtins/mkql_builtins_find.cpp index 1224ecfc59a..6a9120c302e 100644 --- a/yql/essentials/minikql/invoke_builtins/mkql_builtins_find.cpp +++ b/yql/essentials/minikql/invoke_builtins/mkql_builtins_find.cpp @@ -34,23 +34,10 @@ 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()) { - 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); - return result; - } else { - const auto ptrArg = new AllocaInst(string->getType(), 0U, "arg", block); - const auto ptrSub = new AllocaInst(sub->getType(), 0U, "sub", block); - const auto ptrResult = new AllocaInst(string->getType(), 0U, "result", block); - new StoreInst(string, ptrArg, block); - new StoreInst(sub, ptrSub, block); - const auto funType = FunctionType::get(Type::getVoidTy(context), {ptrResult->getType(), ptrArg->getType(), ptrSub->getType(), pos->getType()}, false); - const auto funcPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(funType), "func", block); - CallInst::Create(funType, funcPtr, {ptrResult, ptrArg, ptrSub, pos}, "", block); - const auto result = new LoadInst(string->getType(), ptrResult, "find", block); - return result; - } + 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); + return result; } #endif }; diff --git a/yql/essentials/minikql/invoke_builtins/mkql_builtins_substring.cpp b/yql/essentials/minikql/invoke_builtins/mkql_builtins_substring.cpp index 2b292f6b36c..8a0c6f6f586 100644 --- a/yql/essentials/minikql/invoke_builtins/mkql_builtins_substring.cpp +++ b/yql/essentials/minikql/invoke_builtins/mkql_builtins_substring.cpp @@ -35,21 +35,10 @@ struct TSubString { GetterFor<ui32>(cn, context, block), "count", block ): GetterFor<ui32>(cn, context, block); - 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); - return result; - } else { - const auto ptrArg = new AllocaInst(string->getType(), 0U, "arg", block); - const auto ptrResult = new AllocaInst(string->getType(), 0U, "result", block); - new StoreInst(string, ptrArg, block); - const auto funType = FunctionType::get(Type::getVoidTy(context), {ptrResult->getType(), ptrArg->getType(), start->getType(), count->getType()}, false); - const auto funcPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(funType), "func", block); - CallInst::Create(funType, funcPtr, {ptrResult, ptrArg, start, count}, "", block); - const auto result = new LoadInst(string->getType(), ptrResult, "substring", block); - return result; - } + 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); + return result; } #endif }; diff --git a/yql/essentials/minikql/invoke_builtins/mkql_builtins_with.cpp b/yql/essentials/minikql/invoke_builtins/mkql_builtins_with.cpp index 723bff5cab6..60927c0e187 100644 --- a/yql/essentials/minikql/invoke_builtins/mkql_builtins_with.cpp +++ b/yql/essentials/minikql/invoke_builtins/mkql_builtins_with.cpp @@ -29,23 +29,10 @@ struct TStringWith { { auto& context = ctx.Codegen.GetContext(); const auto doFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(StringFunc)); - 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); - return result; - } else { - const auto ptrArg = new AllocaInst(string->getType(), 0U, "arg", block); - const auto ptrSub = new AllocaInst(sub->getType(), 0U, "sub", block); - const auto ptrResult = new AllocaInst(string->getType(), 0U, "result", block); - new StoreInst(string, ptrArg, block); - new StoreInst(sub, ptrSub, block); - const auto funType = FunctionType::get(Type::getVoidTy(context), {ptrResult->getType(), ptrArg->getType(), ptrSub->getType()}, false); - const auto funcPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(funType), "func", block); - CallInst::Create(funType, funcPtr, {ptrResult, ptrArg, ptrSub}, "", block); - const auto result = new LoadInst(string->getType(), ptrResult, "has", block); - return result; - } + 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); + return result; } #endif }; diff --git a/yt/yql/providers/yt/codec/codegen/yt_codec_cg.cpp b/yt/yql/providers/yt/codec/codegen/yt_codec_cg.cpp index cdf9588f948..c81dab97cf7 100644 --- a/yt/yql/providers/yt/codec/codegen/yt_codec_cg.cpp +++ b/yt/yql/providers/yt/codec/codegen/yt_codec_cg.cpp @@ -85,7 +85,7 @@ public: auto& module = Codegen_->GetModule(); auto& context = Codegen_->GetContext(); // input - pointer to struct UnboxedValue as int128 and instance of buffer, output - void - const auto funcType = Flat || Codegen_->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? + const auto funcType = Flat ? FunctionType::get(Type::getVoidTy(context), {PointerType::getUnqual(Type::getInt128Ty(context)), PointerType::getUnqual(Type::getInt8Ty(context))}, false): FunctionType::get(Type::getVoidTy(context), {Type::getInt128Ty(context), PointerType::getUnqual(Type::getInt8Ty(context))}, false); Func_ = cast<Function>(module.getOrInsertFunction((TStringBuilder() << (Flat ? "YtCodecCgWriterFlat." : "YtCodecCgWriter.") << cookie).data(), funcType).getCallee()); @@ -768,7 +768,7 @@ private: case NUdf::TDataType<NUdf::TTzTimestamp64>::Id: { CallInst::Create(module.getFunction("ReadTzTimestamp64"), { buf, velemPtr }, "", Block_); break; - } + } default: YQL_ENSURE(false, "Unknown data type: " << schemeType); diff --git a/yt/yql/providers/yt/codec/yt_codec_io.cpp b/yt/yql/providers/yt/codec/yt_codec_io.cpp index 0530bba5f72..aa47453ea26 100644 --- a/yt/yql/providers/yt/codec/yt_codec_io.cpp +++ b/yt/yql/providers/yt/codec/yt_codec_io.cpp @@ -1655,7 +1655,7 @@ void TMkqlReaderImpl::SetSpecs(const TMkqlIOSpecs& specs, const NKikimr::NMiniKQ if (Specs_->UseBlockInput_) { Decoder_.Reset(new TArrowDecoder(Buf_, *Specs_, holderFactory, NUdf::GetYqlMemoryPool())); } else if (Specs_->UseSkiff_) { -#ifndef MKQL_DISABLE_CODEGEN +#if !defined(MKQL_DISABLE_CODEGEN) && !defined(__aarch64__) && !defined(_win_) if (Specs_->OptLLVM_ != "OFF" && NCodegen::ICodegen::IsCodegenAvailable()) { Decoder_.Reset(new TSkiffLLVMDecoder(Buf_, *Specs_, holderFactory)); } diff --git a/yt/yql/providers/yt/comp_nodes/yql_mkql_output.cpp b/yt/yql/providers/yt/comp_nodes/yql_mkql_output.cpp index a093b6f89be..1448c77e374 100644 --- a/yt/yql/providers/yt/comp_nodes/yql_mkql_output.cpp +++ b/yt/yql/providers/yt/comp_nodes/yql_mkql_output.cpp @@ -27,7 +27,7 @@ public: 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)); - const auto arg = WrapArgumentForWindows(item, ctx, block); + const auto arg = item; const auto addType = FunctionType::get(Type::getVoidTy(context), {selfArg->getType(), arg->getType()}, false); const auto addPtr = CastInst::Create(Instruction::IntToPtr, addFunc, PointerType::getUnqual(addType), "write", block); CallInst::Create(addType, addPtr, {selfArg, arg}, "", block); @@ -77,7 +77,7 @@ public: const auto addFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TYtFlowOutputWrapper::AddRowImpl)); const auto selfArg = ConstantInt::get(Type::getInt64Ty(context), ui64(this)); - const auto arg = WrapArgumentForWindows(item, ctx, block); + const auto arg = item; const auto addType = FunctionType::get(Type::getVoidTy(context), {selfArg->getType(), arg->getType()}, false); const auto addPtr = CastInst::Create(Instruction::IntToPtr, addFunc, PointerType::getUnqual(addType), "write", block); CallInst::Create(addType, addPtr, {selfArg, arg}, "", block); |