e-kud wrote:

> What exactly does it mean for a constraint to conflict with a feature? The 
> only thing I can think of is if it somehow involves a register class that 
> doesn't exist on the target with the current set of target features. I guess 
> we could try to diagnose that, but I'm not sure it's worth duplicating that 
> code.

Yes, indeed. For instance, we have a constraint `x` that must provide `xmm` 
register. But if we compile with `-mno-sse` there are no `xmm`s available. And 
these changes in targets are the prework to handle these cases in clang. This 
is not a special case for X86. ARM, for example, makes some target constraints 
invalid if a feature is not enabled:
https://github.com/llvm/llvm-project/blob/a9c12e481bfef5b2913e2241486f4dd450188cd2/clang/lib/Basic/Targets/ARM.cpp#L1157-L1161

However this implementation is buggy because it doesn't consider function 
attributes. In case of multiversioning in the same TU we will hit compilation 
errors.

>  I'm not sure it's worth duplicating that code.

So, then return to the idea to better diagnose these things from backends?

https://github.com/llvm/llvm-project/pull/96363
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to