[llvm] r249165 - Actually switch the arch when we see .arch. PR21695
Roman Divacky via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 2 11:25:25 PDT 2015
Author: rdivacky
Date: Fri Oct 2 13:25:25 2015
New Revision: 249165
URL: http://llvm.org/viewvc/llvm-project?rev=249165&view=rev
Log:
Actually switch the arch when we see .arch. PR21695
Added:
llvm/trunk/test/MC/ARM/directive-arch-semantic-action.s
Modified:
llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
Modified: llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp?rev=249165&r1=249164&r2=249165&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp (original)
+++ llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp Fri Oct 2 13:25:25 2015
@@ -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"
@@ -9023,6 +9024,10 @@ bool ARMAsmParser::parseDirectiveArch(SM
return false;
}
+ Triple T;
+ STI.setDefaultFeatures(T.getARMCPUForArch(Arch));
+ setAvailableFeatures(ComputeAvailableFeatures(STI.getFeatureBits()));
+
getTargetStreamer().emitArch(ID);
return false;
}
Added: llvm/trunk/test/MC/ARM/directive-arch-semantic-action.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/directive-arch-semantic-action.s?rev=249165&view=auto
==============================================================================
--- llvm/trunk/test/MC/ARM/directive-arch-semantic-action.s (added)
+++ llvm/trunk/test/MC/ARM/directive-arch-semantic-action.s Fri Oct 2 13:25:25 2015
@@ -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
More information about the llvm-commits
mailing list