[cfe-dev] Class instance with address space

Bevin Hansson via cfe-dev cfe-dev at lists.llvm.org
Wed Jan 22 06:50:56 PST 2020


Hi Jon,

There's currently no way to qualify a method with an arbitrary address space. There is a work-in-progress patch on it:

https://reviews.llvm.org/D57464

and I have an experimental local patch that tries to alleviate some issues with the patch above, but it doesn't really work. Parsing this pattern properly is unfortunately rather difficult. There's also no real syntax support in C++ for qualified constructors/destructors, which is another problem.

/ Bevin

On 2020-01-22 04:51, Jon Chesterfield via cfe-dev wrote:
C++ source, compiled as clang++ --target=amdgcn-amd-amdhsa

struct t
{
  int v;
};
__attribute__((address_space(3))) t d;

// error: no matching constructor for initialization of '__attribute__((address_space(3)))

with  t() : v(0) {}, same error

with  t() __attribute__((address_space(3))) : v(0) {},
// error: function type may not be qualified with an address space

How should I be spelling this? I'm essentially trying to replicate cuda's __shared__. Ideally I'd like implicit conversions to a and from an int which is not address space qualified, but right now I'm stuck on the constructor.

Thanks,

Jon



_______________________________________________
cfe-dev mailing list
cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org>
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20200122/d7877f4b/attachment-0001.html>


More information about the cfe-dev mailing list