[m-dev.] for review: improvements to intermodule specialization
Fergus Henderson
fjh at cs.mu.OZ.AU
Tue Sep 26 01:57:25 AEDT 2000
Simon, could you please review this one?
----------
Estimated hours taken: 6
Fix some problems with intermodule higher-order specialization that
were preventing the compiler from properly specializing calls
to list__sort/3, even at the highest optimization level.
compiler/intermod.m:
Allow procedures which are called from exported procedures
to be put in the `.opt' files. This is needed e.g. for
list__hosort.
compiler/options.m:
Increase the --higher-order-size-limit at higher optimization
levels. --optimize-higher-order is enabled at -O3, with a
default size limit of 20. I changed the limit at higher
optimization levels: at -O4, the limit is set to 30, and at
-O5, it is set to 40.
Workspace: /home/mercury0/fjh/mercury
Index: compiler/intermod.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/intermod.m,v
retrieving revision 1.84
diff -u -d -r1.84 intermod.m
--- compiler/intermod.m 2000/09/21 00:23:49 1.84
+++ compiler/intermod.m 2000/09/25 14:36:25
@@ -188,6 +188,7 @@
intermod__gather_preds([PredId | PredIds], CollectTypes,
InlineThreshold, HigherOrderSizeLimit, Deforestation) -->
intermod_info_get_module_info(ModuleInfo0),
+ intermod_info_get_pred_decls(NewlyExportedPreds),
{ module_info_preds(ModuleInfo0, PredTable0) },
{ map__lookup(PredTable0, PredId, PredInfo0) },
{ module_info_type_spec_info(ModuleInfo0, TypeSpecInfo) },
@@ -195,7 +196,8 @@
(
{ intermod__should_be_processed(PredId, PredInfo0,
TypeSpecForcePreds, InlineThreshold,
- HigherOrderSizeLimit, Deforestation, ModuleInfo0) }
+ HigherOrderSizeLimit, Deforestation,
+ NewlyExportedPreds, ModuleInfo0) }
->
=(IntermodInfo0),
{ pred_info_clauses_info(PredInfo0, ClausesInfo0) },
@@ -239,17 +241,22 @@
:- pred intermod__should_be_processed(pred_id::in, pred_info::in,
set(pred_id)::in, int::in, int::in, bool::in,
- module_info::in) is semidet.
+ set(pred_id)::in, module_info::in) is semidet.
intermod__should_be_processed(PredId, PredInfo, TypeSpecForcePreds,
InlineThreshold, HigherOrderSizeLimit,
- Deforestation, ModuleInfo) :-
+ Deforestation, NewlyExportedPreds, ModuleInfo) :-
%
% note: we can't include exported_to_submodules predicates in
% the `.opt' file, for reasons explained in the comments for
% intermod__add_proc
%
- pred_info_is_exported(PredInfo),
+ (
+ pred_info_is_exported(PredInfo)
+ ;
+ pred_info_import_status(PredInfo, local),
+ set__member(PredId, NewlyExportedPreds)
+ ),
(
pred_info_clauses_info(PredInfo, ClauseInfo),
clauses_info_clauses(ClauseInfo, Clauses),
Index: compiler/options.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/options.m,v
retrieving revision 1.290
diff -u -d -r1.290 options.m
--- compiler/options.m 2000/09/17 09:18:59 1.290
+++ compiler/options.m 2000/09/25 14:04:09
@@ -1430,7 +1430,8 @@
opt_level(4, _, [
optimize_value_number - bool(yes),
inline_simple_threshold - int(8),
- inline_compound_threshold - int(20)
+ inline_compound_threshold - int(20),
+ higher_order_size_limit - int(30)
]).
% Optimization level 5: apply optimizations which may have some
@@ -1443,7 +1444,8 @@
pred_value_number - bool(yes),
optimize_repeat - int(5),
optimize_vnrepeat - int(2),
- inline_compound_threshold - int(100)
+ inline_compound_threshold - int(100),
+ higher_order_size_limit - int(40)
]).
% Optimization level 6: apply optimizations which may have any
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3 | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to: mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions: mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------
More information about the developers
mailing list