mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-19 20:39:25 +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
|
||||
sysutils,
|
||||
globals,
|
||||
verbose,tgobj,procinfo;
|
||||
verbose,tgobj,procinfo,cgobj;
|
||||
|
||||
procedure sort_movelist(ml:Pmovelist);
|
||||
|
||||
@ -2107,10 +2107,39 @@ unit rgobj;
|
||||
|
||||
|
||||
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
|
||||
hp,p,q:Tai;
|
||||
i:shortint;
|
||||
u:longint;
|
||||
s:string;
|
||||
{$ifdef arm}
|
||||
so:pshifterop;
|
||||
{$endif arm}
|
||||
@ -2158,17 +2187,17 @@ unit rgobj;
|
||||
begin
|
||||
if (cs_asm_source in current_settings.globalswitches) then
|
||||
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);
|
||||
if tai_varloc(p).newlocationhi<>NR_NO then
|
||||
begin
|
||||
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);
|
||||
setsupreg(tai_varloc(p).newlocationhi,reginfo[getsupreg(tai_varloc(p).newlocationhi)].colour);
|
||||
end;
|
||||
q:=tai(p.next);
|
||||
list.remove(p);
|
||||
|
Loading…
Reference in New Issue
Block a user