[llvm] [AMDGPU][MC] Allow UC_VERSION_* constant reuse (PR #96461)
Carl Ritson via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 2 17:23:46 PDT 2024
================
@@ -1755,18 +1755,25 @@ MCOperand AMDGPUDisassembler::decodeVersionImm(unsigned Imm) const {
if (Encoding::encode(Version, W64, W32, MDP) != Imm)
return MCOperand::createImm(Imm);
- const auto &Versions = AMDGPU::UCVersion::getGFXVersions();
- auto I = find_if(Versions,
- [Version = Version](const AMDGPU::UCVersion::GFXVersion &V) {
- return V.Code == Version;
- });
+ // Locate UC_VERSION symbol matching Version.
MCContext &Ctx = getContext();
- const MCExpr *E;
- if (I == Versions.end())
+ const MCExpr *E = nullptr;
+ for (auto *VersionSym : UCVersionSymbols) {
+ int64_t Val;
+ if (!VersionSym->evaluateAsAbsolute(Val))
----------------
perlfu wrote:
The point of the evaluation is to obtain the current value of the symbol for matching versions to it.
If the symbol is later redefined then the newer version should match.
https://github.com/llvm/llvm-project/pull/96461
More information about the llvm-commits
mailing list