================
@@ -1563,6 +1575,39 @@ CIRGenModule::getAddrOfConstantStringFromLiteral(const
StringLiteral *s,
return builder.getGlobalViewAttr(ptrTy, gv);
}
+LangAS CIRGenModule::getGlobalVarAddressSpace(const VarDecl *d) {
+ if (langOpts.OpenCL) {
+ LangAS as = d ? d->getType().getAddressSpace() : LangAS::opencl_global;
+ assert(as == LangAS::opencl_global || as == LangAS::opencl_global_device ||
+ as == LangAS::opencl_global_host || as == LangAS::opencl_constant ||
+ as == LangAS::opencl_local || as >=
LangAS::FirstTargetAddressSpace);
+ return as;
+ }
+
+ if (langOpts.SYCLIsDevice &&
+ (!d || d->getType().getAddressSpace() == LangAS::Default))
+ llvm_unreachable("NYI");
+
+ if (langOpts.CUDA && langOpts.CUDAIsDevice) {
+ if (d) {
+ if (d->hasAttr<CUDAConstantAttr>())
+ return LangAS::cuda_constant;
+ if (d->hasAttr<CUDASharedAttr>())
+ return LangAS::cuda_shared;
+ if (d->hasAttr<CUDADeviceAttr>())
+ return LangAS::cuda_device;
+ if (d->getType().isConstQualified())
+ return LangAS::cuda_constant;
+ }
+ return LangAS::cuda_device;
+ }
+
+ if (langOpts.OpenMP)
+ llvm_unreachable("NYI");
----------------
andykaylor wrote:
```suggestion
errorNYI(g->getSourceRange(), "global as for OpenMP");
```
https://github.com/llvm/llvm-project/pull/184248
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits