Merging r249165:
authorRenato Golin <renato.golin@linaro.org>
Mon, 9 Nov 2015 09:59:23 +0000 (09:59 +0000)
committerRenato Golin <renato.golin@linaro.org>
Mon, 9 Nov 2015 09:59:23 +0000 (09:59 +0000)
------------------------------------------------------------------------
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

lib/Target/ARM/AsmParser/ARMAsmParser.cpp
test/MC/ARM/directive-arch-semantic-action.s [new file with mode: 0644]

index f8f0eb2d4baaa54e9864bfbffb80e2a261253053..cf6b8929f311aa49b318bfc33ac30df7dccf9f5d 100644 (file)
@@ -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 (file)
index 0000000..b9c65d8
--- /dev/null
@@ -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