[clang] [llvm] RFC: Implementing new mechanism for hard register operands to inline asm as a constraint. (PR #85846)

Ulrich Weigand via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 9 02:53:00 PST 2025


uweigand wrote:

> IMO, this goes against the intended use of hard registers, so I think we should disallow this in the front end, and error out if it detects `{}` in the constraint string with other constraints. But I'm open to other ideas.

Not sure why we have to fully reject this.  In GCC, using a register asm in an operand with hard register constraints is allowed if the register asm is compatible with the constraint.  When there are multiple constraints, I think it could work the same way - if the register asm is compatible with at least one of the constraints, it is OK (and we effectively force the register from the register asm), otherwise we should error out.

@stefan-sf-ibm , the GCC docs do not specifically go into this case.  Can you confirm how GCC handles register asm in combination with multiple constraints including hard register constraints?

https://github.com/llvm/llvm-project/pull/85846


More information about the llvm-commits mailing list