瀏覽代碼

MIPS: use OC_EQ instead of OC_NE for new_exception to avoid branch out of range error

git-svn-id: trunk@21791 -
pierre 13 年之前
父節點
當前提交
b63bc6be13
共有 1 個文件被更改,包括 11 次插入1 次删除
  1. 11 1
      compiler/ncgutil.pas

+ 11 - 1
compiler/ncgutil.pas

@@ -413,6 +413,9 @@ implementation
     procedure new_exception(list:TAsmList;const t:texceptiontemps;exceptlabel:tasmlabel);
       var
         paraloc1,paraloc2,paraloc3 : tcgpara;
+{$ifdef MIPS}
+		sbl : tasmlabel;
+{$endif MIPS}
       begin
         paraloc1.init;
         paraloc2.init;
@@ -440,7 +443,14 @@ implementation
         cg.alloccpuregisters(list,R_INTREGISTER,[RS_FUNCTION_RESULT_REG]);
 
         cg.g_exception_reason_save(list, t.reasonbuf);
-        cg.a_cmp_const_reg_label(list,OS_S32,OC_NE,0,cg.makeregsize(list,NR_FUNCTION_RESULT_REG,OS_S32),exceptlabel);
+{$ifdef MIPS}
+        current_asmdata.getjumplabel(sbl);
+		cg.a_cmp_const_reg_label(list,OS_S32,OC_EQ,0,cg.makeregsize(list,NR_FUNCTION_RESULT_REG,OS_S32),sbl);
+        cg.a_jmp_always(list,exceptlabel);
+        cg.a_label(list,sbl);
+{$else not MIPS}
+          cg.a_cmp_const_reg_label(list,OS_S32,OC_NE,0,cg.makeregsize(list,NR_FUNCTION_RESULT_REG,OS_S32),exceptlabel);
+{$endif not MIPS}
         cg.dealloccpuregisters(list,R_INTREGISTER,[RS_FUNCTION_RESULT_REG]);
         paraloc1.done;
         paraloc2.done;