summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/ARM64/AsmParser
diff options
context:
space:
mode:
authorKevin Qin <Kevin.Qin@arm.com>2014-04-23 06:22:48 +0000
committerKevin Qin <Kevin.Qin@arm.com>2014-04-23 06:22:48 +0000
commita4ee17876265b37b065ed8d3665de2461cca077a (patch)
tree155b8b06ce49785006946e8dde7e0f7b192b4d99 /llvm/lib/Target/ARM64/AsmParser
parent3f9869a8e2ae7a9a453a9bef09e3a131536339c4 (diff)
downloadbcm5719-llvm-a4ee17876265b37b065ed8d3665de2461cca077a.tar.gz
bcm5719-llvm-a4ee17876265b37b065ed8d3665de2461cca077a.zip
[ARM64] Enable feature predicates for NEON / FP / CRYPTO.
AArch64 has feature predicates for NEON, FP and CRYPTO instructions. This allows the compiler to generate code without using FP, NEON or CRYPTO instructions. llvm-svn: 206949
Diffstat (limited to 'llvm/lib/Target/ARM64/AsmParser')
-rw-r--r--llvm/lib/Target/ARM64/AsmParser/ARM64AsmParser.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/llvm/lib/Target/ARM64/AsmParser/ARM64AsmParser.cpp b/llvm/lib/Target/ARM64/AsmParser/ARM64AsmParser.cpp
index 3c5f1d8c66c..d1fee2e7c6a 100644
--- a/llvm/lib/Target/ARM64/AsmParser/ARM64AsmParser.cpp
+++ b/llvm/lib/Target/ARM64/AsmParser/ARM64AsmParser.cpp
@@ -107,6 +107,9 @@ public:
const MCInstrInfo &MII)
: MCTargetAsmParser(), STI(_STI), Parser(_Parser) {
MCAsmParserExtension::Initialize(_Parser);
+
+ // Initialize the set of available features.
+ setAvailableFeatures(ComputeAvailableFeatures(STI.getFeatureBits()));
}
virtual bool ParseInstruction(ParseInstructionInfo &Info, StringRef Name,
@@ -3815,6 +3818,8 @@ bool ARM64AsmParser::showMatchError(SMLoc Loc, unsigned ErrCode) {
}
}
+static const char *getSubtargetFeatureName(unsigned Val);
+
bool ARM64AsmParser::MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
OperandVector &Operands,
MCStreamer &Out,
@@ -4247,7 +4252,21 @@ bool ARM64AsmParser::MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
Out.EmitInstruction(Inst, STI);
return false;
}
- case Match_MissingFeature:
+ case Match_MissingFeature: {
+ assert(ErrorInfo && "Unknown missing feature!");
+ // Special case the error message for the very common case where only
+ // a single subtarget feature is missing (neon, e.g.).
+ std::string Msg = "instruction requires:";
+ unsigned Mask = 1;
+ for (unsigned i = 0; i < (sizeof(ErrorInfo)*8-1); ++i) {
+ if (ErrorInfo & Mask) {
+ Msg += " ";
+ Msg += getSubtargetFeatureName(ErrorInfo & Mask);
+ }
+ Mask <<= 1;
+ }
+ return Error(IDLoc, Msg);
+ }
case Match_MnemonicFail:
return showMatchError(IDLoc, MatchResult);
case Match_InvalidOperand: {
@@ -4494,6 +4513,7 @@ extern "C" void LLVMInitializeARM64AsmParser() {
}
#define GET_REGISTER_MATCHER
+#define GET_SUBTARGET_FEATURE_NAME
#define GET_MATCHER_IMPLEMENTATION
#include "ARM64GenAsmMatcher.inc"
OpenPOWER on IntegriCloud