[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:55 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 there is 

  ```
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.
```

in the llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp ,

in the test case ,`r2` is not marked as  reversed . if it can not has `implicit $x2` , otherwise it will have 
`Bad machine code: Using an undefined physical register ` when parse the MIR of the function.


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


More information about the llvm-commits mailing list