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 /yql/essentials/minikql/computation | |
parent | 230b2bd8262d16de167b0bd9c761c271182a8582 (diff) |
Drop broken windows LLVM support
commit_hash:fc1f44ff256c759953b54e2ccac3277dc66c1165
Diffstat (limited to 'yql/essentials/minikql/computation')
4 files changed, 61 insertions, 220 deletions
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: |