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

Rafael EspĂ­ndola rafael.espindola at gmail.com
Tue Jan 6 08:40:21 PST 2015


On 6 January 2015 at 11:38, David Majnemer <david.majnemer at gmail.com> wrote:
>
>
> 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.

I like it. I will post a patch with it.

Cheers,
Rafael




More information about the llvm-commits mailing list