blob: 2a7b70be25de25d3257d975418fabebc34872f17 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
//===- SubtargetEmitter.h - Generate subtarget enumerations -----*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file was developed by James M. Laskey and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This tablegen backend emits subtarget enumerations.
//
//===----------------------------------------------------------------------===//
#ifndef SUBTARGET_EMITTER_H
#define SUBTARGET_EMITTER_H
#include "TableGenBackend.h"
#include "llvm/Target/TargetInstrItineraries.h"
#include <vector>
#include <map>
#include <string>
namespace llvm {
//
// Convenience types.
//
typedef std::map<std::string, unsigned> IntMap;
typedef std::vector<InstrItinerary> IntineraryList;
typedef std::vector<IntineraryList> ProcessorList;
class SubtargetEmitter : public TableGenBackend {
RecordKeeper &Records;
std::string Target;
void Enumeration(std::ostream &OS, const char *ClassName, bool isBits);
void FeatureKeyValues(std::ostream &OS);
void CPUKeyValues(std::ostream &OS);
unsigned CollectAllItinClasses(IntMap &ItinClassesMap);
void FormItineraryString(Record *ItinData, std::string &ItinString,
unsigned &N);
void EmitStageData(std::ostream &OS, unsigned N,
IntMap &ItinClassesMap, ProcessorList &ProcList);
void EmitProcessData(std::ostream &OS, ProcessorList &ProcList);
void EmitData(std::ostream &OS);
void ParseFeaturesFunction(std::ostream &OS);
public:
SubtargetEmitter(RecordKeeper &R) : Records(R) {}
// run - Output the subtarget enumerations, returning true on failure.
void run(std::ostream &o);
};
} // End llvm namespace
#endif
|