summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorEli Bendersky <eliben@google.com>2014-09-30 17:38:34 +0000
committerEli Bendersky <eliben@google.com>2014-09-30 17:38:34 +0000
commitf2787a0dc0eeb57990ecba67b76b7d3557e13b0b (patch)
tree3711e796a712b0c54f3515ed55ffad3c86022168 /clang/lib/Sema
parent8d81bdf11fe02b286702c416b9cb5ebfa05b68fc (diff)
downloadbcm5719-llvm-f2787a0dc0eeb57990ecba67b76b7d3557e13b0b.tar.gz
bcm5719-llvm-f2787a0dc0eeb57990ecba67b76b7d3557e13b0b.zip
CUDA: mark the target of implicit intrinsics properly
r218624 implemented target inference for implicit special members. However, other entities can be implicit - for example intrinsics. These can not have inference running on them, so they should be marked host device as before. This is the safest and most flexible setting, since by construction these functions don't invoke anything, and we'd like them to be invokable from both host and device code. LLVM's intrinsics definitions (where these intrinsics come from in the case of CUDA/NVPTX) have no notion of target, so both host and device intrinsics can be supported this way. llvm-svn: 218688
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaCUDA.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaCUDA.cpp b/clang/lib/Sema/SemaCUDA.cpp
index 55a34e35413..66715209beb 100644
--- a/clang/lib/Sema/SemaCUDA.cpp
+++ b/clang/lib/Sema/SemaCUDA.cpp
@@ -48,6 +48,12 @@ Sema::CUDAFunctionTarget Sema::IdentifyCUDATarget(const FunctionDecl *D) {
if (D->hasAttr<CUDAHostAttr>())
return CFT_HostDevice;
return CFT_Device;
+ } else if (D->hasAttr<CUDAHostAttr>()) {
+ return CFT_Host;
+ } else if (D->isImplicit()) {
+ // Some implicit declarations (like intrinsic functions) are not marked.
+ // Set the most lenient target on them for maximal flexibility.
+ return CFT_HostDevice;
}
return CFT_Host;
OpenPOWER on IntegriCloud