mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-27 10:13:35 +02:00
+ TAILREC optimizer switch
git-svn-id: trunk@4849 -
This commit is contained in:
parent
71665dbc4c
commit
82b7b785f7
@ -149,7 +149,7 @@ than 255 characters. That's why using Ansi Strings}
|
||||
toptimizerswitch = (cs_opt_none,
|
||||
cs_opt_level1,cs_opt_level2,cs_opt_level3,
|
||||
cs_opt_regvar,cs_opt_uncertain,cs_opt_size,cs_opt_stackframe,
|
||||
cs_opt_peephole,cs_opt_asmcse,cs_opt_loopunroll
|
||||
cs_opt_peephole,cs_opt_asmcse,cs_opt_loopunroll,cs_opt_tailrecursion
|
||||
);
|
||||
toptimizerswitches = set of toptimizerswitch;
|
||||
|
||||
@ -157,7 +157,7 @@ than 255 characters. That's why using Ansi Strings}
|
||||
OptimizerSwitchStr : array[toptimizerswitch] of string[10] = ('',
|
||||
'LEVEL1','LEVEL2','LEVEL3',
|
||||
'REGVAR','UNCERTAIN','SIZE','STACKFRAME',
|
||||
'PEEPHOLE','ASMCSE','LOOPUNROLL'
|
||||
'PEEPHOLE','ASMCSE','LOOPUNROLL','TAILREC'
|
||||
);
|
||||
|
||||
type
|
||||
|
@ -100,7 +100,8 @@ implementation
|
||||
pbase,pstatmnt,pdecl,pdecsub,pexports,
|
||||
{ codegen }
|
||||
tgobj,cgbase,cgobj,dbgbase,
|
||||
ncgutil,regvars
|
||||
ncgutil,regvars,
|
||||
opttail
|
||||
{$if defined(arm) or defined(powerpc) or defined(powerpc64)}
|
||||
,aasmcpu
|
||||
{$endif arm}
|
||||
@ -727,6 +728,12 @@ implementation
|
||||
if code.registersfpu>0 then
|
||||
include(flags,pi_uses_fpu);
|
||||
|
||||
{ do this before adding the entry code else the tail recursion recognition won't work,
|
||||
if this causes troubles, it must be ifdef'ed
|
||||
}
|
||||
if cs_opt_tailrecursion in aktoptimizerswitches then
|
||||
do_opttail(code,procdef);
|
||||
|
||||
{ add implicit entry and exit code }
|
||||
add_entry_exit_code;
|
||||
|
||||
@ -806,7 +813,6 @@ implementation
|
||||
procdef.has_paraloc_info:=true;
|
||||
end;
|
||||
|
||||
|
||||
{ generate code for the node tree }
|
||||
do_secondpass(code);
|
||||
aktproccode.concatlist(current_asmdata.CurrAsmList);
|
||||
|
Loading…
Reference in New Issue
Block a user