[llvm-commits] [llvm] r108095 - in /llvm/trunk: 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

Jakob Stoklund Olesen stoklund at 2pi.dk
Sun Jul 11 10:01:17 PDT 2010


Author: stoklund
Date: Sun Jul 11 12:01:17 2010
New Revision: 108095

URL: http://llvm.org/viewvc/llvm-project?rev=108095&view=rev
Log:
Remove TargetInstrInfo::copyRegToReg entirely.

Targets must now implement TargetInstrInfo::copyPhysReg instead. There is no
longer a default implementation forwarding to copyRegToReg.

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

Modified: llvm/trunk/docs/WritingAnLLVMBackend.html
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/WritingAnLLVMBackend.html?rev=108095&r1=108094&r2=108095&view=diff
==============================================================================
--- llvm/trunk/docs/WritingAnLLVMBackend.html (original)
+++ llvm/trunk/docs/WritingAnLLVMBackend.html Sun Jul 11 12:01:17 2010
@@ -1310,7 +1310,8 @@
     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> — Copy values between a pair of registers.</li>
+<li><tt>copyPhysReg</tt> — Copy values between a pair of physical
+    registers.</li>
 
 <li><tt>storeRegToStackSlot</tt> — Store a register value to a stack
     slot.</li>

Modified: llvm/trunk/include/llvm/Target/TargetInstrInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetInstrInfo.h?rev=108095&r1=108094&r2=108095&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetInstrInfo.h (original)
+++ llvm/trunk/include/llvm/Target/TargetInstrInfo.h Sun Jul 11 12:01:17 2010
@@ -357,7 +357,9 @@
   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 @@
 
   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

Modified: llvm/trunk/include/llvm/Target/TargetOpcodes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetOpcodes.h?rev=108095&r1=108094&r2=108095&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetOpcodes.h (original)
+++ llvm/trunk/include/llvm/Target/TargetOpcodes.h Sun Jul 11 12:01:17 2010
@@ -62,8 +62,7 @@
     /// 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

Modified: llvm/trunk/lib/CodeGen/TargetInstrInfoImpl.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetInstrInfoImpl.cpp?rev=108095&r1=108094&r2=108095&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/TargetInstrInfoImpl.cpp (original)
+++ llvm/trunk/lib/CodeGen/TargetInstrInfoImpl.cpp Sun Jul 11 12:01:17 2010
@@ -438,20 +438,3 @@
 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);
-}

Modified: llvm/trunk/test/CodeGen/Blackfin/cmp64.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Blackfin/cmp64.ll?rev=108095&r1=108094&r2=108095&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/Blackfin/cmp64.ll (original)
+++ llvm/trunk/test/CodeGen/Blackfin/cmp64.ll Sun Jul 11 12:01:17 2010
@@ -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:

Modified: llvm/trunk/test/TableGen/TargetInstrInfo.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/TargetInstrInfo.td?rev=108095&r1=108094&r2=108095&view=diff
==============================================================================
--- llvm/trunk/test/TableGen/TargetInstrInfo.td (original)
+++ llvm/trunk/test/TableGen/TargetInstrInfo.td Sun Jul 11 12:01:17 2010
@@ -83,8 +83,7 @@
 //     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)]>;





More information about the llvm-commits mailing list