1 //===- SubtargetEmitter.h - Generate subtarget enumerations -----*- 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 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"
26 class SubtargetEmitter
: public TableGenBackend
{
28 RecordKeeper
&Records
;
32 void Enumeration(std::ostream
&OS
, const char *ClassName
, bool isBits
);
33 void FeatureKeyValues(std::ostream
&OS
);
34 void CPUKeyValues(std::ostream
&OS
);
35 unsigned CollectAllItinClasses(std::ostream
&OS
,
36 std::map
<std::string
, unsigned> &ItinClassesMap
);
37 void FormItineraryString(Record
*ItinData
, std::string
&ItinString
,
39 void EmitStageData(std::ostream
&OS
, unsigned NItinClasses
,
40 std::map
<std::string
, unsigned> &ItinClassesMap
,
41 std::vector
<std::vector
<InstrItinerary
> > &ProcList
);
42 void EmitProcessorData(std::ostream
&OS
,
43 std::vector
<std::vector
<InstrItinerary
> > &ProcList
);
44 void EmitProcessorLookup(std::ostream
&OS
);
45 void EmitData(std::ostream
&OS
);
46 void ParseFeaturesFunction(std::ostream
&OS
);
49 SubtargetEmitter(RecordKeeper
&R
) : Records(R
), HasItineraries(false) {}
51 // run - Output the subtarget enumerations, returning true on failure.
52 void run(std::ostream
&o
);
57 } // End llvm namespace