From 82e6e1eb3453ddd6c41f9a765766d1c7d2aabab7 Mon Sep 17 00:00:00 2001 From: florian Date: Sat, 5 Nov 2016 23:05:41 +0000 Subject: [PATCH] + tempinfo flag ti_no_final_regsync which prevents that the final reg. sync. is emitted git-svn-id: trunk@34787 - --- compiler/nbas.pas | 8 ++++++-- compiler/ncgbas.pas | 12 ++++++------ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/compiler/nbas.pas b/compiler/nbas.pas index 165ed106c1..f0ac721b7d 100644 --- a/compiler/nbas.pas +++ b/compiler/nbas.pas @@ -159,12 +159,16 @@ interface that temp is not deallocated until this temp is deleted (since otherwise the assigned value may be freed before the last use of the temp) } - ti_const + ti_const, + { the temp. needs no final sync instruction if it is located in a register, + so there are no loops involved in the usage of the temp. + } + ti_no_final_regsync ); ttempinfoflags = set of ttempinfoflag; const - tempinfostoreflags = [ti_may_be_in_reg,ti_addr_taken,ti_reference,ti_readonly]; + tempinfostoreflags = [ti_may_be_in_reg,ti_addr_taken,ti_reference,ti_readonly,ti_no_final_regsync]; type { to allow access to the location by temp references even after the temp has } diff --git a/compiler/ncgbas.pas b/compiler/ncgbas.pas index c9a610581c..0f61722e31 100644 --- a/compiler/ncgbas.pas +++ b/compiler/ncgbas.pas @@ -567,8 +567,8 @@ interface LOC_CREGISTER, LOC_REGISTER: begin - if not(cs_opt_regvar in current_settings.optimizerswitches) or - (pi_has_label in current_procinfo.flags) then + if (not(cs_opt_regvar in current_settings.optimizerswitches) or + (pi_has_label in current_procinfo.flags)) and not(ti_no_final_regsync in tempflags) then begin { make sure the register allocator doesn't reuse the } { register e.g. in the middle of a loop } @@ -632,8 +632,8 @@ interface LOC_CFPUREGISTER, LOC_FPUREGISTER: begin - if not(cs_opt_regvar in current_settings.optimizerswitches) or - (pi_has_label in current_procinfo.flags) then + if (not(cs_opt_regvar in current_settings.optimizerswitches) or + (pi_has_label in current_procinfo.flags)) and not(ti_no_final_regsync in tempflags) then begin { make sure the register allocator doesn't reuse the } { register e.g. in the middle of a loop } @@ -647,8 +647,8 @@ interface LOC_CMMREGISTER, LOC_MMREGISTER: begin - if not(cs_opt_regvar in current_settings.optimizerswitches) or - (pi_has_label in current_procinfo.flags) then + if (not(cs_opt_regvar in current_settings.optimizerswitches) or + (pi_has_label in current_procinfo.flags)) and not(ti_no_final_regsync in tempflags) then begin { make sure the register allocator doesn't reuse the } { register e.g. in the middle of a loop }