Lines Matching refs:rewriter

18                                    ConversionPatternRewriter &rewriter) const {  in matchAndRewrite()
36 auto globalOp = rewriter.create<LLVM::GlobalOp>( in matchAndRewrite()
68 attributes.emplace_back(kernelAttributeName, rewriter.getUnitAttr()); in matchAndRewrite()
69 auto llvmFuncOp = rewriter.create<LLVM::LLVMFuncOp>( in matchAndRewrite()
80 OpBuilder::InsertionGuard guard(rewriter); in matchAndRewrite()
83 rewriter.setInsertionPointToStart(&gpuFuncOp.front()); in matchAndRewrite()
85 auto i32Type = IntegerType::get(rewriter.getContext(), 32); in matchAndRewrite()
89 zero = rewriter.create<LLVM::ConstantOp>(loc, i32Type, in matchAndRewrite()
90 rewriter.getI32IntegerAttr(0)); in matchAndRewrite()
93 Value address = rewriter.create<LLVM::AddressOfOp>(loc, global); in matchAndRewrite()
96 Value memory = rewriter.create<LLVM::GEPOp>( in matchAndRewrite()
107 rewriter, loc, *getTypeConverter(), type, memory); in matchAndRewrite()
113 auto int64Ty = IntegerType::get(rewriter.getContext(), 64); in matchAndRewrite()
126 Value numElements = rewriter.create<LLVM::ConstantOp>( in matchAndRewrite()
128 rewriter.getI64IntegerAttr(type.getNumElements())); in matchAndRewrite()
129 Value allocated = rewriter.create<LLVM::AllocaOp>( in matchAndRewrite()
132 rewriter, loc, *getTypeConverter(), type, allocated); in matchAndRewrite()
139 rewriter.inlineRegionBefore(gpuFuncOp.getBody(), llvmFuncOp.getBody(), in matchAndRewrite()
141 if (failed(rewriter.convertRegionTypes(&llvmFuncOp.getBody(), *typeConverter, in matchAndRewrite()
145 rewriter.eraseOp(gpuFuncOp); in matchAndRewrite()
153 ConversionPatternRewriter &rewriter, in getOrDefineFunction() argument
158 ConversionPatternRewriter::InsertionGuard guard(rewriter); in getOrDefineFunction()
159 rewriter.setInsertionPointToStart(moduleOp.getBody()); in getOrDefineFunction()
160 ret = rewriter.create<LLVM::LLVMFuncOp>(loc, name, type, in getOrDefineFunction()
168 ConversionPatternRewriter &rewriter) const { in matchAndRewrite()
171 mlir::Type llvmI8 = typeConverter->convertType(rewriter.getI8Type()); in matchAndRewrite()
173 mlir::Type llvmIndex = typeConverter->convertType(rewriter.getIndexType()); in matchAndRewrite()
174 mlir::Type llvmI32 = typeConverter->convertType(rewriter.getI32Type()); in matchAndRewrite()
175 mlir::Type llvmI64 = typeConverter->convertType(rewriter.getI64Type()); in matchAndRewrite()
182 getOrDefineFunction(moduleOp, loc, rewriter, "__ockl_printf_begin", in matchAndRewrite()
187 moduleOp, loc, rewriter, "__ockl_printf_append_args", in matchAndRewrite()
193 moduleOp, loc, rewriter, "__ockl_printf_append_string_n", in matchAndRewrite()
199 Value zeroI64 = rewriter.create<LLVM::ConstantOp>( in matchAndRewrite()
200 loc, llvmI64, rewriter.getI64IntegerAttr(0)); in matchAndRewrite()
201 auto printfBeginCall = rewriter.create<LLVM::CallOp>(loc, ocklBegin, zeroI64); in matchAndRewrite()
219 ConversionPatternRewriter::InsertionGuard guard(rewriter); in matchAndRewrite()
220 rewriter.setInsertionPointToStart(moduleOp.getBody()); in matchAndRewrite()
221 global = rewriter.create<LLVM::GlobalOp>( in matchAndRewrite()
224 rewriter.getStringAttr(formatString)); in matchAndRewrite()
228 Value globalPtr = rewriter.create<LLVM::AddressOfOp>(loc, global); in matchAndRewrite()
229 Value zero = rewriter.create<LLVM::ConstantOp>( in matchAndRewrite()
230 loc, llvmIndex, rewriter.getIntegerAttr(llvmIndex, 0)); in matchAndRewrite()
231 Value stringStart = rewriter.create<LLVM::GEPOp>( in matchAndRewrite()
233 Value stringLen = rewriter.create<LLVM::ConstantOp>( in matchAndRewrite()
234 loc, llvmI64, rewriter.getI64IntegerAttr(formatStringSize)); in matchAndRewrite()
236 Value oneI32 = rewriter.create<LLVM::ConstantOp>( in matchAndRewrite()
237 loc, llvmI32, rewriter.getI32IntegerAttr(1)); in matchAndRewrite()
238 Value zeroI32 = rewriter.create<LLVM::ConstantOp>( in matchAndRewrite()
239 loc, llvmI32, rewriter.getI32IntegerAttr(0)); in matchAndRewrite()
241 auto appendFormatCall = rewriter.create<LLVM::CallOp>( in matchAndRewrite()
256 arguments.push_back(rewriter.create<LLVM::ConstantOp>( in matchAndRewrite()
257 loc, llvmI32, rewriter.getI32IntegerAttr(numArgsThisCall))); in matchAndRewrite()
262 arg = rewriter.create<LLVM::FPExtOp>( in matchAndRewrite()
263 loc, typeConverter->convertType(rewriter.getF64Type()), arg); in matchAndRewrite()
264 arg = rewriter.create<LLVM::BitcastOp>(loc, llvmI64, arg); in matchAndRewrite()
267 arg = rewriter.create<LLVM::ZExtOp>(loc, llvmI64, arg); in matchAndRewrite()
278 auto call = rewriter.create<LLVM::CallOp>(loc, ocklAppendArgs, arguments); in matchAndRewrite()
281 rewriter.eraseOp(gpuPrintfOp); in matchAndRewrite()
287 ConversionPatternRewriter &rewriter) const { in matchAndRewrite()
290 mlir::Type llvmI8 = typeConverter->convertType(rewriter.getIntegerType(8)); in matchAndRewrite()
292 mlir::Type llvmIndex = typeConverter->convertType(rewriter.getIndexType()); in matchAndRewrite()
299 auto printfType = LLVM::LLVMFunctionType::get(rewriter.getI32Type(), {i8Ptr}, in matchAndRewrite()
302 getOrDefineFunction(moduleOp, loc, rewriter, "printf", printfType); in matchAndRewrite()
318 ConversionPatternRewriter::InsertionGuard guard(rewriter); in matchAndRewrite()
319 rewriter.setInsertionPointToStart(moduleOp.getBody()); in matchAndRewrite()
320 global = rewriter.create<LLVM::GlobalOp>( in matchAndRewrite()
323 rewriter.getStringAttr(formatString), /*allignment=*/0, addressSpace); in matchAndRewrite()
327 Value globalPtr = rewriter.create<LLVM::AddressOfOp>(loc, global); in matchAndRewrite()
328 Value zero = rewriter.create<LLVM::ConstantOp>( in matchAndRewrite()
329 loc, llvmIndex, rewriter.getIntegerAttr(llvmIndex, 0)); in matchAndRewrite()
330 Value stringStart = rewriter.create<LLVM::GEPOp>( in matchAndRewrite()
340 rewriter.create<LLVM::CallOp>(loc, printfDecl, printfArgs); in matchAndRewrite()
341 rewriter.eraseOp(gpuPrintfOp); in matchAndRewrite()