mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-13 11:59:19 +02:00
* In assembly comments include all used registers by a variable for 8/16 bit CPUs.
* Do not add comments about unused varlocs. git-svn-id: trunk@46296 -
This commit is contained in:
parent
16c9d406e1
commit
d9db680937
@ -320,7 +320,7 @@ unit rgobj;
|
|||||||
uses
|
uses
|
||||||
sysutils,
|
sysutils,
|
||||||
globals,
|
globals,
|
||||||
verbose,tgobj,procinfo;
|
verbose,tgobj,procinfo,cgobj;
|
||||||
|
|
||||||
procedure sort_movelist(ml:Pmovelist);
|
procedure sort_movelist(ml:Pmovelist);
|
||||||
|
|
||||||
@ -2107,10 +2107,39 @@ unit rgobj;
|
|||||||
|
|
||||||
|
|
||||||
procedure Trgobj.translate_registers(list:TAsmList);
|
procedure Trgobj.translate_registers(list:TAsmList);
|
||||||
|
|
||||||
|
function get_reg_name_full(r: tregister): string;
|
||||||
|
var
|
||||||
|
rr:tregister;
|
||||||
|
sr:TSuperRegister;
|
||||||
|
begin
|
||||||
|
rr:=r;
|
||||||
|
sr:=getsupreg(r);
|
||||||
|
if reginfo[sr].live_start=nil then
|
||||||
|
begin
|
||||||
|
result:='';
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
setsupreg(rr,reginfo[sr].colour);
|
||||||
|
result:=std_regname(rr);
|
||||||
|
{$if defined(cpu8bitalu) or defined(cpu16bitalu)}
|
||||||
|
if sr<first_int_imreg then
|
||||||
|
exit;
|
||||||
|
while cg.has_next_reg[sr] do
|
||||||
|
begin
|
||||||
|
r:=cg.GetNextReg(r);
|
||||||
|
sr:=getsupreg(r);
|
||||||
|
setsupreg(rr,reginfo[sr].colour);
|
||||||
|
result:=result+':'+std_regname(rr);
|
||||||
|
end;
|
||||||
|
{$endif defined(cpu8bitalu) or defined(cpu16bitalu)}
|
||||||
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
hp,p,q:Tai;
|
hp,p,q:Tai;
|
||||||
i:shortint;
|
i:shortint;
|
||||||
u:longint;
|
u:longint;
|
||||||
|
s:string;
|
||||||
{$ifdef arm}
|
{$ifdef arm}
|
||||||
so:pshifterop;
|
so:pshifterop;
|
||||||
{$endif arm}
|
{$endif arm}
|
||||||
@ -2158,17 +2187,17 @@ unit rgobj;
|
|||||||
begin
|
begin
|
||||||
if (cs_asm_source in current_settings.globalswitches) then
|
if (cs_asm_source in current_settings.globalswitches) then
|
||||||
begin
|
begin
|
||||||
|
s:=get_reg_name_full(tai_varloc(p).newlocation);
|
||||||
|
if s<>'' then
|
||||||
|
begin
|
||||||
|
if tai_varloc(p).newlocationhi<>NR_NO then
|
||||||
|
s:=get_reg_name_full(tai_varloc(p).newlocationhi)+':'+s;
|
||||||
|
hp:=Tai_comment.Create(strpnew('Var '+tai_varloc(p).varsym.realname+' located in register '+s));
|
||||||
|
list.insertafter(hp,p);
|
||||||
|
end;
|
||||||
setsupreg(tai_varloc(p).newlocation,reginfo[getsupreg(tai_varloc(p).newlocation)].colour);
|
setsupreg(tai_varloc(p).newlocation,reginfo[getsupreg(tai_varloc(p).newlocation)].colour);
|
||||||
if tai_varloc(p).newlocationhi<>NR_NO then
|
if tai_varloc(p).newlocationhi<>NR_NO then
|
||||||
begin
|
setsupreg(tai_varloc(p).newlocationhi,reginfo[getsupreg(tai_varloc(p).newlocationhi)].colour);
|
||||||
setsupreg(tai_varloc(p).newlocationhi,reginfo[getsupreg(tai_varloc(p).newlocationhi)].colour);
|
|
||||||
hp:=Tai_comment.Create(strpnew('Var '+tai_varloc(p).varsym.realname+' located in register '+
|
|
||||||
std_regname(tai_varloc(p).newlocationhi)+':'+std_regname(tai_varloc(p).newlocation)));
|
|
||||||
end
|
|
||||||
else
|
|
||||||
hp:=Tai_comment.Create(strpnew('Var '+tai_varloc(p).varsym.realname+' located in register '+
|
|
||||||
std_regname(tai_varloc(p).newlocation)));
|
|
||||||
list.insertafter(hp,p);
|
|
||||||
end;
|
end;
|
||||||
q:=tai(p.next);
|
q:=tai(p.next);
|
||||||
list.remove(p);
|
list.remove(p);
|
||||||
|
Loading…
Reference in New Issue
Block a user