Remove TargetInstrInfo::copyRegToReg entirely.
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Sun, 11 Jul 2010 17:01:17 +0000 (17:01 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Sun, 11 Jul 2010 17:01:17 +0000 (17:01 +0000)
Targets must now implement TargetInstrInfo::copyPhysReg instead. There is no
longer a default implementation forwarding to copyRegToReg.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108095 91177308-0d34-0410-b5e6-96231b3b80d8

docs/WritingAnLLVMBackend.html
include/llvm/Target/TargetInstrInfo.h
include/llvm/Target/TargetOpcodes.h
lib/CodeGen/TargetInstrInfoImpl.cpp
test/CodeGen/Blackfin/cmp64.ll
test/TableGen/TargetInstrInfo.td

index d909a1a3fb72e5b1774929aa42f92ef7a7a90c93..077dea0ed62d300569960b4cabd67e9f74918056 100644 (file)
@@ -1310,7 +1310,8 @@ implementation in <tt>SparcInstrInfo.cpp</tt>:
     a direct store to a stack slot, return the register number of the
     destination and the <tt>FrameIndex</tt> of the stack slot.</li>
 
-<li><tt>copyRegToReg</tt> &mdash; Copy values between a pair of registers.</li>
+<li><tt>copyPhysReg</tt> &mdash; Copy values between a pair of physical
+    registers.</li>
 
 <li><tt>storeRegToStackSlot</tt> &mdash; Store a register value to a stack
     slot.</li>
index 6a4573b4fde0fbe69903ad1953154626152d1220..6e699143205200f272517095652898052335f2ca 100644 (file)
@@ -357,7 +357,9 @@ public:
   virtual void copyPhysReg(MachineBasicBlock &MBB,
                            MachineBasicBlock::iterator MI, DebugLoc DL,
                            unsigned DestReg, unsigned SrcReg,
-                           bool KillSrc) const =0;
+                           bool KillSrc) const {
+    assert(0 && "Target didn't implement TargetInstrInfo::copyPhysReg!");
+  }
 
   /// storeRegToStackSlot - Store the specified register of the given register
   /// class to the specified stack frame index. The store instruction is to be
@@ -648,22 +650,6 @@ public:
 
   virtual ScheduleHazardRecognizer *
   CreateTargetPostRAHazardRecognizer(const InstrItineraryData&) const;
-  virtual void copyPhysReg(MachineBasicBlock &MBB,
-                           MachineBasicBlock::iterator MI, DebugLoc DL,
-                           unsigned DestReg, unsigned SrcReg,
-                           bool KillSrc) const;
-  /// copyRegToReg - Legacy hook going away soon. Targets should implement
-  /// copyPhysReg instead.
-  virtual bool copyRegToReg(MachineBasicBlock &MBB,
-                            MachineBasicBlock::iterator MI,
-                            unsigned DestReg, unsigned SrcReg,
-                            const TargetRegisterClass *DestRC,
-                            const TargetRegisterClass *SrcRC,
-                            DebugLoc DL) const {
-    assert(0 && "Target didn't implement TargetInstrInfo::copyPhysReg!");
-    return false;
-  }
-
 };
 
 } // End llvm namespace
index e710c702194b91cad68bd69073333e48a93b7f12..cb772ecd77de486ea6bf2ac1f8a828693a4e12e8 100644 (file)
@@ -62,8 +62,7 @@ namespace TargetOpcode {
     /// used between instruction selection and MachineInstr creation, before
     /// virtual registers have been created for all the instructions, and it's
     /// only needed in cases where the register classes implied by the
-    /// instructions are insufficient. The actual MachineInstrs to perform
-    /// the copy are emitted with the TargetInstrInfo::copyRegToReg hook.
+    /// instructions are insufficient. It is emitted as a COPY MachineInstr.
     COPY_TO_REGCLASS = 10,
 
     /// DBG_VALUE - a mapping of the llvm.dbg.value intrinsic
index 56cb4b19b8cd0362c334f8dc5b26677f18a2fa9a..5b1d5a62ffbb07dfe8a5e5b2a2abcd9c617c7773 100644 (file)
@@ -438,20 +438,3 @@ ScheduleHazardRecognizer *TargetInstrInfoImpl::
 CreateTargetPostRAHazardRecognizer(const InstrItineraryData &II) const {
   return (ScheduleHazardRecognizer *)new PostRAHazardRecognizer(II);
 }
-
-// Default implementation of copyPhysReg using copyRegToReg.
-void TargetInstrInfoImpl::copyPhysReg(MachineBasicBlock &MBB,
-                                      MachineBasicBlock::iterator MI,
-                                      DebugLoc DL,
-                                      unsigned DestReg, unsigned SrcReg,
-                                      bool KillSrc) const {
-  assert(TargetRegisterInfo::isPhysicalRegister(DestReg));
-  assert(TargetRegisterInfo::isPhysicalRegister(SrcReg));
-  const TargetRegisterInfo *TRI = MBB.getParent()->getTarget().getRegisterInfo();
-  const TargetRegisterClass *DRC = TRI->getPhysicalRegisterRegClass(DestReg);
-  const TargetRegisterClass *SRC = TRI->getPhysicalRegisterRegClass(SrcReg);
-  if (!copyRegToReg(MBB, MI, DestReg, SrcReg, DRC, SRC, DL))
-    llvm_unreachable("Cannot emit physreg copy instruction");
-  if (KillSrc)
-    llvm::prior(MI)->addRegisterKilled(SrcReg, TRI, true);
-}
index ef5bf45861ddc4fa0c99afb3cc94eb5de2117987..6c4f9c5bd7fdd60acfbeacb9b31a828fa25ca13d 100644 (file)
@@ -1,8 +1,8 @@
 ; RUN: llc < %s -march=bfin
 
 ; This test tries to use a JustCC register as a data operand for MOVEcc.  It
-; calls copyRegToReg(JustCC -> DP), failing because JustCC can only be copied to
-; D.  The proper solution would be to restrict the virtual register to D only.
+; copies (JustCC -> DP), failing because JustCC can only be copied to D.
+; The proper solution would be to restrict the virtual register to D only.
 
 define i32 @main() {
 entry:
index 2871eb81df9cd804e018e5f2da2f93ad67961f49..146ef6fd7682630ee4eef7843c59411c197b72ed 100644 (file)
@@ -83,8 +83,7 @@ class Inst<dag opnds, string asmstr, bits<8> opcode,
 //     the pattern.
 //  6. Address expressions should become first-class entities.
 
-// Simple copy instruction.  isMoveInstr could easily be inferred from this,
-// as could TargetRegisterInfo::copyRegToReg.
+// Simple copy instruction.
 def MOV8rr : Inst<(ops R8:$dst, R8:$src),
                   "mov $dst, $src", 0x88, MRMDestReg,
                   [(set R8:$dst, R8:$src)]>;