@@ -47,9 +47,7 @@ class X86CompressEVEXTablesEmitter {
4747 typedef std::pair<const CodeGenInstruction *, const CodeGenInstruction *>
4848 Entry;
4949
50- // Represent both compress tables
51- std::vector<Entry> EVEX2VEX128;
52- std::vector<Entry> EVEX2VEX256;
50+ std::vector<Entry> Table;
5351
5452public:
5553 X86CompressEVEXTablesEmitter (RecordKeeper &R) : Records(R), Target(R) {}
@@ -64,20 +62,13 @@ class X86CompressEVEXTablesEmitter {
6462
6563void X86CompressEVEXTablesEmitter::printTable (const std::vector<Entry> &Table,
6664 raw_ostream &OS) {
67- StringRef Size = (Table == EVEX2VEX128) ? " 128" : " 256" ;
6865
69- OS << " // X86 EVEX encoded instructions that have a VEX " << Size
70- << " encoding\n "
71- << " // (table format: <EVEX opcode, VEX-" << Size << " opcode>).\n "
72- << " static const X86CompressEVEXTableEntry X86EvexToVex" << Size
73- << " CompressTable[] = {\n "
74- << " // EVEX scalar with corresponding VEX.\n " ;
66+ OS << " static const X86CompressEVEXTableEntry X86CompressEVEXTable[] = { \n " ;
7567
7668 // Print all entries added to the table
77- for (const auto &Pair : Table) {
69+ for (const auto &Pair : Table)
7870 OS << " { X86::" << Pair.first ->TheDef ->getName ()
7971 << " , X86::" << Pair.second ->TheDef ->getName () << " },\n " ;
80- }
8172
8273 OS << " };\n\n " ;
8374}
@@ -175,33 +166,27 @@ void X86CompressEVEXTablesEmitter::run(raw_ostream &OS) {
175166 const Record *Rec = Inst->TheDef ;
176167 uint64_t Opcode =
177168 getValueFromBitsInit (Inst->TheDef ->getValueAsBitsInit (" Opcode" ));
178- const CodeGenInstruction *VEXInst = nullptr ;
169+ const CodeGenInstruction *NewInst = nullptr ;
179170 if (ManualMap.find (Rec->getName ()) != ManualMap.end ()) {
180171 Record *NewRec = Records.getDef (ManualMap.at (Rec->getName ()));
181172 assert (NewRec && " Instruction not found!" );
182- VEXInst = &Target.getInstruction (NewRec);
173+ NewInst = &Target.getInstruction (NewRec);
183174 } else {
184- // For each EVEX instruction look for a VEX match in the appropriate
175+ // For each pre-compression instruction look for a match in the appropriate
185176 // vector (instructions with the same opcode) using function object
186177 // IsMatch.
187178 auto Match = llvm::find_if (CompressedInsts[Opcode], IsMatch (Inst));
188179 if (Match != CompressedInsts[Opcode].end ())
189- VEXInst = *Match;
180+ NewInst = *Match;
190181 }
191182
192- if (!VEXInst )
183+ if (!NewInst )
193184 continue ;
194185
195- // In case a match is found add new entry to the appropriate table
196- if (Rec->getValueAsBit (" hasVEX_L" ))
197- EVEX2VEX256.push_back (std::make_pair (Inst, VEXInst)); // {0,1}
198- else
199- EVEX2VEX128.push_back (std::make_pair (Inst, VEXInst)); // {0,0}
186+ Table.push_back (std::make_pair (Inst, NewInst));
200187 }
201188
202- // Print both tables
203- printTable (EVEX2VEX128, OS);
204- printTable (EVEX2VEX256, OS);
189+ printTable (Table, OS);
205190}
206191} // namespace
207192
0 commit comments