1 //===- SubtargetEmitter.h - Generate subtarget enumerations -----*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by James M. Laskey and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This tablegen backend emits subtarget enumerations.
12 //===----------------------------------------------------------------------===//
14 #ifndef SUBTARGET_EMITTER_H
15 #define SUBTARGET_EMITTER_H
17 #include "TableGenBackend.h"
18 #include "llvm/Target/TargetInstrItineraries.h"
29 typedef std::map<std::string, unsigned> IntMap;
30 typedef std::vector<InstrItinerary> IntineraryList;
31 typedef std::vector<IntineraryList> ProcessorList;
33 class SubtargetEmitter : public TableGenBackend {
35 RecordKeeper &Records;
38 void Enumeration(std::ostream &OS, const char *ClassName, bool isBits);
39 void FeatureKeyValues(std::ostream &OS);
40 void CPUKeyValues(std::ostream &OS);
41 unsigned CollectAllItinClasses(IntMap &ItinClassesMap);
42 void FormItineraryString(Record *ItinData, std::string &ItinString,
44 void EmitStageData(std::ostream &OS, unsigned N,
45 IntMap &ItinClassesMap, ProcessorList &ProcList);
46 void EmitProcessData(std::ostream &OS, ProcessorList &ProcList);
47 void EmitData(std::ostream &OS);
48 void ParseFeaturesFunction(std::ostream &OS);
51 SubtargetEmitter(RecordKeeper &R) : Records(R) {}
53 // run - Output the subtarget enumerations, returning true on failure.
54 void run(std::ostream &o);
59 } // End llvm namespace