Browse Source

* use dwarf_reg()

git-svn-id: trunk@3046 -
peter 19 years ago
parent
commit
870be04a3f

+ 9 - 0
compiler/arm/cpubase.pas

@@ -370,6 +370,7 @@ unit cpubase;
     function is_pc(const r : tregister) : boolean;
 
     function is_shifter_const(d : aint;var imm_shift : byte) : boolean;
+    function dwarf_reg(r:tregister):byte;
 
   implementation
 
@@ -517,4 +518,12 @@ unit cpubase;
          result:=false;
       end;
 
+
+    function dwarf_reg(r:tregister):byte;
+      begin
+        result:=regdwarf_table[findreg_by_number(r)];
+        if result=-1 then
+          internalerror(200603251);
+      end;
+
 end.

+ 1 - 14
compiler/cfidwarf.pas

@@ -85,9 +85,6 @@ interface
       end;
 
 
-    function dwarf_reg(r:tregister):byte;
-
-
 implementation
 
     uses
@@ -129,16 +126,6 @@ implementation
       DW_LNE_hi_user      = $ff;
 
 
-{****************************************************************************
-                                  Helpers
-****************************************************************************}
-
-    function dwarf_reg(r:tregister):byte;
-      begin
-        result:=regdwarf_table[findreg_by_number(r)];
-      end;
-
-
 {****************************************************************************
                                 TDWARFITEM
 ****************************************************************************}
@@ -224,7 +211,7 @@ implementation
               dop_reloffset :
                 list.concat(tai_const.create_rel_sym(enc2ait_const[oper[i].enc],oper[i].beginsym,oper[i].endsym));
               dop_reg :
-                list.concat(tai_const.create(enc2ait_const[oper[i].enc],regdwarf_table[findreg_by_number(oper[i].register)]));
+                list.concat(tai_const.create(enc2ait_const[oper[i].enc],dwarf_reg(oper[i].register)));
               else
                 internalerror(200404128);
             end;

+ 11 - 6
compiler/dbgdwarf.pas

@@ -423,6 +423,11 @@ implementation
       { Implementation-defined range end.   }
       DW_OP_hi_user = $ff;
 
+
+{****************************************************************************
+                              TDebugInfoDwarf
+****************************************************************************}
+
     function TDebugInfoDwarf.def_dwarf_lab(def:tdef) : tasmsymbol;
       begin
         { procdefs only need a number, mark them as already written
@@ -1503,8 +1508,8 @@ implementation
           var
             templist : TAsmList;
             blocksize : longint;
-            regidx : longint;
             tag : tdwarf_tag;
+            dreg : byte;
           begin
             { external symbols can't be resolved at link time, so we
               can't generate stabs for them
@@ -1528,10 +1533,10 @@ implementation
               LOC_FPUREGISTER,
               LOC_CFPUREGISTER :
                 begin
-                  regidx:=findreg_by_number(sym.localloc.register);
                   templist.concat(tai_const.create_8bit(ord(DW_OP_regx)));
-                  templist.concat(tai_const.create_uleb128bit(regdwarf_table[regidx]));
-                  blocksize:=1+Lengthuleb128(regdwarf_table[regidx]);
+                  dreg:=dwarf_reg(sym.localloc.register);
+                  templist.concat(tai_const.create_uleb128bit(dreg));
+                  blocksize:=1+Lengthuleb128(dreg);
                 end;
               else
                 begin
@@ -1553,8 +1558,8 @@ implementation
                     paravarsym,
                     localvarsym:
                       begin
-                        regidx:=findreg_by_number(sym.localloc.reference.base);
-                        templist.concat(tai_const.create_8bit(ord(DW_OP_breg0)+regdwarf_table[regidx]));
+                        dreg:=dwarf_reg(sym.localloc.reference.base);
+                        templist.concat(tai_const.create_8bit(ord(DW_OP_breg0)+dreg));
                         templist.concat(tai_const.create_sleb128bit(sym.localloc.reference.offset));
                         blocksize:=1+Lengthsleb128(sym.localloc.reference.offset);
                       end

+ 10 - 1
compiler/m68k/cpubase.pas

@@ -333,6 +333,7 @@ unit cpubase;
 
     function inverse_cond(const c: TAsmCond): TAsmCond; {$ifdef USEINLINE}inline;{$endif USEINLINE}
     function conditions_equal(const c1, c2: TAsmCond): boolean; {$ifdef USEINLINE}inline;{$endif USEINLINE}
+    function dwarf_reg(r:tregister):byte;
 
 implementation
 
@@ -424,7 +425,7 @@ implementation
             cgsize2subreg:=R_SUBFS;
           OS_F64 :
             cgsize2subreg:=R_SUBFD;
-{            
+{
             begin
               // is this correct? (KB)
               cgsize2subreg:=R_SUBNONE;
@@ -502,4 +503,12 @@ implementation
         result := c1 = c2;
       end;
 
+
+    function dwarf_reg(r:tregister):byte;
+      begin
+        result:=regdwarf_table[findreg_by_number(r)];
+        if result=-1 then
+          internalerror(200603251);
+      end;
+
 end.

+ 8 - 0
compiler/powerpc/cpubase.pas

@@ -399,6 +399,7 @@ uses
 
     function inverse_cond(const c: TAsmCond): Tasmcond; {$ifdef USEINLINE}inline;{$endif USEINLINE}
     function conditions_equal(const c1, c2: TAsmCond): boolean;
+    function dwarf_reg(r:tregister):byte;
 
 implementation
 
@@ -555,4 +556,11 @@ implementation
       end;
 
 
+    function dwarf_reg(r:tregister):byte;
+      begin
+        result:=regdwarf_table[findreg_by_number(r)];
+        if result=-1 then
+          internalerror(200603251);
+      end;
+
 end.

+ 9 - 0
compiler/powerpc64/cpubase.pas

@@ -397,6 +397,7 @@ function is_condreg(r: tregister): boolean;
 function inverse_cond(const c: TAsmCond): Tasmcond;
 {$IFDEF USEINLINE}inline;{$ENDIF USEINLINE}
 function conditions_equal(const c1, c2: TAsmCond): boolean;
+    function dwarf_reg(r:tregister):byte;
 
 implementation
 
@@ -544,5 +545,13 @@ begin
     result := generic_regname(r);
 end;
 
+    function dwarf_reg(r:tregister):byte;
+      begin
+        result:=regdwarf_table[findreg_by_number(r)];
+        if result=-1 then
+          internalerror(200603251);
+      end;
+
+
 end.
 

+ 8 - 0
compiler/sparc/cpubase.pas

@@ -338,6 +338,7 @@ uses
     function std_regname(r:Tregister):string;
     function std_regnum_search(const s:string):Tregister;
     function findreg_by_number(r:Tregister):tregisterindex;
+    function dwarf_reg(r:tregister):byte;
 
 
 implementation
@@ -459,4 +460,11 @@ implementation
         result := c1 = c2;
       end;
 
+    function dwarf_reg(r:tregister):byte;
+      begin
+        result:=regdwarf_table[findreg_by_number(r)];
+        if result=-1 then
+          internalerror(200603251);
+      end;
+
 end.

+ 9 - 0
compiler/x86/cpubase.pas

@@ -254,6 +254,7 @@ uses
     function findreg_by_number(r:Tregister):tregisterindex;
     function std_regnum_search(const s:string):Tregister;
     function std_regname(r:Tregister):string;
+    function dwarf_reg(r:tregister):byte;
 
     function inverse_cond(const c: TAsmCond): TAsmCond; {$ifdef USEINLINE}inline;{$endif USEINLINE}
     function conditions_equal(const c1, c2: TAsmCond): boolean; {$ifdef USEINLINE}inline;{$endif USEINLINE}
@@ -471,4 +472,12 @@ implementation
       end;
 
 
+    function dwarf_reg(r:tregister):byte;
+      begin
+        result:=regdwarf_table[findreg_by_number(r)];
+        if result=-1 then
+          internalerror(200603251);
+      end;
+
+
 end.