[llvm] r190862 - [ARM] Fix the deprecation of MCR encodings that map to CP15{ISB, DSB, DMB}.

Joey Gouly joey.gouly at arm.com
Tue Sep 17 02:54:58 PDT 2013


Author: joey
Date: Tue Sep 17 04:54:57 2013
New Revision: 190862

URL: http://llvm.org/viewvc/llvm-project?rev=190862&view=rev
Log:
[ARM] Fix the deprecation of MCR encodings that map to CP15{ISB,DSB,DMB}.

Modified:
    llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td
    llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp
    llvm/trunk/test/MC/ARM/deprecated-v8.s

Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td?rev=190862&r1=190861&r2=190862&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td (original)
+++ llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td Tue Sep 17 04:54:57 2013
@@ -4007,7 +4007,8 @@ def t2MCR : t2MovRCopro<0b1110, "mcr", 0
            (ins p_imm:$cop, imm0_7:$opc1, GPR:$Rt, c_imm:$CRn,
                 c_imm:$CRm, imm0_7:$opc2),
            [(int_arm_mcr imm:$cop, imm:$opc1, GPR:$Rt, imm:$CRn,
-                         imm:$CRm, imm:$opc2)]>;
+                         imm:$CRm, imm:$opc2)]>,
+           ComplexDeprecationPredicate<"MCR">;
 def : t2InstAlias<"mcr${p} $cop, $opc1, $Rt, $CRn, $CRm",
                   (t2MCR p_imm:$cop, imm0_7:$opc1, GPR:$Rt, c_imm:$CRn,
                          c_imm:$CRm, 0, pred:$p)>;

Modified: llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp?rev=190862&r1=190861&r2=190862&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp (original)
+++ llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp Tue Sep 17 04:54:57 2013
@@ -33,15 +33,32 @@ using namespace llvm;
 
 static bool getMCRDeprecationInfo(MCInst &MI, MCSubtargetInfo &STI,
                                   std::string &Info) {
-  // Checks for the deprecated CP15ISB encoding:
-  // mcr pX, #0, rX, c7, c5, #4
-  if (STI.getFeatureBits() & llvm::ARM::HasV8Ops &&
+  if (STI.getFeatureBits() & llvm::ARM::HasV7Ops &&
+      (MI.getOperand(0).isImm() && MI.getOperand(0).getImm() == 15) &&
       (MI.getOperand(1).isImm() && MI.getOperand(1).getImm() == 0) &&
-      (MI.getOperand(3).isImm() && MI.getOperand(3).getImm() == 7) &&
-      (MI.getOperand(4).isImm() && MI.getOperand(4).getImm() == 5) &&
-      (MI.getOperand(5).isImm() && MI.getOperand(5).getImm() == 4)) {
-    Info = "deprecated on armv8";
-    return true;
+      // Checks for the deprecated CP15ISB encoding:
+      // mcr p15, #0, rX, c7, c5, #4
+      (MI.getOperand(3).isImm() && MI.getOperand(3).getImm() == 7)) {
+    if ((MI.getOperand(5).isImm() && MI.getOperand(5).getImm() == 4)) {
+      if (MI.getOperand(4).isImm() && MI.getOperand(4).getImm() == 5) {
+        Info = "deprecated since v7, use 'isb'";
+        return true;
+      }
+
+      // Checks for the deprecated CP15DSB encoding:
+      // mcr p15, #0, rX, c7, c10, #4
+      if (MI.getOperand(4).isImm() && MI.getOperand(4).getImm() == 10) {
+        Info = "deprecated since v7, use 'dsb'";
+        return true;
+      }
+    }
+    // Checks for the deprecated CP15DMB encoding:
+    // mcr p15, #0, rX, c7, c10, #5
+    if (MI.getOperand(4).isImm() && MI.getOperand(4).getImm() == 10 &&
+        (MI.getOperand(5).isImm() && MI.getOperand(5).getImm() == 5)) {
+      Info = "deprecated since v7, use 'dmb'";
+      return true;
+    }
   }
   return false;
 }

Modified: llvm/trunk/test/MC/ARM/deprecated-v8.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/deprecated-v8.s?rev=190862&r1=190861&r2=190862&view=diff
==============================================================================
--- llvm/trunk/test/MC/ARM/deprecated-v8.s (original)
+++ llvm/trunk/test/MC/ARM/deprecated-v8.s Tue Sep 17 04:54:57 2013
@@ -1,8 +1,18 @@
 @ RUN: llvm-mc -triple armv8 -show-encoding < %s 2>&1 | FileCheck %s --check-prefix=CHECK-V8
 @ RUN: llvm-mc -triple armv7 -show-encoding < %s 2>&1 | FileCheck %s --check-prefix=CHECK-V7
+@ RUN: llvm-mc -triple armv6 -show-encoding < %s 2>&1 | FileCheck %s --check-prefix=CHECK-V6
 setend be
 @ CHECK-V8: warning: deprecated
 @ CHECK-V7-NOT: warning: deprecated
-mcr p8, #0, r5, c7, c5, #4
-@ CHECK-V8: warning: deprecated on armv8
-@ CHECK-V7-NOT: warning: deprecated on armv8
+mcr p15, #0, r5, c7, c5, #4
+@ CHECK-V8: warning: deprecated since v7, use 'isb'
+@ CHECK-V7: warning: deprecated since v7, use 'isb'
+@ CHECK-V6-NOT: warning: deprecated since v7, use 'isb'
+mcr p15, #0, r5, c7, c10, #4
+@ CHECK-V8: warning: deprecated since v7, use 'dsb'
+@ CHECK-V7: warning: deprecated since v7, use 'dsb'
+@ CHECK-V6-NOT: warning: deprecated since v7, use 'dsb'
+mcr p15, #0, r5, c7, c10, #5
+@ CHECK-V8: warning: deprecated since v7, use 'dmb'
+@ CHECK-V7: warning: deprecated since v7, use 'dmb'
+@ CHECK-V6-NOT: warning: deprecated since v7, use 'dmb'





More information about the llvm-commits mailing list