[cfe-dev] Allow implicit copy constructor between address spaces in C++

Adam Strzelecki ono at java.pl
Sat May 3 13:31:10 PDT 2014


FYI. Continuing my effort I have added "pod_assign" variable attribute, that triggers POD assign rather than constructor on object (behavior described in previous post). There was nothing better that came to my mind to circumvent problems described previously.

  https://github.com/ujhpc/clang/commits/patch/pod-assign-attr
  https://github.com/ujhpc/clang/commits/patch/openclxx

Here is working code:

> struct Point {
>   float x, y;
> };
> typedef struct Point Point;
> 
> float test(int i, // index
>            __attribute__((address_space(1))) const Point *in,
>            __attribute__((address_space(1))) Point *out) {
>   __attribute__((pod_assign)) Point r = in[i];
>   out[i] = r;
>   return r.x * r.y;
> }

Now both C++ and C modes generate identical ll assembly. Now it is time to test whether using C++ goodness will produce runnable SPIR kernels.

Regards,
-- 
Adam





More information about the cfe-dev mailing list