[m-rev.] diff: use terms in analysis files

Peter Wang novalazy at gmail.com
Fri Jun 6 12:22:29 AEST 2008


Branches: main

Store call and answer patterns as terms in `.analysis' (and related) files and
not strings.  It's easier to convert complex patterns to/from terms than
strings.  Also change the module names and function-ids while we're at it.

compiler/analysis.m:
	Replace the `to_string' typeclass with a `to_term' typeclass.  Make
	call and answer patterns convert to/from terms instead of strings.

compiler/analysis.file.m:
	Read/write terms for call and answer patterns.

	Read/write module names and function-ids with more natural syntax
	than the term representations of internal data structures.

	Bump the analysis file version number.

	Move some code around.

	Use promise_equivalent_solutions goals instead of
	promise_equivalent_solution_io.

compiler/exception_analysis.m:
compiler/structure_reuse.analysis.m:
compiler/structure_sharing.analysis.m:
compiler/tabling_analysis.m:
compiler/trailing_analysis.m:
compiler/unused_args.m:
	Conform to `to_term' typeclass interface.

tests/analysis/ctgc/reuse_runtest.sh:
tests/analysis/excp/excp_runtest.sh:
tests/analysis/sharing/sharing_runtest.sh:
tests/analysis/unused_args/unused_args_runtest.sh:
	Update test scripts for changed file formats.

compiler/mercury_compile.m:
	Print verbose messages and report stats when reading in files for
	intermodule analysis.

Index: compiler/analysis.file.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/analysis.file.m,v
retrieving revision 1.5
diff -u -p -r1.5 analysis.file.m
--- compiler/analysis.file.m	5 Jun 2008 06:25:16 -0000	1.5
+++ compiler/analysis.file.m	6 Jun 2008 01:57:12 -0000
@@ -96,10 +96,6 @@
 
 :- implementation.
 
-:- import_module libs.compiler_util.
-:- import_module parse_tree.            % XXX unwanted dependency
-:- import_module parse_tree.modules.    % XXX unwanted dependency
-
 :- import_module bool.
 :- import_module char.
 :- import_module exception.
@@ -108,6 +104,12 @@
 :- import_module term_io.
 :- import_module varset.
 
+:- import_module libs.compiler_util.
+:- import_module parse_tree.
+:- import_module parse_tree.modules.    % XXX unwanted dependency
+:- import_module parse_tree.prog_io.
+:- import_module parse_tree.prog_out.
+
 %-----------------------------------------------------------------------------%
 
 % The format of an analysis result file is:
@@ -115,6 +117,9 @@
 % version_number.
 % analysis_name(analysis_version, func_id, call_pattern, answer_pattern,
 %   result_status).
+%
+% where func_id = p(name, arity, mode_id).
+%   or  func_id = f(name, arity, mode_id).
 
 % An .analysis_status file contains a single line, which is one of:
 %
@@ -139,7 +144,7 @@
 
 :- func version_number = int.
 
-version_number = 5.
+version_number = 6.
 
 :- func analysis_registry_suffix = string.
 
@@ -159,6 +164,19 @@ request_suffix = ".request".
 
 %-----------------------------------------------------------------------------%
 
+:- pred analysis_status_to_string(analysis_status, string).
+:- mode analysis_status_to_string(in, out) is det.
+:- mode analysis_status_to_string(out, in) is semidet.
+
+analysis_status_to_string(invalid, "invalid").
+analysis_status_to_string(suboptimal, "suboptimal").
+analysis_status_to_string(optimal, "optimal").
+
+%-----------------------------------------------------------------------------%
+%
+% Reading
+%
+
 read_module_overall_status(Compiler, ModuleName, ModuleStatus, !IO) :-
     module_name_to_read_file_name(Compiler, ModuleName,
         analysis_registry_status_suffix, MaybeFileName, !IO),
@@ -226,29 +244,6 @@ read_module_overall_status_2(FileName, M
             "read_module_overall_status_2: " ++ io.error_message(IOError))
     ).
 
-write_module_overall_status(Info, ModuleName, Status, !IO) :-
-    module_name_to_write_file_name(Info ^ compiler, ModuleName,
-        analysis_registry_status_suffix, FileName, !IO),
-    io.open_output(FileName, OpenResult, !IO),
-    (
-        OpenResult = ok(Stream),
-        (
-            Status = optimal,
-            io.write_string(Stream, "optimal.\n", !IO)
-        ;
-            Status = suboptimal,
-            io.write_string(Stream, "suboptimal.\n", !IO)
-        ;
-            Status = invalid,
-            io.write_string(Stream, "invalid.\n", !IO)
-        ),
-        io.close_output(Stream, !IO)
-    ;
-        OpenResult = error(IOError),
-        unexpected(this_file,
-            "write_module_overall_status: " ++ io.error_message(IOError))
-    ).
-
 %-----------------------------------------------------------------------------%
 
 read_module_analysis_results(Info, ModuleName, ModuleResults, !IO) :-
@@ -285,25 +280,18 @@ read_module_analysis_results_2(Compiler,
         io.set_input_stream(Stream, OldStream, !IO),
 
         check_analysis_file_version_number(!IO),
-        promise_only_solution_io(
-            (pred(Results2::out, !.IO::di, !:IO::uo) is cc_multi :-
-                try_io((pred(Results1::out, !.IO::di, !:IO::uo) is det :-
-                    read_analysis_file_2(parse_result_entry(Compiler),
-                        ModuleResults0, Results1, !IO)
-                ), Results2, !IO)
-            ), Results, !IO),
+        promise_equivalent_solutions [Results, !:IO] (
+            try_io(read_analysis_file_2(parse_result_entry(Compiler),
+                ModuleResults0), Results, !IO)
+        ),
+        io.set_input_stream(OldStream, _, !IO),
+        io.close_input(Stream, !IO),
         (
             Results = succeeded(ModuleResults)
         ;
-            Results = failed,
-            ModuleResults = ModuleResults0
-        ;
             Results = exception(_),
-            % XXX Report error.
-            ModuleResults = ModuleResults0
-        ),
-        io.set_input_stream(OldStream, _, !IO),
-        io.close_input(Stream, !IO)
+            rethrow(Results)
+        )
     ;
         OpenResult = error(_),
         debug_msg((pred(!.IO::di, !:IO::uo) is det :-
@@ -314,14 +302,6 @@ read_module_analysis_results_2(Compiler,
         ModuleResults = ModuleResults0
     ).
 
-:- pred analysis_status_to_string(analysis_status, string).
-:- mode analysis_status_to_string(in, out) is det.
-:- mode analysis_status_to_string(out, in) is semidet.
-
-analysis_status_to_string(invalid, "invalid").
-analysis_status_to_string(suboptimal, "suboptimal").
-analysis_status_to_string(optimal, "optimal").
-
 :- pred parse_result_entry(Compiler::in)
     `with_type` parse_entry(module_analysis_map(some_analysis_result))
     `with_inst` parse_entry <= compiler(Compiler).
@@ -331,17 +311,13 @@ parse_result_entry(Compiler, Term, Resul
         Term = term.functor(term.atom(AnalysisName),
             [VersionNumberTerm, FuncIdTerm,
             CallPatternTerm, AnswerPatternTerm, StatusTerm], _),
-        term_to_type(FuncIdTerm, FuncId),
-        CallPatternTerm = term.functor(
-            term.string(CallPatternString), [], _),
-        AnswerPatternTerm = term.functor(
-            term.string(AnswerPatternString), [], _),
-        StatusTerm = term.functor(term.string(StatusString), [], _),
+        StatusTerm = term.functor(term.atom(StatusString), [], _),
         analysis_type(_ : unit(Call), _ : unit(Answer)) =
             analyses(Compiler, AnalysisName),
 
-        CallPattern = from_string(CallPatternString) : Call,
-        AnswerPattern = from_string(AnswerPatternString) : Answer,
+        parse_func_id(FuncIdTerm, FuncId),
+        from_term(CallPatternTerm, CallPattern : Call),
+        from_term(AnswerPatternTerm, AnswerPattern : Answer),
         analysis_status_to_string(Status, StatusString)
     ->
         (
@@ -351,7 +327,7 @@ parse_result_entry(Compiler, Term, Resul
         ->
             Result = 'new some_analysis_result'(CallPattern, AnswerPattern,
                 Status),
-            ( AnalysisResults0 = map.search(Results0, AnalysisName) ->
+            ( map.search(Results0, AnalysisName, AnalysisResults0) ->
                 AnalysisResults1 = AnalysisResults0
             ;
                 AnalysisResults1 = map.init
@@ -388,13 +364,12 @@ parse_request_entry(Compiler, Term, Requ
         Term = term.functor(atom("->"), [CallerModuleTerm, RHS], _),
         RHS = term.functor(atom(AnalysisName),
             [VersionNumberTerm, FuncIdTerm, CallPatternTerm], _),
-        term_to_type(CallerModuleTerm, CallerModule),
-        term_to_type(FuncIdTerm, FuncId),
-        CallPatternTerm = term.functor(
-            term.string(CallPatternString), [], _),
         analysis_type(_ : unit(Call), _ : unit(Answer)) =
             analyses(Compiler, AnalysisName),
-        CallPattern = from_string(CallPatternString) : Call
+
+        parse_module_name(CallerModuleTerm, CallerModule),
+        parse_func_id(FuncIdTerm, FuncId),
+        from_term(CallPatternTerm, CallPattern : Call)
     ->
         (
             VersionNumber = analysis_version_number(_ : Call, _ : Answer),
@@ -402,7 +377,7 @@ parse_request_entry(Compiler, Term, Requ
                 term.integer(VersionNumber), [], _)
         ->
             Result = 'new analysis_request'(CallPattern, CallerModule),
-            ( AnalysisRequests0 = map.search(Requests0, AnalysisName) ->
+            ( map.search(Requests0, AnalysisName, AnalysisRequests0) ->
                 AnalysisRequests1 = AnalysisRequests0
             ;
                 AnalysisRequests1 = map.init
@@ -437,14 +412,14 @@ read_module_imdg(Info, ModuleName, Modul
 parse_imdg_arc(Compiler, Term, Arcs0, Arcs) :-
     (
         Term = term.functor(atom("->"), [DependentModuleTerm, ResultTerm], _),
-        term_to_type(DependentModuleTerm, DependentModule),
         ResultTerm = functor(atom(AnalysisName),
             [VersionNumberTerm, FuncIdTerm, CallPatternTerm], _),
-        term_to_type(FuncIdTerm, FuncId),
-        CallPatternTerm = functor(string(CallPatternString), [], _),
         analysis_type(_ : unit(Call), _ : unit(Answer))
             = analyses(Compiler, AnalysisName),
-        CallPattern = from_string(CallPatternString) : Call
+
+        parse_module_name(DependentModuleTerm, DependentModule),
+        parse_func_id(FuncIdTerm, FuncId),
+        from_term(CallPatternTerm, CallPattern : Call)
     ->
         (
             VersionNumber = analysis_version_number(_ : Call, _ : Answer),
@@ -452,7 +427,7 @@ parse_imdg_arc(Compiler, Term, Arcs0, Ar
                 term.integer(VersionNumber), [], _)
         ->
             Arc = 'new imdg_arc'(CallPattern, DependentModule),
-            ( AnalysisArcs0 = map.search(Arcs0, AnalysisName) ->
+            ( map.search(Arcs0, AnalysisName, AnalysisArcs0) ->
                 AnalysisArcs1 = AnalysisArcs0
             ;
                 AnalysisArcs1 = map.init
@@ -477,6 +452,30 @@ parse_imdg_arc(Compiler, Term, Arcs0, Ar
 
 %-----------------------------------------------------------------------------%
 
+:- pred parse_func_id(term::in, func_id::out) is semidet.
+
+parse_func_id(Term, FuncId) :-
+    Term = functor(atom(PF), [NameTerm, ArityTerm, ProcTerm], _),
+    (
+        PF = "p",
+        PredOrFunc = pf_predicate
+    ;
+        PF = "f",
+        PredOrFunc = pf_function
+    ),
+    NameTerm = functor(atom(Name), [], _),
+    ArityTerm = functor(integer(Arity), [], _),
+    ProcTerm = functor(integer(ProcInt), [], _),
+    proc_id_to_int(ProcId, ProcInt),
+    FuncId = func_id(PredOrFunc, Name, Arity, ProcId).
+
+:- pred parse_module_name(term::in, module_name::out) is semidet.
+
+parse_module_name(Term, ModuleName) :-
+    sym_name_and_args(Term, ModuleName, []).
+
+%-----------------------------------------------------------------------------%
+
 :- type parse_entry(T) == pred(term, T, T).
 :- inst parse_entry == (pred(in, in, out) is det).
 
@@ -521,25 +520,22 @@ read_analysis_file(AnalysisFileName, Par
         ), !IO),
         io.set_input_stream(Stream, OldStream, !IO),
 
-        promise_only_solution_io(
-            (pred(R::out, di, uo) is cc_multi -->
-                try_io((pred(Results1::out, di, uo) is det -->
-                    check_analysis_file_version_number,
-                    read_analysis_file_2(ParseEntry, ModuleResults0, Results1)
-                ), R)
-            ), Result, !IO),
+        promise_equivalent_solutions [Result, !:IO] (
+            try_io(
+                (pred(Results1::out, !.IO::di, !:IO::uo) is det :-
+                    check_analysis_file_version_number(!IO),
+                    read_analysis_file_2(ParseEntry, ModuleResults0, Results1,
+                        !IO)
+                ), Result, !IO)
+        ),
+        io.set_input_stream(OldStream, _, !IO),
+        io.close_input(Stream, !IO),
         (
             Result = succeeded(ModuleResults)
         ;
-            Result = failed,
-            ModuleResults = ModuleResults0
-        ;
             Result = exception(_),
-            % XXX Report error.
-            ModuleResults = ModuleResults0
-        ),
-        io.set_input_stream(OldStream, _, !IO),
-        io.close_input(Stream, !IO)
+            rethrow(Result)
+        )
     ;
         OpenResult = error(_),
         debug_msg((pred(!.IO::di, !:IO::uo) is det :-
@@ -581,6 +577,33 @@ read_analysis_file_2(ParseEntry, Results
     ).
 
 %-----------------------------------------------------------------------------%
+%
+% Writing
+%
+
+write_module_overall_status(Info, ModuleName, Status, !IO) :-
+    module_name_to_write_file_name(Info ^ compiler, ModuleName,
+        analysis_registry_status_suffix, FileName, !IO),
+    io.open_output(FileName, OpenResult, !IO),
+    (
+        OpenResult = ok(Stream),
+        (
+            Status = optimal,
+            io.write_string(Stream, "optimal.\n", !IO)
+        ;
+            Status = suboptimal,
+            io.write_string(Stream, "suboptimal.\n", !IO)
+        ;
+            Status = invalid,
+            io.write_string(Stream, "invalid.\n", !IO)
+        ),
+        io.close_output(Stream, !IO)
+    ;
+        OpenResult = error(IOError),
+        unexpected(this_file,
+            "write_module_overall_status: " ++ io.error_message(IOError))
+    ).
+
 %-----------------------------------------------------------------------------%
 
 write_module_analysis_results(Info, ModuleName, ModuleResults, !IO) :-
@@ -602,14 +625,19 @@ write_result_entry(AnalysisName, FuncId,
     Result = some_analysis_result(Call, Answer, Status),
     VersionNumber = analysis_version_number(Call, Answer),
     analysis_status_to_string(Status, StatusString),
-    term_io.write_term_nl(varset.init : varset,
-        functor(atom(AnalysisName), [
-            functor(integer(VersionNumber), [], context_init),
-            type_to_term(FuncId),
-            functor(string(to_string(Call)), [], context_init),
-            functor(string(to_string(Answer)), [], context_init),
-            functor(string(StatusString), [], context_init)
-        ], context_init), !IO).
+
+    io.write_string(AnalysisName, !IO),
+    io.write_char('(', !IO),
+    io.write_int(VersionNumber, !IO),
+    io.write_string(", ", !IO),
+    write_func_id(FuncId, !IO),
+    io.write_string(", ", !IO),
+    term_io.write_term(varset.init, to_term(Call), !IO),
+    io.write_string(", ", !IO),
+    term_io.write_term(varset.init, to_term(Answer), !IO),
+    io.write_string(", ", !IO),
+    io.write_string(StatusString, !IO),
+    io.write_string(").\n", !IO).
 
 %-----------------------------------------------------------------------------%
 
@@ -679,17 +707,17 @@ write_request_entry(Compiler, AnalysisNa
         unexpected(this_file,
             "write_request_entry: unknown analysis type")
     ),
-    term_io.write_term_nl(varset.init : varset,
-        functor(atom("->"), [
-            type_to_term(CallerModule),
-            CallTerm
-        ], context_init), !IO),
-    CallTerm =
-        functor(atom(AnalysisName), [
-            functor(integer(VersionNumber), [], context_init),
-            type_to_term(FuncId),
-            functor(string(to_string(Call)), [], context_init)
-        ], context_init).
+
+    write_module_name(CallerModule, !IO),
+    io.write_string(" -> ", !IO),
+    io.write_string(AnalysisName, !IO),
+    io.write_string("(", !IO),
+    io.write_int(VersionNumber, !IO),
+    io.write_string(", ", !IO),
+    write_func_id(FuncId, !IO),
+    io.write_string(", ", !IO),
+    term_io.write_term(varset.init, to_term(Call), !IO),
+    io.write_string(").\n", !IO).
 
 %-----------------------------------------------------------------------------%
 
@@ -702,27 +730,51 @@ write_module_imdg(Info, ModuleName, Modu
     `with_type` write_entry(imdg_arc)
     `with_inst` write_entry <= compiler(Compiler).
 
-write_imdg_arc(Compiler, AnalysisName, FuncId, imdg_arc(Call, DependentModule),
-        !IO) :-
+write_imdg_arc(Compiler, AnalysisName, FuncId, Arc, !IO) :-
+    Arc = imdg_arc(Call, DependentModule),
     (
         analysis_type(_ : unit(Call), _ : unit(Answer))
             = analyses(Compiler, AnalysisName)
     ->
         VersionNumber = analysis_version_number(_ : Call, _ : Answer)
     ;
-        unexpected(this_file,
-            "write_imdg_arc: unknown analysis type")
+        unexpected(this_file, "write_imdg_arc: unknown analysis type")
+    ),
+
+    write_module_name(DependentModule, !IO),
+    io.write_string(" -> ", !IO),
+    io.write_string(AnalysisName, !IO),
+    io.write_char('(', !IO),
+    io.write_int(VersionNumber, !IO),
+    io.write_string(", ", !IO),
+    write_func_id(FuncId, !IO),
+    io.write_string(", ", !IO),
+    term_io.write_term(varset.init, to_term(Call), !IO),
+    io.write_string(").\n", !IO).
+
+%-----------------------------------------------------------------------------%
+
+:- pred write_func_id(func_id::in, io::di, io::uo) is det.
+
+write_func_id(func_id(PredOrFunc, Name, Arity, ProcId), !IO) :-
+    (
+        PredOrFunc = pf_predicate,
+        io.write_string("p(", !IO)
+    ;
+        PredOrFunc = pf_function,
+        io.write_string("f(", !IO)
     ),
-    term_io.write_term_nl(varset.init : varset,
-        functor(atom("->"), [
-            type_to_term(DependentModule),
-            ResultTerm
-        ], context_init), !IO),
-    ResultTerm = functor(atom(AnalysisName), [
-        functor(integer(VersionNumber), [], context_init),
-        type_to_term(FuncId),
-        functor(string(to_string(Call)), [], context_init)
-    ], context_init).
+    term_io.quote_atom(Name, !IO),
+    io.write_string(", ", !IO),
+    io.write_int(Arity, !IO),
+    io.write_string(", ", !IO),
+    io.write_int(proc_id_to_int(ProcId), !IO),
+    io.write_char(')', !IO).
+
+:- pred write_module_name(module_name::in, io::di, io::uo) is det.
+
+write_module_name(ModuleName, !IO) :-
+    write_sym_name(ModuleName, !IO).
 
 %-----------------------------------------------------------------------------%
 
@@ -789,6 +841,7 @@ write_analysis_file_4(WriteEntry, Analys
         ), FuncResultListSorted, !IO).
 
 %-----------------------------------------------------------------------------%
+%-----------------------------------------------------------------------------%
 
 empty_request_file(Info, ModuleName, !IO) :-
     module_name_to_write_file_name(Info ^ compiler, ModuleName, request_suffix,
Index: compiler/analysis.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/analysis.m,v
retrieving revision 1.6
diff -u -p -r1.6 analysis.m
--- compiler/analysis.m	5 Jun 2008 06:25:16 -0000	1.6
+++ compiler/analysis.m	6 Jun 2008 01:57:12 -0000
@@ -33,6 +33,7 @@
 :- import_module list.
 :- import_module maybe.
 :- import_module set.
+:- import_module term.
 :- import_module unit.
 
 %-----------------------------------------------------------------------------%
@@ -107,12 +108,12 @@
 
 :- typeclass call_pattern(FuncInfo, Call)
     <= (partial_order(FuncInfo, Call),
-        to_string(Call))
+        to_term(Call))
     where [].
 
 :- typeclass answer_pattern(FuncInfo, Answer)
     <= (partial_order(FuncInfo, Answer),
-        to_string(Answer))
+        to_term(Answer))
     where [].
 
 :- type analysis_result(Call, Answer)
@@ -130,9 +131,9 @@
     pred equivalent(FuncInfo::in, T::in, T::in) is semidet
 ].
 
-:- typeclass to_string(S) where [
-    func to_string(S) = string,
-    func from_string(string) = S is semidet
+:- typeclass to_term(S) where [
+    func to_term(S) = term,
+    pred from_term(term::in, S::out) is semidet
 ].
 
 :- type no_func_info
@@ -146,7 +147,7 @@
 
 :- instance call_pattern(no_func_info, any_call).
 :- instance partial_order(no_func_info, any_call).
-:- instance to_string(any_call).
+:- instance to_term(any_call).
 
     % The status of a module or a specific analysis result.
     %
@@ -442,9 +443,13 @@
         semidet_succeed
     )
 ].
-:- instance to_string(any_call) where [
-    to_string(any_call) = "",
-    from_string("") = any_call
+:- instance to_term(any_call) where [
+    ( to_term(any_call) = Term :-
+        Term = term.functor(atom("any"), [], context_init)
+    ),
+    ( from_term(Term, any_call) :-
+        Term = term.functor(atom("any"), [], _)
+    )
 ].
 
 %-----------------------------------------------------------------------------%
Index: compiler/exception_analysis.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/exception_analysis.m,v
retrieving revision 1.48
diff -u -p -r1.48 exception_analysis.m
--- compiler/exception_analysis.m	5 Jun 2008 06:25:16 -0000	1.48
+++ compiler/exception_analysis.m	6 Jun 2008 01:57:12 -0000
@@ -120,7 +120,7 @@
 :- instance analysis(no_func_info, any_call, exception_analysis_answer).
 :- instance partial_order(no_func_info, exception_analysis_answer).
 :- instance answer_pattern(no_func_info, exception_analysis_answer).
-:- instance to_string(exception_analysis_answer).
+:- instance to_term(exception_analysis_answer).
 
 %----------------------------------------------------------------------------%
 %----------------------------------------------------------------------------%
@@ -1017,20 +1017,22 @@ exception_status_more_precise_than(throw
 exception_status_more_precise_than(may_throw(type_exception),
     may_throw(user_exception)).
 
-:- instance to_string(exception_analysis_answer) where [
-    func(to_string/1) is answer_to_string,
-    func(from_string/1) is answer_from_string
+:- instance to_term(exception_analysis_answer) where [
+    func(to_term/1) is answer_to_term,
+    pred(from_term/2) is answer_from_term
 ].
 
-:- func answer_to_string(exception_analysis_answer) = string.
+:- func answer_to_term(exception_analysis_answer) = term.
 
-answer_to_string(Answer) = String :-
+answer_to_term(Answer) = Term :-
     Answer = exception_analysis_answer(Status),
-    exception_status_to_string(Status, String).
+    exception_status_to_string(Status, String),
+    Term = term.functor(atom(String), [], context_init).
 
-:- func answer_from_string(string) = exception_analysis_answer is semidet.
+:- pred answer_from_term(term::in, exception_analysis_answer::out) is semidet.
 
-answer_from_string(String) = exception_analysis_answer(Status) :-
+answer_from_term(Term, exception_analysis_answer(Status)) :-
+    Term = term.functor(atom(String), [], _),
     exception_status_to_string(Status, String).
 
 :- pred exception_status_to_string(exception_status, string).
@@ -1040,9 +1042,9 @@ answer_from_string(String) = exception_a
 exception_status_to_string(will_not_throw, "will_not_throw").
 exception_status_to_string(throw_conditional, "conditional").
 exception_status_to_string(may_throw(type_exception),
-    "may_throw(type_exception)").
+    "may_throw_type_exception").
 exception_status_to_string(may_throw(user_exception),
-    "may_throw(user_exception)").
+    "may_throw_user_exception").
 
 %----------------------------------------------------------------------------%
 %
Index: compiler/mercury_compile.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/mercury_compile.m,v
retrieving revision 1.472
diff -u -p -r1.472 mercury_compile.m
--- compiler/mercury_compile.m	5 Jun 2008 06:25:17 -0000	1.472
+++ compiler/mercury_compile.m	6 Jun 2008 01:57:13 -0000
@@ -1521,14 +1521,15 @@ mercury_compile(Module, NestedSubModules
             output_trans_opt_file(HLDS21, !DumpInfo, !IO),
             FactTableObjFiles = []
         ; MakeAnalysisRegistry = yes ->
-            prepare_intermodule_analysis(HLDS21, HLDS22, !IO),
+            prepare_intermodule_analysis(Verbose, Stats, HLDS21, HLDS22, !IO),
             output_analysis_file(HLDS22, !DumpInfo, !IO),
             FactTableObjFiles = []
         ; MakeXmlDocumentation = yes ->
             xml_documentation(HLDS21, !IO),
             FactTableObjFiles = []
         ;
-            maybe_prepare_intermodule_analysis(HLDS21, HLDS22, !IO),
+            maybe_prepare_intermodule_analysis(Verbose, Stats, HLDS21, HLDS22,
+                !IO),
             mercury_compile_after_front_end(NestedSubModules,
                 FindTimestampFiles, MaybeTimestamps, ModuleName, HLDS22,
                 FactTableObjFiles, !DumpInfo, !IO)
@@ -1545,22 +1546,25 @@ mercury_compile(Module, NestedSubModules
         FactTableObjFiles = []
     ).
 
-:- pred maybe_prepare_intermodule_analysis(module_info::in, module_info::out,
-    io::di, io::uo) is det.
+:- pred maybe_prepare_intermodule_analysis(bool::in, bool::in,
+    module_info::in, module_info::out, io::di, io::uo) is det.
 
-maybe_prepare_intermodule_analysis(!HLDS, !IO) :-
+maybe_prepare_intermodule_analysis(Verbose, Stats, !HLDS, !IO) :-
     globals.io_lookup_bool_option(intermodule_analysis, IntermodAnalysis, !IO),
     (
         IntermodAnalysis = yes,
-        prepare_intermodule_analysis(!HLDS, !IO)
+        prepare_intermodule_analysis(Verbose, Stats, !HLDS, !IO)
     ;
         IntermodAnalysis = no
     ).
 
-:- pred prepare_intermodule_analysis(module_info::in, module_info::out,
-    io::di, io::uo) is det.
+:- pred prepare_intermodule_analysis(bool::in, bool::in,
+    module_info::in, module_info::out, io::di, io::uo) is det.
+
+prepare_intermodule_analysis(Verbose, Stats, !HLDS, !IO) :-
+    maybe_write_string(Verbose, "% Preparing for intermodule analysis...\n",
+        !IO),
 
-prepare_intermodule_analysis(!HLDS, !IO) :-
     module_info_get_all_deps(!.HLDS, ModuleNames),
 
     globals.io_lookup_accumulating_option(local_module_id, LocalModulesList,
@@ -1571,7 +1575,10 @@ prepare_intermodule_analysis(!HLDS, !IO)
     module_info_get_analysis_info(!.HLDS, AnalysisInfo0),
     analysis.prepare_intermodule_analysis(ModuleNames, LocalModuleNames,
         AnalysisInfo0, AnalysisInfo, !IO),
-    module_info_set_analysis_info(AnalysisInfo, !HLDS).
+    module_info_set_analysis_info(AnalysisInfo, !HLDS),
+
+    maybe_write_string(Verbose, "% done.\n", !IO),
+    maybe_report_stats(Stats, !IO).
 
 :- pred mercury_compile_after_front_end(list(module_name)::in,
     find_timestamp_file_names::in(find_timestamp_file_names),
Index: compiler/structure_reuse.analysis.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/structure_reuse.analysis.m,v
retrieving revision 1.15
diff -u -p -r1.15 structure_reuse.analysis.m
--- compiler/structure_reuse.analysis.m	5 Jun 2008 06:25:17 -0000	1.15
+++ compiler/structure_reuse.analysis.m	6 Jun 2008 01:57:13 -0000
@@ -81,11 +81,11 @@
 
 :- instance call_pattern(structure_reuse_func_info, structure_reuse_call).
 :- instance partial_order(structure_reuse_func_info, structure_reuse_call).
-:- instance to_string(structure_reuse_call).
+:- instance to_term(structure_reuse_call).
 
 :- instance answer_pattern(structure_reuse_func_info, structure_reuse_answer).
 :- instance partial_order(structure_reuse_func_info, structure_reuse_answer).
-:- instance to_string(structure_reuse_answer).
+:- instance to_term(structure_reuse_answer).
 
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
@@ -122,8 +122,8 @@
 :- import_module map.
 :- import_module maybe.
 :- import_module set.
-:- import_module string.
 :- import_module svmap.
+:- import_module term.
 
 %-----------------------------------------------------------------------------%
 
@@ -796,14 +796,14 @@ analysis_name = "structure_reuse".
     equivalent(_, Call, Call)
 ].
 
-:- instance to_string(structure_reuse_call) where [
-    ( to_string(structure_reuse_call(List)) = String :-
-        Strs = list.map(string.from_int, List),
-        String = string.join_list(" ", Strs)
+:- instance to_term(structure_reuse_call) where [
+    ( to_term(Call) = Term :-
+        Call = structure_reuse_call(NoClobbers),
+        type_to_term(NoClobbers, Term)
     ),
-    ( from_string(String) = structure_reuse_call(List) :-
-        Strs = string.words(String),
-        List = list.map(string.det_to_int, Strs)
+    ( from_term(Term, Call) :-
+        term_to_type(Term, NoClobbers),
+        Call = structure_reuse_call(NoClobbers)
     )
 ].
 
@@ -852,52 +852,48 @@ analysis_name = "structure_reuse".
     )
 ].
 
-:- instance to_string(structure_reuse_answer) where [
-    func(to_string/1) is reuse_answer_to_string,
-    func(from_string/1) is reuse_answer_from_string
+:- instance to_term(structure_reuse_answer) where [
+    func(to_term/1) is reuse_answer_to_term,
+    pred(from_term/2) is reuse_answer_from_term
 ].
 
-:- func reuse_answer_to_string(structure_reuse_answer) = string.
+:- func reuse_answer_to_term(structure_reuse_answer) = term.
 
-reuse_answer_to_string(Answer) = String :-
+reuse_answer_to_term(Answer) = Term :-
     (
         Answer = structure_reuse_answer_no_reuse,
-        String = "no_reuse"
+        Term = term.functor(atom("no_reuse"), [], term.context_init)
     ;
         Answer = structure_reuse_answer_unconditional,
-        String = "uncond"
+        Term = term.functor(atom("uncond"), [], term.context_init)
     ;
         Answer = structure_reuse_answer_conditional(HeadVars, Types, ReuseAs),
         ReuseDomain = to_structure_reuse_domain(ReuseAs),
-        String = string({HeadVars, Types, ReuseDomain})
+        type_to_term(HeadVars, HeadVarsTerm),
+        type_to_term(Types, TypesTerm),
+        type_to_term(ReuseDomain, ReuseDomainTerm),
+        Term = term.functor(atom("cond"),
+            [HeadVarsTerm, TypesTerm, ReuseDomainTerm], term.context_init)
     ).
 
-:- func reuse_answer_from_string(string::in) =
-    (structure_reuse_answer::out) is det.
+:- pred reuse_answer_from_term(term::in, structure_reuse_answer::out)
+    is semidet.
 
-reuse_answer_from_string(String) = Answer :-
-    ( String = "no_reuse" ->
+reuse_answer_from_term(Term, Answer) :-
+    (
+        Term = functor(atom("no_reuse"), [], _),
         Answer = structure_reuse_answer_no_reuse
-    ; String = "uncond" ->
+    ;
+        Term = functor(atom("uncond"), [], _),
         Answer = structure_reuse_answer_unconditional
     ;
-        % XXX this is ugly.  Later we should move to writing call and answer
-        % patterns in analysis files as terms rather than strings which will
-        % clean this up.
-        StringStop = String ++ ".",
-        io.read_from_string("", StringStop, string.length(StringStop), Res,
-            posn(0, 0, 0), _Posn),
-        (
-            Res = ok({HeadVars, Types, ReuseDomain}),
-            ReuseAs = from_structure_reuse_domain(ReuseDomain),
-            Answer = structure_reuse_answer_conditional(HeadVars, Types,
-                ReuseAs)
-        ;
-            ( Res = eof
-            ; Res = error(_, _)
-            ),
-            unexpected(this_file, "reuse_answer_from_string: " ++ String)
-        )
+        Term = functor(atom("cond"),
+            [HeadVarsTerm, TypesTerm, ReuseDomainTerm], _),
+        term_to_type(HeadVarsTerm, HeadVars),
+        term_to_type(TypesTerm, Types),
+        term_to_type(ReuseDomainTerm, ReuseDomain),
+        ReuseAs = from_structure_reuse_domain(ReuseDomain),
+        Answer = structure_reuse_answer_conditional(HeadVars, Types, ReuseAs)
     ).
 
 %-----------------------------------------------------------------------------%
Index: compiler/structure_sharing.analysis.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/structure_sharing.analysis.m,v
retrieving revision 1.36
diff -u -p -r1.36 structure_sharing.analysis.m
--- compiler/structure_sharing.analysis.m	5 Jun 2008 06:25:17 -0000	1.36
+++ compiler/structure_sharing.analysis.m	6 Jun 2008 01:57:13 -0000
@@ -52,13 +52,13 @@
 :- instance call_pattern(structure_sharing_func_info, structure_sharing_call).
 :- instance partial_order(structure_sharing_func_info,
     structure_sharing_call).
-:- instance to_string(structure_sharing_call).
+:- instance to_term(structure_sharing_call).
 
 :- instance answer_pattern(structure_sharing_func_info, 
     structure_sharing_answer).
 :- instance partial_order(structure_sharing_func_info,
     structure_sharing_answer).
-:- instance to_string(structure_sharing_answer).
+:- instance to_term(structure_sharing_answer).
 
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
@@ -994,9 +994,13 @@ analysis_name = "structure_sharing".
     equivalent(_, Call, Call)
 ].
 
-:- instance to_string(structure_sharing_call) where [
-    to_string(structure_sharing_call) = "",
-    from_string("") = structure_sharing_call
+:- instance to_term(structure_sharing_call) where [
+    ( to_term(structure_sharing_call) = Term :-
+        Term = term.functor(atom("any"), [], context_init)
+    ),
+    ( from_term(Term, structure_sharing_call) :-
+        Term = term.functor(atom("any"), [], _)
+    )
 ].
 
 :- instance answer_pattern(structure_sharing_func_info,
@@ -1050,51 +1054,48 @@ structure_sharing_answer_to_sharing_as(A
         Answer = structure_sharing_answer_real(_, _, SharingAs)
     ).
 
-:- instance to_string(structure_sharing_answer) where [
-    func(to_string/1) is sharing_answer_to_string,
-    func(from_string/1) is sharing_answer_from_string
+:- instance to_term(structure_sharing_answer) where [
+    func(to_term/1) is sharing_answer_to_term,
+    pred(from_term/2) is sharing_answer_from_term
 ].
 
-:- func sharing_answer_to_string(structure_sharing_answer) = string.
+:- func sharing_answer_to_term(structure_sharing_answer) = term.
 
-sharing_answer_to_string(Answer) = String :-
+sharing_answer_to_term(Answer) = Term :-
     (
         Answer = structure_sharing_answer_bottom,
-        String = "b"
+        Term = term.functor(atom("b"), [], context_init)
     ;
         Answer = structure_sharing_answer_top,
-        String = "t"
+        Term = term.functor(atom("t"), [], context_init)
     ;
         Answer = structure_sharing_answer_real(HeadVars, Types, SharingAs),
         SharingDomain = to_structure_sharing_domain(SharingAs),
-        String = string({HeadVars, Types, SharingDomain})
+        type_to_term(HeadVars, HeadVarsTerm),
+        type_to_term(Types, TypesTerm),
+        type_to_term(SharingDomain, SharingDomainTerm),
+        Term = term.functor(atom("sharing"),
+            [HeadVarsTerm, TypesTerm, SharingDomainTerm], context_init)
     ).
 
-:- func sharing_answer_from_string(string::in) =
-    (structure_sharing_answer::out) is det.
+:- pred sharing_answer_from_term(term::in, structure_sharing_answer::out)
+    is semidet.
 
-sharing_answer_from_string(String) = Answer :-
-    ( String = "b" ->
+sharing_answer_from_term(Term, Answer) :-
+    (
+        Term = term.functor(atom("b"), [], _),
         Answer = structure_sharing_answer_bottom
-    ; String = "t" ->
+    ;
+        Term = term.functor(atom("t"), [], _),
         Answer = structure_sharing_answer_top
     ;
-        % XXX this is ugly.  Later we should move to writing call and answer
-        % patterns in analysis files as terms rather than strings which will
-        % clean this up.
-        StringStop = String ++ ".",
-        io.read_from_string("", StringStop, string.length(StringStop), Res,
-            posn(0, 0, 0), _Posn),
-        (
-            Res = ok({HeadVars, Types, SharingDomain}),
-            SharingAs = from_structure_sharing_domain(SharingDomain),
-            Answer = structure_sharing_answer_real(HeadVars, Types, SharingAs)
-        ;
-            ( Res = eof
-            ; Res = error(_, _)
-            ),
-            unexpected(this_file, "sharing_answer_from_string: " ++ String)
-        )
+        Term = term.functor(atom("sharing"),
+            [HeadVarsTerm, TypesTerm, SharingDomainTerm], _),
+        term_to_type(HeadVarsTerm, HeadVars),
+        term_to_type(TypesTerm, Types),
+        term_to_type(SharingDomainTerm, SharingDomain),
+        SharingAs = from_structure_sharing_domain(SharingDomain),
+        Answer = structure_sharing_answer_real(HeadVars, Types, SharingAs)
     ).
 
 %-----------------------------------------------------------------------------%
Index: compiler/tabling_analysis.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/tabling_analysis.m,v
retrieving revision 1.16
diff -u -p -r1.16 tabling_analysis.m
--- compiler/tabling_analysis.m	5 Jun 2008 06:25:18 -0000	1.16
+++ compiler/tabling_analysis.m	6 Jun 2008 01:57:13 -0000
@@ -79,7 +79,7 @@
 :- instance analysis(no_func_info, any_call, mm_tabling_analysis_answer).
 :- instance partial_order(no_func_info, mm_tabling_analysis_answer).
 :- instance answer_pattern(no_func_info, mm_tabling_analysis_answer).
-:- instance to_string(mm_tabling_analysis_answer).
+:- instance to_term(mm_tabling_analysis_answer).
 
 %----------------------------------------------------------------------------%
 %----------------------------------------------------------------------------%
@@ -920,24 +920,26 @@ mm_tabling_status_more_precise_than(mm_t
 mm_tabling_status_more_precise_than(mm_tabled_conditional,
     mm_tabled_may_call).
 
-:- instance to_string(mm_tabling_analysis_answer) where [
-    func(to_string/1) is mm_tabling_analysis_answer_to_string,
-    func(from_string/1) is mm_tabling_analysis_answer_from_string
+:- instance to_term(mm_tabling_analysis_answer) where [
+    func(to_term/1) is mm_tabling_analysis_answer_to_term,
+    pred(from_term/2) is mm_tabling_analysis_answer_from_term
 ].
 
-:- func mm_tabling_analysis_answer_to_string(mm_tabling_analysis_answer)
-    = string.
+:- func mm_tabling_analysis_answer_to_term(mm_tabling_analysis_answer)
+    = term.
 
-mm_tabling_analysis_answer_to_string(mm_tabling_analysis_answer(Status))
-        = Str :-
-    mm_tabling_status_to_string(Status, Str).
-
-:- func mm_tabling_analysis_answer_from_string(string) =
-    mm_tabling_analysis_answer is semidet.
-
-mm_tabling_analysis_answer_from_string(Str)
-        = mm_tabling_analysis_answer(Status) :-
-    mm_tabling_status_to_string(Status, Str).
+mm_tabling_analysis_answer_to_term(Answer) = Term :-
+    Answer = mm_tabling_analysis_answer(Status),
+    mm_tabling_status_to_string(Status, String),
+    Term = term.functor(atom(String), [], context_init).
+
+:- pred mm_tabling_analysis_answer_from_term(term::in,
+    mm_tabling_analysis_answer::out) is semidet.
+
+mm_tabling_analysis_answer_from_term(Term, Answer) :-
+    Term = term.functor(atom(String), [], _),
+    mm_tabling_status_to_string(Status, String),
+    Answer = mm_tabling_analysis_answer(Status).
 
 :- pred mm_tabling_status_to_string(mm_tabling_status, string).
 :- mode mm_tabling_status_to_string(in, out) is det.
Index: compiler/trailing_analysis.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/trailing_analysis.m,v
retrieving revision 1.35
diff -u -p -r1.35 trailing_analysis.m
--- compiler/trailing_analysis.m	5 Jun 2008 06:25:18 -0000	1.35
+++ compiler/trailing_analysis.m	6 Jun 2008 01:57:14 -0000
@@ -77,7 +77,7 @@
 :- instance analysis(no_func_info, any_call, trailing_analysis_answer).
 :- instance partial_order(no_func_info, trailing_analysis_answer).
 :- instance answer_pattern(no_func_info, trailing_analysis_answer).
-:- instance to_string(trailing_analysis_answer).
+:- instance to_term(trailing_analysis_answer).
 
 %----------------------------------------------------------------------------%
 %----------------------------------------------------------------------------%
@@ -1160,21 +1160,23 @@ trailing_status_more_precise_than(trail_
 trailing_status_more_precise_than(trail_will_not_modify, trail_conditional).
 trailing_status_more_precise_than(trail_conditional, trail_may_modify).
 
-:- instance to_string(trailing_analysis_answer) where [
-    func(to_string/1) is trailing_analysis_answer_to_string,
-    func(from_string/1) is trailing_analysis_answer_from_string
+:- instance to_term(trailing_analysis_answer) where [
+    func(to_term/1) is trailing_analysis_answer_to_term,
+    pred(from_term/2) is trailing_analysis_answer_from_term
 ].
 
-:- func trailing_analysis_answer_to_string(trailing_analysis_answer) = string.
+:- func trailing_analysis_answer_to_term(trailing_analysis_answer) = term.
 
-trailing_analysis_answer_to_string(trailing_analysis_answer(Status)) = Str :-
-    trailing_status_to_string(Status, Str).
-
-:- func trailing_analysis_answer_from_string(string) =
-        trailing_analysis_answer is semidet.
-
-trailing_analysis_answer_from_string(Str) = trailing_analysis_answer(Status) :-
-    trailing_status_to_string(Status, Str).
+trailing_analysis_answer_to_term(trailing_analysis_answer(Status)) = Term :-
+    trailing_status_to_string(Status, String),
+    Term = term.functor(atom(String), [], context_init).
+
+:- pred trailing_analysis_answer_from_term(term::in,
+    trailing_analysis_answer::out) is semidet.
+
+trailing_analysis_answer_from_term(Term, trailing_analysis_answer(Status)) :-
+    Term = term.functor(atom(String), [], _),
+    trailing_status_to_string(Status, String).
 
 :- pred trailing_status_to_string(trailing_status, string).
 :- mode trailing_status_to_string(in, out) is det.
Index: compiler/unused_args.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/unused_args.m,v
retrieving revision 1.154
diff -u -p -r1.154 unused_args.m
--- compiler/unused_args.m	5 Jun 2008 06:25:18 -0000	1.154
+++ compiler/unused_args.m	6 Jun 2008 01:57:14 -0000
@@ -73,11 +73,11 @@
 
 :- instance partial_order(unused_args_func_info, unused_args_call).
 :- instance call_pattern(unused_args_func_info, unused_args_call).
-:- instance to_string(unused_args_call).
+:- instance to_term(unused_args_call).
 
 :- instance partial_order(unused_args_func_info, unused_args_answer).
 :- instance answer_pattern(unused_args_func_info, unused_args_answer).
-:- instance to_string(unused_args_answer).
+:- instance to_term(unused_args_answer).
 
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
@@ -115,6 +115,7 @@
 :- import_module set.
 :- import_module string.
 :- import_module svmap.
+:- import_module term.
 :- import_module varset.
 
 %-----------------------------------------------------------------------------%
@@ -187,13 +188,19 @@ analysis_name = "unused_args".
 
 :- instance call_pattern(unused_args_func_info, unused_args_call) where [].
 :- instance partial_order(unused_args_func_info, unused_args_call) where [
-    (more_precise_than(_, _, _) :- semidet_fail),
+    ( more_precise_than(_, _, _) :-
+        semidet_fail
+    ),
     equivalent(_, Call, Call)
 ].
 
-:- instance to_string(unused_args_call) where [
-    to_string(_) = "",
-    from_string(_) = unused_args_call
+:- instance to_term(unused_args_call) where [
+    ( to_term(unused_args_call) = Term :-
+        Term = term.functor(atom("any"), [], context_init)
+    ),
+    ( from_term(Term, unused_args_call) :-
+        Term = term.functor(atom("any"), [], _)
+    )
 ].
 
 :- instance answer_pattern(unused_args_func_info, unused_args_answer) where [].
@@ -206,22 +213,15 @@ analysis_name = "unused_args".
     equivalent(_, Args, Args)
 ].
 
-:- instance to_string(unused_args_answer) where [
-    func(to_string/1) is unused_args_answer_to_string,
-    func(from_string/1) is unused_args_answer_from_string
+:- instance to_term(unused_args_answer) where [
+    ( to_term(unused_args(Args)) = Term :-
+        type_to_term(Args, Term)
+    ),
+    ( from_term(Term, unused_args(Args)) :-
+        term_to_type(Term, Args)
+    )
 ].
 
-:- func unused_args_answer_to_string(unused_args_answer) = string.
-
-unused_args_answer_to_string(unused_args(Args)) =
-    string.join_list(" ", list.map(int_to_string, Args)).
-
-:- func unused_args_answer_from_string(string) = unused_args_answer is semidet.
-
-unused_args_answer_from_string(String) = unused_args(Args) :-
-    Words = string.words(String),
-    list.map(string.to_int, Words, Args).
-
 %-----------------------------------------------------------------------------%
 
 process_module(!ModuleInfo, !Specs, !IO) :-
Index: tests/analysis/ctgc/reuse_runtest.sh
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/analysis/ctgc/reuse_runtest.sh,v
retrieving revision 1.1
diff -u -p -r1.1 reuse_runtest.sh
--- tests/analysis/ctgc/reuse_runtest.sh	6 Jun 2008 01:03:50 -0000	1.1
+++ tests/analysis/ctgc/reuse_runtest.sh	6 Jun 2008 01:57:14 -0000
@@ -15,9 +15,9 @@ rm -rf Mercury
 cat reuse_m3.m.ctgc > reuse_m3.m
 $MMCMAKE reuse_m1.analyse --analysis-repeat 0 || failed
 
-check_result reuse_m1 "reuse.*main\".*\"\".*no_reuse"
-check_result reuse_m2 "reuse.*fiddle2\".*\"\".*no_reuse"
-check_result reuse_m3 "reuse.*fiddle3\".*\"\".*conditional_reuse"
+check_result reuse_m1 "reuse.*main.*\[\].*no_reuse"
+check_result reuse_m2 "reuse.*fiddle2.*\[\].*no_reuse"
+check_result reuse_m3 "reuse.*fiddle3.*\[\].*conditional_reuse"
 check_statuses "optimal.suboptimal.optimal."
 check_no_requests
 
@@ -25,43 +25,43 @@ check_no_requests
 
 $MMCMAKE reuse_m1.analyse --analysis-repeat 1 || failed
 
-check_result reuse_m1 "_reuse.*main\".*\"\".*no_reuse"
-check_result reuse_m2 "_reuse.*fiddle2\".*\"\".*conditional_reuse"
-check_result reuse_m3 "_reuse.*fiddle3\".*\"\".*conditional_reuse"
+check_result reuse_m1 "_reuse.*main.*\[\].*no_reuse"
+check_result reuse_m2 "_reuse.*fiddle2.*\[\].*conditional_reuse"
+check_result reuse_m3 "_reuse.*fiddle3.*\[\].*conditional_reuse"
 check_statuses "optimal.optimal.optimal."
-check_request reuse_m2 "reuse_m1.*_reuse.*fiddle2.*\"1\""
-check_imdg reuse_m2 "reuse_m1.*reuse.*fiddle2.*\"\""
-check_imdg reuse_m3 "reuse_m2.*reuse.*fiddle3.*\"\""
+check_request reuse_m2 "reuse_m1.*_reuse.*fiddle2.*\[1\]"
+check_imdg reuse_m2 "reuse_m1.*reuse.*fiddle2.*\[\]"
+check_imdg reuse_m3 "reuse_m2.*reuse.*fiddle3.*\[\]"
 
 : Step 3
 
 $MMCMAKE reuse_m1.analyse --analysis-repeat 1 || failed
 
-check_result reuse_m1 "_reuse.*main\".*\"\".*no_reuse"
-check_result reuse_m2 "_reuse.*fiddle2\".*\"\".*conditional_reuse"
-check_result reuse_m2 "_reuse.*fiddle2\".*\"1\".*no_reuse"
-check_result reuse_m3 "_reuse.*fiddle3\".*\"\".*conditional_reuse"
-check_result reuse_m3 "_reuse.*fiddle3\".*\"1\".*conditional_reuse"
+check_result reuse_m1 "_reuse.*main.*\[\].*no_reuse"
+check_result reuse_m2 "_reuse.*fiddle2.*\[\].*conditional_reuse"
+check_result reuse_m2 "_reuse.*fiddle2.*\[1\].*no_reuse"
+check_result reuse_m3 "_reuse.*fiddle3.*\[\].*conditional_reuse"
+check_result reuse_m3 "_reuse.*fiddle3.*\[1\].*conditional_reuse"
 check_statuses "optimal.suboptimal.optimal."
 check_no_requests
-check_imdg reuse_m2 "reuse_m1.*reuse.*fiddle2.*\"\""
-check_imdg reuse_m3 "reuse_m2.*reuse.*fiddle3.*\"\""
+check_imdg reuse_m2 "reuse_m1.*reuse.*fiddle2.*\[\]"
+check_imdg reuse_m3 "reuse_m2.*reuse.*fiddle3.*\[\]"
 
 : Step 4
 
 $MMCMAKE reuse_m1.analyse --analysis-repeat 1 || failed
 
-check_result reuse_m1 "_reuse.*main\".*\"\".*uncond"
-check_result reuse_m2 "_reuse.*fiddle2\".*\"\".*conditional_reuse"
-check_result reuse_m2 "_reuse.*fiddle2\".*\"1\".*conditional_reuse"
-check_result reuse_m3 "_reuse.*fiddle3\".*\"\".*conditional_reuse"
-check_result reuse_m3 "_reuse.*fiddle3\".*\"1\".*conditional_reuse"
+check_result reuse_m1 "_reuse.*main.*\[\].*uncond"
+check_result reuse_m2 "_reuse.*fiddle2.*\[\].*conditional_reuse"
+check_result reuse_m2 "_reuse.*fiddle2.*\[1\].*conditional_reuse"
+check_result reuse_m3 "_reuse.*fiddle3.*\[\].*conditional_reuse"
+check_result reuse_m3 "_reuse.*fiddle3.*\[1\].*conditional_reuse"
 check_statuses "optimal.optimal.optimal."
 check_no_requests
-check_imdg reuse_m2 "reuse_m1.*reuse.*fiddle2.*\"\""
-check_imdg reuse_m2 "reuse_m1.*reuse.*fiddle2.*\"1\""
-check_imdg reuse_m3 "reuse_m2.*reuse.*fiddle3.*\"\""
-check_imdg reuse_m3 "reuse_m2.*reuse.*fiddle3.*\"1\""
+check_imdg reuse_m2 "reuse_m1.*reuse.*fiddle2.*\[\]"
+check_imdg reuse_m2 "reuse_m1.*reuse.*fiddle2.*\[1\]"
+check_imdg reuse_m3 "reuse_m2.*reuse.*fiddle3.*\[\]"
+check_imdg reuse_m3 "reuse_m2.*reuse.*fiddle3.*\[1\]"
 
 : Step 5
 
@@ -69,15 +69,15 @@ sleep 1
 cat reuse_m3.m.no_ctgc > reuse_m3.m
 $MMCMAKE reuse_m1.analyse --analysis-repeat 1 || failed
 
-check_result reuse_m1 "_reuse.*main\".*\"\".*no_reuse"
-check_result reuse_m2 "_reuse.*fiddle2\".*\"\".*no_reuse"
-check_result reuse_m2 "_reuse.*fiddle2\".*\"1\".*no_reuse"
-check_result reuse_m3 "_reuse.*fiddle3\".*\"\".*no_reuse"
-check_result reuse_m3 "_reuse.*fiddle3\".*\"1\".*no_reuse"
+check_result reuse_m1 "_reuse.*main.*\[\].*no_reuse"
+check_result reuse_m2 "_reuse.*fiddle2.*\[\].*no_reuse"
+check_result reuse_m2 "_reuse.*fiddle2.*\[1\].*no_reuse"
+check_result reuse_m3 "_reuse.*fiddle3.*\[\].*no_reuse"
+check_result reuse_m3 "_reuse.*fiddle3.*\[1\].*no_reuse"
 check_statuses "optimal.optimal.optimal."
 check_no_requests
-check_imdg reuse_m2 "reuse_m1.*reuse.*fiddle2.*\"\""
-check_imdg reuse_m3 "reuse_m2.*reuse.*fiddle3.*\"\""
+check_imdg reuse_m2 "reuse_m1.*reuse.*fiddle2.*\[\]"
+check_imdg reuse_m3 "reuse_m2.*reuse.*fiddle3.*\[\]"
 
 : Succeeded
 
Index: tests/analysis/excp/excp_runtest.sh
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/analysis/excp/excp_runtest.sh,v
retrieving revision 1.1
diff -u -p -r1.1 excp_runtest.sh
--- tests/analysis/excp/excp_runtest.sh	5 Jun 2008 06:25:19 -0000	1.1
+++ tests/analysis/excp/excp_runtest.sh	6 Jun 2008 01:57:14 -0000
@@ -15,9 +15,9 @@ rm -rf Mercury
 cat excp_m1.m.no_exception > excp_m1.m
 $MMCMAKE excp_m1.analyse --analysis-repeat 0 || failed
 
-check_result excp_m1 'exception.*aaa.*may_throw(user_exception)'
+check_result excp_m1 'exception.*aaa.*may_throw_user_exception'
 check_result excp_m1 'exception.*aaa2.*will_not_throw'
-check_result excp_m2 'exception.*bbb.*may_throw(user_exception)'
+check_result excp_m2 'exception.*bbb.*may_throw_user_exception'
 check_result excp_m3 'exception.*ccc.*will_not_throw'
 check_statuses 'suboptimal.suboptimal.optimal.'
 check_no_requests
@@ -42,10 +42,10 @@ sleep 1
 cat excp_m1.m.exception > excp_m1.m
 $MMCMAKE excp_m1.analyse --analysis-repeat 0 || failed
 
-check_result excp_m1 'exception.*aaa.*may_throw(user_exception)'
-check_result excp_m1 'exception.*aaa2.*may_throw(user_exception)'
-check_result excp_m2 'exception.*bbb.*may_throw(user_exception)'
-check_result excp_m3 'exception.*ccc.*may_throw(user_exception)'
+check_result excp_m1 'exception.*aaa.*may_throw_user_exception'
+check_result excp_m1 'exception.*aaa2.*may_throw_user_exception'
+check_result excp_m2 'exception.*bbb.*may_throw_user_exception'
+check_result excp_m3 'exception.*ccc.*may_throw_user_exception'
 check_statuses 'optimal.optimal.optimal.'
 check_no_requests
 
Index: tests/analysis/sharing/sharing_runtest.sh
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/analysis/sharing/sharing_runtest.sh,v
retrieving revision 1.1
diff -u -p -r1.1 sharing_runtest.sh
--- tests/analysis/sharing/sharing_runtest.sh	5 Jun 2008 06:25:19 -0000	1.1
+++ tests/analysis/sharing/sharing_runtest.sh	6 Jun 2008 01:57:14 -0000
@@ -15,10 +15,10 @@ rm -rf Mercury
 cat sharing_m1.m.no_share > sharing_m1.m
 $MMCMAKE sharing_m1.analyse --analysis-repeat 0 || failed
 
-check_result sharing_m1 'sharing.*aaa.*"t"'
-check_result sharing_m1 'sharing.*aaa2.*"b"'
-check_result sharing_m2 'sharing.*bbb.*"t"'
-check_result sharing_m3 'sharing.*ccc.*"b"'
+check_result sharing_m1 'sharing.*aaa.* t,'
+check_result sharing_m1 'sharing.*aaa2.* b,'
+check_result sharing_m2 'sharing.*bbb.* t,'
+check_result sharing_m3 'sharing.*ccc.* b,'
 check_statuses 'suboptimal.suboptimal.optimal.'
 check_no_requests
 
@@ -26,10 +26,10 @@ check_no_requests
 
 $MMCMAKE sharing_m1.analyse --analysis-repeat 3 || failed
 
-check_result sharing_m1 'sharing.*aaa.*"b"'
-check_result sharing_m1 'sharing.*aaa2.*"b"'
-check_result sharing_m2 'sharing.*bbb.*"b"'
-check_result sharing_m3 'sharing.*ccc.*"b"'
+check_result sharing_m1 'sharing.*aaa.* b,'
+check_result sharing_m1 'sharing.*aaa2.* b,'
+check_result sharing_m2 'sharing.*bbb.* b,'
+check_result sharing_m3 'sharing.*ccc.* b,'
 check_statuses 'optimal.optimal.optimal.'
 check_no_requests
 check_imdg sharing_m2 'sharing_m1.*sharing.*bbb'
@@ -55,10 +55,10 @@ sleep 1
 cat sharing_m1.m.no_share > sharing_m1.m
 $MMCMAKE sharing_m1.analyse --analysis-repeat 3 || failed
 
-check_result sharing_m1 'sharing.*aaa.*"b"'
-check_result sharing_m1 'sharing.*aaa2.*"b"'
-check_result sharing_m2 'sharing.*bbb.*"b"'
-check_result sharing_m3 'sharing.*ccc.*"b"'
+check_result sharing_m1 'sharing.*aaa.* b,'
+check_result sharing_m1 'sharing.*aaa2.* b,'
+check_result sharing_m2 'sharing.*bbb.* b,'
+check_result sharing_m3 'sharing.*ccc.* b,'
 check_statuses 'optimal.optimal.optimal.'
 check_no_requests
 
Index: tests/analysis/unused_args/unused_args_runtest.sh
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/analysis/unused_args/unused_args_runtest.sh,v
retrieving revision 1.1
diff -u -p -r1.1 unused_args_runtest.sh
--- tests/analysis/unused_args/unused_args_runtest.sh	5 Jun 2008 06:25:20 -0000	1.1
+++ tests/analysis/unused_args/unused_args_runtest.sh	6 Jun 2008 01:57:14 -0000
@@ -17,10 +17,10 @@ rm -rf Mercury
 cat ua_m1.m.no_unused_args > ua_m1.m
 $MMCMAKE ua_m1.analyse --analysis-repeat 0 || failed
 
-check_result ua_m1 'aaa1.*"", ""'
-check_result ua_m1 'aaa2.*"", ""'
-check_result ua_m2 'bbb.*"", ""'
-check_result ua_m3 'ccc.*"", ""'
+check_result ua_m1 'aaa1.*\[\]'
+check_result ua_m1 'aaa2.*\[\]'
+check_result ua_m2 'bbb.*\[\]'
+check_result ua_m3 'ccc.*\[\]'
 check_statuses 'suboptimal.suboptimal.optimal.'
 check_no_requests
 
@@ -28,10 +28,10 @@ check_no_requests
 
 $MMCMAKE ua_m1.analyse --analysis-repeat 1 || failed
 
-check_result ua_m1 'aaa1.*"", ""'
-check_result ua_m1 'aaa2.*"", ""'
-check_result ua_m2 'bbb.*"", ""'
-check_result ua_m3 'ccc.*"", ""'
+check_result ua_m1 'aaa1.*\[\]'
+check_result ua_m1 'aaa2.*\[\]'
+check_result ua_m2 'bbb.*\[\]'
+check_result ua_m3 'ccc.*\[\]'
 check_statuses 'optimal.optimal.optimal.'
 check_no_requests
 check_imdg ua_m2 'ua_m1.*unused_args.*bbb'
@@ -47,10 +47,10 @@ sleep 1
 cat ua_m1.m.unused_args > ua_m1.m
 $MMCMAKE ua_m1.analyse --analysis-repeat 0 || failed
 
-check_result ua_m1 'aaa1.*"", ""'
-check_result ua_m1 'aaa2.*"", "1"'
-check_result ua_m2 'bbb.*"", ""'
-check_result ua_m3 'ccc.*"", ""'
+check_result ua_m1 'aaa1.*\[\]'
+check_result ua_m1 'aaa2.*\[1\]'
+check_result ua_m2 'bbb.*\[\]'
+check_result ua_m3 'ccc.*\[\]'
 check_statuses 'optimal.optimal.suboptimal.'
 check_no_requests
 check_imdg ua_m2 'ua_m1.*unused_args.*bbb'
@@ -61,10 +61,10 @@ check_imdg ua_m1 'ua_m3.*unused_args.*aa
 
 $MMCMAKE ua_m1.analyse --analysis-repeat 1 || failed
 
-check_result ua_m1 'aaa1.*"", ""'
-check_result ua_m1 'aaa2.*"", "1"'
-check_result ua_m2 'bbb.*"", ""'
-check_result ua_m3 'ccc.*"", "1"'
+check_result ua_m1 'aaa1.*\[\]'
+check_result ua_m1 'aaa2.*\[1\]'
+check_result ua_m2 'bbb.*\[\]'
+check_result ua_m3 'ccc.*\[1\]'
 check_statuses 'optimal.suboptimal.optimal.'
 check_no_requests
 
@@ -72,10 +72,10 @@ check_no_requests
 
 $MMCMAKE ua_m1.analyse --analysis-repeat 2 || failed
 
-check_result ua_m1 'aaa1.*"", "1"'
-check_result ua_m1 'aaa2.*"", "1"'
-check_result ua_m2 'bbb.*"", "1"'
-check_result ua_m3 'ccc.*"", "1"'
+check_result ua_m1 'aaa1.*\[1\]'
+check_result ua_m1 'aaa2.*\[1\]'
+check_result ua_m2 'bbb.*\[1\]'
+check_result ua_m3 'ccc.*\[1\]'
 check_statuses 'optimal.optimal.optimal.'
 check_no_requests
 
@@ -88,10 +88,10 @@ sleep 1
 cat ua_m1.m.no_unused_args > ua_m1.m
 $MMCMAKE ua_m1.analyse --analysis-repeat 0 || failed
 
-check_result ua_m1 'aaa1.*"", ""'
-check_result ua_m1 'aaa2.*"", ""'
-check_result ua_m2 'bbb.*"", ""'
-check_result ua_m3 'ccc.*"", ""'
+check_result ua_m1 'aaa1.*\[\]'
+check_result ua_m1 'aaa2.*\[\]'
+check_result ua_m2 'bbb.*\[\]'
+check_result ua_m3 'ccc.*\[\]'
 check_statuses 'optimal.optimal.optimal.'
 check_no_requests
 


--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list