[llvm] [PowerPC] Utilize getReservedRegs to find asm clobberable registers. (PR #107863)

zhijian lin via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 16 13:37:56 PDT 2024


================
@@ -27,12 +27,12 @@ body: |
     ; CHECK: $x0 = MFLR8 implicit $lr8
     ; CHECK-NEXT: STD killed $x0, 16, $x1
     ; CHECK-NEXT: $x1 = STDU $x1, -32752, $x1
-    ; CHECK-NEXT: BL8 @test_callee, csr_ppc64, implicit-def dead $lr8, implicit $rm, implicit $x2, implicit-def $r1, implicit-def $x3
+    ; CHECK-NEXT: BL8 @test_callee, csr_ppc64_r2, implicit-def dead $lr8, implicit $rm, implicit-def $r1, implicit-def $x3
----------------
diggerlin wrote:

since we have following code in the llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp

```
if (Subtarget.isAIXABI())
    // We only reserve r2 if we need to use the TOC pointer on AIX.
    if (!TM.isPPC64() || UsesTOCBasePtr || MF.hasInlineAsm())
      markSuperRegs(Reserved, PPC::R2); // System-reserved register.
```

we need to change the test case to 

`BL8 @test_callee, csr_ppc64_r2, implicit-def dead $lr8, implicit $rm, implicit-def $r1, implicit-def $x3`

otherwise it is a illegal instruction at   `implicit $x2`


https://github.com/llvm/llvm-project/pull/107863


More information about the llvm-commits mailing list