Browse Source

* MIPS: dropped gas_std_regname, its functionality merged into std_regname. This fixes register names in non-instructions (reg. allocation information, variable locations, etc.) and makes assembler listings more readable.

git-svn-id: trunk@27986 -
sergei 11 years ago
parent
commit
244f65525b
2 changed files with 18 additions and 23 deletions
  1. 17 4
      compiler/mips/cpubase.pas
  2. 1 19
      compiler/mips/cpugas.pas

+ 17 - 4
compiler/mips/cpubase.pas

@@ -377,12 +377,25 @@ unit cpubase;
     function std_regname(r:Tregister):string;
     function std_regname(r:Tregister):string;
       var
       var
         p : tregisterindex;
         p : tregisterindex;
+        hr : tregister;
       begin
       begin
-        p:=findreg_by_number_table(r,regnumber_index);
-        if p<>0 then
-          result:=std_regname_table[p]
+        if getregtype(r)=R_SPECIALREGISTER then
+          result:=tostr(getsupreg(r))
         else
         else
-          result:=generic_regname(r);
+          begin
+            hr:=r;
+            case getsubreg(hr) of
+              R_SUBFD:
+                setsubreg(hr, R_SUBFS);
+              R_SUBL, R_SUBW, R_SUBD, R_SUBQ:
+               setsubreg(hr, R_SUBD);
+            end;
+            p:=findreg_by_number_table(hr,regnumber_index);
+            if p<>0 then
+              result:=std_regname_table[p]
+            else
+              result:=generic_regname(r);
+          end;
       end;
       end;
 
 
     function dwarf_reg(r:tregister):shortint;
     function dwarf_reg(r:tregister):shortint;

+ 1 - 19
compiler/mips/cpugas.pas

@@ -55,30 +55,12 @@ unit cpugas;
       cutils, systems, cpuinfo,
       cutils, systems, cpuinfo,
       globals, verbose, itcpugas, cgbase, cgutils;
       globals, verbose, itcpugas, cgbase, cgutils;
 
 
-    function gas_std_regname(r:Tregister):string;
-      var
-        hr: tregister;
-      begin
-        { Double uses the same table as single }
-        hr := r;
-        case getsubreg(hr) of
-          R_SUBFD:
-            setsubreg(hr, R_SUBFS);
-          R_SUBL, R_SUBW, R_SUBD, R_SUBQ:
-           setsubreg(hr, R_SUBD);
-        end;
-        if getregtype(r)=R_SPECIALREGISTER then
-          result:=tostr(getsupreg(r))
-        else
-          result:=std_regname(hr);
-      end;
-
 
 
       function asm_regname(reg : TRegister) : string;
       function asm_regname(reg : TRegister) : string;
 
 
         begin
         begin
           if use_std_regnames then
           if use_std_regnames then
-            asm_regname:='$'+gas_std_regname(reg)
+            asm_regname:='$'+std_regname(reg)
           else
           else
             asm_regname:=gas_regname(reg);
             asm_regname:=gas_regname(reg);
         end;
         end;