[llvm] [X86] Support EGPR (R16-R31) for APX (PR #67702)
Phoebe Wang via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 29 06:46:38 PDT 2023
================
@@ -92,6 +92,37 @@ X86InstrInfo::X86InstrInfo(X86Subtarget &STI)
Subtarget(STI), RI(STI.getTargetTriple()) {
}
+const TargetRegisterClass *
+X86InstrInfo::getRegClass(const MCInstrDesc &MCID, unsigned OpNum,
+ const TargetRegisterInfo *TRI,
+ const MachineFunction &MF) const {
+ auto *RC = TargetInstrInfo::getRegClass(MCID, OpNum, TRI, MF);
+ // If the target does not have egpr, then r16-r31 will be resereved for all
+ // instructions.
+ if (!RC || !Subtarget.hasEGPR())
+ return RC;
+
+ if (X86II::canUseApxExtendedReg(MCID))
+ return RC;
+
+ switch (RC->getID()) {
+ default:
----------------
phoebewang wrote:
Is this optimism for other cases? I think we have other classes like `GR8_ABCD_LRegClassID`, `GR16_ABCDRegClassID` etc.
https://github.com/llvm/llvm-project/pull/67702
More information about the llvm-commits
mailing list