[PATCH] D74387: [SYCL] Do not diagnose use of __float128

Mariya Podchishchaeva via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 13 09:01:31 PST 2020


Fznamznon added a comment.

> In D74387#1869845 <https://reviews.llvm.org/D74387#1869845>, @rjmccall wrote:
> 
>> The right approach here is probably what we do in ObjC ARC when we see types that are illegal in ARC: in system headers, we allow the code but add a special `UnavailableAttr` to the declaration so that it can't be directly used.
>>
>> That is straightforward enough that I think you should just do it instead of leaving this as technical debt.
> 
> 
> I haven't considered something like this, because I'm not familiar with ObjC at all... I will give it a try, thanks.

Hi @rjmccall , I assume, I took a look at this. 
Let's imagine, I will try to diagnose `__float128` type using already implemented functionality. It seems like I need to call something like

  S.DelayedDiagnostics.add(                                        
      sema::DelayedDiagnostic::makeForbiddenType(loc,              
          diag::err_type_unsupported, type, "__float128"));
  `

right?
I suppose, then this diagnostic will be saved and emitted inside function named `handleDelayedForbiddenType`.
Here it checks that this forbidden type is actually allowed and emits a diagnostic if it's not.
The first problem that `handleDelayedForbiddenType` is called too early. We don't know in this place whether we are in SYCL device code or not. Because basically entry point to SYCL device code is a template function with `sycl_kernel` attribute, and every function it calls become a device function. So we only know where is device code only after templates instantiation, it happens a bit later after `handleDelayedForbiddenType` call.

It seems that the second problem is the same problem which prevented me from implementing diagnosing of `__float128` type through CUDA/OMP deferred diagnostics (I mentioned my attempt in the last comment https://reviews.llvm.org/D74387#1870014). I still need to find best place for diagnostic issuing. It seems that there are so many places where type can actually be introduced to resulting LLVM IR module, and in some of them I need to check some additional conditions to do not prevent `__float128` usage when it actually doesn't introduce forbidden type to resulting LLVM IR module.

Please, correct me if I don't understand something or said something wrong. 
I would appreciate if you had some advices.

Thanks a lot.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74387/new/

https://reviews.llvm.org/D74387





More information about the cfe-commits mailing list