MCSubtargetInfo.h revision 347c50a2933f756097fa5798f2b6c34a19df4162
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
20namespace llvm {
21
22class StringRef;
23
24//===----------------------------------------------------------------------===//
25///
26/// MCSubtargetInfo - Generic base class for all target subtargets.
27///
28class 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  uint64_t FeatureBits;                // Feature bits for current CPU
38
39public:
40  void InitMCSubtargetInfo(StringRef CPU, StringRef FS,
41                           const SubtargetFeatureKV *PF,
42                           const SubtargetFeatureKV *PD,
43                           const SubtargetInfoKV *PI, const InstrStage *IS,
44                           const unsigned *OC, const unsigned *FP,
45                           unsigned NF, unsigned NP);
46
47  /// getFeatureBits - Get the feature bits.
48  ///
49  uint64_t getFeatureBits() const {
50    return FeatureBits;
51  }
52
53  /// ReInitMCSubtargetInfo - Change CPU (and optionally supplemented with
54  /// feature string), recompute and return feature bits.
55  uint64_t ReInitMCSubtargetInfo(StringRef CPU, StringRef FS);
56
57  /// getInstrItineraryForCPU - Get scheduling itinerary of a CPU.
58  ///
59  InstrItineraryData getInstrItineraryForCPU(StringRef CPU) const;
60};
61
62} // End llvm namespace
63
64#endif
65