[PATCH] [ARMv8] SETEND is deprecated.

Joey Gouly joey.gouly at arm.com
Fri Aug 2 10:55:08 PDT 2013


On ARMv8 the 'setend' instruction is deprecated. This adds a warning to the ARM AsmParser.

The Disassembler doesn't seem to have a way of producing warnings, unless I'm mistaken, so I couldn't add one there. 

Is there a need for a proper solution to deprecated instructions in TableGen? 

http://llvm-reviews.chandlerc.com/D1269

Files:
  lib/Target/ARM/AsmParser/ARMAsmParser.cpp
  test/MC/ARM/deprecated-v8.s

Index: lib/Target/ARM/AsmParser/ARMAsmParser.cpp
===================================================================
--- lib/Target/ARM/AsmParser/ARMAsmParser.cpp
+++ lib/Target/ARM/AsmParser/ARMAsmParser.cpp
@@ -229,6 +229,7 @@
                               SmallVectorImpl<MCParsedAsmOperand*> &Operands);
   bool shouldOmitPredicateOperand(StringRef Mnemonic,
                               SmallVectorImpl<MCParsedAsmOperand*> &Operands);
+  bool isDeprecated(StringRef &Mnemonic, StringRef &Info);

 public:
   enum ARMMatchResultTy {
@@ -4876,6 +4877,13 @@
   return false;
 }

+bool ARMAsmParser::isDeprecated(StringRef &Mnemonic, StringRef &Info) {
+  if (hasV8Ops() && Mnemonic == "setend") {
+    Info = "armv8";
+    return true;
+  }
+}
+
 static bool isDataTypeToken(StringRef Tok) {
   return Tok == ".8" || Tok == ".16" || Tok == ".32" || Tok == ".64" ||
     Tok == ".i8" || Tok == ".i16" || Tok == ".i32" || Tok == ".i64" ||
@@ -5158,6 +5166,11 @@
     Operands.erase(Operands.begin() + 1);
     delete Op1;
   }
+
+  StringRef DepInfo;
+  if (isDeprecated(Mnemonic, DepInfo))
+    Warning(NameLoc, Mnemonic + " is deprecated on " + DepInfo);
+
   return false;
 }

Index: test/MC/ARM/deprecated-v8.s
===================================================================
--- /dev/null
+++ test/MC/ARM/deprecated-v8.s
@@ -0,0 +1,3 @@
+@ RUN: llvm-mc -triple armv8 -show-encoding < %s 2>&1 | FileCheck %s
+setend be
+@ CHECK: warning: setend is deprecated on armv8
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1269.1.patch
Type: text/x-patch
Size: 1479 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130802/de9d7e91/attachment.bin>


More information about the llvm-commits mailing list