summaryrefslogtreecommitdiff
path: root/lib/MC/MCSubtargetInfo.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2011-07-09 05:47:46 +0000
committerEvan Cheng <evan.cheng@apple.com>2011-07-09 05:47:46 +0000
commitffc0e73046f737d75e0a62b3a83ef19bcef111e3 (patch)
tree1f82f6a0b1c1a743dd4c10377858004988a47262 /lib/MC/MCSubtargetInfo.cpp
parent4f4a6fcd165293c347a42b543e5e55aa42a09bb2 (diff)
downloadllvm-ffc0e73046f737d75e0a62b3a83ef19bcef111e3.tar.gz
llvm-ffc0e73046f737d75e0a62b3a83ef19bcef111e3.tar.bz2
llvm-ffc0e73046f737d75e0a62b3a83ef19bcef111e3.tar.xz
Change createAsmParser to take a MCSubtargetInfo instead of triple,
CPU, and feature string. Parsing some asm directives can change subtarget state (e.g. .code 16) and it must be reflected in other modules (e.g. MCCodeEmitter). That is, the MCSubtargetInfo instance must be shared. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134795 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/MCSubtargetInfo.cpp')
-rw-r--r--lib/MC/MCSubtargetInfo.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/MC/MCSubtargetInfo.cpp b/lib/MC/MCSubtargetInfo.cpp
index 3bb20b07f3..b1b86fe61e 100644
--- a/lib/MC/MCSubtargetInfo.cpp
+++ b/lib/MC/MCSubtargetInfo.cpp
@@ -48,6 +48,23 @@ uint64_t MCSubtargetInfo::ReInitMCSubtargetInfo(StringRef CPU, StringRef FS) {
return FeatureBits;
}
+/// ToggleFeature - Toggle a feature and returns the re-computed feature
+/// bits. This version does not change the implied bits.
+uint64_t MCSubtargetInfo::ToggleFeature(uint64_t FB) {
+ FeatureBits ^= FB;
+ return FeatureBits;
+}
+
+/// ToggleFeature - Toggle a feature and returns the re-computed feature
+/// bits. This version will also change all implied bits.
+uint64_t MCSubtargetInfo::ToggleFeature(StringRef FS) {
+ SubtargetFeatures Features;
+ FeatureBits = Features.ToggleFeature(FeatureBits, FS,
+ ProcFeatures, NumFeatures);
+ return FeatureBits;
+}
+
+
InstrItineraryData
MCSubtargetInfo::getInstrItineraryForCPU(StringRef CPU) const {
assert(ProcItins && "Instruction itineraries information not available!");