瀏覽代碼

m68k: while updating reference, don't reallocate and copy the index to another register if we can apply scaling for it and we don't need to multiply, so the maybe_const_reg doesn't change. this improves generated code when a const reg (eg: a loop counter) is used as array index

git-svn-id: trunk@32830 -
Károly Balogh 9 年之前
父節點
當前提交
ff7a0c5235
共有 1 個文件被更改,包括 2 次插入3 次删除
  1. 2 3
      compiler/m68k/n68kmem.pas

+ 2 - 3
compiler/m68k/n68kmem.pas

@@ -72,7 +72,6 @@ implementation
         if l<>1 then
           begin
             //current_asmdata.CurrAsmList.concat(tai_comment.create(strpnew('updref: l <> 1')));
-            hreg:=cg.getintregister(current_asmdata.CurrAsmList,OS_32);
             { if we have a possibility, setup a scalefactor instead of the MUL }
             if (location.reference.index<>NR_NO) or
                (current_settings.cputype in [cpu_mc68000]) or
@@ -80,15 +79,15 @@ implementation
                not (l in [2,4,8]) then
               begin
                 //current_asmdata.CurrAsmList.concat(tai_comment.create(strpnew('updref: mul')));
+                hreg:=cg.getintregister(current_asmdata.CurrAsmList,OS_32);
                 cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,OP_IMUL,OS_ADDR,l,maybe_const_reg,hreg);
+                maybe_const_reg:=hreg;
               end
             else
               begin
                 //current_asmdata.CurrAsmList.concat(tai_comment.create(strpnew('updref: scale')));
-                cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,maybe_const_reg,hreg);
                 scaled:=true;
               end;
-            maybe_const_reg:=hreg;
           end;
 
         if (location.reference.base=NR_NO) and not (scaled) then