[ARMv8] Add an assembler warning for the deprecated 'setend' instruction.
authorJoey Gouly <joey.gouly@arm.com>
Fri, 2 Aug 2013 19:18:12 +0000 (19:18 +0000)
committerJoey Gouly <joey.gouly@arm.com>
Fri, 2 Aug 2013 19:18:12 +0000 (19:18 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187666 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/AsmParser/ARMAsmParser.cpp
test/MC/ARM/deprecated-v8.s [new file with mode: 0644]

index 8e56a1ab9427dcb1b4de9987ac262ca7bdd7d016..862e1166027c05b57239b1d62ccc46f47085428e 100644 (file)
@@ -229,6 +229,7 @@ class ARMAsmParser : public MCTargetAsmParser {
                               SmallVectorImpl<MCParsedAsmOperand*> &Operands);
   bool shouldOmitPredicateOperand(StringRef Mnemonic,
                               SmallVectorImpl<MCParsedAsmOperand*> &Operands);
+  bool isDeprecated(MCInst &Inst, StringRef &Info);
 
 public:
   enum ARMMatchResultTy {
@@ -4876,6 +4877,13 @@ bool ARMAsmParser::shouldOmitPredicateOperand(
   return false;
 }
 
+bool ARMAsmParser::isDeprecated(MCInst &Inst, StringRef &Info) {
+  if (hasV8Ops() && Inst.getOpcode() == ARM::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" ||
@@ -5376,6 +5384,10 @@ validateInstruction(MCInst &Inst,
   }
   }
 
+  StringRef DepInfo;
+  if (isDeprecated(Inst, DepInfo))
+    Warning(Loc, "deprecated on " + DepInfo);
+
   return false;
 }
 
diff --git a/test/MC/ARM/deprecated-v8.s b/test/MC/ARM/deprecated-v8.s
new file mode 100644 (file)
index 0000000..e509a35
--- /dev/null
@@ -0,0 +1,3 @@
+@ RUN: llvm-mc -triple armv8 -show-encoding < %s 2>&1 | FileCheck %s
+setend be
+@ CHECK: warning: deprecated on armv8