Fix up the disassembly a little.
authorGabe Black <gblack@eecs.umich.edu>
Tue, 14 Nov 2006 06:28:11 +0000 (01:28 -0500)
committerGabe Black <gblack@eecs.umich.edu>
Tue, 14 Nov 2006 06:28:11 +0000 (01:28 -0500)
--HG--
extra : convert_revision : 7bdf68f445b79b1b5dbcdfa5fa1005c68d03724c

src/arch/sparc/isa/formats/mem/util.isa
src/arch/sparc/isa/formats/priv.isa

index 00360aa43730f7b7dfcc4e1b6da6c7e83e180c81..857f3716032f75fb6645c6dd3978e11ee8102695 100644 (file)
@@ -76,23 +76,26 @@ output decoder {{
         {
             std::stringstream response;
             bool load = flags[IsLoad];
-            bool save = flags[IsStore];
+            bool store = flags[IsStore];
 
             printMnemonic(response, mnemonic);
-            if(save)
+            if(store)
             {
-                    printReg(response, _srcRegIdx[0]);
+                printReg(response, _srcRegIdx[0]);
                 ccprintf(response, ", ");
             }
-            ccprintf(response, "[ ");
-            printReg(response, _srcRegIdx[!save ? 0 : 1]);
-            ccprintf(response, " + ");
-            printReg(response, _srcRegIdx[!save ? 1 : 2]);
-            ccprintf(response, " ]");
+            ccprintf(response, "[");
+            if(_srcRegIdx[!store ? 0 : 1] != 0)
+            {
+                printSrcReg(response, !store ? 0 : 1);
+                ccprintf(response, " + ");
+            }
+            printSrcReg(response, !store ? 1 : 2);
+            ccprintf(response, "]");
             if(load)
             {
                 ccprintf(response, ", ");
-                    printReg(response, _destRegIdx[0]);
+                printReg(response, _destRegIdx[0]);
             }
 
             return response.str();
@@ -108,19 +111,23 @@ output decoder {{
             printMnemonic(response, mnemonic);
             if(save)
             {
-                    printReg(response, _srcRegIdx[0]);
+                printReg(response, _srcRegIdx[0]);
                 ccprintf(response, ", ");
             }
-            ccprintf(response, "[ ");
-            printReg(response, _srcRegIdx[!save ? 0 : 1]);
+            ccprintf(response, "[");
+            if(_srcRegIdx[!save ? 0 : 1] != 0)
+            {
+                printReg(response, _srcRegIdx[!save ? 0 : 1]);
+                ccprintf(response, " + ");
+            }
             if(imm >= 0)
-                ccprintf(response, " + 0x%x ]", imm);
+                ccprintf(response, "0x%x]", imm);
             else
-                ccprintf(response, " + -0x%x ]", -imm);
+                ccprintf(response, "-0x%x]", -imm);
             if(load)
             {
                 ccprintf(response, ", ");
-                    printReg(response, _destRegIdx[0]);
+                printReg(response, _destRegIdx[0]);
             }
 
             return response.str();
index 94a68aebec6367b3f9a9033b233c7cc24a8dcb34..3d47ca02f9ac7b49d4e5af954de169647418e3ba 100644 (file)
@@ -153,8 +153,13 @@ output decoder {{
             printMnemonic(response, mnemonic);
 
             ccprintf(response, " ");
-            printSrcReg(response, 0);
-            ccprintf(response, ", ");
+            //If the first reg is %g0, don't print it.
+            //This improves readability
+            if(_srcRegIdx[0] != 0)
+            {
+                printSrcReg(response, 0);
+                ccprintf(response, ", ");
+            }
             printSrcReg(response, 1);
             ccprintf(response, ", %%%s", regName);
 
@@ -169,8 +174,14 @@ output decoder {{
             printMnemonic(response, mnemonic);
 
             ccprintf(response, " ");
-            printSrcReg(response, 0);
-            ccprintf(response, ", 0x%x, %%%s", imm, regName);
+            //If the first reg is %g0, don't print it.
+            //This improves readability
+            if(_srcRegIdx[0] != 0)
+            {
+                printSrcReg(response, 0);
+                ccprintf(response, ", ");
+            }
+            ccprintf(response, "0x%x, %%%s", imm, regName);
 
             return response.str();
         }