浏览代码

* removed extra deallocation and allocation of function result
registers, allows for most optimal code possible to be generated
for trivial functions (but in some cases worsens generated code
because the register allocator is not 100% optimal)

git-svn-id: trunk@2208 -

Jonas Maebe 19 年之前
父节点
当前提交
c54826b403
共有 1 个文件被更改,包括 0 次插入11 次删除
  1. 0 11
      compiler/ncgutil.pas

+ 0 - 11
compiler/ncgutil.pas

@@ -1183,9 +1183,6 @@ implementation
                       if getsupreg(resloc.register64.reglo)<first_int_imreg then
                       if getsupreg(resloc.register64.reglo)<first_int_imreg then
                         begin
                         begin
                           cg.getcpuregister(list,resloc.register64.reglo);
                           cg.getcpuregister(list,resloc.register64.reglo);
-                          cg.ungetcpuregister(list,resloc.register64.reglo);
-                          { for the optimizer }
-                          cg.a_reg_alloc(list,resloc.register64.reglo);
                         end;
                         end;
                       case restmploc.loc of
                       case restmploc.loc of
                         LOC_REFERENCE :
                         LOC_REFERENCE :
@@ -1203,9 +1200,6 @@ implementation
                       if getsupreg(resloc.register64.reghi)<first_int_imreg then
                       if getsupreg(resloc.register64.reghi)<first_int_imreg then
                         begin
                         begin
                           cg.getcpuregister(list,resloc.register64.reghi);
                           cg.getcpuregister(list,resloc.register64.reghi);
-                          cg.ungetcpuregister(list,resloc.register64.reghi);
-                          { for the optimizer }
-                          cg.a_reg_alloc(list,resloc.register64.reghi);
                         end;
                         end;
                       case restmploc.loc of
                       case restmploc.loc of
                         LOC_REFERENCE :
                         LOC_REFERENCE :
@@ -1228,9 +1222,6 @@ implementation
                       if getsupreg(funcretloc.register)<first_int_imreg then
                       if getsupreg(funcretloc.register)<first_int_imreg then
                         begin
                         begin
                           cg.getcpuregister(list,funcretloc.register);
                           cg.getcpuregister(list,funcretloc.register);
-                          cg.ungetcpuregister(list,hreg);
-                          { for the optimizer }
-                          cg.a_reg_alloc(list,funcretloc.register);
                         end;
                         end;
                       { it could be that a structure is passed in memory but the function is expected to
                       { it could be that a structure is passed in memory but the function is expected to
                         return a pointer to this memory }
                         return a pointer to this memory }
@@ -1245,7 +1236,6 @@ implementation
                   if getsupreg(funcretloc.register)<first_fpu_imreg then
                   if getsupreg(funcretloc.register)<first_fpu_imreg then
                     begin
                     begin
                       cg.getcpuregister(list,funcretloc.register);
                       cg.getcpuregister(list,funcretloc.register);
-                      cg.ungetcpuregister(list,funcretloc.register);
                     end;
                     end;
                   { we can't do direct moves between fpu and mm registers }
                   { we can't do direct moves between fpu and mm registers }
                   if restmploc.loc in [LOC_MMREGISTER,LOC_CMMREGISTER] then
                   if restmploc.loc in [LOC_MMREGISTER,LOC_CMMREGISTER] then
@@ -1257,7 +1247,6 @@ implementation
                   if getsupreg(funcretloc.register)<first_mm_imreg then
                   if getsupreg(funcretloc.register)<first_mm_imreg then
                     begin
                     begin
                       cg.getcpuregister(list,funcretloc.register);
                       cg.getcpuregister(list,funcretloc.register);
-                      cg.ungetcpuregister(list,funcretloc.register);
                     end;
                     end;
                   cg.a_loadmm_loc_reg(list,restmploc.size,restmploc,funcretloc.register,mms_movescalar);
                   cg.a_loadmm_loc_reg(list,restmploc.size,restmploc,funcretloc.register,mms_movescalar);
                 end;
                 end;