1 //==-- llvm/MC/MCSubtargetInfo.h - Subtarget Information ---------*- C++ -*-==//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file describes the subtarget options of a Target machine.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_MC_MCSUBTARGET_H
15 #define LLVM_MC_MCSUBTARGET_H
17 #include "llvm/MC/SubtargetFeature.h"
18 #include "llvm/MC/MCInstrItineraries.h"
25 //===----------------------------------------------------------------------===//
27 /// MCSubtargetInfo - Generic base class for all target subtargets.
29 class MCSubtargetInfo {
30 std::string TargetTriple; // Target triple
31 const SubtargetFeatureKV *ProcFeatures; // Processor feature list
32 const SubtargetFeatureKV *ProcDesc; // Processor descriptions
33 const SubtargetInfoKV *ProcItins; // Scheduling itineraries
34 const InstrStage *Stages; // Instruction stages
35 const unsigned *OperandCycles; // Operand cycles
36 const unsigned *ForwardingPaths; // Forwarding paths
37 unsigned NumFeatures; // Number of processor features
38 unsigned NumProcs; // Number of processors
39 uint64_t FeatureBits; // Feature bits for current CPU + FS
42 void InitMCSubtargetInfo(StringRef TT, StringRef CPU, StringRef FS,
43 const SubtargetFeatureKV *PF,
44 const SubtargetFeatureKV *PD,
45 const SubtargetInfoKV *PI, const InstrStage *IS,
46 const unsigned *OC, const unsigned *FP,
47 unsigned NF, unsigned NP);
49 /// getTargetTriple - Return the target triple string.
50 StringRef getTargetTriple() const {
54 /// getFeatureBits - Return the feature bits.
56 uint64_t getFeatureBits() const {
60 /// ReInitMCSubtargetInfo - Change CPU (and optionally supplemented with
61 /// feature string), recompute and return feature bits.
62 uint64_t ReInitMCSubtargetInfo(StringRef CPU, StringRef FS);
64 /// ToggleFeature - Toggle a feature and returns the re-computed feature
65 /// bits. This version does not change the implied bits.
66 uint64_t ToggleFeature(uint64_t FB);
68 /// ToggleFeature - Toggle a feature and returns the re-computed feature
69 /// bits. This version will also change all implied bits.
70 uint64_t ToggleFeature(StringRef FS);
72 /// getInstrItineraryForCPU - Get scheduling itinerary of a CPU.
74 InstrItineraryData getInstrItineraryForCPU(StringRef CPU) const;
77 } // End llvm namespace