[clang] [llvm] [Clang][inlineasm] Add special support for "rm" output constraints (PR #92040)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 4 08:14:29 PST 2026
================
@@ -2892,13 +2892,19 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) {
if (!Constraints.empty())
Constraints += ',';
- // If this is a register output, then make the inline asm return it
- // by-value. If this is a memory result, return the value by-reference.
+ // - If this is a register output, then make the inline asm return it
+ // by-value.
+ // - If this is an "rm" constraint, then treat it like a register output.
+ // (We'll correct this before ISel if using the fast register allocator.)
+ // - If this is a memory result, return the value by-reference.
QualType QTy = OutExpr->getType();
const bool IsScalarOrAggregate = hasScalarEvaluationKind(QTy) ||
hasAggregateEvaluationKind(QTy);
- if (!Info.allowsMemory() && IsScalarOrAggregate) {
+ const bool RegisterMemoryConstraints =
+ OutputConstraint == "rm" || OutputConstraint == "mr";
----------------
nikic wrote:
Should avoid matching the constraint string directly. I think the right logic here may be to replace !allowsMemory with allowsRegister?
https://github.com/llvm/llvm-project/pull/92040
More information about the llvm-commits
mailing list