[PATCH] D62300: [AVR] Fix incorrect source regclass of LDWRdPtr

Dylan McKay via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 1 01:32:25 PDT 2019

dylanmckay added inline comments.

Comment at: lib/Target/AVR/AVRRegisterInfo.td:175
     // Callee saved registers.
-    R29R28, R17R16, R15R14, R13R12, R11R10,
+    R17R16, R15R14, R13R12, R11R10,
     R9R8, R7R6, R5R4, R3R2, R1R0
Jim wrote:
> dylanmckay wrote:
> > I can't tell why the removal of `Y` is needed.
> > 
> > `LDWRdPtr` expands to `LDRdPtr` and `LDDRdPtrQ`.
> > 
> > `LDRdPtr` accepts any pointer register (`X`, `Y`, or `Z`), and as you point out, `LDDRdPtrQ` only accepts `DREGS_WITHOUT_Z_WORKAROUND:` (AKA some GPRs and `X`, `Y`). The register constraints over the instruction pair is the intersection of the register classes for these sub instructions, which is the set of pointer registers `{ X, Y }`
> > 
> > What are your thoughts?
> `LDRdPtr` accepts `X`, `Y` or `Z` as pointer register, But `LDDRdPtrQ` only accepts `Y` or `Z` as pointer register. 
>  I changed the pointer register of `LDWRdPtr` from {`X`, `Y`, `Z`} to {`Y`, `Z`}.  Since their intersection of registers are `Y` or `Z` (Register class `PTRDISPREGS`). `Y` has more register pressure due to this change. So I removed Y from DREGS_WITHOUT_Z_WORKAROUND. In my experiment, if it is without the removal of `Y`, it has the same issue, ran out of registers, as `Z`.
That makes sense, thanks




More information about the llvm-commits mailing list