================
@@ -289,6 +289,43 @@ class OpLowerer {
     });
   }
 
+  void lowerTypedBufferStore(Function &F) {
+    IRBuilder<> &IRB = OpBuilder.getIRB();
+    Type *Int8Ty = IRB.getInt8Ty();
+    Type *Int32Ty = IRB.getInt32Ty();
+
+    replaceFunction(F, [&](CallInst *CI) -> Error {
----------------
bogner wrote:

We aren't doing methods sometimes and lambdas others, we have a method on the 
`OpLowerer` called `replaceFunction` that takes a lambda `ReplaceCall` that 
replaces an individual call, and then each kind of function we want to replace 
specializes behaviour through that. The idea here is that we can share the 
boilerplate for looping through the users, constructing an error message, and 
erasing the function itself once it's been replaced.

The other "obvious" way to structure this would be to have some kind of 
"FunctionReplacer" class that does the boilerplate and then subclass it for 
each of what are currently lambdas. I don't like this as much since it makes it 
harder to access the shared state of the OpLowerer in that model.

https://github.com/llvm/llvm-project/pull/104253
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to