From: Renato Golin Date: Mon, 9 Nov 2015 09:59:23 +0000 (+0000) Subject: Merging r249165: X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=13640e5c0eac687ff7e1bd8435af65a60ce43c19;p=llvm 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 --- diff --git a/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/lib/Target/ARM/AsmParser/ARMAsmParser.cpp index f8f0eb2d4ba..cf6b8929f31 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 00000000000..b9c65d8e49c --- /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