[PATCH] D150388: [CodeGen]Allow targets to use target specific COPY instructions for live range splitting

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 19 08:56:28 PDT 2023


arsenm added inline comments.


================
Comment at: llvm/include/llvm/CodeGen/TargetInstrInfo.h:1963
 
+  virtual unsigned getTargetCopyOpcode(Register &reg, MachineRegisterInfo &MRI) const{
+    return TargetOpcode::COPY;
----------------
Register should be passed by value. MRI should also be const.

Needs a doc comment.

I'd also rename this to something like getLiveRangeSplitOpcode?


================
Comment at: llvm/lib/CodeGen/TargetInstrInfo.cpp:444
                                               unsigned FoldIdx) {
-  assert(MI.isCopy() && "MI must be a COPY instruction");
+  const TargetInstrInfo &TII = *MI.getParent()->getParent()->getSubtarget().getInstrInfo();
+  assert(TII.isCopyInstr(MI) && "MI must be a COPY instruction");
----------------
I'd prefer to pass in TII separately rather than jumping through all these hoops. Also, this is only used in the assert so will warn in release build 


================
Comment at: llvm/test/CodeGen/Mips/dsp-r1.ll:3-5
+; XFAIL: *
+; This test fails after introducing TII::isCopyInstr() instead of MI.isCopy()
+; in regalloc pipeline
----------------
Can't do this, just fix the mips isCopy implementation?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150388



More information about the llvm-commits mailing list