@@ -39,10 +39,10 @@ struct DXILOperationDesc {
39
39
StringRef OpClass; // name of the opcode class
40
40
StringRef Doc; // the documentation description of this instruction
41
41
// Vector of operand type records - return type is at index 0
42
- SmallVector<Record *> OpTypes;
43
- SmallVector<Record *> OverloadRecs;
44
- SmallVector<Record *> StageRecs;
45
- SmallVector<Record *> AttrRecs;
42
+ SmallVector<const Record *> OpTypes;
43
+ SmallVector<const Record *> OverloadRecs;
44
+ SmallVector<const Record *> StageRecs;
45
+ SmallVector<const Record *> AttrRecs;
46
46
StringRef Intrinsic; // The llvm intrinsic map to OpName. Default is "" which
47
47
// means no map exists
48
48
SmallVector<StringRef, 4 >
@@ -57,8 +57,8 @@ struct DXILOperationDesc {
57
57
// / In-place sort TableGen records of class with a field
58
58
// / Version dxil_version
59
59
// / in the ascending version order.
60
- static void AscendingSortByVersion (std::vector<Record *> &Recs) {
61
- std:: sort (Recs. begin (), Recs. end (), [](Record *RecA, Record *RecB) {
60
+ static void AscendingSortByVersion (std::vector<const Record *> &Recs) {
61
+ sort (Recs, [](const Record *RecA, const Record *RecB) {
62
62
unsigned RecAMaj =
63
63
RecA->getValueAsDef (" dxil_version" )->getValueAsInt (" Major" );
64
64
unsigned RecAMin =
@@ -82,13 +82,12 @@ DXILOperationDesc::DXILOperationDesc(const Record *R) {
82
82
OpCode = R->getValueAsInt (" OpCode" );
83
83
84
84
Doc = R->getValueAsString (" Doc" );
85
- SmallVector<Record *> ParamTypeRecs;
85
+ SmallVector<const Record *> ParamTypeRecs;
86
86
87
87
ParamTypeRecs.push_back (R->getValueAsDef (" result" ));
88
88
89
- std::vector<Record *> ArgTys = R->getValueAsListOfDefs (" arguments" );
90
- for (auto Ty : ArgTys) {
91
- ParamTypeRecs.push_back (Ty);
89
+ for (const Record *ArgTy : R->getValueAsListOfDefs (" arguments" )) {
90
+ ParamTypeRecs.push_back (ArgTy);
92
91
}
93
92
size_t ParamTypeRecsSize = ParamTypeRecs.size ();
94
93
// Populate OpTypes with return type and parameter types
@@ -100,7 +99,7 @@ DXILOperationDesc::DXILOperationDesc(const Record *R) {
100
99
// llvm/IR/Intrinsics.td
101
100
OverloadParamIndex = -1 ; // A sigil meaning none.
102
101
for (unsigned i = 0 ; i < ParamTypeRecsSize; i++) {
103
- Record *TR = ParamTypeRecs[i];
102
+ const Record *TR = ParamTypeRecs[i];
104
103
// Track operation parameter indices of any overload types
105
104
if (TR->getValueAsInt (" isOverload" )) {
106
105
if (OverloadParamIndex != -1 ) {
@@ -117,17 +116,17 @@ DXILOperationDesc::DXILOperationDesc(const Record *R) {
117
116
}
118
117
119
118
// Get overload records
120
- std::vector<Record *> Recs = R->getValueAsListOfDefs (" overloads" );
119
+ std::vector<const Record *> Recs = R->getValueAsListOfConstDefs (" overloads" );
121
120
122
121
// Sort records in ascending order of DXIL version
123
122
AscendingSortByVersion (Recs);
124
123
125
- for (Record *CR : Recs) {
124
+ for (const Record *CR : Recs) {
126
125
OverloadRecs.push_back (CR);
127
126
}
128
127
129
128
// Get stage records
130
- Recs = R->getValueAsListOfDefs (" stages" );
129
+ Recs = R->getValueAsListOfConstDefs (" stages" );
131
130
132
131
if (Recs.empty ()) {
133
132
PrintFatalError (R, Twine (" Atleast one specification of valid stage for " ) +
@@ -137,17 +136,17 @@ DXILOperationDesc::DXILOperationDesc(const Record *R) {
137
136
// Sort records in ascending order of DXIL version
138
137
AscendingSortByVersion (Recs);
139
138
140
- for (Record *CR : Recs) {
139
+ for (const Record *CR : Recs) {
141
140
StageRecs.push_back (CR);
142
141
}
143
142
144
143
// Get attribute records
145
- Recs = R->getValueAsListOfDefs (" attributes" );
144
+ Recs = R->getValueAsListOfConstDefs (" attributes" );
146
145
147
146
// Sort records in ascending order of DXIL version
148
147
AscendingSortByVersion (Recs);
149
148
150
- for (Record *CR : Recs) {
149
+ for (const Record *CR : Recs) {
151
150
AttrRecs.push_back (CR);
152
151
}
153
152
@@ -201,7 +200,7 @@ static StringRef getOverloadKindStr(const Record *R) {
201
200
// / \return std::string string representation of overload mask string
202
201
// / predicated by DXIL Version. E.g.,
203
202
// {{{1, 0}, Mask1}, {{1, 2}, Mask2}, ...}
204
- static std::string getOverloadMaskString (const SmallVector< Record *> Recs) {
203
+ static std::string getOverloadMaskString (ArrayRef< const Record *> Recs) {
205
204
std::string MaskString = " " ;
206
205
std::string Prefix = " " ;
207
206
MaskString.append (" {" );
@@ -247,7 +246,7 @@ static std::string getOverloadMaskString(const SmallVector<Record *> Recs) {
247
246
// / \return std::string string representation of stages mask string
248
247
// / predicated by DXIL Version. E.g.,
249
248
// {{{1, 0}, Mask1}, {{1, 2}, Mask2}, ...}
250
- static std::string getStageMaskString (const SmallVector< Record *> Recs) {
249
+ static std::string getStageMaskString (ArrayRef< const Record *> Recs) {
251
250
std::string MaskString = " " ;
252
251
std::string Prefix = " " ;
253
252
MaskString.append (" {" );
@@ -290,7 +289,7 @@ static std::string getStageMaskString(const SmallVector<Record *> Recs) {
290
289
// / \return std::string string representation of stages mask string
291
290
// / predicated by DXIL Version. E.g.,
292
291
// {{{1, 0}, Mask1}, {{1, 2}, Mask2}, ...}
293
- static std::string getAttributeMaskString (const SmallVector< Record *> Recs) {
292
+ static std::string getAttributeMaskString (ArrayRef< const Record *> Recs) {
294
293
std::string MaskString = " " ;
295
294
std::string Prefix = " " ;
296
295
MaskString.append (" {" );
0 commit comments