@@ -47,9 +47,7 @@ class X86CompressEVEXTablesEmitter {
47
47
typedef std::pair<const CodeGenInstruction *, const CodeGenInstruction *>
48
48
Entry;
49
49
50
- // Represent both compress tables
51
- std::vector<Entry> EVEX2VEX128;
52
- std::vector<Entry> EVEX2VEX256;
50
+ std::vector<Entry> Table;
53
51
54
52
public:
55
53
X86CompressEVEXTablesEmitter (RecordKeeper &R) : Records(R), Target(R) {}
@@ -64,20 +62,13 @@ class X86CompressEVEXTablesEmitter {
64
62
65
63
void X86CompressEVEXTablesEmitter::printTable (const std::vector<Entry> &Table,
66
64
raw_ostream &OS) {
67
- StringRef Size = (Table == EVEX2VEX128) ? " 128" : " 256" ;
68
65
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 " ;
75
67
76
68
// Print all entries added to the table
77
- for (const auto &Pair : Table) {
69
+ for (const auto &Pair : Table)
78
70
OS << " { X86::" << Pair.first ->TheDef ->getName ()
79
71
<< " , X86::" << Pair.second ->TheDef ->getName () << " },\n " ;
80
- }
81
72
82
73
OS << " };\n\n " ;
83
74
}
@@ -175,33 +166,27 @@ void X86CompressEVEXTablesEmitter::run(raw_ostream &OS) {
175
166
const Record *Rec = Inst->TheDef ;
176
167
uint64_t Opcode =
177
168
getValueFromBitsInit (Inst->TheDef ->getValueAsBitsInit (" Opcode" ));
178
- const CodeGenInstruction *VEXInst = nullptr ;
169
+ const CodeGenInstruction *NewInst = nullptr ;
179
170
if (ManualMap.find (Rec->getName ()) != ManualMap.end ()) {
180
171
Record *NewRec = Records.getDef (ManualMap.at (Rec->getName ()));
181
172
assert (NewRec && " Instruction not found!" );
182
- VEXInst = &Target.getInstruction (NewRec);
173
+ NewInst = &Target.getInstruction (NewRec);
183
174
} 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
185
176
// vector (instructions with the same opcode) using function object
186
177
// IsMatch.
187
178
auto Match = llvm::find_if (CompressedInsts[Opcode], IsMatch (Inst));
188
179
if (Match != CompressedInsts[Opcode].end ())
189
- VEXInst = *Match;
180
+ NewInst = *Match;
190
181
}
191
182
192
- if (!VEXInst )
183
+ if (!NewInst )
193
184
continue ;
194
185
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));
200
187
}
201
188
202
- // Print both tables
203
- printTable (EVEX2VEX128, OS);
204
- printTable (EVEX2VEX256, OS);
189
+ printTable (Table, OS);
205
190
}
206
191
} // namespace
207
192
0 commit comments