[llvm-commits] [llvm] r44860 - /llvm/trunk/docs/LangRef.html
Chris Lattner
clattner at apple.com
Tue Dec 11 20:34:01 PST 2007
On Dec 11, 2007, at 5:56 PM, Christopher Lamb wrote:
>
> On Dec 11, 2007, at 3:54 PM, Chris Lattner wrote:
>
>> On Dec 11, 2007, at 1:31 AM, Christopher Lamb wrote:
>>> Add information on address space qualifiers for pointer types and
>>> global
>>> declarations to the LangRef.
>>
>> Nice!
>>
>>> <div class="doc_code">
>>> <pre>
>>> + at G = constant float 1.0 addrspace(5), section "foo", align 4
>>
>> Is there a comma after 1.0?
>
> Nope. It's not treated like other attributes as it affects the type
> of the GlobalVariable that's created, rather than modifying it after
> the fact. Ideally I would have liked it to be between the type name
> and the initializer value, but the current Assembly parser made this
> very yucky. The other option would be to support the addrspace
> attribute on types other than pointers in the Assembly syntax, but
> discard them in all cases except when declaring a global variable,
> also yucky.
>
> The key here is that the order of asterisks and addrspace()
> qualifiers are consistent in the global variable declaration and the
> type name:
>
> @foo = constant float addrspace(1)* 1.0 addrspace(2)
>
> @foo has a type of
>
> float addrspace(1)* addrspace(2)*
That is a very strong argument to me, but it seems to argue even more
strongly for:
@G = constant float addrspace(5) 1.0, section "foo", align 4
Your example above would then be:
> @foo = constant float addrspace(1)* addrspace(2) 1.0
which has type:
> float addrspace(1)* addrspace(2)*
What do you think? the downside is that this may cause bison to have
issues :)
-Chris
More information about the llvm-commits
mailing list