summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRenato Golin <renato.golin@linaro.org>2015-11-09 09:59:23 +0000
committerRenato Golin <renato.golin@linaro.org>2015-11-09 09:59:23 +0000
commit13640e5c0eac687ff7e1bd8435af65a60ce43c19 (patch)
treebdd0515980dd128091a05e47dde75d6ac294a26c
parent75e2ec66f096a042ea05df2e666c0de459ba6da9 (diff)
downloadllvm-13640e5c0eac687ff7e1bd8435af65a60ce43c19.tar.gz
Merging r249165:
------------------------------------------------------------------------ r249165 | rdivacky | 2015-10-02 19:25:25 +0100 (Fri, 02 Oct 2015) | 2 lines Actually switch the arch when we see .arch. PR21695 git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_37@252456 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/ARM/AsmParser/ARMAsmParser.cpp5
-rw-r--r--test/MC/ARM/directive-arch-semantic-action.s12
2 files changed, 17 insertions, 0 deletions
diff --git a/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
index f8f0eb2d4baa..cf6b8929f311 100644
--- a/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
+++ b/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
@@ -15,6 +15,7 @@
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringSwitch.h"
+#include "llvm/ADT/Triple.h"
#include "llvm/ADT/Twine.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCAssembler.h"
@@ -9104,6 +9105,10 @@ bool ARMAsmParser::parseDirectiveArch(SMLoc L) {
return false;
}
+ Triple T;
+ STI.setDefaultFeatures(T.getARMCPUForArch(Arch));
+ setAvailableFeatures(ComputeAvailableFeatures(STI.getFeatureBits()));
+
getTargetStreamer().emitArch(ID);
return false;
}
diff --git a/test/MC/ARM/directive-arch-semantic-action.s b/test/MC/ARM/directive-arch-semantic-action.s
new file mode 100644
index 000000000000..b9c65d8e49c8
--- /dev/null
+++ b/test/MC/ARM/directive-arch-semantic-action.s
@@ -0,0 +1,12 @@
+@ RUN: not llvm-mc -triple arm-gnueabi-linux -filetype asm %s 2>&1 | FileCheck %s
+
+ .arch armv6
+ dsb
+@ CHECK: error: instruction requires: data-barriers
+
+ .arch armv7
+ dsb
+@ CHECK-NOT: error: instruction requires: data-barriers
+
+ .arch invalid_architecture_name
+@ CHECK: error: Unknown arch name