aboutsummaryrefslogtreecommitdiff
path: root/llvm/utils/TableGen/X86DisassemblerTables.cpp
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@intel.com>2019-06-13 22:15:25 +0000
committerCraig Topper <craig.topper@intel.com>2019-06-13 22:15:25 +0000
commitcf34a2bd5d6ec941e755d85e49525712453b0777 (patch)
treec99abfaf5faa60a26de8ae53451c401768181c4d /llvm/utils/TableGen/X86DisassemblerTables.cpp
parent1c88445840c5412965d4bbee6f558d0dd7aed9b4 (diff)
downloadllvm-cf34a2bd5d6ec941e755d85e49525712453b0777.zip
llvm-cf34a2bd5d6ec941e755d85e49525712453b0777.tar.gz
llvm-cf34a2bd5d6ec941e755d85e49525712453b0777.tar.bz2
[X86Disassembler] Unify the EVEX and VEX code in emitContextTable. Merge the ATTR_VEXL/ATTR_EVEXL bits. NFCI
Merging the two bits shrinks the context table from 16384 bytes to 8192 bytes. Remove the ATTRIBUTE_BITS macro and just create an enum directly. Then fix the ATTR_max define to be 8192 to reflect the table size so we stop hardcoding it separately. llvm-svn: 363330
Diffstat (limited to 'llvm/utils/TableGen/X86DisassemblerTables.cpp')
-rw-r--r--llvm/utils/TableGen/X86DisassemblerTables.cpp74
1 files changed, 23 insertions, 51 deletions
diff --git a/llvm/utils/TableGen/X86DisassemblerTables.cpp b/llvm/utils/TableGen/X86DisassemblerTables.cpp
index db8d623..8036aec 100644
--- a/llvm/utils/TableGen/X86DisassemblerTables.cpp
+++ b/llvm/utils/TableGen/X86DisassemblerTables.cpp
@@ -888,67 +888,44 @@ void DisassemblerTables::emitInstructionInfo(raw_ostream &o,
}
void DisassemblerTables::emitContextTable(raw_ostream &o, unsigned &i) const {
- const unsigned int tableSize = 16384;
o.indent(i * 2) << "static const uint8_t " CONTEXTS_STR
- "[" << tableSize << "] = {\n";
+ "[" << ATTR_max << "] = {\n";
i++;
- for (unsigned index = 0; index < tableSize; ++index) {
+ for (unsigned index = 0; index < ATTR_max; ++index) {
o.indent(i * 2);
- if (index & ATTR_EVEX) {
- o << "IC_EVEX";
- if (index & ATTR_EVEXL2)
+ if ((index & ATTR_EVEX) || (index & ATTR_VEX) || (index & ATTR_VEXL)) {
+ if (index & ATTR_EVEX)
+ o << "IC_EVEX";
+ else
+ o << "IC_VEX";
+
+ if ((index & ATTR_EVEX) && (index & ATTR_EVEXL2))
o << "_L2";
- else if (index & ATTR_EVEXL)
+ else if (index & ATTR_VEXL)
o << "_L";
+
if (index & ATTR_REXW)
o << "_W";
+
if (index & ATTR_OPSIZE)
o << "_OPSIZE";
else if (index & ATTR_XD)
o << "_XD";
else if (index & ATTR_XS)
o << "_XS";
- if (index & ATTR_EVEXKZ)
- o << "_KZ";
- else if (index & ATTR_EVEXK)
- o << "_K";
- if (index & ATTR_EVEXB)
- o << "_B";
+
+ if ((index & ATTR_EVEX)) {
+ if (index & ATTR_EVEXKZ)
+ o << "_KZ";
+ else if (index & ATTR_EVEXK)
+ o << "_K";
+
+ if (index & ATTR_EVEXB)
+ o << "_B";
+ }
}
- else if ((index & ATTR_VEXL) && (index & ATTR_REXW) && (index & ATTR_OPSIZE))
- o << "IC_VEX_L_W_OPSIZE";
- else if ((index & ATTR_VEXL) && (index & ATTR_REXW) && (index & ATTR_XD))
- o << "IC_VEX_L_W_XD";
- else if ((index & ATTR_VEXL) && (index & ATTR_REXW) && (index & ATTR_XS))
- o << "IC_VEX_L_W_XS";
- else if ((index & ATTR_VEXL) && (index & ATTR_REXW))
- o << "IC_VEX_L_W";
- else if ((index & ATTR_VEXL) && (index & ATTR_OPSIZE))
- o << "IC_VEX_L_OPSIZE";
- else if ((index & ATTR_VEXL) && (index & ATTR_XD))
- o << "IC_VEX_L_XD";
- else if ((index & ATTR_VEXL) && (index & ATTR_XS))
- o << "IC_VEX_L_XS";
- else if ((index & ATTR_VEX) && (index & ATTR_REXW) && (index & ATTR_OPSIZE))
- o << "IC_VEX_W_OPSIZE";
- else if ((index & ATTR_VEX) && (index & ATTR_REXW) && (index & ATTR_XD))
- o << "IC_VEX_W_XD";
- else if ((index & ATTR_VEX) && (index & ATTR_REXW) && (index & ATTR_XS))
- o << "IC_VEX_W_XS";
- else if (index & ATTR_VEXL)
- o << "IC_VEX_L";
- else if ((index & ATTR_VEX) && (index & ATTR_REXW))
- o << "IC_VEX_W";
- else if ((index & ATTR_VEX) && (index & ATTR_OPSIZE))
- o << "IC_VEX_OPSIZE";
- else if ((index & ATTR_VEX) && (index & ATTR_XD))
- o << "IC_VEX_XD";
- else if ((index & ATTR_VEX) && (index & ATTR_XS))
- o << "IC_VEX_XS";
- else if (index & ATTR_VEX)
- o << "IC_VEX";
else if ((index & ATTR_64BIT) && (index & ATTR_REXW) && (index & ATTR_XS))
o << "IC_64BIT_REXW_XS";
else if ((index & ATTR_64BIT) && (index & ATTR_REXW) && (index & ATTR_XD))
@@ -1003,12 +980,7 @@ void DisassemblerTables::emitContextTable(raw_ostream &o, unsigned &i) const {
else
o << "IC";
- if (index < tableSize - 1)
- o << ",";
- else
- o << " ";
-
- o << " /* " << index << " */";
+ o << ", /* " << index << " */";
o << "\n";
}