From: Evan Cheng Date: Sat, 2 Jul 2011 00:43:44 +0000 (+0000) Subject: Add getFeatureBits to extract feature bits for a given CPU. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=2416b8962105078594d70cdd16cc6cb45b332e02;p=oota-llvm.git Add getFeatureBits to extract feature bits for a given CPU. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134298 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/MC/MCSubtargetInfo.h b/include/llvm/MC/MCSubtargetInfo.h index d991f427a68..d8552712271 100644 --- a/include/llvm/MC/MCSubtargetInfo.h +++ b/include/llvm/MC/MCSubtargetInfo.h @@ -54,6 +54,10 @@ public: /// getInstrItineraryForCPU - Get scheduling itinerary of a CPU. /// InstrItineraryData getInstrItineraryForCPU(StringRef CPU) const; + + /// getFeatureBits - Get the feature bits for a CPU (optionally supplemented + /// with feature string). + uint64_t getFeatureBits(StringRef CPU, StringRef FS) const; }; } // End llvm namespace diff --git a/lib/MC/MCSubtargetInfo.cpp b/lib/MC/MCSubtargetInfo.cpp index c401b7e1de0..1874bf03bd8 100644 --- a/lib/MC/MCSubtargetInfo.cpp +++ b/lib/MC/MCSubtargetInfo.cpp @@ -42,3 +42,11 @@ MCSubtargetInfo::getInstrItineraryForCPU(StringRef CPU) const { return InstrItineraryData(Stages, OperandCycles, ForwardingPathes, (InstrItinerary *)Found->Value); } + +/// getFeatureBits - Get the feature bits for a CPU (optionally supplemented +/// with feature string). +uint64_t MCSubtargetInfo::getFeatureBits(StringRef CPU, StringRef FS) const { + SubtargetFeatures Features(FS); + return Features.getFeatureBits(CPU, ProcDesc, NumProcs, + ProcFeatures, NumFeatures); +}