@@ -25,14 +25,14 @@ static StringRef getExtensionName(const Record *R) {
25
25
}
26
26
27
27
static void printExtensionTable (raw_ostream &OS,
28
- const std::vector< Record *> & Extensions,
28
+ ArrayRef< const Record *> Extensions,
29
29
bool Experimental) {
30
30
OS << " static const RISCVSupportedExtension Supported" ;
31
31
if (Experimental)
32
32
OS << " Experimental" ;
33
33
OS << " Extensions[] = {\n " ;
34
34
35
- for (Record *R : Extensions) {
35
+ for (const Record *R : Extensions) {
36
36
if (R->getValueAsBit (" Experimental" ) != Experimental)
37
37
continue ;
38
38
@@ -44,11 +44,11 @@ static void printExtensionTable(raw_ostream &OS,
44
44
OS << " };\n\n " ;
45
45
}
46
46
47
- static void emitRISCVExtensions (RecordKeeper &Records, raw_ostream &OS) {
47
+ static void emitRISCVExtensions (const RecordKeeper &Records, raw_ostream &OS) {
48
48
OS << " #ifdef GET_SUPPORTED_EXTENSIONS\n " ;
49
49
OS << " #undef GET_SUPPORTED_EXTENSIONS\n\n " ;
50
50
51
- std::vector<Record *> Extensions =
51
+ std::vector<const Record *> Extensions =
52
52
Records.getAllDerivedDefinitionsIfDefined (" RISCVExtension" );
53
53
llvm::sort (Extensions, [](const Record *Rec1, const Record *Rec2) {
54
54
return getExtensionName (Rec1) < getExtensionName (Rec2);
@@ -66,7 +66,7 @@ static void emitRISCVExtensions(RecordKeeper &Records, raw_ostream &OS) {
66
66
67
67
if (!Extensions.empty ()) {
68
68
OS << " \n static constexpr ImpliedExtsEntry ImpliedExts[] = {\n " ;
69
- for (Record *Ext : Extensions) {
69
+ for (const Record *Ext : Extensions) {
70
70
auto ImpliesList = Ext->getValueAsListOfDefs (" Implies" );
71
71
if (ImpliesList.empty ())
72
72
continue ;
@@ -94,12 +94,12 @@ static void emitRISCVExtensions(RecordKeeper &Records, raw_ostream &OS) {
94
94
//
95
95
// This is almost the same as RISCVFeatures::parseFeatureBits, except that we
96
96
// get feature name from feature records instead of feature bits.
97
- static void printMArch (raw_ostream &OS, const std::vector< Record *> & Features) {
97
+ static void printMArch (raw_ostream &OS, ArrayRef< const Record *> Features) {
98
98
RISCVISAUtils::OrderedExtensionMap Extensions;
99
99
unsigned XLen = 0 ;
100
100
101
101
// Convert features to FeatureVector.
102
- for (auto *Feature : Features) {
102
+ for (const Record *Feature : Features) {
103
103
StringRef FeatureName = getExtensionName (Feature);
104
104
if (Feature->isSubClassOf (" RISCVExtension" )) {
105
105
unsigned Major = Feature->getValueAsInt (" MajorVersion" );
@@ -124,7 +124,7 @@ static void printMArch(raw_ostream &OS, const std::vector<Record *> &Features) {
124
124
}
125
125
126
126
static void printProfileTable (raw_ostream &OS,
127
- const std::vector< Record *> & Profiles,
127
+ ArrayRef< const Record *> Profiles,
128
128
bool Experimental) {
129
129
OS << " static constexpr RISCVProfile Supported" ;
130
130
if (Experimental)
@@ -145,7 +145,7 @@ static void printProfileTable(raw_ostream &OS,
145
145
OS << " };\n\n " ;
146
146
}
147
147
148
- static void emitRISCVProfiles (RecordKeeper &Records, raw_ostream &OS) {
148
+ static void emitRISCVProfiles (const RecordKeeper &Records, raw_ostream &OS) {
149
149
OS << " #ifdef GET_SUPPORTED_PROFILES\n " ;
150
150
OS << " #undef GET_SUPPORTED_PROFILES\n\n " ;
151
151
@@ -163,7 +163,7 @@ static void emitRISCVProfiles(RecordKeeper &Records, raw_ostream &OS) {
163
163
OS << " #endif // GET_SUPPORTED_PROFILES\n\n " ;
164
164
}
165
165
166
- static void emitRISCVProcs (RecordKeeper &RK, raw_ostream &OS) {
166
+ static void emitRISCVProcs (const RecordKeeper &RK, raw_ostream &OS) {
167
167
OS << " #ifndef PROC\n "
168
168
<< " #define PROC(ENUM, NAME, DEFAULT_MARCH, FAST_SCALAR_UNALIGN"
169
169
<< " , FAST_VECTOR_UNALIGN)\n "
@@ -210,9 +210,8 @@ static void emitRISCVProcs(RecordKeeper &RK, raw_ostream &OS) {
210
210
OS << " \n #undef TUNE_PROC\n " ;
211
211
}
212
212
213
- static void emitRISCVExtensionBitmask (RecordKeeper &RK, raw_ostream &OS) {
214
-
215
- std::vector<Record *> Extensions =
213
+ static void emitRISCVExtensionBitmask (const RecordKeeper &RK, raw_ostream &OS) {
214
+ std::vector<const Record *> Extensions =
216
215
RK.getAllDerivedDefinitionsIfDefined (" RISCVExtensionBitmask" );
217
216
llvm::sort (Extensions, [](const Record *Rec1, const Record *Rec2) {
218
217
return getExtensionName (Rec1) < getExtensionName (Rec2);
@@ -245,7 +244,7 @@ static void emitRISCVExtensionBitmask(RecordKeeper &RK, raw_ostream &OS) {
245
244
OS << " #endif\n " ;
246
245
}
247
246
248
- static void EmitRISCVTargetDef (RecordKeeper &RK, raw_ostream &OS) {
247
+ static void EmitRISCVTargetDef (const RecordKeeper &RK, raw_ostream &OS) {
249
248
emitRISCVExtensions (RK, OS);
250
249
emitRISCVProfiles (RK, OS);
251
250
emitRISCVProcs (RK, OS);
0 commit comments