[PATCH] D110869: [X86] Implement -fzero-call-used-regs option

Bill Wendling via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 31 16:20:03 PST 2022


void marked 3 inline comments as done.
void added inline comments.


================
Comment at: llvm/include/llvm/CodeGen/MachineRegisterInfo.h:232-240
+  /// Returns true if a register can be used as an argument to a function.
+  bool isArgumentRegister(const MachineFunction &MF, MCRegister Reg) const;
+
+  /// Returns true if a register is a fixed register.
+  bool isFixedRegister(const MachineFunction &MF, MCRegister Reg) const;
+
+  /// Returns true if a register is a general purpose register.
----------------
nickdesaulniers wrote:
> are these methods on `MachineRegisterInfo` used anywhere? It looks like only the ones on `TargetRegisterInfo` are, IIUC?
> 
> Oh, are these related to the .td additions? Something seems asymmetric with these three. Like perhaps we only need `isFixedRegister` here?
`isFixedRegister` is there :-)

I added these to MRI for completeness. It looks like all such predicates are reflected in both places.


================
Comment at: llvm/lib/CodeGen/PrologEpilogInserter.cpp:1269
+  const TargetFrameLowering &TFI = *MF.getSubtarget().getFrameLowering();
+  for (auto RestoreBlock : RestoreBlocks)
+    TFI.emitZeroCallUsedRegs(RegsToZero, *RestoreBlock);
----------------
nickdesaulniers wrote:
> ```
> for (MachineBasicBlock *RestoreBlock : RestoreBlocks)
> ```
I prefer `auto` unless absolutely necessary (or to avoid confusion).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110869



More information about the cfe-commits mailing list