[llvm] [AMDGPU][AsmParser] Simplify getting source locations of operands. (PR #158323)
Ivan Kosarev via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 15 04:30:07 PDT 2025
================
@@ -228,6 +213,9 @@ class AMDGPUOperand : public MCParsedAsmOperand {
const MCExpr *Expr;
};
+ // The index of the associated MCInst operand.
+ mutable int MCOpIdx = -1;
----------------
kosarev wrote:
Would take all the AddImm*() / AddReg*() members to lose their const qualifiers. Alternatively, since AMDGPUOperands store a reference to the AsmParser, we could store the mapping there, which looks more complicated than necessary and then again requires dealing with the const-ness of that reference. Wasn't able to convince myself any of the options are worth it.
Note that the removed `ImmKindTy Kind` field was also declared mutable, so the patch doesn't make it worse.
https://github.com/llvm/llvm-project/pull/158323
More information about the llvm-commits
mailing list