[clang] [CIR] Add support for indirect calls (PR #139748)

Sirui Mu via cfe-commits cfe-commits at lists.llvm.org
Sat May 17 08:29:55 PDT 2025


================
@@ -464,15 +464,35 @@ OpFoldResult cir::CastOp::fold(FoldAdaptor adaptor) {
 // CallOp
 //===----------------------------------------------------------------------===//
 
+mlir::OperandRange cir::CallOp::getArgOperands() {
+  if (isIndirect())
+    return getArgs().drop_front(1);
+  return getArgs();
+}
+
+mlir::MutableOperandRange cir::CallOp::getArgOperandsMutable() {
+  mlir::MutableOperandRange args = getArgsMutable();
+  if (isIndirect())
+    return args.slice(1, args.size() - 1);
----------------
Lancern wrote:

Yes. That's why `getArgOperandsMutable` and `getArgOperands` are implemented a bit differently.

It would be nice to also have `drop_front` in `mlir::MutableOperandRange` though.

https://github.com/llvm/llvm-project/pull/139748


More information about the cfe-commits mailing list