[llvm-commits] [Review] Attributes Documentation

Meador Inge meadori at codesourcery.com
Thu Dec 6 06:52:24 PST 2012


On Dec 5, 2012, at 7:53 PM, Bill Wendling wrote:

>> ====
>> 
>> Why is the syntax backwards? Metadata are defined like this:
>> 
>> !x = metadata { ... }
>> 
>> whereas attributes are defined like this:
>> 
>> attributes #0 = { ... }
>> 
>> This seems weird. Can we not standardise it?
>> 
> I actually based this off of the module-level asm syntax. (In an earlier version, there was a 'module' keyword before the 'attributes' keyword.)
> 
> I'm not a big fan of the metadata syntax. One reason I can think of for why metadata is written that way is because metadata lets one metadata object reference another. So there's a 'metadata' keyword placed in front of it. I'm not going to allow attribute groups to reference each other.

FWIW, most things in LLVM assembly language that involve defining names
for things do have the "type information" after the equals sign:

   %struct.T = type { i32 }

   @y = global i32 12, align 4

   !0 = metadata !{metadata !"zero"}

   @foo = alias @bar

I think James' suggestion is a good one and is more consistent with
other language elements that introduce named objects.  'module asm'
isn't necessarily a good model because it doesn't introduce a named
object -- it is more of a directive for inlining assembly.

--
Meador Inge
CodeSourcery / Mentor Embedded




More information about the llvm-commits mailing list