ソースを参照

* take care of po_noreturn in more cases

git-svn-id: trunk@47623 -
florian 4 年 前
コミット
5ca2356638
2 ファイル変更9 行追加0 行削除
  1. 5 0
      compiler/m68k/cgcpu.pas
  2. 4 0
      compiler/ncgutil.pas

+ 5 - 0
compiler/m68k/cgcpu.pas

@@ -1884,6 +1884,11 @@ unit cgcpu;
         ref : TReference;
         ref2: TReference;
       begin
+        { if a subroutine is marked as non-returning, we do
+          not generate any exit code, so we really trust the noreturn directive
+        }
+        if po_noreturn in current_procinfo.procdef.procoptions then
+          exit;
         if not nostackframe then
           begin
             list.concat(taicpu.op_reg(A_UNLK,S_NO,NR_FRAME_POINTER_REG));

+ 4 - 0
compiler/ncgutil.pas

@@ -870,6 +870,8 @@ implementation
 
     procedure gen_save_used_regs(list:TAsmList);
       begin
+        if po_noreturn in current_procinfo.procdef.procoptions then
+          exit;
         { Pure assembler routines need to save the registers themselves }
         if (po_assembler in current_procinfo.procdef.procoptions) then
           exit;
@@ -880,6 +882,8 @@ implementation
 
     procedure gen_restore_used_regs(list:TAsmList);
       begin
+        if po_noreturn in current_procinfo.procdef.procoptions then
+          exit;
         { Pure assembler routines need to save the registers themselves }
         if (po_assembler in current_procinfo.procdef.procoptions) then
           exit;