nutils.pas: Add new procedure:

procedure node_change_local_switch(p : tnode;cs : tlocalswitch;enable : boolean);
    to add/remove cs local switch from all p tnode tree localsettings.

    modify second_prefetch implementation in arm, ppcgen and x86 subdirectories
    to use node_change_local_settings to temporarily disabled
    checkpointer local switch, as prefetch is allowed even on unaccessible addresses.
    (previous code was buggy because I frogot that each node has it own localswitches).

git-svn-id: trunk@34576 -
This commit is contained in:
pierre 2016-09-29 21:34:34 +00:00
parent 3ba12f2fd7
commit 1e9491550d
4 changed files with 45 additions and 13 deletions

View File

@ -64,7 +64,7 @@ implementation
cpuinfo, defutil,symdef,aasmdata,aasmcpu,
cgbase,cgutils,pass_1,pass_2,
cpubase,ncgutil,cgobj,cgcpu, hlcgobj,
ncal;
nutils,ncal;
{*****************************************************************************
tarminlinenode
@ -384,12 +384,13 @@ implementation
begin
if not(GenerateThumbCode) and (CPUARM_HAS_EDSP in cpu_capabilities[current_settings.cputype]) then
begin
{ do not call Checkpointer for left node }
checkpointer_used:=(cs_checkpointer in current_settings.localswitches);
exclude(current_settings.localswitches,cs_checkpointer);
secondpass(left);
if checkpointer_used then
include(current_settings.localswitches,cs_checkpointer);
{ do not call Checkpointer for left node }
checkpointer_used:=(cs_checkpointer in current_settings.localswitches);
if checkpointer_used then
node_change_local_switch(left,cs_checkpointer,false);
secondpass(left);
if checkpointer_used then
node_change_local_switch(left,cs_checkpointer,false);
case left.location.loc of
LOC_CREFERENCE,
LOC_REFERENCE:

View File

@ -148,6 +148,9 @@ interface
{ excludes the flags passed in nf from the node tree passed }
procedure node_reset_flags(p : tnode;nf : tnodeflags);
{ include or exclude cs from p.localswitches }
procedure node_change_local_switch(p : tnode;cs : tlocalswitch;enable : boolean);
implementation
uses
@ -1404,4 +1407,30 @@ implementation
foreachnodestatic(p,@do_node_reset_flags,@nf);
end;
type
tlocalswitchchange = record
cs : tlocalswitch;
enable : boolean;
end;
plocalswitchchange = ^tlocalswitchchange;
function do_change_local_settings(var p : tnode;plsc : pointer) : foreachnoderesult;
begin
if plocalswitchchange(plsc)^.enable then
include(p.localswitches, plocalswitchchange(plsc)^.cs)
else
exclude(p.localswitches, plocalswitchchange(plsc)^.cs);
result:=fen_true;
end;
procedure node_change_local_switch(p : tnode;cs : tlocalswitch;enable : boolean);
var
lsc : tlocalswitchchange;
begin
lsc.cs:=cs;
lsc.enable:=enable;
foreachnodestatic(p,@do_change_local_settings,@lsc);
end;
end.

View File

@ -59,7 +59,7 @@ implementation
symconst,symdef,
defutil,
cgbase,pass_2,
cpuinfo,ncgutil,
cpuinfo,ncgutil,nutils,
hlcgobj,cgutils,cgobj,rgobj,tgobj;
@ -209,10 +209,11 @@ implementation
begin
{ do not call Checkpointer for left node }
checkpointer_used:=(cs_checkpointer in current_settings.localswitches);
exclude(current_settings.localswitches,cs_checkpointer);
if checkpointer_used then
node_change_local_switch(left,cs_checkpointer,false);
secondpass(left);
if checkpointer_used then
include(current_settings.localswitches,cs_checkpointer);
node_change_local_switch(left,cs_checkpointer,false);
case left.location.loc of
LOC_CREFERENCE,
LOC_REFERENCE:

View File

@ -84,7 +84,7 @@ implementation
aasmbase,aasmtai,aasmdata,aasmcpu,
symtype,symdef,symcpu,
cgbase,pass_2,
cpuinfo,cpubase,paramgr,
cpuinfo,cpubase,paramgr,nutils,
nbas,ncon,ncal,ncnv,nld,ncgutil,
tgobj,
cga,cgutils,cgx86,cgobj,hlcgobj;
@ -599,10 +599,11 @@ implementation
begin
{ do not call Checkpointer for left node }
checkpointer_used:=(cs_checkpointer in current_settings.localswitches);
exclude(current_settings.localswitches,cs_checkpointer);
if checkpointer_used then
node_change_local_switch(left,cs_checkpointer,false);
secondpass(left);
if checkpointer_used then
include(current_settings.localswitches,cs_checkpointer);
node_change_local_switch(left,cs_checkpointer,false);
case left.location.loc of
LOC_CREFERENCE,
LOC_REFERENCE: