type attributes

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

type attributes

Zach Anderson-2
Hello,

Does the bitcode representation retain any information about gcc attributes
placed on types?

Thanks,
Zach
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: type attributes

Duncan Sands
Hi Zach,

> Does the bitcode representation retain any information about gcc attributes
> placed on types?

yes it does, at least for some of them.  For example, suppose you specify
that a type should be 16 byte aligned.  This will not change the LLVM type,
instead every time an object of your type is created the object creation
operation (eg: an alloca) will ensure that the object is 16 byte aligned.
Volatile types are another example: types are not volatile in LLVM, only
load and store operations are.  Loads and stores to an object for which the
gcc type was volatile are marked volatile.  In LLVM the general rule is that
operations have attributes, not types.  It is the job of llvm-gcc to output
the right operation given the attributes on the gcc type.  Which attributes
are you interested in?

Ciao,

Duncan.
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: type attributes

Zach Anderson-2
I see. I was hoping to preserve some of my own custom type attributes
for use in a type based analysis I'm working on, but from your answer it
seems as though this won't be possible.

Thanks for your help,
Zach

Duncan Sands wrote:

> Hi Zach,
>
>> Does the bitcode representation retain any information about gcc attributes
>> placed on types?
>
> yes it does, at least for some of them.  For example, suppose you specify
> that a type should be 16 byte aligned.  This will not change the LLVM type,
> instead every time an object of your type is created the object creation
> operation (eg: an alloca) will ensure that the object is 16 byte aligned.
> Volatile types are another example: types are not volatile in LLVM, only
> load and store operations are.  Loads and stores to an object for which the
> gcc type was volatile are marked volatile.  In LLVM the general rule is that
> operations have attributes, not types.  It is the job of llvm-gcc to output
> the right operation given the attributes on the gcc type.  Which attributes
> are you interested in?
>
> Ciao,
>
> Duncan.
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: type attributes

Anton Korobeynikov
In reply to this post by Zach Anderson-2
Hello, Zach

> I see. I was hoping to preserve some of my own custom type attributes
> for use in a type based analysis I'm working on, but from your answer it
> seems as though this won't be possible.
You can use 'annotate' attribute, which was specially designed for this
purpose.

--
WBR, Anton Korobeynikov
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev