From 870be04a3f3151ea8e6b0ec446e70edcdb58fef0 Mon Sep 17 00:00:00 2001 From: peter Date: Sun, 26 Mar 2006 20:15:32 +0000 Subject: [PATCH] * use dwarf_reg() git-svn-id: trunk@3046 - --- compiler/arm/cpubase.pas | 9 +++++++++ compiler/cfidwarf.pas | 15 +-------------- compiler/dbgdwarf.pas | 17 +++++++++++------ compiler/m68k/cpubase.pas | 11 ++++++++++- compiler/powerpc/cpubase.pas | 8 ++++++++ compiler/powerpc64/cpubase.pas | 9 +++++++++ compiler/sparc/cpubase.pas | 8 ++++++++ compiler/x86/cpubase.pas | 9 +++++++++ 8 files changed, 65 insertions(+), 21 deletions(-) diff --git a/compiler/arm/cpubase.pas b/compiler/arm/cpubase.pas index 097854076b..5e150b3028 100644 --- a/compiler/arm/cpubase.pas +++ b/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. diff --git a/compiler/cfidwarf.pas b/compiler/cfidwarf.pas index d70cab101e..c9b1db6410 100644 --- a/compiler/cfidwarf.pas +++ b/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; diff --git a/compiler/dbgdwarf.pas b/compiler/dbgdwarf.pas index 8f622e1529..72f91c5f7b 100644 --- a/compiler/dbgdwarf.pas +++ b/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 diff --git a/compiler/m68k/cpubase.pas b/compiler/m68k/cpubase.pas index e0184bcf01..6c839ef2a5 100644 --- a/compiler/m68k/cpubase.pas +++ b/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. diff --git a/compiler/powerpc/cpubase.pas b/compiler/powerpc/cpubase.pas index b09e1ccaf7..1c396febac 100644 --- a/compiler/powerpc/cpubase.pas +++ b/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. diff --git a/compiler/powerpc64/cpubase.pas b/compiler/powerpc64/cpubase.pas index 0f0ad34b2c..0c0f4f54af 100644 --- a/compiler/powerpc64/cpubase.pas +++ b/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. diff --git a/compiler/sparc/cpubase.pas b/compiler/sparc/cpubase.pas index 97a6a569a6..48f44024f6 100644 --- a/compiler/sparc/cpubase.pas +++ b/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. diff --git a/compiler/x86/cpubase.pas b/compiler/x86/cpubase.pas index 37219a3270..4b44a86f72 100644 --- a/compiler/x86/cpubase.pas +++ b/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.