Lines Matching refs:funcOp
27 createGlobalVarForEntryPointArgument(OpBuilder &builder, spirv::FuncOp funcOp, in createGlobalVarForEntryPointArgument() argument
30 auto spirvModule = funcOp->getParentOfType<spirv::ModuleOp>(); in createGlobalVarForEntryPointArgument()
35 builder.setInsertionPoint(funcOp.getOperation()); in createGlobalVarForEntryPointArgument()
37 funcOp.getName().str() + "_arg_" + std::to_string(argIndex); in createGlobalVarForEntryPointArgument()
42 auto varType = funcOp.getFunctionType().getInput(argIndex); in createGlobalVarForEntryPointArgument()
64 funcOp.getLoc(), varType, varName, abiInfo.getDescriptorSet(), in createGlobalVarForEntryPointArgument()
71 getInterfaceVariables(spirv::FuncOp funcOp, in getInterfaceVariables() argument
73 auto module = funcOp->getParentOfType<spirv::ModuleOp>(); in getInterfaceVariables()
82 funcOp.walk([&](spirv::AddressOfOp addressOfOp) { in getInterfaceVariables()
101 funcOp.getContext(), cast<spirv::GlobalVariableOp>(var).sym_name())); in getInterfaceVariables()
107 static LogicalResult lowerEntryPointABIAttr(spirv::FuncOp funcOp, in lowerEntryPointABIAttr() argument
111 funcOp->getAttrOfType<spirv::EntryPointABIAttr>(entryPointAttrName); in lowerEntryPointABIAttr()
117 auto spirvModule = funcOp->getParentOfType<spirv::ModuleOp>(); in lowerEntryPointABIAttr()
123 if (failed(getInterfaceVariables(funcOp, interfaceVars))) { in lowerEntryPointABIAttr()
127 spirv::TargetEnvAttr targetEnv = spirv::lookupTargetEnv(funcOp); in lowerEntryPointABIAttr()
131 return funcOp.emitRemark("lower entry point failure: could not select " in lowerEntryPointABIAttr()
134 builder.create<spirv::EntryPointOp>(funcOp.getLoc(), executionModel.value(), in lowerEntryPointABIAttr()
135 funcOp, interfaceVars); in lowerEntryPointABIAttr()
143 funcOp.getLoc(), funcOp, spirv::ExecutionMode::LocalSize, localSize); in lowerEntryPointABIAttr()
144 funcOp->removeAttr(entryPointAttrName); in lowerEntryPointABIAttr()
162 matchAndRewrite(spirv::FuncOp funcOp, OpAdaptor adaptor,
174 spirv::FuncOp funcOp, OpAdaptor adaptor, in matchAndRewrite() argument
176 if (!funcOp->getAttrOfType<spirv::EntryPointABIAttr>( in matchAndRewrite()
182 funcOp.getFunctionType().getNumInputs()); in matchAndRewrite()
189 llvm::enumerate(funcOp.getFunctionType().getInputs())) { in matchAndRewrite()
190 auto abiInfo = funcOp.getArgAttrOfType<spirv::InterfaceVarABIAttr>( in matchAndRewrite()
200 rewriter, funcOp, argType.index(), abiInfo); in matchAndRewrite()
205 rewriter.setInsertionPointToStart(&funcOp.front()); in matchAndRewrite()
208 rewriter.create<spirv::AddressOfOp>(funcOp.getLoc(), var); in matchAndRewrite()
217 spirv::ConstantOp::getZero(indexType, funcOp.getLoc(), rewriter); in matchAndRewrite()
219 funcOp.getLoc(), replacement, zero.constant()); in matchAndRewrite()
220 replacement = rewriter.create<spirv::LoadOp>(funcOp.getLoc(), loadPtr); in matchAndRewrite()
224 if (failed(rewriter.convertRegionTypes(&funcOp.getBody(), *getTypeConverter(), in matchAndRewrite()
229 rewriter.updateRootInPlace(funcOp, [&] { in matchAndRewrite()
230 funcOp.setType(rewriter.getFunctionType( in matchAndRewrite()
280 module.walk([&](spirv::FuncOp funcOp) { in runOnOperation() argument
281 if (funcOp->getAttrOfType<spirv::EntryPointABIAttr>(entryPointAttrName)) { in runOnOperation()
282 entryPointFns.push_back(funcOp); in runOnOperation()