[PATCH] D112073: [PowerPC] Emit warning when SP is clobbered by asm

Nemanja Ivanovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 29 08:05:28 PST 2021


nemanjai requested changes to this revision.
nemanjai added inline comments.
This revision now requires changes to proceed.


================
Comment at: llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp:396
+  // The stack pointer (R1) is not clobberable by inline asm
+  return PhysReg != PPC::R1;
+}
----------------
shchenz wrote:
> PowerPC overrides `getReservedRegs()`, why don't we use this function and only warn for `R1` even no `X1`?
It is unfortunately not as simple as that. We do have some reserved registers that can be clobbered. For example `R2` can be clobbered since the compiler will spill and restore it.
There should be a comment to that end in the code. The test should definitely cover `X1` in 64-bit mode.

Furthermore, there needs to be a 64-bit test as well.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112073/new/

https://reviews.llvm.org/D112073



More information about the llvm-commits mailing list