+ TAILREC optimizer switch

git-svn-id: trunk@4849 -
This commit is contained in:
florian 2006-10-10 18:41:28 +00:00
parent 71665dbc4c
commit 82b7b785f7
2 changed files with 10 additions and 4 deletions

View File

@ -149,7 +149,7 @@ than 255 characters. That's why using Ansi Strings}
toptimizerswitch = (cs_opt_none, toptimizerswitch = (cs_opt_none,
cs_opt_level1,cs_opt_level2,cs_opt_level3, cs_opt_level1,cs_opt_level2,cs_opt_level3,
cs_opt_regvar,cs_opt_uncertain,cs_opt_size,cs_opt_stackframe, 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; toptimizerswitches = set of toptimizerswitch;
@ -157,7 +157,7 @@ than 255 characters. That's why using Ansi Strings}
OptimizerSwitchStr : array[toptimizerswitch] of string[10] = ('', OptimizerSwitchStr : array[toptimizerswitch] of string[10] = ('',
'LEVEL1','LEVEL2','LEVEL3', 'LEVEL1','LEVEL2','LEVEL3',
'REGVAR','UNCERTAIN','SIZE','STACKFRAME', 'REGVAR','UNCERTAIN','SIZE','STACKFRAME',
'PEEPHOLE','ASMCSE','LOOPUNROLL' 'PEEPHOLE','ASMCSE','LOOPUNROLL','TAILREC'
); );
type type

View File

@ -100,7 +100,8 @@ implementation
pbase,pstatmnt,pdecl,pdecsub,pexports, pbase,pstatmnt,pdecl,pdecsub,pexports,
{ codegen } { codegen }
tgobj,cgbase,cgobj,dbgbase, tgobj,cgbase,cgobj,dbgbase,
ncgutil,regvars ncgutil,regvars,
opttail
{$if defined(arm) or defined(powerpc) or defined(powerpc64)} {$if defined(arm) or defined(powerpc) or defined(powerpc64)}
,aasmcpu ,aasmcpu
{$endif arm} {$endif arm}
@ -727,6 +728,12 @@ implementation
if code.registersfpu>0 then if code.registersfpu>0 then
include(flags,pi_uses_fpu); 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 implicit entry and exit code }
add_entry_exit_code; add_entry_exit_code;
@ -806,7 +813,6 @@ implementation
procdef.has_paraloc_info:=true; procdef.has_paraloc_info:=true;
end; end;
{ generate code for the node tree } { generate code for the node tree }
do_secondpass(code); do_secondpass(code);
aktproccode.concatlist(current_asmdata.CurrAsmList); aktproccode.concatlist(current_asmdata.CurrAsmList);