[m-rev.] diff: fix a problem with unused args and intermodule-analysis
Julien Fischer
juliensf at cs.mu.OZ.AU
Tue Feb 14 17:23:35 AEDT 2006
Estimated hours taken: 1
Branches: main
Fix a problem with unused argument analysis and intermodule-analysis.
compiler/unused_args.m:
Do not write unused argument info. for unification and comparison
predicates to the analysis registry.
With intermodule-optimization there were some limitations on what
could appear in the .opt files - this may not be the case with
.analysis files. Add an XXX comment about this.
Remove some (now redundant) support for `:` as a module qualifier.
Fix some overlong lines.
Julien.
Index: compiler/unused_args.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/unused_args.m,v
retrieving revision 1.118
diff -u -r1.118 unused_args.m
--- compiler/unused_args.m 6 Feb 2006 05:39:44 -0000 1.118
+++ compiler/unused_args.m 14 Feb 2006 05:41:41 -0000
@@ -414,22 +414,25 @@
MaybeBestResult, AnalysisInfo0, AnalysisInfo1, !IO),
(
MaybeBestResult = yes({_, unused_args(UnusedArgs), _}),
- ( UnusedArgs \= [] ->
+ (
+ UnusedArgs = [_|_],
proc_info_headvars(ProcInfo, HeadVars),
- list__map(list__index1_det(HeadVars), UnusedArgs, UnusedVars),
+ list__map(list__index1_det(HeadVars), UnusedArgs,
+ UnusedVars),
initialise_vardep(UnusedVars, !.VarDep, VarDep),
svmap__set(proc(PredId, ProcId), VarDep, !VarUsage),
- globals__io_lookup_bool_option(optimize_unused_args, Optimize,
- !IO),
+ globals__io_lookup_bool_option(optimize_unused_args,
+ Optimize, !IO),
(
Optimize = yes,
- make_imported_unused_args_pred_info(proc(PredId, ProcId),
- UnusedArgs, !OptProcs, !ModuleInfo)
+ make_imported_unused_args_pred_info(
+ proc(PredId, ProcId), UnusedArgs, !OptProcs,
+ !ModuleInfo)
;
Optimize = no
)
;
- true
+ UnusedArgs = []
),
AnalysisInfo = AnalysisInfo1
;
@@ -646,10 +649,10 @@
set_list_vars_used(Args, !VarDep)
;
GoalExpr = foreign_proc(_, _, _, Args, ExtraArgs, _),
- % Only arguments with names can be used in the foreign code.
- % The code in here should be kept in sync with the treatment of
- % foreign_procs in fixup_goal_expr: any variable considered unused here
- % should be renamed apart in fixup_goal_expr.
+ % Only arguments with names can be used in the foreign code. The code
+ % in here should be kept in sync with the treatment of foreign_procs
+ % in fixup_goal_expr: any variable considered unused here should be
+ % renamed apart in fixup_goal_expr.
ArgIsUsed = (pred(Arg::in, Var::out) is semidet :-
Arg = foreign_arg(Var, MaybeNameAndMode, _),
MaybeNameAndMode = yes(_)
@@ -1000,7 +1003,12 @@
MakeAnalysisRegistry, !IO),
(
MakeAnalysisRegistry = yes,
- procedure_is_exported(!.ModuleInfo, OrigPredInfo, ProcId)
+ procedure_is_exported(!.ModuleInfo, OrigPredInfo, ProcId),
+ not is_unify_or_compare_pred(OrigPredInfo)
+ % XXX What about class instance methods and predicates used
+ % for type specialization. (These are a problem for
+ % intermodule-optimization; they may not be here.)
+ % (See exception_analysis.should_write_exception_info/4).
->
analysis__record_result(ModuleId, FuncId, Call, Answer, optimal,
AnalysisInfo1, AnalysisInfo)
@@ -1129,8 +1137,6 @@
string__int_to_string(TypeArity, TypeAr),
sym_name_to_string(TypeModule, TypeModuleString0),
string__replace_all(TypeModuleString0, ".", "__",
- TypeModuleString1),
- string__replace_all(TypeModuleString1, ":", "__",
TypeModuleString),
string__append_list([Name0, "_", TypeModuleString,
"__", TypeName, "_", TypeAr], Name1)
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list