[clang] [CIR] Add custom assembly format for alloca op to fix flag parsing (PR #198962)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Thu May 21 06:41:59 PDT 2026
erichkeane wrote:
> > > What about changing the format non-ambiguous parse that does not need lookahead, i.e. dropping commas:
> > > ```
> > > let assemblyFormat = [{
> > > $allocaType `,` qualified(type($addr)) `,`
> > > ($dynAllocSize^ `:` type($dynAllocSize) `,`)?
> > > `[` $name
> > > oilist( `init` $init
> > > | `const` $constant
> > > | `cleanup_dest_slot` $cleanup_dest_slot )
> > > `]`
> > > ($annotations^)? attr-dict
> > > }];
> > > ```
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > or adding `comma-separated-oilist` to mlir tablegen?
> >
> >
> > yes that works, i did it this way because i wanted to maintain the current format and avoid changing all the test cases 😅 since dropping the comma would break them, but if you prefer the oilist approach i can change it.
>
> Yeah I got it, and if we are to change format we can make it a bit more uniform with other operations. It is a weird that alloca has some attributes in surrounded by `[` `]`. Not sure what would be the best here. @andykaylor @erichkeane would you have a preference or do we want to keep old format and custom printer/parser?
I am not attached to the format... I kinda like the brackets as they stick out nicely, but am not particularly attached.
What I would like MORE is to not have custom parsing/printing ever. Does MLIR printers NOT have something for a comma delimited list though? I would expect this is such a common thing that it would be handled...
https://github.com/llvm/llvm-project/pull/198962
More information about the cfe-commits
mailing list