浏览代码

* patch by Jeppe Johansen: fixes TCGMIPS.getfpuregister

git-svn-id: trunk@21419 -
florian 13 年之前
父节点
当前提交
1b3dd8eefe
共有 1 个文件被更改,包括 14 次插入4 次删除
  1. 14 4
      compiler/mips/cgcpu.pas

+ 14 - 4
compiler/mips/cgcpu.pas

@@ -544,7 +544,7 @@ end;
 function TCGMIPS.getfpuregister(list: tasmlist; size: Tcgsize): Tregister;
 function TCGMIPS.getfpuregister(list: tasmlist; size: Tcgsize): Tregister;
 begin
 begin
   if size = OS_F64 then
   if size = OS_F64 then
-    Result := rg[R_FPUREGISTER].getregister(list, R_SUBFS)
+    Result := rg[R_FPUREGISTER].getregister(list, R_SUBFD)
   else
   else
     Result := rg[R_FPUREGISTER].getregister(list, R_SUBFS);
     Result := rg[R_FPUREGISTER].getregister(list, R_SUBFS);
 end;
 end;
@@ -1484,9 +1484,19 @@ begin
              end;
              end;
          end;
          end;
 
 
-       list.concat(taicpu.op_reg(A_J, NR_R31));
-       { correct stack pointer in the delay slot }
-       list.concat(Taicpu.Op_reg_reg_const(A_ADDIU, NR_STACK_POINTER_REG, NR_STACK_POINTER_REG, stacksize));
+       if (-stacksize >= simm16lo) and (-stacksize <= simm16hi) then
+         begin
+           list.concat(taicpu.op_reg(A_J, NR_R31));
+           { correct stack pointer in the delay slot }
+           list.concat(Taicpu.Op_reg_reg_const(A_ADDIU, NR_STACK_POINTER_REG, NR_STACK_POINTER_REG, stacksize));
+         end
+       else
+         begin
+           a_load_const_reg(list,OS_32,stacksize,NR_R1);
+           list.concat(taicpu.op_reg(A_J, NR_R31));
+           { correct stack pointer in the delay slot }
+           list.concat(taicpu.op_reg_reg_reg(A_ADD,NR_STACK_POINTER_REG,NR_STACK_POINTER_REG,NR_R1));
+         end;
        list.concat(Taicpu.op_none(A_P_SET_MACRO));
        list.concat(Taicpu.op_none(A_P_SET_MACRO));
        list.concat(Taicpu.op_none(A_P_SET_REORDER));
        list.concat(Taicpu.op_none(A_P_SET_REORDER));
     end;
     end;