瀏覽代碼

+ tempinfo flag ti_no_final_regsync which prevents that the final reg. sync. is emitted

git-svn-id: trunk@34787 -
florian 8 年之前
父節點
當前提交
82e6e1eb34
共有 2 個文件被更改,包括 12 次插入8 次删除
  1. 6 2
      compiler/nbas.pas
  2. 6 6
      compiler/ncgbas.pas

+ 6 - 2
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 }

+ 6 - 6
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              }