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

Rafael EspĂ­ndola rafael.espindola at gmail.com
Tue Jan 6 07:04:20 PST 2015


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"

> 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



More information about the llvm-commits mailing list