[clang] [CIR] Add support for indirect calls (PR #139748)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Thu May 15 11:49:33 PDT 2025
================
@@ -1839,16 +1837,24 @@ class CIR_CallOpBase<string mnemonic, list<Trait> extra_traits = []>
// the upstreaming process moves on. The verifiers is also missing for now,
// will add in the future.
- dag commonArgs = (ins FlatSymbolRefAttr:$callee,
- Variadic<CIR_AnyType>:$args);
+ dag commonArgs = (ins OptionalAttr<FlatSymbolRefAttr>:$callee,
+ Variadic<CIR_AnyType>:$args);
}
def CallOp : CIR_CallOpBase<"call", [NoRegionArguments]> {
let summary = "call a function";
let description = [{
- The `cir.call` operation represents a direct call to a function that is
- within the same symbol scope as the call. The callee is encoded as a symbol
- reference attribute named `callee`.
+ The `cir.call` operation represents a function call. It could represent
+ either a direct call or an indirect call.
+
+ If the operation represents a direct call, the callee should be defined
+ within the same symbol scope as the call. The `callee` attribute contains a
+ symbol reference to the callee function. All operands of this operation are
+ arguments to the callee function.
+
+ If the operation represents an indirect call, the `callee` attribute is
+ empty. The first operand of this operation must be a pointer to the callee
+ function. All the rest operands are arguments to the callee function.
----------------
andykaylor wrote:
```suggestion
function. The rest operands are arguments to the callee function.
```
https://github.com/llvm/llvm-project/pull/139748
More information about the cfe-commits
mailing list