summaryrefslogtreecommitdiff
path: root/lib/Target/ARM/MCTargetDesc
diff options
context:
space:
mode:
authorJoey Gouly <joey.gouly@arm.com>2013-09-12 10:28:05 +0000
committerJoey Gouly <joey.gouly@arm.com>2013-09-12 10:28:05 +0000
commit715d98d657491b3fb8ea0e14643e9801b2f9628c (patch)
treed4d597bcfaee4367d1c0cbfebcc1dbb7274db0ed /lib/Target/ARM/MCTargetDesc
parentf9d2d2dc89f0c2d39f597038ee723fb9c9af91da (diff)
downloadllvm-715d98d657491b3fb8ea0e14643e9801b2f9628c.tar.gz
llvm-715d98d657491b3fb8ea0e14643e9801b2f9628c.tar.bz2
llvm-715d98d657491b3fb8ea0e14643e9801b2f9628c.tar.xz
Add an instruction deprecation feature to TableGen.
The 'Deprecated' class allows you to specify a SubtargetFeature that the instruction is deprecated on. The 'ComplexDeprecationPredicate' class allows you to define a custom predicate that is called to check for deprecation. For example: ComplexDeprecationPredicate<"MCR"> would mean you would have to define the following function: bool getMCRDeprecationInfo(MCInst &MI, MCSubtargetInfo &STI, std::string &Info) Which returns 'false' for not deprecated, and 'true' for deprecated and store the warning message in 'Info'. The MCTargetAsmParser constructor was chaned to take an extra argument of the MCInstrInfo class, so out-of-tree targets will need to be changed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190598 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/ARM/MCTargetDesc')
-rw-r--r--lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp b/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp
index caa19495bb..ea5d7ba5c5 100644
--- a/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp
+++ b/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp
@@ -26,16 +26,32 @@
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/TargetRegistry.h"
+using namespace llvm;
+
#define GET_REGINFO_MC_DESC
#include "ARMGenRegisterInfo.inc"
+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 &&
+ (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;
+ }
+ return false;
+}
+
#define GET_INSTRINFO_MC_DESC
#include "ARMGenInstrInfo.inc"
#define GET_SUBTARGETINFO_MC_DESC
#include "ARMGenSubtargetInfo.inc"
-using namespace llvm;
std::string ARM_MC::ParseARMTriple(StringRef TT, StringRef CPU) {
Triple triple(TT);