Create a isFullCopy predicate.
authorRafael Espindola <rafael.espindola@gmail.com>
Thu, 30 Jun 2011 21:15:52 +0000 (21:15 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Thu, 30 Jun 2011 21:15:52 +0000 (21:15 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134189 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/MachineInstr.h
lib/CodeGen/InlineSpiller.cpp

index 07a14cf0c15a5f8db834838d47b32701006fb327..788d149c868532229e0fbbd12f081ee1645964c3 100644 (file)
@@ -278,6 +278,9 @@ public:
   bool isCopy() const {
     return getOpcode() == TargetOpcode::COPY;
   }
+  bool isFullCopy() const {
+    return isCopy() && !getOperand(0).getSubReg() && !getOperand(1).getSubReg();
+  }
 
   /// isCopyLike - Return true if the instruction behaves like a copy.
   /// This does not include native copy instructions.
index 19ae333115c067c2ffda3ea4ef85e7a206090736..0273891d690b04ddf4ae92c185e8e24a234e9cd1 100644 (file)
@@ -180,11 +180,7 @@ Spiller *createInlineSpiller(MachineFunctionPass &pass,
 /// isFullCopyOf - If MI is a COPY to or from Reg, return the other register,
 /// otherwise return 0.
 static unsigned isFullCopyOf(const MachineInstr *MI, unsigned Reg) {
-  if (!MI->isCopy())
-    return 0;
-  if (MI->getOperand(0).getSubReg() != 0)
-    return 0;
-  if (MI->getOperand(1).getSubReg() != 0)
+  if (!MI->isFullCopy())
     return 0;
   if (MI->getOperand(0).getReg() == Reg)
       return MI->getOperand(1).getReg();