[llvm-commits] [Review] Attributes Documentation

James Molloy James.Molloy at arm.com
Wed Dec 5 00:56:17 PST 2012


Hi Bill,

A couple of comments:

====

It seems strange to me that attribute groups cannot be named, and *must*
be referred to by number. It is at odds with how registers, globals and
named metadata work. Is there any reason why they can't be named
entities?

====

How does uniquing work?

attributes #0 = { noinline, optsize }
attributes #1 = { noinline, optsize }

declare void @f() #0
define void @g() {
  call void @f() #1
  ret void
}

That you can define @f with one attribute group but call it with another
is confusing. I can see it becoming *very* confusing when using multiple
attribute groups - do I know that "#0 #1" and "#2 #3" are equivalent? Is
this a valid call? I can see it adding headaches to read the IR,
especially if they are numeric-only and not nameable (see above).

Could we make attribute groups unique? so in the example above, this
would be illegal as #0 and #1 are equivalent?

In fact, the LangRef doesn't mention if the above is correct. Even if
attribute groups #0 and #1 are the same, is it legal to call with #1 a
function defined with #0?

====

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?

Cheers,

James

On Tue, 2012-12-04 at 22:56 +0000, Bill Wendling wrote:
> Hi all,
>
> This is the language reference patch for the new attributes rewrite. Please review and give feedback!
>
> Cheers!
> -bw
>


-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium.  Thank you.




More information about the llvm-commits mailing list