mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-08 03:48:07 +02:00
+ make empty proc. removal switchable by removeemptyprocs
git-svn-id: trunk@23621 -
This commit is contained in:
parent
bcd48ac1a1
commit
63f6afffd5
@ -257,7 +257,9 @@ interface
|
||||
explicit side-effects, only implicit side-effects (like the ones
|
||||
mentioned before) can disappear.
|
||||
}
|
||||
cs_opt_dead_values
|
||||
cs_opt_dead_values,
|
||||
{ compiler checks for empty procedures/methods and removes calls to them if possible }
|
||||
cs_opt_remove_emtpy_proc
|
||||
);
|
||||
toptimizerswitches = set of toptimizerswitch;
|
||||
|
||||
@ -284,12 +286,12 @@ interface
|
||||
end;
|
||||
|
||||
const
|
||||
OptimizerSwitchStr : array[toptimizerswitch] of string[11] = ('',
|
||||
OptimizerSwitchStr : array[toptimizerswitch] of string[16] = ('',
|
||||
'LEVEL1','LEVEL2','LEVEL3',
|
||||
'REGVAR','UNCERTAIN','SIZE','STACKFRAME',
|
||||
'PEEPHOLE','ASMCSE','LOOPUNROLL','TAILREC','CSE',
|
||||
'DFA','STRENGTH','SCHEDULE','AUTOINLINE','USEEBP',
|
||||
'ORDERFIELDS','FASTMATH','DEADVALUES'
|
||||
'ORDERFIELDS','FASTMATH','DEADVALUES','REMOVEEMPTYPROCS'
|
||||
);
|
||||
WPOptimizerSwitchStr : array [twpoptimizerswitch] of string[14] = (
|
||||
'DEVIRTCALLS','OPTVMTS','SYMBOLLIVENESS'
|
||||
@ -310,7 +312,7 @@ interface
|
||||
|
||||
{ switches being applied to all CPUs at the given level }
|
||||
genericlevel1optimizerswitches = [cs_opt_level1];
|
||||
genericlevel2optimizerswitches = [cs_opt_level2];
|
||||
genericlevel2optimizerswitches = [cs_opt_level2,cs_opt_remove_emtpy_proc];
|
||||
genericlevel3optimizerswitches = [cs_opt_level3];
|
||||
genericlevel4optimizerswitches = [cs_opt_reorder_fields,cs_opt_dead_values,cs_opt_fastmath];
|
||||
|
||||
|
@ -3461,7 +3461,7 @@ implementation
|
||||
Message(parser_e_no_category_as_types);
|
||||
|
||||
{ can we get rid of the call? }
|
||||
if (cs_opt_level2 in current_settings.optimizerswitches) and
|
||||
if (cs_opt_remove_emtpy_proc in current_settings.optimizerswitches) and
|
||||
not(cnf_return_value_used in callnodeflags) and
|
||||
(procdefinition.typ=procdef) and
|
||||
tprocdef(procdefinition).isempty and
|
||||
|
@ -1573,7 +1573,7 @@ implementation
|
||||
internalerror(200611083);
|
||||
if (po_abstractmethod in vmtpd.procoptions) then
|
||||
procname:='FPC_ABSTRACTERROR'
|
||||
else if (cs_opt_level2 in current_settings.optimizerswitches) and RedirectToEmpty(vmtpd) then
|
||||
else if (cs_opt_remove_emtpy_proc in current_settings.optimizerswitches) and RedirectToEmpty(vmtpd) then
|
||||
procname:='FPC_EMPTYMETHOD'
|
||||
else if not wpoinfomanager.optimized_name_for_vmt(_class,vmtpd,procname) then
|
||||
procname:=vmtpd.mangledname;
|
||||
|
@ -1268,7 +1268,8 @@ implementation
|
||||
if cs_opt_nodecse in current_settings.optimizerswitches then
|
||||
do_optcse(code);
|
||||
|
||||
if (procdef.proctypeoption in [potype_operator,potype_procedure,potype_function]) and
|
||||
if (cs_opt_remove_emtpy_proc in current_settings.optimizerswitches) and
|
||||
(procdef.proctypeoption in [potype_operator,potype_procedure,potype_function]) and
|
||||
(code.nodetype=blockn) and (tblocknode(code).statements=nil) then
|
||||
procdef.isempty:=true;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user