[patch] Change the .ll syntax for comdats and add a syntactic sugar

David Majnemer david.majnemer at gmail.com
Tue Jan 6 08:38:33 PST 2015


On Tue, Jan 6, 2015 at 7:04 AM, Rafael EspĂ­ndola <rafael.espindola at gmail.com
> wrote:

> On 6 January 2015 at 00:25, David Majnemer <david.majnemer at gmail.com>
> wrote:
> > It seems wrong to make it 'comdat $foo global i32 42' instead of 'global
> i32
> > 42, comdat $foo'.  We seem to usually follow the convention that we comma
> > delimitate optional things like alignment. More importantly, I'd like
> comdat
> > and section to be near each other because they are very related.
>
> Any ideas on how to avoid the ambiguity in
>
> ----------------------------------------
> @g = global i32 0, comdat $foo
> ----------------------------------------
>
> versus
>
> ---------------------------------------------
> @g = global i32 0, comdat
> $foo = comdat any
> -----------------------------------------
>
> Having to check if the $foo is followed by a = is quite ugly IMHO.
>
> I guess one option is to change the syntax to
>
> @g1 = global i32 0, comdat($c1)
> @g2 = global i32 0, comdat(); same as comdat($g2)
>
> or
>
> @g1 = global i32 0, comdat $c1
> @g2 = global i32, comdat $ ; same as "comdat $g2"
>

How about:
@g1 = global i32 0, comdat($c1)
@g2 = global i32 0, comdat

It keeps it nice and terse when possible and we only need to check if the
next token after comdat is '(' to see if it is in an explicit comdat group.


> > To be honest, I don't really like the idea of providing two ways to do it
> > but if we must can we at least support 'comdat $foo', 'comdat(any)',
> > 'comdat(largest)' etc? Special casing 'comdat any' seems wrong.
>
> Note that the patch does *not* specialize 'comdat any'. I only noted
> the possibility.
>
> Cheers,
> Rafael
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150106/f30d9898/attachment.html>


More information about the llvm-commits mailing list