瀏覽代碼

* 16-bit and 8-bit ALU fixes in tcgtempdeletenode.pass_generate_code

git-svn-id: trunk@26272 -
nickysn 11 年之前
父節點
當前提交
99770d367f
共有 1 個文件被更改,包括 44 次插入2 次删除
  1. 44 2
      compiler/ncgbas.pas

+ 44 - 2
compiler/ncgbas.pas

@@ -554,14 +554,56 @@ interface
                 begin
                 begin
                   { make sure the register allocator doesn't reuse the }
                   { make sure the register allocator doesn't reuse the }
                   { register e.g. in the middle of a loop              }
                   { register e.g. in the middle of a loop              }
-{$ifndef cpu64bitalu}
+{$if defined(cpu32bitalu)}
                   if tempinfo^.location.size in [OS_64,OS_S64] then
                   if tempinfo^.location.size in [OS_64,OS_S64] then
                     begin
                     begin
                       cg.a_reg_sync(current_asmdata.CurrAsmList,tempinfo^.location.register64.reghi);
                       cg.a_reg_sync(current_asmdata.CurrAsmList,tempinfo^.location.register64.reghi);
                       cg.a_reg_sync(current_asmdata.CurrAsmList,tempinfo^.location.register64.reglo);
                       cg.a_reg_sync(current_asmdata.CurrAsmList,tempinfo^.location.register64.reglo);
                     end
                     end
                   else
                   else
-{$endif not cpu64bitalu}
+{$elseif defined(cpu16bitalu)}
+                  if tempinfo^.location.size in [OS_64,OS_S64] then
+                    begin
+                      cg.a_reg_sync(current_asmdata.CurrAsmList,tempinfo^.location.register64.reghi);
+                      cg.a_reg_sync(current_asmdata.CurrAsmList,GetNextReg(tempinfo^.location.register64.reghi));
+                      cg.a_reg_sync(current_asmdata.CurrAsmList,tempinfo^.location.register64.reglo);
+                      cg.a_reg_sync(current_asmdata.CurrAsmList,GetNextReg(tempinfo^.location.register64.reglo));
+                    end
+                  else
+                  if tempinfo^.location.size in [OS_32,OS_S32] then
+                    begin
+                      cg.a_reg_sync(current_asmdata.CurrAsmList,tempinfo^.location.register);
+                      cg.a_reg_sync(current_asmdata.CurrAsmList,GetNextReg(tempinfo^.location.register));
+                    end
+                  else
+{$elseif defined(cpu8bitalu)}
+                  if tempinfo^.location.size in [OS_64,OS_S64] then
+                    begin
+                      cg.a_reg_sync(current_asmdata.CurrAsmList,tempinfo^.location.register64.reghi);
+                      cg.a_reg_sync(current_asmdata.CurrAsmList,GetNextReg(tempinfo^.location.register64.reghi));
+                      cg.a_reg_sync(current_asmdata.CurrAsmList,GetNextReg(GetNextReg(tempinfo^.location.register64.reghi)));
+                      cg.a_reg_sync(current_asmdata.CurrAsmList,GetNextReg(GetNextReg(GetNextReg(tempinfo^.location.register64.reghi))));
+                      cg.a_reg_sync(current_asmdata.CurrAsmList,tempinfo^.location.register64.reglo);
+                      cg.a_reg_sync(current_asmdata.CurrAsmList,GetNextReg(tempinfo^.location.register64.reglo));
+                      cg.a_reg_sync(current_asmdata.CurrAsmList,GetNextReg(GetNextReg(tempinfo^.location.register64.reglo)));
+                      cg.a_reg_sync(current_asmdata.CurrAsmList,GetNextReg(GetNextReg(GetNextReg(tempinfo^.location.register64.reglo))));
+                    end
+                  else
+                  if tempinfo^.location.size in [OS_32,OS_S32] then
+                    begin
+                      cg.a_reg_sync(current_asmdata.CurrAsmList,tempinfo^.location.register);
+                      cg.a_reg_sync(current_asmdata.CurrAsmList,GetNextReg(tempinfo^.location.register));
+                      cg.a_reg_sync(current_asmdata.CurrAsmList,GetNextReg(GetNextReg(tempinfo^.location.register)));
+                      cg.a_reg_sync(current_asmdata.CurrAsmList,GetNextReg(GetNextReg(GetNextReg(tempinfo^.location.register))));
+                    end
+                  else
+                  if tempinfo^.location.size in [OS_16,OS_S16] then
+                    begin
+                      cg.a_reg_sync(current_asmdata.CurrAsmList,tempinfo^.location.register);
+                      cg.a_reg_sync(current_asmdata.CurrAsmList,GetNextReg(tempinfo^.location.register));
+                    end
+                  else
+{$endif}
                     cg.a_reg_sync(current_asmdata.CurrAsmList,tempinfo^.location.register);
                     cg.a_reg_sync(current_asmdata.CurrAsmList,tempinfo^.location.register);
                 end;
                 end;
               if release_to_normal then
               if release_to_normal then