Browse Source

* reduce register usage in tcgmoddivnode.pass_generate_code

florian 22 giờ trước cách đây
mục cha
commit
e9026b2a1c
1 tập tin đã thay đổi với 7 bổ sung2 xóa
  1. 7 2
      compiler/ncgmat.pas

+ 7 - 2
compiler/ncgmat.pas

@@ -438,8 +438,13 @@ implementation
                   { hdenom is always free, it's }
                   { only used for temporary }
                   { purposes                }
-                  hdenom := cg.getintregister(current_asmdata.CurrAsmList,OS_INT);
-                  hlcg.a_load_loc_reg(current_asmdata.CurrAsmList,right.resultdef,osuinttype,right.location,hdenom);
+                  if not(right.location.loc in [LOC_CREGISTER,LOC_REGISTER]) then
+                    begin
+                      hdenom := cg.getintregister(current_asmdata.CurrAsmList,OS_INT);
+                      hlcg.a_load_loc_reg(current_asmdata.CurrAsmList,right.resultdef,osuinttype,right.location,hdenom);
+                    end
+                  else
+                    hdenom:=right.location.register;
                   { verify if the divisor is zero, if so return an error immediately,
                     except if we have a const node, where we don't need this, because
                     then zero check was done earlier.