question about adding qualifiers

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 ?

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.