Use uint8_t instead of enums to store values in X86 disassembler table. Shaves 150k...
authorCraig Topper <craig.topper@gmail.com>
Sun, 4 Mar 2012 02:16:41 +0000 (02:16 +0000)
committerCraig Topper <craig.topper@gmail.com>
Sun, 4 Mar 2012 02:16:41 +0000 (02:16 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151995 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/Disassembler/X86Disassembler.cpp
lib/Target/X86/Disassembler/X86DisassemblerDecoderCommon.h
utils/TableGen/X86DisassemblerTables.cpp

index 963bdd15370e65ed201a7d80ca6a0a330c0258b9..8278bde7c21871a90d9beaeb0379d9e058801486 100644 (file)
@@ -320,7 +320,7 @@ static void translateImmediate(MCInst &mcInst, uint64_t immediate,
                                const MCDisassembler *Dis) {  
   // Sign-extend the immediate if necessary.
 
-  OperandType type = operand.type;
+  OperandType type = (OperandType)operand.type;
 
   if (type == TYPE_RELv) {
     switch (insn.displacementSize) {
index d5e7c690198bda4567cbcbb2684c0c861cda9dc4..d2e30f1766017501099c2b9da11ed3207ba933ef 100644 (file)
@@ -343,8 +343,8 @@ typedef enum {
  *   operand.
  */
 struct OperandSpecifier {
-  OperandEncoding  encoding;
-  OperandType      type;
+  uint8_t encoding;
+  uint8_t type;
 };
 
 /*
@@ -371,7 +371,7 @@ typedef enum {
  * its operands.
  */
 struct InstructionSpecifier {
-  ModifierType modifierType;
+  uint8_t modifierType;
   uint8_t modifierBase;
   struct OperandSpecifier operands[X86_MAX_OPERANDS];
   
index 52b2486a0d5cfcc3598f0f6efd32abb28111a7e1..2875168a108373e16f9f31a7734583058b8107f1 100644 (file)
@@ -457,11 +457,11 @@ void DisassemblerTables::emitInstructionInfo(raw_ostream &o, uint32_t &i)
   for (index = 0; index < numInstructions; ++index) {
     o.indent(i * 2) << "{ /* " << index << " */" << "\n";
     i++;
-    
-    o.indent(i * 2) << 
-      stringForModifierType(InstructionSpecifiers[index].modifierType);
+
+    o.indent(i * 2) << stringForModifierType(
+                       (ModifierType)InstructionSpecifiers[index].modifierType);
     o << "," << "\n";
-    
+
     o.indent(i * 2) << "0x";
     o << format("%02hhx", (uint16_t)InstructionSpecifiers[index].modifierBase);
     o << "," << "\n";
@@ -471,11 +471,11 @@ void DisassemblerTables::emitInstructionInfo(raw_ostream &o, uint32_t &i)
 
     for (operandIndex = 0; operandIndex < X86_MAX_OPERANDS; ++operandIndex) {
       o.indent(i * 2) << "{ ";
-      o << stringForOperandEncoding(InstructionSpecifiers[index]
-                                    .operands[operandIndex]
-                                    .encoding);
+      o <<stringForOperandEncoding((OperandEncoding)InstructionSpecifiers[index]
+                                   .operands[operandIndex]
+                                   .encoding);
       o << ", ";
-      o << stringForOperandType(InstructionSpecifiers[index]
+      o << stringForOperandType((OperandType)InstructionSpecifiers[index]
                                 .operands[operandIndex]
                                 .type);
       o << " }";