[libc-commits] [libc] [NFC][CodeGen] Create method to clear registers (PR #66958)

Bill Wendling via libc-commits libc-commits at lists.llvm.org
Thu Sep 21 13:36:05 PDT 2023


================
@@ -2057,6 +2057,14 @@ class TargetInstrInfo : public MCInstrInfo {
         "Target didn't implement TargetInstrInfo::insertOutlinedCall!");
   }
 
+  /// Insert an architecture-specific instruction to clear a register.
+  virtual void buildClearRegister(Register Reg, MachineBasicBlock &MBB,
+                                  MachineBasicBlock::iterator Iter,
----------------
bwendling wrote:

That could work, though I'm then a bit confused why `BuildMI` requires both the `MBB` and `Iter` values. My guess is that it has something to do with when `Iter` is at the end of the list?

If it's okay, I'd like to keep it like this for the time being. If it's possible to safely get the MBB from the iterator, then we should probably consider adding a `BuildMI` which takes only an iterator instead of both.

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


More information about the libc-commits mailing list