Skip to content

Commit

Permalink
Actually switch the arch when we see .arch. PR21695
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249165 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
rdivacky committed Oct 2, 2015
1 parent 90161a2 commit 87b7b2f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/Target/ARM/AsmParser/ARMAsmParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -9023,6 +9024,10 @@ bool ARMAsmParser::parseDirectiveArch(SMLoc L) {
return false;
}

Triple T;
STI.setDefaultFeatures(T.getARMCPUForArch(Arch));
setAvailableFeatures(ComputeAvailableFeatures(STI.getFeatureBits()));

getTargetStreamer().emitArch(ID);
return false;
}
Expand Down
12 changes: 12 additions & 0 deletions test/MC/ARM/directive-arch-semantic-action.s
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 87b7b2f

Please sign in to comment.