question about adding qualifiers

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

question about adding qualifiers

kartik kumar
Hello clang,

This is my first post here. I have gone through the previous posts of the cfe-dev group and found them quite useful and helpful. I have a conceptual (and dumb ) doubt before I start digging into clang code base. When adding compiler support to a hardware like a GPU where the memory is divided into "private" "local" and "global", How do you represent these memory locations through coding. I know that these locations are accessed through the address space qualifiers of the language that we add to the existing compiler, but how are these qualifiers digested by a compiler frontend like clang. Do I just pick a number for following representation and tell clang that this is some location of the hardware that I am going to support and make it print some instructions in the LLVM IR ?

#define _global __attribute__((address_space(NUMBER)))

I have a faint idea about GPUs, the architecture that I want to support is something like that. Can someone please help me with the above doubt ?
Thanks.
kk


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: question about adding qualifiers

John McCall
On May 15, 2010, at 12:13 PM, kartik kumar wrote:
> I know that these locations are accessed through the address space qualifiers of the language that we add to the existing compiler, but how are these qualifiers digested by a compiler frontend like clang. Do I just pick a number for following representation and tell clang that this is some location of the hardware that I am going to support and make it print some instructions in the LLVM IR ?

Yes, that is pretty much exactly what you should do.  You would then need to teach your backend how to deal with the address spaces you've chosen.

John.
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev