Add getFeatureBits to extract feature bits for a given CPU.
[oota-llvm.git] / include / llvm / MC / MCSubtargetInfo.h
1 //==-- llvm/MC/MCSubtargetInfo.h - Subtarget Information ---------*- C++ -*-==//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file describes the subtarget options of a Target machine.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef LLVM_MC_MCSUBTARGET_H
15 #define LLVM_MC_MCSUBTARGET_H
16
17 #include "llvm/MC/SubtargetFeature.h"
18 #include "llvm/MC/MCInstrItineraries.h"
19
20 namespace llvm {
21
22 class StringRef;
23
24 //===----------------------------------------------------------------------===//
25 ///
26 /// MCSubtargetInfo - Generic base class for all target subtargets.
27 ///
28 class MCSubtargetInfo {
29   const SubtargetFeatureKV *ProcFeatures;  // Processor feature list
30   const SubtargetFeatureKV *ProcDesc;  // Processor descriptions
31   const SubtargetInfoKV *ProcItins;    // Scheduling itineraries
32   const InstrStage *Stages;            // Instruction stages
33   const unsigned *OperandCycles;       // Operand cycles
34   const unsigned *ForwardingPathes;    // Forwarding pathes
35   unsigned NumFeatures;                // Number of processor features
36   unsigned NumProcs;                   // Number of processors
37     
38 public:
39   void InitMCSubtargetInfo(const SubtargetFeatureKV *PF,
40                            const SubtargetFeatureKV *PD,
41                            const SubtargetInfoKV *PI, const InstrStage *IS,
42                            const unsigned *OC, const unsigned *FP,
43                            unsigned NF, unsigned NP) {
44     ProcFeatures = PF;
45     ProcDesc = PD;
46     ProcItins = PI;
47     Stages = IS;
48     OperandCycles = OC;
49     ForwardingPathes = FP;
50     NumFeatures = NF;
51     NumProcs = NP;
52   }
53
54   /// getInstrItineraryForCPU - Get scheduling itinerary of a CPU.
55   ///
56   InstrItineraryData getInstrItineraryForCPU(StringRef CPU) const;
57
58   /// getFeatureBits - Get the feature bits for a CPU (optionally supplemented
59   /// with feature string).
60   uint64_t getFeatureBits(StringRef CPU, StringRef FS) const;
61 };
62
63 } // End llvm namespace
64
65 #endif