@@ -26,8 +26,8 @@ using namespace X86Disassembler;
26
26
namespace {
27
27
28
28
class X86InstrMappingEmitter {
29
- RecordKeeper &Records;
30
- CodeGenTarget Target;
29
+ const RecordKeeper &Records;
30
+ const CodeGenTarget Target;
31
31
32
32
// Hold all pontentially compressible EVEX instructions
33
33
std::vector<const CodeGenInstruction *> PreCompressionInsts;
@@ -44,7 +44,7 @@ class X86InstrMappingEmitter {
44
44
PredicateInstMap PredicateInsts;
45
45
46
46
public:
47
- X86InstrMappingEmitter (RecordKeeper &R) : Records(R), Target(R) {}
47
+ X86InstrMappingEmitter (const RecordKeeper &R) : Records(R), Target(R) {}
48
48
49
49
// run - Output X86 EVEX compression tables.
50
50
void run (raw_ostream &OS);
@@ -63,8 +63,8 @@ class X86InstrMappingEmitter {
63
63
void printClassDef (raw_ostream &OS);
64
64
// Prints the given table as a C++ array of type X86TableEntry under the guard
65
65
// \p Macro.
66
- void printTable (const std::vector <Entry> & Table, StringRef Name,
67
- StringRef Macro, raw_ostream &OS);
66
+ void printTable (ArrayRef <Entry> Table, StringRef Name, StringRef Macro ,
67
+ raw_ostream &OS);
68
68
};
69
69
70
70
void X86InstrMappingEmitter::printClassDef (raw_ostream &OS) {
@@ -90,9 +90,8 @@ static void printMacroEnd(StringRef Macro, raw_ostream &OS) {
90
90
OS << " #endif // " << Macro << " \n\n " ;
91
91
}
92
92
93
- void X86InstrMappingEmitter::printTable (const std::vector<Entry> &Table,
94
- StringRef Name, StringRef Macro,
95
- raw_ostream &OS) {
93
+ void X86InstrMappingEmitter::printTable (ArrayRef<Entry> Table, StringRef Name,
94
+ StringRef Macro, raw_ostream &OS) {
96
95
printMacroBegin (Macro, OS);
97
96
98
97
OS << " static const X86TableEntry " << Name << " [] = {\n " ;
@@ -220,7 +219,7 @@ void X86InstrMappingEmitter::emitCompressEVEXTable(
220
219
assert (NewRec && " Instruction not found!" );
221
220
NewInst = &Target.getInstruction (NewRec);
222
221
} else if (Name.ends_with (" _EVEX" )) {
223
- if (auto *NewRec = Records.getDef (Name.drop_back (5 )))
222
+ if (const auto *NewRec = Records.getDef (Name.drop_back (5 )))
224
223
NewInst = &Target.getInstruction (NewRec);
225
224
} else if (Name.ends_with (" _ND" ))
226
225
// Leave it to ND2NONND table.
@@ -319,7 +318,7 @@ void X86InstrMappingEmitter::emitND2NonNDTable(
319
318
if (!isInteresting (Rec) || NoCompressSet.find (Name) != NoCompressSet.end ())
320
319
continue ;
321
320
if (ManualMap.find (Name) != ManualMap.end ()) {
322
- auto *NewRec = Records.getDef (ManualMap.at (Rec->getName ()));
321
+ const auto *NewRec = Records.getDef (ManualMap.at (Rec->getName ()));
323
322
assert (NewRec && " Instruction not found!" );
324
323
auto &NewInst = Target.getInstruction (NewRec);
325
324
Table.push_back (std::pair (Inst, &NewInst));
@@ -328,10 +327,10 @@ void X86InstrMappingEmitter::emitND2NonNDTable(
328
327
329
328
if (!Name.ends_with (" _ND" ))
330
329
continue ;
331
- auto *NewRec = Records.getDef (Name.drop_back (3 ));
330
+ const auto *NewRec = Records.getDef (Name.drop_back (3 ));
332
331
if (!NewRec)
333
332
continue ;
334
- auto &NewInst = Target.getInstruction (NewRec);
333
+ const auto &NewInst = Target.getInstruction (NewRec);
335
334
if (isRegisterOperand (NewInst.Operands [0 ].Rec ))
336
335
Table.push_back (std::pair (Inst, &NewInst));
337
336
}
@@ -353,15 +352,15 @@ void X86InstrMappingEmitter::emitSSE2AVXTable(
353
352
if (!isInteresting (Rec))
354
353
continue ;
355
354
if (ManualMap.find (Name) != ManualMap.end ()) {
356
- auto *NewRec = Records.getDef (ManualMap.at (Rec->getName ()));
355
+ const auto *NewRec = Records.getDef (ManualMap.at (Rec->getName ()));
357
356
assert (NewRec && " Instruction not found!" );
358
- auto &NewInst = Target.getInstruction (NewRec);
357
+ const auto &NewInst = Target.getInstruction (NewRec);
359
358
Table.push_back (std::pair (Inst, &NewInst));
360
359
continue ;
361
360
}
362
361
363
362
std::string NewName = (" V" + Name).str ();
364
- auto *AVXRec = Records.getDef (NewName);
363
+ const auto *AVXRec = Records.getDef (NewName);
365
364
if (!AVXRec)
366
365
continue ;
367
366
auto &AVXInst = Target.getInstruction (AVXRec);
0 commit comments