summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorflorian <florian@3ad0048d-3df7-0310-abae-a5850022a9f2>2020-11-28 16:02:51 +0000
committerflorian <florian@3ad0048d-3df7-0310-abae-a5850022a9f2>2020-11-28 16:02:51 +0000
commitd784744c2620d1fbde26dec0f9f840911fad147a (patch)
treeacf30fd79c0743ba9adc8eec49a576de5eeb92e7
parent1620bb568539ca015ce657f5cc709dfab5c25a8e (diff)
downloadfpc-d784744c2620d1fbde26dec0f9f840911fad147a.tar.gz
* take care of po_noreturn in more cases
git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@47623 3ad0048d-3df7-0310-abae-a5850022a9f2
-rw-r--r--compiler/m68k/cgcpu.pas5
-rw-r--r--compiler/ncgutil.pas4
2 files changed, 9 insertions, 0 deletions
diff --git a/compiler/m68k/cgcpu.pas b/compiler/m68k/cgcpu.pas
index 79d1c07e3c..d24ac8060a 100644
--- a/compiler/m68k/cgcpu.pas
+++ b/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));
diff --git a/compiler/ncgutil.pas b/compiler/ncgutil.pas
index a7c129ec82..e5f16bb920 100644
--- a/compiler/ncgutil.pas
+++ b/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;