From 41c9661d6da2baa5e6bc765b81cdbd3526f9e1d8 Mon Sep 17 00:00:00 2001 From: Yuriy Sydorov Date: Tue, 2 Nov 2021 13:01:44 +0200 Subject: [PATCH] * The label which is generated by traisenode is not a jump target. Mark this label as nf_internal, which means the label does not impact the code flow. This leads to a much better register allocation. (cherry picked from commit e04df465efe7fdbdc8ebe6b812789daa0bea0e25) --- compiler/ncgflw.pas | 4 ++-- compiler/nflw.pas | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/compiler/ncgflw.pas b/compiler/ncgflw.pas index 70c42d7182..0f38f88810 100644 --- a/compiler/ncgflw.pas +++ b/compiler/ncgflw.pas @@ -512,8 +512,8 @@ implementation procedure tcglabelnode.pass_generate_code; begin location_reset(location,LOC_VOID,OS_NO); - - include(flowcontrol,fc_gotolabel); + if not (nf_internal in flags) then + include(flowcontrol,fc_gotolabel); {$ifdef OLDREGVARS} load_all_regvars(current_asmdata.CurrAsmList); {$endif OLDREGVARS} diff --git a/compiler/nflw.pas b/compiler/nflw.pas index 3896810ce1..fc393f4d7c 100644 --- a/compiler/nflw.pas +++ b/compiler/nflw.pas @@ -2118,7 +2118,8 @@ implementation result:=nil; expectloc:=LOC_VOID; - include(current_procinfo.flags,pi_has_label); + if not (nf_internal in flags) then + include(current_procinfo.flags,pi_has_label); if assigned(labsym) and labsym.nonlocal then begin @@ -2223,6 +2224,7 @@ implementation begin third:=cinlinenode.create(in_get_frame,false,nil); current_addr:=clabelnode.create(cnothingnode.create,clabelsym.create('$raiseaddr')); + current_addr.toggleflag(nf_internal); addstatement(statements,current_addr); right:=caddrnode.create(cloadnode.create(current_addr.labsym,current_addr.labsym.owner)); end;