X86: Make register names in disassembly reflect high bytes.
authorGabe Black <gblack@eecs.umich.edu>
Mon, 30 Jul 2007 20:26:14 +0000 (13:26 -0700)
committerGabe Black <gblack@eecs.umich.edu>
Mon, 30 Jul 2007 20:26:14 +0000 (13:26 -0700)
--HG--
extra : convert_revision : e2891581e5504de0a2c8e5932fd22425cafd4fc7

src/arch/x86/insts/static_inst.cc

index 9b2f81e49a08980589c865408d07d5eac3bf69a7..948a74bc178af63118087af251cdbd29c89661b7 100644 (file)
@@ -117,15 +117,27 @@ namespace X86ISA
     {
         assert(size == 1 || size == 2 || size == 4 || size == 8);
         static const char * abcdFormats[9] =
-            {"", "%sl",  "%sx",  "", "e%sx", "", "", "", "r%sx"};
+            {"", "%s",  "%sx",  "", "e%sx", "", "", "", "r%sx"};
         static const char * piFormats[9] =
-            {"", "%sl",  "%s",   "", "e%s",  "", "", "", "r%s"};
+            {"", "%s",  "%s",   "", "e%s",  "", "", "", "r%s"};
         static const char * longFormats[9] =
             {"", "r%sb", "r%sw", "", "r%sd", "", "", "", "r%s"};
         static const char * microFormats[9] =
             {"", "t%db", "t%dw", "", "t%dd", "", "", "", "t%d"};
 
         if (reg < FP_Base_DepTag) {
+            char * suffix = "";
+            bool fold = reg & (1 << 6);
+            reg &= ~(1 << 6);
+
+            if(fold)
+            {
+                suffix = "h";
+                reg -= 4;
+            }
+            else if(reg < 8 && size == 1)
+                suffix = "l";
+
             switch (reg) {
               case INTREG_RAX:
                 ccprintf(os, abcdFormats[size], "a");
@@ -178,6 +190,7 @@ namespace X86ISA
               default:
                 ccprintf(os, microFormats[size], reg - NUM_INTREGS);
             }
+            ccprintf(os, suffix);
         } else if (reg < Ctrl_Base_DepTag) {
             ccprintf(os, "%%f%d", reg - FP_Base_DepTag);
         } else {