[llvm] [LLVM-Tablegen] Pretty Printing Arguments in LLVM Intrinsics (PR #162629)

Rahul Joshi via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 20 16:01:01 PDT 2025


================
@@ -87,6 +87,14 @@ class NoUndef<AttrIndex idx> : IntrinsicProperty {
   int ArgNo = idx.Value;
 }
 
+// ArgInfo - The specified argument has an argument name and an optional argument printing
----------------
jurahul wrote:

If we want to go with a generic ArgInfo in future where we list all the properties of a particular arg for an intrinsic, it seems we would need something like 

```
class ArgInfo<AttrIndex idx, list<ArgProperty> arg_proprties> {
}
```

And then we can have something like

```
ArgInfo<ArgIndex<0>, [ArgName<"Foo">, ImmArg, ImmArgPrinter<"printFoo">, NoCapture>
```

where `ImmArg` and `NoCapture` can be used without any ArgIndex in them. To be able to do that, does it make sense to atleast start with such a scheme for ArgName and ImmArgPrinter<>? So you'd define a ArgProperty class and subclass from it ArgName<> and ImmArgPrinter<>.

Then we can extend these for other properties in future. @nikic does that direction sound ok?

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


More information about the llvm-commits mailing list