[llvm-commits] [llvm] r134298 - in /llvm/trunk: include/llvm/MC/MCSubtargetInfo.h lib/MC/MCSubtargetInfo.cpp

Evan Cheng evan.cheng at apple.com
Fri Jul 1 17:43:44 PDT 2011


Author: evancheng
Date: Fri Jul  1 19:43:44 2011
New Revision: 134298

URL: http://llvm.org/viewvc/llvm-project?rev=134298&view=rev
Log:
Add getFeatureBits to extract feature bits for a given CPU.

Modified:
    llvm/trunk/include/llvm/MC/MCSubtargetInfo.h
    llvm/trunk/lib/MC/MCSubtargetInfo.cpp

Modified: llvm/trunk/include/llvm/MC/MCSubtargetInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCSubtargetInfo.h?rev=134298&r1=134297&r2=134298&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCSubtargetInfo.h (original)
+++ llvm/trunk/include/llvm/MC/MCSubtargetInfo.h Fri Jul  1 19:43:44 2011
@@ -54,6 +54,10 @@
   /// 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

Modified: llvm/trunk/lib/MC/MCSubtargetInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCSubtargetInfo.cpp?rev=134298&r1=134297&r2=134298&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCSubtargetInfo.cpp (original)
+++ llvm/trunk/lib/MC/MCSubtargetInfo.cpp Fri Jul  1 19:43:44 2011
@@ -42,3 +42,11 @@
   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);
+}





More information about the llvm-commits mailing list