[llvm] [CodeGen] Enhance inline asm constraint diagnostics (PR #101354)
Evgenii Kudriashov via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 31 09:05:58 PDT 2024
e-kud wrote:
This is a continuation of https://github.com/llvm/llvm-project/pull/96363. Here I want backends to provide additional information why a register can't be allocated.
My points of concerns:
* I don't like using `std::string` for error messages.
* I've tried to return `Expected<std::pair<unsigned, const TargetRegisterClass *>>` from `getRegForInlineAsmConstraint`. But this is much more intrusive change than simply adding the reference argument. Because we need to update all return statements in all backends.
* In case of `X86`, `TargetLowering::getRegForInlineAsmConstraint` may override the error message obtained from switches before. But it's not a problem to preserve a message if any, and ignore the one from generic version.
Hi @arsenm @RKSimon @efriedma-quic @phoebewang what do you think? Are there better ways to make backends more friendly in terms of diagnostics.
This is a draft. When or if we agree with the approach, I'll cover all failures from `getRegForInlineAsmConstraint` for `X86`. For now I've covered only cases from tests.
https://github.com/llvm/llvm-project/pull/101354
More information about the llvm-commits
mailing list