浏览代码

* genlinearlist and genlinearcmplist for case blocks now allocate the flags properly

J. Gareth "Curious Kit" Moreton 1 年之前
父节点
当前提交
cba0ca490e
共有 4 个文件被更改,包括 13 次插入0 次删除
  1. 2 0
      compiler/aarch64/ncpuset.pas
  2. 2 0
      compiler/arm/narmset.pas
  3. 5 0
      compiler/ncgset.pas
  4. 4 0
      compiler/x86/nx86set.pas

+ 2 - 0
compiler/aarch64/ncpuset.pas

@@ -177,7 +177,9 @@ implementation
                 last:=0;
                 lastrange:=false;
                 first:=true;
+                cg.a_reg_alloc(current_asmdata.CurrAsmList, NR_DEFAULTFLAGS);
                 genitem(hp);
+                cg.a_reg_dealloc(current_asmdata.CurrAsmList, NR_DEFAULTFLAGS);
                 cg.a_jmp_always(current_asmdata.CurrAsmList,elselabel);
              end;
         end;

+ 2 - 0
compiler/arm/narmset.pas

@@ -406,7 +406,9 @@ implementation
                 last:=0;
                 lastrange:=false;
                 first:=true;
+                cg.a_reg_alloc(current_asmdata.CurrAsmList, NR_DEFAULTFLAGS);
                 genitem(hp);
+                cg.a_reg_dealloc(current_asmdata.CurrAsmList, NR_DEFAULTFLAGS);
                 cg.a_jmp_always(current_asmdata.CurrAsmList,elselabel);
              end;
         end;

+ 5 - 0
compiler/ncgset.pas

@@ -769,11 +769,13 @@ implementation
                   last:=0;
                   first:=true;
                   scratch_reg:=hlcg.getintregister(current_asmdata.CurrAsmList,opsize);
+                  cg.a_reg_alloc(current_asmdata.CurrAsmList,NR_DEFAULTFLAGS);
                   genitem(hp);
                 end
               else
                 begin
                   { If only one label exists, we can greatly simplify the checks to a simple comparison }
+                  cg.a_reg_alloc(current_asmdata.CurrAsmList,NR_DEFAULTFLAGS);
                   if hp^._low=hp^._high then
                     hlcg.a_cmp_const_reg_label(current_asmdata.CurrAsmList, opsize, OC_EQ, tcgint(hp^._low.svalue), hregister, blocklabel(hp^.blockid))
                   else
@@ -783,6 +785,7 @@ implementation
                       hlcg.a_cmp_const_reg_label(current_asmdata.CurrAsmList, opsize, OC_BE, tcgint(hp^._high.svalue-hp^._low.svalue), hregister, blocklabel(hp^.blockid))
                     end;
                 end;
+              cg.a_reg_dealloc(current_asmdata.CurrAsmList,NR_DEFAULTFLAGS);
               hlcg.a_jmp_always(current_asmdata.CurrAsmList,elselabel);
            end;
       end;
@@ -1080,7 +1083,9 @@ implementation
       begin
          last:=0;
          lastwasrange:=false;
+         cg.a_reg_alloc(current_asmdata.CurrAsmList,NR_DEFAULTFLAGS);
          genitem(hp);
+         cg.a_reg_dealloc(current_asmdata.CurrAsmList,NR_DEFAULTFLAGS);
          hlcg.a_jmp_always(current_asmdata.CurrAsmList,elselabel);
       end;
 

+ 4 - 0
compiler/x86/nx86set.pas

@@ -240,8 +240,10 @@ implementation
                     cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList, opcgsize, OC_EQ,0,hregister,blocklabel(t^.blockid))
                   else
                     begin
+                      cg.a_reg_alloc(current_asmdata.CurrAsmList, NR_DEFAULTFLAGS);
                       cg.a_op_const_reg(current_asmdata.CurrAsmList, OP_SUB, opcgsize, aint(t^._low.svalue-last.svalue), hregister);
                       cg.a_jmp_flags(current_asmdata.CurrAsmList,F_E,blocklabel(t^.blockid));
+                      cg.a_reg_dealloc(current_asmdata.CurrAsmList, NR_DEFAULTFLAGS);
                     end;
                   last:=t^._low;
                   lastrange:=false;
@@ -252,6 +254,7 @@ implementation
                   { it begins with the smallest label, if the value }
                   { is even smaller then jump immediately to the    }
                   { ELSE-label                                }
+                  cg.a_reg_alloc(current_asmdata.CurrAsmList, NR_DEFAULTFLAGS);
                   if first then
                     begin
                        { have we to ajust the first value ? }
@@ -287,6 +290,7 @@ implementation
                     cg.a_op_const_reg(current_asmdata.CurrAsmList, OP_SUB, opcgsize, range, hregister);
 
                   cg.a_jmp_flags(current_asmdata.CurrAsmList,cond_le,blocklabel(t^.blockid));
+                  cg.a_reg_dealloc(current_asmdata.CurrAsmList, NR_DEFAULTFLAGS);
                   last:=t^._high;
                   lastrange:=true;
                end;