This is an archive of the discontinued LLVM Phabricator instance.

[OpenCL] OpenCL2.0 - Apply default address space rules
ClosedPublic

Authored by Anastasia on Sep 25 2015, 10:46 AM.

Details

Summary

If address space (AS) of a variable/parameter declaration is not set, OpenCL2.0 s6.5 defines explicit rules for default ASes:

  • The AS of global and local static variables defaults to global;
  • All pointers point to generic AS.

Diff Detail

Event Timeline

Anastasia updated this revision to Diff 35734.Sep 25 2015, 10:46 AM
Anastasia retitled this revision from to [OpenCL] OpenCL2.0 - Apply default address space rules.
Anastasia updated this object.
Anastasia added a reviewer: pekka.jaaskelainen.
Anastasia added a subscriber: cfe-commits.
pekka.jaaskelainen requested changes to this revision.Sep 29 2015, 7:38 AM
pekka.jaaskelainen edited edge metadata.
pekka.jaaskelainen added inline comments.
lib/Sema/SemaType.cpp
6166

Should this be below AttributeList::AT_OpenCLGenericAddressSpace? Does it now include the address space attribute even when used from C? Probably doesn't harm, but a bit misleading.

6282

Should this "white list" the cases where it's safe to add the default AS, not assume that it's applicable to any not listed here? Maybe safer that way.

This revision now requires changes to proceed.Sep 29 2015, 7:38 AM
Anastasia added inline comments.Oct 5 2015, 4:23 AM
lib/Sema/SemaType.cpp
6282

It seems like there are no corresponding helper methods available in Declarator. So the code is therefore using negation everywhere. But also if we would add a helper function, I think we would implement it as a form of negation anyways.

Anastasia added inline comments.Oct 21 2015, 3:43 AM
lib/Sema/SemaType.cpp
6282

Any more thoughts here?

pekka.jaaskelainen edited edge metadata.
This revision is now accepted and ready to land.Oct 21 2015, 5:51 AM