[llvm] 803d4f8 - [ARM][AsmParser] Don't emit "deprecated instruction in IT block" warning if requested
Yi Kong via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 3 02:20:46 PDT 2021
Author: Yi Kong
Date: 2021-11-03T17:18:04+08:00
New Revision: 803d4f8a35ca8d6eeb5c172ae02705645e6dfe1f
URL: https://github.com/llvm/llvm-project/commit/803d4f8a35ca8d6eeb5c172ae02705645e6dfe1f
DIFF: https://github.com/llvm/llvm-project/commit/803d4f8a35ca8d6eeb5c172ae02705645e6dfe1f.diff
LOG: [ARM][AsmParser] Don't emit "deprecated instruction in IT block" warning if requested
Also fixed formatting in AsmMatcherEmitter because it was confusing.
Differential Revision: https://reviews.llvm.org/D112993
Added:
Modified:
llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
llvm/test/MC/ARM/deprecated-v8.s
llvm/utils/TableGen/AsmMatcherEmitter.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
index 3aa9491001cf1..64d2e1bfa9b23 100644
--- a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
+++ b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
@@ -10961,7 +10961,7 @@ bool ARMAsmParser::MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
// Only after the instruction is fully processed, we can validate it
if (wasInITBlock && hasV8Ops() && isThumb() &&
- !isV8EligibleForIT(&Inst)) {
+ !isV8EligibleForIT(&Inst) && !getTargetOptions().MCNoDeprecatedWarn) {
Warning(IDLoc, "deprecated instruction in IT block");
}
}
diff --git a/llvm/test/MC/ARM/deprecated-v8.s b/llvm/test/MC/ARM/deprecated-v8.s
index aa72c2e7bd8e6..3962396884042 100644
--- a/llvm/test/MC/ARM/deprecated-v8.s
+++ b/llvm/test/MC/ARM/deprecated-v8.s
@@ -3,49 +3,58 @@
@ RUN: llvm-mc -triple armv7 -show-encoding < %s 2>&1 | FileCheck %s --check-prefix=CHECK-ARMV7
@ RUN: llvm-mc -triple thumbv7 -show-encoding < %s 2>&1 | FileCheck %s --check-prefix=CHECK-THUMBV7
@ RUN: llvm-mc -triple armv6 -show-encoding < %s 2>&1 | FileCheck %s --check-prefix=CHECK-ARMV6
+@ RUN: llvm-mc -triple thumbv8 -show-encoding -no-deprecated-warn < %s 2>&1 | FileCheck %s --check-prefix=CHECK-NO-WARN
setend be
@ CHECK-ARMV8: warning: deprecated
@ CHECK-THUMBV8: warning: deprecated
@ CHECK-ARMV7-NOT: warning: deprecated
@ CHECK-THUMBV7-NOT: warning: deprecated
+@ CHECK-NO-WARN-NOT: warning: deprecated
mcr p15, #0, r5, c7, c5, #4
@ CHECK-ARMV8: warning: deprecated since v7, use 'isb'
@ CHECK-THUMBV8: warning: deprecated since v7, use 'isb'
@ CHECK-ARMV7: warning: deprecated since v7, use 'isb'
@ CHECK-THUMBV7: warning: deprecated since v7, use 'isb'
@ CHECK-ARMV6-NOT: warning: deprecated since v7, use 'isb'
+@ CHECK-NO-WARN-NOT: warning: deprecated since v7, use 'isb'
mcr p15, #0, r5, c7, c10, #4
@ CHECK-ARMV8: warning: deprecated since v7, use 'dsb'
@ CHECK-THUMBV8: warning: deprecated since v7, use 'dsb'
@ CHECK-ARMV7: warning: deprecated since v7, use 'dsb'
@ CHECK-THUMBV7: warning: deprecated since v7, use 'dsb'
@ CHECK-ARMV6-NOT: warning: deprecated since v7, use 'dsb'
+@ CHECK-NO-WARN-NOT: warning: deprecated since v7, use 'dsb'
mcr p15, #0, r5, c7, c10, #5
@ CHECK-ARMV8: warning: deprecated since v7, use 'dmb'
@ CHECK-THUMBV8: warning: deprecated since v7, use 'dmb'
@ CHECK-ARMV7: warning: deprecated since v7, use 'dmb'
@ CHECK-THUMBV7: warning: deprecated since v7, use 'dmb'
@ CHECK-ARMV6-NOT: warning: deprecated since v7, use 'dmb'
+@ CHECK-NO-WARN-NOT: warning: deprecated since v7, use 'dmb'
it ge
movge r0, #4096
@ CHECK-THUMBV8: warning: deprecated instruction in IT block
@ CHECK-THUMBV7-NOT: warning
+@ CHECK-NO-WARN-NOT: warning
ite ge
addge r0, r1
addlt r0, r2
@ CHECK-ARMV8: warning: applying IT instruction to more than one subsequent instruction is deprecated
@ CHECK-THUMBV8: warning: applying IT instruction to more than one subsequent instruction is deprecated
@ CHECK-THUMBV7-NOT: warning
+@ CHECK-NO-WARN-NOT: warning
it ge
movge r0, pc // invalid operand
@ CHECK-THUMBV8: warning: deprecated instruction in IT block
@ CHECK-THUMBV7-NOT: warning
+@ CHECK-NO-WARN-NOT: warning
it ge
revge r0, r0 // invalid instruction
@ CHECK-THUMBV8: warning: deprecated instruction in IT block
@ CHECK-THUMBV7-NOT: warning
+@ CHECK-NO-WARN-NOT: warning
it ge
clzge r0, r0 // only has 32-bit form
@ CHECK-THUMBV8: warning: deprecated instruction in IT block
@ CHECK-THUMBV7-NOT: warning
-
+@ CHECK-NO-WARN-NOT: warning
diff --git a/llvm/utils/TableGen/AsmMatcherEmitter.cpp b/llvm/utils/TableGen/AsmMatcherEmitter.cpp
index 9c1d1a4b64aad..be17d5c718c25 100644
--- a/llvm/utils/TableGen/AsmMatcherEmitter.cpp
+++ b/llvm/utils/TableGen/AsmMatcherEmitter.cpp
@@ -3924,8 +3924,7 @@ void AsmMatcherEmitter::run(raw_ostream &OS) {
if (HasDeprecation) {
OS << " std::string Info;\n";
- OS << " if (!getParser().getTargetParser().\n";
- OS << " getTargetOptions().MCNoDeprecatedWarn &&\n";
+ OS << " if (!getParser().getTargetParser().getTargetOptions().MCNoDeprecatedWarn &&\n";
OS << " MII.getDeprecatedInfo(Inst, getSTI(), Info)) {\n";
OS << " SMLoc Loc = ((" << Target.getName()
<< "Operand &)*Operands[0]).getStartLoc();\n";
More information about the llvm-commits
mailing list