[clang] [clang] Improve diagnostics for constraints of inline asm (NFC) (PR #96363)
Evgenii Kudriashov via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 28 14:03:36 PDT 2024
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
More information about the cfe-commits
mailing list