[PATCH] D57716: [CUDA][HIP] Check calling convention based on function target
Artem Belevich via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 5 13:44:48 PST 2019
tra added inline comments.
================
Comment at: lib/Sema/SemaDeclAttr.cpp:4621-4638
+ auto CUDATarget = IdentifyCUDATarget(FD);
+ if (CUDATarget == CFT_HostDevice) {
+ A = TI.checkCallingConvention(CC);
+ if (A == TargetInfo::CCCR_OK && Aux)
+ A = Aux->checkCallingConvention(CC);
+ } else if (LangOpts.CUDAIsDevice) {
+ if (CUDATarget == CFT_Device || CUDATarget == CFT_Global) {
----------------
This is rather convoluted.
Perhaps it would be easier to understand if the code is restructured. along these lines:
```
// Returns a tuple indicating whether we need to check TargetInfo on host/device side of the compilation
bool CheckHost = false, CheckDevice=false;
switch (CudaTarget) {
case CFT_HostDevice:
CheckHost = true; CheckDevice=true; break;
case CFT_Host:
CheckHost = true; break;
case CFG_Device:
case CFG_Global:
CheckDevice=true; break;
}
} ();
TargetInfo *HostTI = CudaIsDevice ? Aux : &TI;
TargetInfo * DeviceTI = CudaIsDevice ? &TI : Aux;
if (CheckHost && HostTI)
HostTI->checkCallingConvention(CC);
if (CheckDevice && DeviceTI)
DeviceTI->checkCallingConvention(CC);
```
================
Comment at: test/SemaCUDA/amdgpu-windows-vectorcall.cu:3
+
+// expected-no-diagnostics
+template<class _Ty>
----------------
It may be good to add a check where we *would* expect to see the diagnostics.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D57716/new/
https://reviews.llvm.org/D57716
More information about the cfe-commits
mailing list