mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-10-02 07:00:16 +02:00
* properly copy tasmlabels when generating altsymbols
git-svn-id: trunk@3753 -
This commit is contained in:
parent
f6d4f38bc0
commit
8e1dd27896
@ -89,11 +89,13 @@ interface
|
|||||||
{ Cached objsymbol }
|
{ Cached objsymbol }
|
||||||
cachedobjsymbol : TObject;
|
cachedobjsymbol : TObject;
|
||||||
constructor create(const s:string;_bind:TAsmsymbind;_typ:Tasmsymtype);
|
constructor create(const s:string;_bind:TAsmsymbind;_typ:Tasmsymtype);
|
||||||
|
function getaltcopy(altnr: longint): tasmsymbol; virtual;
|
||||||
function is_used:boolean;
|
function is_used:boolean;
|
||||||
procedure increfs;
|
procedure increfs;
|
||||||
procedure decrefs;
|
procedure decrefs;
|
||||||
function getrefs: longint;
|
function getrefs: longint;
|
||||||
end;
|
end;
|
||||||
|
TAsmSymbolClass = class of TAsmSymbol;
|
||||||
|
|
||||||
TAsmLabel = class(TAsmSymbol)
|
TAsmLabel = class(TAsmSymbol)
|
||||||
labelnr : longint;
|
labelnr : longint;
|
||||||
@ -101,6 +103,7 @@ interface
|
|||||||
is_set : boolean;
|
is_set : boolean;
|
||||||
constructor createlocal(nr:longint;ltyp:TAsmLabelType);
|
constructor createlocal(nr:longint;ltyp:TAsmLabelType);
|
||||||
constructor createglobal(const modulename:string;nr:longint;ltyp:TAsmLabelType);
|
constructor createglobal(const modulename:string;nr:longint;ltyp:TAsmLabelType);
|
||||||
|
function getaltcopy(altnr: longint): tasmsymbol; override;
|
||||||
function getname:string;override;
|
function getname:string;override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -251,6 +254,15 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function tasmsymbol.getaltcopy(altnr: longint): tasmsymbol;
|
||||||
|
begin
|
||||||
|
result := TAsmSymbol(TAsmSymbolClass(classtype).createname(name+'_'+tostr(altnr)));
|
||||||
|
result.bind:=bind;
|
||||||
|
result.typ:=typ;
|
||||||
|
result.refs:=0;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
function tasmsymbol.is_used:boolean;
|
function tasmsymbol.is_used:boolean;
|
||||||
begin
|
begin
|
||||||
is_used:=(refs>0);
|
is_used:=(refs>0);
|
||||||
@ -282,7 +294,7 @@ implementation
|
|||||||
*****************************************************************************}
|
*****************************************************************************}
|
||||||
|
|
||||||
constructor tasmlabel.createlocal(nr:longint;ltyp:TAsmLabelType);
|
constructor tasmlabel.createlocal(nr:longint;ltyp:TAsmLabelType);
|
||||||
begin;
|
begin
|
||||||
inherited create(target_asm.labelprefix+asmlabeltypeprefix[ltyp]+tostr(nr),AB_LOCAL,AT_LABEL);
|
inherited create(target_asm.labelprefix+asmlabeltypeprefix[ltyp]+tostr(nr),AB_LOCAL,AT_LABEL);
|
||||||
labelnr:=nr;
|
labelnr:=nr;
|
||||||
labeltype:=ltyp;
|
labeltype:=ltyp;
|
||||||
@ -291,7 +303,7 @@ implementation
|
|||||||
|
|
||||||
|
|
||||||
constructor tasmlabel.createglobal(const modulename:string;nr:longint;ltyp:TAsmLabelType);
|
constructor tasmlabel.createglobal(const modulename:string;nr:longint;ltyp:TAsmLabelType);
|
||||||
begin;
|
begin
|
||||||
inherited create('_$'+modulename+'$_L'+asmlabeltypeprefix[ltyp]+tostr(nr),AB_GLOBAL,AT_DATA);
|
inherited create('_$'+modulename+'$_L'+asmlabeltypeprefix[ltyp]+tostr(nr),AB_GLOBAL,AT_DATA);
|
||||||
labelnr:=nr;
|
labelnr:=nr;
|
||||||
labeltype:=ltyp;
|
labeltype:=ltyp;
|
||||||
@ -301,6 +313,23 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function tasmlabel.getaltcopy(altnr: longint): tasmsymbol;
|
||||||
|
begin;
|
||||||
|
result := inherited getaltcopy(altnr);
|
||||||
|
tasmlabel(result).labelnr:=labelnr;
|
||||||
|
tasmlabel(result).labeltype:=labeltype;
|
||||||
|
tasmlabel(result).is_set:=false;
|
||||||
|
case bind of
|
||||||
|
AB_GLOBAL:
|
||||||
|
result.increfs;
|
||||||
|
AB_LOCAL:
|
||||||
|
;
|
||||||
|
else
|
||||||
|
internalerror(2006053101);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
function tasmlabel.getname:string;
|
function tasmlabel.getname:string;
|
||||||
begin
|
begin
|
||||||
getname:=inherited getname;
|
getname:=inherited getname;
|
||||||
|
@ -369,7 +369,7 @@ implementation
|
|||||||
begin
|
begin
|
||||||
if not assigned(p.altsymbol) then
|
if not assigned(p.altsymbol) then
|
||||||
begin
|
begin
|
||||||
p.altsymbol:=tasmsymbol.create(p.name+'_'+tostr(FNextAltNr),p.bind,p.typ);
|
p.altsymbol:=p.getaltcopy(FNextAltNr);
|
||||||
FAsmSymbolDict.insert(p.altsymbol);
|
FAsmSymbolDict.insert(p.altsymbol);
|
||||||
FAltSymbolList.Add(p);
|
FAltSymbolList.Add(p);
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user