[llvm] [AArch64] Remove copy in SVE/SME predicate spill and fill (PR #81716)
Sander de Smalen via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 15 02:51:25 PDT 2024
================
@@ -741,6 +744,18 @@ static DecodeStatus DecodeMatrixTile(MCInst &Inst, unsigned RegNo,
return Success;
}
+static DecodeStatus DecodePPRorPNRRegisterClass(MCInst &Inst, unsigned RegNo,
----------------
sdesmalen-arm wrote:
Cleanup suggestion for a separate patch:
All these decoder classes looks rather identical, it would be nice to clean this up with something like this:
```
template <unsigned RegClassID, unsigned FirstReg, unsigned NumRegsInClass>
static DecodeStatus DecodeSimpleReg(MCInst &Inst, unsigned RegNo,
uint64_t Addr,
const MCDisassembler *Decoder) {
if (RegNo > (NumRegsInClass-1))
return Fail;
unsigned Register =
AArch64MCRegisterClasses[RegClassID].getRegister(RegNo);
Inst.addOperand(MCOperand::createReg(Register + FirstReg));
return Success;
}
```
And then remove the other functions and just specify e.g. `DecodeSimpleReg<AArch64::PPRorPNRRegClassID, 0, 16>` in the .td file.
https://github.com/llvm/llvm-project/pull/81716
More information about the llvm-commits
mailing list