diff --git a/NEWS b/NEWS index 1885e0286..a7d5c6526 100644 --- a/NEWS +++ b/NEWS @@ -82,6 +82,12 @@ Changes to the Mercury standard library: * We have added the predicate unsorted_aggregate2/6 to the solutions module of the standard library. +* We have added several predicates and functions to the error module + of the standard library. The predicates sorry/2 and sorry/3 report + the absence of a feature, while the predicates unexpected/2 and unexpected/3 + report an internal error in the program; all have function versions too. + The predicate expect/3 calls unexpected if a condition isn't satisfied. + Changes to the Mercury compiler: * We have added a new backend that generates C#. diff --git a/compiler/accumulator.m b/compiler/accumulator.m index 948c2bfc3..b2aa94d57 100644 --- a/compiler/accumulator.m +++ b/compiler/accumulator.m @@ -174,7 +174,6 @@ :- import_module hlds.instmap. :- import_module hlds.pred_table. :- import_module hlds.quantification. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module mdbcomp.prim_data. @@ -192,6 +191,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module solutions. :- import_module string. diff --git a/compiler/add_class.m b/compiler/add_class.m index 796259a1f..e10f53690 100644 --- a/compiler/add_class.m +++ b/compiler/add_class.m @@ -60,7 +60,6 @@ :- import_module hlds.make_hlds.make_hlds_warn. :- import_module hlds.make_hlds.state_var. :- import_module hlds.pred_table. -:- import_module libs.compiler_util. :- import_module parse_tree.prog_type. :- import_module parse_tree.prog_type_subst. :- import_module parse_tree.prog_util. @@ -69,6 +68,7 @@ :- import_module int. :- import_module map. :- import_module pair. +:- import_module require. :- import_module set. :- import_module solutions. :- import_module string. diff --git a/compiler/add_clause.m b/compiler/add_clause.m index 669959ee9..5bef72bec 100644 --- a/compiler/add_clause.m +++ b/compiler/add_clause.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 1993-2009 The University of Melbourne. +% Copyright (C) 1993-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -72,7 +72,6 @@ :- import_module hlds.make_hlds.make_hlds_warn. :- import_module hlds.make_hlds.superhomogeneous. :- import_module hlds.pred_table. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module parse_tree.mercury_to_mercury. @@ -89,6 +88,7 @@ :- import_module io. :- import_module map. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. :- import_module varset. diff --git a/compiler/add_heap_ops.m b/compiler/add_heap_ops.m index e1ff32e23..3c2baf202 100644 --- a/compiler/add_heap_ops.m +++ b/compiler/add_heap_ops.m @@ -48,7 +48,6 @@ :- import_module hlds.instmap. :- import_module hlds.pred_table. :- import_module hlds.quantification. -:- import_module libs.compiler_util. :- import_module mdbcomp.prim_data. :- import_module parse_tree.builtin_lib_types. :- import_module parse_tree.prog_data. @@ -60,6 +59,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module term. :- import_module varset. diff --git a/compiler/add_mode.m b/compiler/add_mode.m index 997275279..6fefa4dc4 100644 --- a/compiler/add_mode.m +++ b/compiler/add_mode.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 1993-2006, 2008 The University of Melbourne. +% Copyright (C) 1993-2006, 2008, 2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -38,10 +38,10 @@ :- import_module hlds.hlds_data. :- import_module hlds.hlds_pred. :- import_module hlds.make_hlds.make_hlds_error. -:- import_module libs.compiler_util. :- import_module parse_tree.prog_mode. :- import_module map. +:- import_module require. %----------------------------------------------------------------------------% diff --git a/compiler/add_pragma.m b/compiler/add_pragma.m index a05af7152..4d105fe47 100644 --- a/compiler/add_pragma.m +++ b/compiler/add_pragma.m @@ -141,7 +141,6 @@ :- import_module hlds.make_tags. :- import_module hlds.pred_table. :- import_module hlds.quantification. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module ll_backend. @@ -175,6 +174,7 @@ :- import_module map. :- import_module multi_map. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. :- import_module svmap. diff --git a/compiler/add_pred.m b/compiler/add_pred.m index 802c04282..92bc25e2b 100644 --- a/compiler/add_pred.m +++ b/compiler/add_pred.m @@ -79,7 +79,6 @@ :- import_module hlds.hlds_pred. :- import_module hlds.hlds_rtti. :- import_module hlds.make_hlds.make_hlds_error. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module parse_tree.builtin_lib_types. @@ -90,6 +89,7 @@ :- import_module map. :- import_module set. +:- import_module require. :- import_module term. :- import_module varset. diff --git a/compiler/add_special_pred.m b/compiler/add_special_pred.m index 79a6802f6..6d1bb22d4 100644 --- a/compiler/add_special_pred.m +++ b/compiler/add_special_pred.m @@ -70,7 +70,6 @@ :- import_module hlds.make_hlds.add_pred. :- import_module hlds.pred_table. :- import_module hlds.special_pred. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module parse_tree.prog_type. @@ -80,6 +79,7 @@ :- import_module list. :- import_module map. :- import_module pair. +:- import_module require. :- import_module string. :- import_module varset. diff --git a/compiler/add_trail_ops.m b/compiler/add_trail_ops.m index 7afc7f6b1..970485928 100644 --- a/compiler/add_trail_ops.m +++ b/compiler/add_trail_ops.m @@ -75,7 +75,6 @@ :- import_module hlds.instmap. :- import_module hlds.pred_table. :- import_module hlds.quantification. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module mdbcomp.prim_data. :- import_module parse_tree.builtin_lib_types. @@ -88,6 +87,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module term. :- import_module varset. diff --git a/compiler/add_type.m b/compiler/add_type.m index 97c742918..e27b1f0f5 100644 --- a/compiler/add_type.m +++ b/compiler/add_type.m @@ -64,7 +64,6 @@ :- import_module hlds.hlds_out. :- import_module hlds.hlds_out.hlds_out_goal. :- import_module hlds.hlds_out.hlds_out_util. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module parse_tree.module_qual. @@ -75,6 +74,7 @@ :- import_module map. :- import_module multi_map. :- import_module pair. +:- import_module require. :- import_module string. :- import_module svmap. :- import_module svmulti_map. diff --git a/compiler/analysis.file.m b/compiler/analysis.file.m index b916caaa9..1eb628c6a 100644 --- a/compiler/analysis.file.m +++ b/compiler/analysis.file.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2003, 2005-2009 The University of Melbourne. +% Copyright (C) 2003, 2005-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU Library General % Public License - see the file COPYING.LIB in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -101,18 +101,6 @@ :- implementation. -:- import_module bool. -:- import_module char. -:- import_module dir. -:- import_module exception. -:- import_module parser. -:- import_module term. -:- import_module term_io. -:- import_module type_desc. -:- import_module univ. -:- import_module varset. - -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module libs.pickle. @@ -121,6 +109,18 @@ :- import_module parse_tree.prog_io_sym_name. :- import_module parse_tree.prog_out. +:- import_module bool. +:- import_module char. +:- import_module dir. +:- import_module exception. +:- import_module parser. +:- import_module require. +:- import_module term. +:- import_module term_io. +:- import_module type_desc. +:- import_module univ. +:- import_module varset. + %-----------------------------------------------------------------------------% % The format of an analysis result file is: diff --git a/compiler/analysis.m b/compiler/analysis.m index 8a6673193..7841cfbe7 100644 --- a/compiler/analysis.m +++ b/compiler/analysis.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2003-2004, 2006-2009 The University of Melbourne. +% Copyright (C) 2003-2004, 2006-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU Library General % Public License - see the file COPYING.LIB in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -319,11 +319,11 @@ :- import_module analysis.file. :- import_module libs. -:- import_module libs.compiler_util. :- import_module parse_tree. % XXX unwanted dependency :- import_module parse_tree.module_cmds. % XXX unwanted dependency :- import_module map. +:- import_module require. :- import_module string. :- import_module type_desc. :- import_module univ. diff --git a/compiler/arg_info.m b/compiler/arg_info.m index cfa255c3d..813abb7fd 100644 --- a/compiler/arg_info.m +++ b/compiler/arg_info.m @@ -114,10 +114,10 @@ :- implementation. :- import_module check_hlds.mode_util. -:- import_module libs.compiler_util. :- import_module map. :- import_module pair. +:- import_module require. :- import_module int. :- import_module svset. diff --git a/compiler/assertion.m b/compiler/assertion.m index 0d4de0880..adb249597 100644 --- a/compiler/assertion.m +++ b/compiler/assertion.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 1999-2009 The University of Melbourne. +% Copyright (C) 1999-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -134,7 +134,6 @@ :- import_module hlds.goal_util. :- import_module hlds.hlds_clauses. -:- import_module libs.compiler_util. :- import_module mdbcomp. :- import_module mdbcomp.prim_data. @@ -142,6 +141,7 @@ :- import_module list. :- import_module map. :- import_module maybe. +:- import_module require. :- import_module set. :- import_module solutions. diff --git a/compiler/atsort.m b/compiler/atsort.m index 02ee0be1f..b22ee8388 100644 --- a/compiler/atsort.m +++ b/compiler/atsort.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 1994-1995, 1997, 2004-2006 The University of Melbourne. +% Copyright (C) 1994-1995, 1997, 2004-2006, 2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -47,7 +47,7 @@ :- implementation. -:- import_module libs.compiler_util. +:- import_module require. % :- pred main1(list(list(int))). % :- mode main1(out) is det. diff --git a/compiler/base_typeclass_info.m b/compiler/base_typeclass_info.m index 6130c095d..8914b7be5 100644 --- a/compiler/base_typeclass_info.m +++ b/compiler/base_typeclass_info.m @@ -1,7 +1,7 @@ %---------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %---------------------------------------------------------------------------% -% Copyright (C) 1996-2000, 2003-2007 The University of Melbourne. +% Copyright (C) 1996-2000, 2003-2007, 2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %---------------------------------------------------------------------------% @@ -45,8 +45,6 @@ :- import_module hlds.hlds_data. :- import_module hlds.hlds_pred. :- import_module hlds.hlds_rtti. -:- import_module libs. -:- import_module libs.compiler_util. :- import_module mdbcomp. :- import_module mdbcomp.prim_data. :- import_module parse_tree. @@ -59,6 +57,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module string. :- import_module term. diff --git a/compiler/basic_block.m b/compiler/basic_block.m index 1593711db..2e36e6c3d 100644 --- a/compiler/basic_block.m +++ b/compiler/basic_block.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 1997-2001,2003-2007 The University of Melbourne. +% Copyright (C) 1997-2001,2003-2007, 2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -99,10 +99,10 @@ :- implementation. -:- import_module libs.compiler_util. :- import_module ll_backend.opt_util. :- import_module pair. +:- import_module require. :- import_module svmap. :- import_module svset. diff --git a/compiler/build_mode_constraints.m b/compiler/build_mode_constraints.m index cd0f135cf..01b33aad1 100644 --- a/compiler/build_mode_constraints.m +++ b/compiler/build_mode_constraints.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2004-2009 The University of Melbourne. +% Copyright (C) 2004-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -201,8 +201,6 @@ :- import_module hlds.hlds_args. :- import_module hlds.hlds_clauses. :- import_module hlds.hlds_desc. -:- import_module libs. -:- import_module libs.compiler_util. :- import_module bool. :- import_module cord. @@ -211,6 +209,7 @@ :- import_module maybe. :- import_module multi_map. :- import_module pair. +:- import_module require. :- import_module string. :- import_module svbimap. :- import_module svmulti_map. diff --git a/compiler/bytecode.m b/compiler/bytecode.m index 6f9ae0994..bb2c9f68e 100644 --- a/compiler/bytecode.m +++ b/compiler/bytecode.m @@ -152,10 +152,9 @@ :- import_module backend_libs.bytecode_data. :- import_module backend_libs.c_util. -:- import_module libs. -:- import_module libs.compiler_util. :- import_module assoc_list. +:- import_module require. :- import_module string. %---------------------------------------------------------------------------% diff --git a/compiler/bytecode_data.m b/compiler/bytecode_data.m index 9ebcc2752..db9b2421e 100644 --- a/compiler/bytecode_data.m +++ b/compiler/bytecode_data.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %---------------------------------------------------------------------------% -% Copyright (C) 1999-2000, 2003-2007, 2009 The University of Melbourne. +% Copyright (C) 1999-2000, 2003-2007, 2009-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %---------------------------------------------------------------------------% @@ -62,11 +62,9 @@ :- implementation. -:- import_module libs. -:- import_module libs.compiler_util. - :- import_module char. :- import_module int. +:- import_module require. :- import_module string. %-----------------------------------------------------------------------------% diff --git a/compiler/bytecode_gen.m b/compiler/bytecode_gen.m index c05958367..06a9b72fb 100644 --- a/compiler/bytecode_gen.m +++ b/compiler/bytecode_gen.m @@ -57,8 +57,6 @@ :- import_module hlds.hlds_goal. :- import_module hlds.hlds_pred. :- import_module hlds.passes_aux. -:- import_module libs. -:- import_module libs.compiler_util. :- import_module ll_backend. :- import_module ll_backend.call_gen. % XXX for arg passing convention :- import_module mdbcomp. @@ -75,6 +73,7 @@ :- import_module list. :- import_module map. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. :- import_module term. diff --git a/compiler/call_gen.m b/compiler/call_gen.m index 99747152c..38600ffa2 100644 --- a/compiler/call_gen.m +++ b/compiler/call_gen.m @@ -1,7 +1,7 @@ %---------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %---------------------------------------------------------------------------% -% Copyright (C) 1994-2009 The University of Melbourne. +% Copyright (C) 1994-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %---------------------------------------------------------------------------% @@ -68,7 +68,6 @@ :- import_module hlds.hlds_llds. :- import_module hlds.hlds_module. :- import_module hlds.instmap. -:- import_module libs.compiler_util. :- import_module libs.options. :- import_module ll_backend.code_util. :- import_module ll_backend.continuation_info. @@ -80,6 +79,7 @@ :- import_module int. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. diff --git a/compiler/check_typeclass.m b/compiler/check_typeclass.m index c59c9c674..1355e48b9 100644 --- a/compiler/check_typeclass.m +++ b/compiler/check_typeclass.m @@ -112,7 +112,6 @@ :- import_module hlds.passes_aux. :- import_module hlds.pred_table. :- import_module libs. -:- import_module libs.compiler_util. :- import_module libs.file_util. :- import_module libs.globals. :- import_module libs.options. @@ -131,6 +130,7 @@ :- import_module maybe. :- import_module multi_map. :- import_module pair. +:- import_module require. :- import_module set. :- import_module solutions. :- import_module string. diff --git a/compiler/clause_to_proc.m b/compiler/clause_to_proc.m index 34b305cd3..42ae0738c 100644 --- a/compiler/clause_to_proc.m +++ b/compiler/clause_to_proc.m @@ -72,8 +72,6 @@ :- import_module hlds.hlds_goal. :- import_module hlds.hlds_rtti. :- import_module hlds.make_hlds. -:- import_module libs. -:- import_module libs.compiler_util. :- import_module mdbcomp. :- import_module mdbcomp.prim_data. :- import_module parse_tree. @@ -85,6 +83,7 @@ :- import_module int. :- import_module map. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. :- import_module svmap. diff --git a/compiler/closure_analysis.m b/compiler/closure_analysis.m index b158b20d4..748f1710a 100644 --- a/compiler/closure_analysis.m +++ b/compiler/closure_analysis.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2005-2009 The University of Melbourne. +% Copyright (C) 2005-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -37,7 +37,6 @@ :- import_module hlds.hlds_goal. :- import_module hlds.hlds_pred. :- import_module hlds.passes_aux. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module parse_tree.prog_data. @@ -51,6 +50,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. :- import_module svmap. diff --git a/compiler/code_gen.m b/compiler/code_gen.m index cfb4c111a..d3996a2b2 100644 --- a/compiler/code_gen.m +++ b/compiler/code_gen.m @@ -1,7 +1,7 @@ %---------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %---------------------------------------------------------------------------% -% Copyright (C) 1994-2009 The University of Melbourne. +% Copyright (C) 1994-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %---------------------------------------------------------------------------% @@ -45,7 +45,6 @@ :- import_module hlds.hlds_desc. :- import_module hlds.hlds_pred. :- import_module hlds.instmap. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module ll_backend.call_gen. :- import_module ll_backend.commit_gen. @@ -65,6 +64,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. diff --git a/compiler/code_info.m b/compiler/code_info.m index 292875b1d..cd8b2942f 100644 --- a/compiler/code_info.m +++ b/compiler/code_info.m @@ -69,7 +69,6 @@ :- import_module hlds.hlds_code_util. :- import_module hlds.hlds_desc. :- import_module hlds.hlds_rtti. -:- import_module libs.compiler_util. :- import_module libs.options. :- import_module libs.trace_params. :- import_module ll_backend.code_util. @@ -82,6 +81,7 @@ :- import_module cord. :- import_module int. :- import_module pair. +:- import_module require. :- import_module set. :- import_module stack. :- import_module string. diff --git a/compiler/code_util.m b/compiler/code_util.m index f65ec897c..4360a805b 100644 --- a/compiler/code_util.m +++ b/compiler/code_util.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 1994-2009 The University of Melbourne. +% Copyright (C) 1994-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -96,9 +96,9 @@ :- import_module backend_libs.proc_label. :- import_module backend_libs.rtti. :- import_module hlds.code_model. -:- import_module libs.compiler_util. :- import_module int. +:- import_module require. :- import_module term. %---------------------------------------------------------------------------% diff --git a/compiler/commit_gen.m b/compiler/commit_gen.m index b8237da69..64ac66162 100644 --- a/compiler/commit_gen.m +++ b/compiler/commit_gen.m @@ -1,7 +1,7 @@ %---------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %---------------------------------------------------------------------------% -% Copyright (C) 1997-1998, 2003-2007, 2009 The University of Melbourne. +% Copyright (C) 1997-1998, 2003-2007, 2009-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %---------------------------------------------------------------------------% @@ -35,12 +35,12 @@ :- implementation. -:- import_module libs.compiler_util. :- import_module ll_backend.code_gen. :- import_module cord. :- import_module list. :- import_module maybe. +:- import_module require. :- import_module pair. :- import_module string. diff --git a/compiler/common.m b/compiler/common.m index 1e03cdc31..c23a9e511 100644 --- a/compiler/common.m +++ b/compiler/common.m @@ -1,7 +1,7 @@ %---------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %---------------------------------------------------------------------------% -% Copyright (C) 1995-2009 The University of Melbourne. +% Copyright (C) 1995-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %---------------------------------------------------------------------------% @@ -98,7 +98,6 @@ :- import_module hlds.hlds_rtti. :- import_module hlds.instmap. :- import_module libs. -:- import_module libs.compiler_util. :- import_module libs.options. :- import_module parse_tree.error_util. :- import_module parse_tree.prog_type. @@ -110,6 +109,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module sveqvclass. :- import_module svmap. diff --git a/compiler/compile_target_code.m b/compiler/compile_target_code.m index e5ec04aae..ce0a0b072 100644 --- a/compiler/compile_target_code.m +++ b/compiler/compile_target_code.m @@ -235,7 +235,6 @@ :- import_module hlds. :- import_module hlds.passes_aux. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.handle_options. :- import_module libs.options. @@ -250,6 +249,7 @@ :- import_module dir. :- import_module getopt_io. +:- import_module require. :- import_module string. %-----------------------------------------------------------------------------% diff --git a/compiler/compiler_util.m b/compiler/compiler_util.m index 00a31a9c6..01f958286 100644 --- a/compiler/compiler_util.m +++ b/compiler/compiler_util.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 1997-2006, 2009 The University of Melbourne. +% Copyright (C) 1997-2006, 2009-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -22,28 +22,6 @@ %-----------------------------------------------------------------------------% - % Call error/1 with a "Sorry, not implemented" message. - % - % Use this for features that should be implemented (or at least could be - % implemented). - % -:- func sorry(string, string) = _ is erroneous. -:- pred sorry(string::in, string::in) is erroneous. - - % unexpected(ModuleName, Message): - % - % Call error/1 with an "Unexpected" message. - % Use this to handle cases which are not expected to arise (i.e. bugs). - % -:- func unexpected(string, string) = _ is erroneous. -:- pred unexpected(string::in, string::in) is erroneous. - - % expect(Goal, ModuleName, Message): - % - % Call Goal, and call unexpected(ModuleName, Message) if Goal fails. - % -:- pred expect((pred)::((pred) is semidet), string::in, string::in) is det. - % Record the fact that a warning has been issued; set the exit status % to error if the `--halt-at-warn' option is set. % @@ -74,26 +52,6 @@ %-----------------------------------------------------------------------------% - % Call error/1 with a "Sorry, not implemented" message. - % -sorry(Module, What) = _ :- sorry(Module, What). -sorry(Module, What) :- - string.format("%s: Sorry, not implemented: %s", - [s(Module), s(What)], ErrorMessage), - error(ErrorMessage). - -unexpected(Module, What) = _ :- unexpected(Module, What). -unexpected(Module, What) :- - string.format("%s: Unexpected: %s", [s(Module), s(What)], ErrorMessage), - error(ErrorMessage). - -expect(Goal, Module, Message) :- - ( Goal -> - true - ; - unexpected(Module, Message) - ). - record_warning(Globals, !IO) :- globals.lookup_bool_option(Globals, halt_at_warn, HaltAtWarn), ( diff --git a/compiler/complexity.m b/compiler/complexity.m index 644957b77..a41c6c430 100644 --- a/compiler/complexity.m +++ b/compiler/complexity.m @@ -66,7 +66,6 @@ :- import_module hlds.instmap. :- import_module hlds.passes_aux. :- import_module hlds.pred_table. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module mdbcomp.prim_data. @@ -83,6 +82,7 @@ :- import_module int. :- import_module list. :- import_module map. +:- import_module require. :- import_module set. :- import_module string. :- import_module term. diff --git a/compiler/constraint.m b/compiler/constraint.m index a7b3e04a2..66d0bc74f 100644 --- a/compiler/constraint.m +++ b/compiler/constraint.m @@ -53,7 +53,6 @@ :- import_module check_hlds.inst_match. :- import_module hlds.goal_form. :- import_module hlds.goal_util. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. @@ -61,6 +60,7 @@ :- import_module list. :- import_module map. :- import_module pair. +:- import_module require. :- import_module set. :- import_module term. :- import_module varset. diff --git a/compiler/continuation_info.m b/compiler/continuation_info.m index 0ef81adce..9ef47a753 100644 --- a/compiler/continuation_info.m +++ b/compiler/continuation_info.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 1997-2000,2002-2009 The University of Melbourne. +% Copyright (C) 1997-2000,2002-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -408,12 +408,12 @@ :- import_module check_hlds.type_util. :- import_module hlds.hlds_goal. :- import_module hlds.hlds_llds. -:- import_module libs.compiler_util. :- import_module libs.options. :- import_module ll_backend.code_util. :- import_module parse_tree.prog_type. :- import_module int. +:- import_module require. :- import_module solutions. :- import_module string. :- import_module svmap. diff --git a/compiler/coverage_profiling.m b/compiler/coverage_profiling.m index f87af0d9e..839d7cf09 100644 --- a/compiler/coverage_profiling.m +++ b/compiler/coverage_profiling.m @@ -45,7 +45,6 @@ :- import_module hlds.goal_util. :- import_module hlds.instmap. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module ll_backend.deep_profiling. @@ -56,6 +55,7 @@ :- import_module counter. :- import_module map. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. diff --git a/compiler/cse_detection.m b/compiler/cse_detection.m index 6b1fb954e..25b8e33db 100644 --- a/compiler/cse_detection.m +++ b/compiler/cse_detection.m @@ -47,7 +47,6 @@ :- import_module hlds.instmap. :- import_module hlds.quantification. :- import_module libs. -:- import_module libs.compiler_util. :- import_module libs.file_util. :- import_module libs.globals. :- import_module libs.options. @@ -64,6 +63,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. :- import_module svmap. diff --git a/compiler/ctgc.fixpoint_table.m b/compiler/ctgc.fixpoint_table.m index f1b5e4026..1c92492c5 100644 --- a/compiler/ctgc.fixpoint_table.m +++ b/compiler/ctgc.fixpoint_table.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2006 The University of Melbourne. +% Copyright (C) 2006, 2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -89,11 +89,10 @@ :- implementation. -:- import_module libs.compiler_util. - :- import_module int. :- import_module list. :- import_module map. +:- import_module require. :- import_module svmap. %-----------------------------------------------------------------------------% diff --git a/compiler/ctgc.livedata.m b/compiler/ctgc.livedata.m index a83c53e8c..7668e071e 100644 --- a/compiler/ctgc.livedata.m +++ b/compiler/ctgc.livedata.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2006 The University of Melbourne. +% Copyright (C) 2006, 2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -87,11 +87,11 @@ :- implementation. -:- import_module libs.compiler_util. :- import_module transform_hlds.ctgc.datastruct. :- import_module transform_hlds.ctgc.structure_sharing.domain. :- import_module pair. +:- import_module require. :- import_module set. %-----------------------------------------------------------------------------% diff --git a/compiler/ctgc.selector.m b/compiler/ctgc.selector.m index f40a3df7f..8b3bc5e20 100644 --- a/compiler/ctgc.selector.m +++ b/compiler/ctgc.selector.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2005-2006, 2008-2009 The University of Melbourne. +% Copyright (C) 2005-2006, 2008-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -87,7 +87,6 @@ :- implementation. :- import_module check_hlds.type_util. -:- import_module libs.compiler_util. :- import_module parse_tree.prog_type. :- import_module assoc_list. @@ -96,6 +95,7 @@ :- import_module map. :- import_module pair. :- import_module queue. +:- import_module require. :- import_module set. :- import_module solutions. :- import_module string. diff --git a/compiler/ctgc.util.m b/compiler/ctgc.util.m index c254b583f..1af413e23 100644 --- a/compiler/ctgc.util.m +++ b/compiler/ctgc.util.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2006-2008 The University of Melbourne. +% Copyright (C) 2006-2008, 2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -76,13 +76,13 @@ :- implementation. :- import_module check_hlds.type_util. -:- import_module libs.compiler_util. :- import_module parse_tree.prog_type. :- import_module parse_tree.prog_type_subst. :- import_module bool. :- import_module list. :- import_module map. +:- import_module require. :- import_module svmap. %-----------------------------------------------------------------------------% diff --git a/compiler/dead_proc_elim.m b/compiler/dead_proc_elim.m index 81e9b17d8..125ac7043 100644 --- a/compiler/dead_proc_elim.m +++ b/compiler/dead_proc_elim.m @@ -84,7 +84,6 @@ :- import_module hlds.hlds_goal. :- import_module hlds.passes_aux. :- import_module hlds.pred_table. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module parse_tree.error_util. @@ -96,6 +95,7 @@ :- import_module maybe. :- import_module pair. :- import_module queue. +:- import_module require. :- import_module set_tree234. :- import_module set. :- import_module string. diff --git a/compiler/deforest.m b/compiler/deforest.m index 6ad2b413b..ec515eedb 100644 --- a/compiler/deforest.m +++ b/compiler/deforest.m @@ -60,7 +60,6 @@ :- import_module hlds.instmap. :- import_module hlds.passes_aux. :- import_module hlds.quantification. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module mdbcomp.prim_data. @@ -84,6 +83,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. :- import_module term. diff --git a/compiler/delay_construct.m b/compiler/delay_construct.m index e594449fb..2c2aab0d2 100644 --- a/compiler/delay_construct.m +++ b/compiler/delay_construct.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2001-2009 The University of Melbourne. +% Copyright (C) 2001-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -45,7 +45,6 @@ :- import_module hlds.hlds_rtti. :- import_module hlds.instmap. :- import_module hlds.passes_aux. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module parse_tree.prog_data. @@ -53,6 +52,7 @@ :- import_module io. :- import_module list. :- import_module pair. +:- import_module require. :- import_module set. %-----------------------------------------------------------------------------% diff --git a/compiler/delay_info.m b/compiler/delay_info.m index 4f1573d8e..154a77d2f 100644 --- a/compiler/delay_info.m +++ b/compiler/delay_info.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 1994-1998, 2003-2007, 2009 The University of Melbourne. +% Copyright (C) 1994-1998, 2003-2007, 2009-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -90,13 +90,12 @@ :- implementation. :- import_module check_hlds.mode_errors. % for the mode_error_info - % and delay_info types. -:- import_module libs. -:- import_module libs.compiler_util. + % and delay_info types. :- import_module int. :- import_module map. :- import_module pair. +:- import_module require. :- import_module set. :- import_module stack. :- import_module svmap. diff --git a/compiler/delay_partial_inst.m b/compiler/delay_partial_inst.m index 3a68b5f00..3f2349208 100644 --- a/compiler/delay_partial_inst.m +++ b/compiler/delay_partial_inst.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2007-2009 The University of Melbourne. +% Copyright (C) 2007-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -132,8 +132,6 @@ :- import_module hlds.instmap. :- import_module hlds.passes_aux. :- import_module hlds.quantification. -:- import_module libs. -:- import_module libs.compiler_util. :- import_module parse_tree. :- import_module parse_tree.prog_data. @@ -143,6 +141,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. :- import_module svmap. diff --git a/compiler/dense_switch.m b/compiler/dense_switch.m index d83b559fe..41cb056d9 100644 --- a/compiler/dense_switch.m +++ b/compiler/dense_switch.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 1994-2007, 2009 The University of Melbourne. +% Copyright (C) 1994-2007, 2009-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -58,7 +58,6 @@ :- import_module hlds.hlds_llds. :- import_module hlds.hlds_out. :- import_module hlds.hlds_out.hlds_out_goal. -:- import_module libs.compiler_util. :- import_module ll_backend.code_gen. :- import_module ll_backend.trace_gen. :- import_module parse_tree.prog_type. @@ -69,6 +68,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module svmap. %-----------------------------------------------------------------------------% diff --git a/compiler/dep_par_conj.m b/compiler/dep_par_conj.m index 20669aa0a..6c43c3914 100644 --- a/compiler/dep_par_conj.m +++ b/compiler/dep_par_conj.m @@ -151,7 +151,6 @@ :- import_module hlds.hlds_pred. :- import_module hlds.pred_table. :- import_module hlds.quantification. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module mdbcomp.prim_data. @@ -168,6 +167,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module std_util. :- import_module string. :- import_module svmap. diff --git a/compiler/det_analysis.m b/compiler/det_analysis.m index a0cfa869f..7edde4a19 100644 --- a/compiler/det_analysis.m +++ b/compiler/det_analysis.m @@ -122,7 +122,6 @@ :- import_module libs. :- import_module libs.file_util. :- import_module libs.globals. -:- import_module libs.compiler_util. :- import_module libs.options. :- import_module parse_tree.mercury_to_mercury. :- import_module parse_tree.prog_data. @@ -134,6 +133,7 @@ :- import_module io. :- import_module map. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. :- import_module term. diff --git a/compiler/det_report.m b/compiler/det_report.m index fbec440e2..29b8b4403 100644 --- a/compiler/det_report.m +++ b/compiler/det_report.m @@ -145,7 +145,6 @@ :- import_module hlds.hlds_out.hlds_out_goal. :- import_module hlds.hlds_out.hlds_out_util. :- import_module libs. -:- import_module libs.compiler_util. :- import_module libs.options. :- import_module mdbcomp. :- import_module mdbcomp.prim_data. @@ -163,6 +162,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set_tree234. :- import_module solutions. :- import_module string. diff --git a/compiler/det_util.m b/compiler/det_util.m index 8158f7beb..2bc918054 100644 --- a/compiler/det_util.m +++ b/compiler/det_util.m @@ -118,13 +118,13 @@ :- implementation. :- import_module libs. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module parse_tree.prog_type. :- import_module parse_tree.prog_util. :- import_module map. +:- import_module require. :- import_module set_tree234. :- import_module term. diff --git a/compiler/disj_gen.m b/compiler/disj_gen.m index 0da14260d..5d2bb1972 100644 --- a/compiler/disj_gen.m +++ b/compiler/disj_gen.m @@ -40,7 +40,6 @@ :- import_module backend_libs.builtin_ops. :- import_module hlds.goal_form. :- import_module hlds.hlds_llds. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module ll_backend.code_gen. @@ -57,6 +56,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module term. diff --git a/compiler/dupelim.m b/compiler/dupelim.m index b1e6108e7..4c6e4c573 100644 --- a/compiler/dupelim.m +++ b/compiler/dupelim.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 1995-2007, 2009 The University of Melbourne. +% Copyright (C) 1995-2007, 2009-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -61,7 +61,6 @@ :- implementation. -:- import_module libs.compiler_util. :- import_module ll_backend.basic_block. :- import_module ll_backend.opt_util. @@ -69,6 +68,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module svmap. :- import_module svset. diff --git a/compiler/dupproc.m b/compiler/dupproc.m index f96f491bd..15bec0e30 100644 --- a/compiler/dupproc.m +++ b/compiler/dupproc.m @@ -37,12 +37,12 @@ :- implementation. -:- import_module libs.compiler_util. :- import_module ll_backend.opt_util. :- import_module int. :- import_module maybe. :- import_module pair. +:- import_module require. %-----------------------------------------------------------------------------% diff --git a/compiler/elds.m b/compiler/elds.m index 230b71b6e..3907c9f0c 100644 --- a/compiler/elds.m +++ b/compiler/elds.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2007 The University of Melbourne. +% Copyright (C) 2007, 2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -99,7 +99,7 @@ % :- type elds_rtti_defn ---> elds_rtti_defn( - rtti_defn_id :: elds_rtti_id, + rtti_defn_id :: elds_rtti_id, rtti_defn_exported :: bool, rtti_defn_varset :: prog_varset, rtti_defn_clause :: elds_clause @@ -256,7 +256,7 @@ ---> elds_case(elds_term, elds_expr). :- type elds_catch - ---> elds_catch(elds_term, elds_term, elds_expr). + ---> elds_catch(elds_term, elds_term, elds_expr). :- type elds_unop ---> plus @@ -385,7 +385,7 @@ :- implementation. -:- import_module libs.compiler_util. +:- import_module require. %-----------------------------------------------------------------------------% diff --git a/compiler/elds_to_erlang.m b/compiler/elds_to_erlang.m index ab7f054c8..55e2cc323 100644 --- a/compiler/elds_to_erlang.m +++ b/compiler/elds_to_erlang.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2007-2009 The University of Melbourne. +% Copyright (C) 2007-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -47,7 +47,6 @@ :- import_module hlds.hlds_rtti. :- import_module hlds.pred_table. :- import_module hlds.special_pred. -:- import_module libs.compiler_util. :- import_module libs.file_util. :- import_module libs.globals. :- import_module mdbcomp.prim_data. @@ -65,6 +64,7 @@ :- import_module list. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. :- import_module term. diff --git a/compiler/equiv_type.m b/compiler/equiv_type.m index 847863df8..f89e355fa 100644 --- a/compiler/equiv_type.m +++ b/compiler/equiv_type.m @@ -109,7 +109,6 @@ :- implementation. -:- import_module libs.compiler_util. :- import_module parse_tree.prog_data. :- import_module parse_tree.prog_mode. :- import_module parse_tree.prog_util. @@ -119,6 +118,7 @@ :- import_module assoc_list. :- import_module bool. :- import_module pair. +:- import_module require. :- import_module set. :- import_module svmap. :- import_module term. diff --git a/compiler/equiv_type_hlds.m b/compiler/equiv_type_hlds.m index 21331dfc8..49c0baf72 100644 --- a/compiler/equiv_type_hlds.m +++ b/compiler/equiv_type_hlds.m @@ -41,7 +41,6 @@ :- import_module hlds.hlds_rtti. :- import_module hlds.instmap. :- import_module hlds.quantification. -:- import_module libs.compiler_util. :- import_module mdbcomp.prim_data. :- import_module parse_tree.equiv_type. :- import_module parse_tree.prog_data. @@ -54,6 +53,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module svmap. :- import_module svset. diff --git a/compiler/erl_call_gen.m b/compiler/erl_call_gen.m index 9fff47698..b2d78dad9 100644 --- a/compiler/erl_call_gen.m +++ b/compiler/erl_call_gen.m @@ -106,11 +106,11 @@ :- import_module backend_libs.builtin_ops. :- import_module check_hlds.type_util. :- import_module hlds.hlds_module. -:- import_module libs.compiler_util. :- import_module int. :- import_module map. :- import_module pair. +:- import_module require. %-----------------------------------------------------------------------------% % diff --git a/compiler/erl_code_gen.m b/compiler/erl_code_gen.m index 12e9c921e..0386ef98b 100644 --- a/compiler/erl_code_gen.m +++ b/compiler/erl_code_gen.m @@ -59,7 +59,6 @@ :- import_module hlds.instmap. :- import_module hlds.passes_aux. :- import_module hlds.pred_table. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module mdbcomp.prim_data. @@ -72,6 +71,7 @@ :- import_module list. :- import_module map. :- import_module maybe. +:- import_module require. :- import_module set. :- import_module string. :- import_module varset. diff --git a/compiler/erl_code_util.m b/compiler/erl_code_util.m index fffbdd6c3..aac069170 100644 --- a/compiler/erl_code_util.m +++ b/compiler/erl_code_util.m @@ -1,16 +1,16 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2007-2008 The University of Melbourne. +% Copyright (C) 2007-2008, 2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% -% +% % File: erl_code_util.m. % Main author: wangp. -% +% % This module is part of the Erlang code generator. -% +% %-----------------------------------------------------------------------------% :- module erl_backend.erl_code_util. @@ -211,11 +211,11 @@ :- import_module check_hlds.mode_util. :- import_module check_hlds.type_util. :- import_module hlds.goal_util. -:- import_module libs.compiler_util. :- import_module int. :- import_module map. :- import_module pair. +:- import_module require. :- import_module set. :- import_module svset. :- import_module term. diff --git a/compiler/erl_rtti.m b/compiler/erl_rtti.m index db4edfd76..a13b662f9 100644 --- a/compiler/erl_rtti.m +++ b/compiler/erl_rtti.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2007, 2009 The University of Melbourne. +% Copyright (C) 2007, 2009-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -49,7 +49,6 @@ :- import_module hlds.code_model. :- import_module hlds.hlds_pred. :- import_module hlds.hlds_rtti. -:- import_module libs.compiler_util. :- import_module mdbcomp.prim_data. :- import_module parse_tree.prog_data. :- import_module parse_tree.prog_util. @@ -59,6 +58,7 @@ :- import_module exception. :- import_module int. :- import_module maybe. +:- import_module require. :- import_module string. :- import_module svvarset. :- import_module univ. diff --git a/compiler/erl_unify_gen.m b/compiler/erl_unify_gen.m index 620cced0c..c808dd0bb 100644 --- a/compiler/erl_unify_gen.m +++ b/compiler/erl_unify_gen.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2007-2009 The University of Melbourne. +% Copyright (C) 2007-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -83,7 +83,6 @@ :- import_module erl_backend.erl_call_gen. :- import_module hlds.hlds_module. :- import_module hlds.hlds_pred. -:- import_module libs.compiler_util. :- import_module mdbcomp.prim_data. :- import_module parse_tree.prog_data. :- import_module parse_tree.prog_util. @@ -92,6 +91,7 @@ :- import_module list. :- import_module map. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. diff --git a/compiler/exception_analysis.m b/compiler/exception_analysis.m index c088fada1..325fcccb0 100644 --- a/compiler/exception_analysis.m +++ b/compiler/exception_analysis.m @@ -130,7 +130,6 @@ :- import_module check_hlds.type_util. :- import_module hlds.hlds_goal. :- import_module hlds.hlds_pred. -:- import_module libs.compiler_util. :- import_module libs.file_util. :- import_module libs.globals. :- import_module libs.options. @@ -146,6 +145,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module term. diff --git a/compiler/export.m b/compiler/export.m index 612a2eda7..fc1474d3b 100644 --- a/compiler/export.m +++ b/compiler/export.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 1996-2009 The University of Melbourne. +% Copyright (C) 1996-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -81,20 +81,18 @@ :- implementation. -:- import_module check_hlds. % needed for type_util, mode_util -:- import_module libs. - :- import_module backend_libs.c_util. :- import_module backend_libs.foreign. :- import_module backend_libs.name_mangle. :- import_module backend_libs.proc_label. +:- import_module check_hlds. :- import_module check_hlds.type_util. :- import_module hlds.arg_info. :- import_module hlds.code_model. :- import_module hlds.hlds_data. :- import_module hlds.hlds_pred. :- import_module hlds.pred_table. -:- import_module libs.compiler_util. +:- import_module libs. :- import_module libs.globals. :- import_module parse_tree.file_names. :- import_module parse_tree.module_cmds. @@ -109,6 +107,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module string. :- import_module term. diff --git a/compiler/fact_table.m b/compiler/fact_table.m index cb12b5333..5b2cb5274 100644 --- a/compiler/fact_table.m +++ b/compiler/fact_table.m @@ -102,7 +102,6 @@ :- import_module hlds.arg_info. :- import_module hlds.code_model. :- import_module hlds.passes_aux. -:- import_module libs.compiler_util. :- import_module libs.file_util. :- import_module libs.globals. :- import_module libs.options. @@ -127,6 +126,7 @@ :- import_module maybe. :- import_module pair. :- import_module parser. +:- import_module require. :- import_module string. :- import_module term. :- import_module term_io. diff --git a/compiler/field_access.m b/compiler/field_access.m index b781449cf..4faedbd54 100644 --- a/compiler/field_access.m +++ b/compiler/field_access.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 1993-2006, 2008-2009 The University of Melbourne. +% Copyright (C) 1993-2006, 2008-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -105,12 +105,12 @@ :- import_module hlds.hlds_data. :- import_module hlds.hlds_pred. :- import_module hlds.make_hlds.superhomogeneous. -:- import_module libs.compiler_util. :- import_module parse_tree.mercury_to_mercury. :- import_module parse_tree.prog_io_sym_name. :- import_module bool. :- import_module int. +:- import_module require. :- import_module term. :- import_module varset. diff --git a/compiler/file_names.m b/compiler/file_names.m index c40c9d877..2018f4e4f 100644 --- a/compiler/file_names.m +++ b/compiler/file_names.m @@ -133,7 +133,6 @@ :- implementation. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.handle_options. :- import_module libs.options. @@ -146,6 +145,7 @@ :- import_module dir. :- import_module library. :- import_module list. +:- import_module require. :- import_module string. %-----------------------------------------------------------------------------% diff --git a/compiler/follow_code.m b/compiler/follow_code.m index fd5b91ac6..bbe4adf86 100644 --- a/compiler/follow_code.m +++ b/compiler/follow_code.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 1994-2009 The University of Melbourne. +% Copyright (C) 1994-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -51,7 +51,6 @@ :- import_module hlds.hlds_rtti. :- import_module hlds.instmap. :- import_module hlds.quantification. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module parse_tree.prog_data. @@ -59,6 +58,7 @@ :- import_module bool. :- import_module list. :- import_module pair. +:- import_module require. :- import_module set. %-----------------------------------------------------------------------------% diff --git a/compiler/follow_vars.m b/compiler/follow_vars.m index d70898a52..45ad09e0b 100644 --- a/compiler/follow_vars.m +++ b/compiler/follow_vars.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 1994-2008 The University of Melbourne. +% Copyright (C) 1994-2008, 2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -53,7 +53,6 @@ :- import_module hlds.arg_info. :- import_module hlds.code_model. -:- import_module libs.compiler_util. :- import_module ll_backend.call_gen. :- import_module parse_tree.prog_data. @@ -64,6 +63,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module svmap. %-----------------------------------------------------------------------------% diff --git a/compiler/foreign.m b/compiler/foreign.m index 99f8cc77d..57268624a 100644 --- a/compiler/foreign.m +++ b/compiler/foreign.m @@ -157,7 +157,6 @@ :- import_module hlds.hlds_out. :- import_module hlds.hlds_pred. :- import_module libs. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module parse_tree.error_util. :- import_module parse_tree.prog_out. @@ -169,6 +168,7 @@ :- import_module list. :- import_module map. :- import_module pair. +:- import_module require. :- import_module string. :- import_module term. :- import_module varset. diff --git a/compiler/frameopt.m b/compiler/frameopt.m index 1348d2b6a..c997a3823 100644 --- a/compiler/frameopt.m +++ b/compiler/frameopt.m @@ -154,7 +154,6 @@ :- implementation. -:- import_module libs.compiler_util. :- import_module libs.options. :- import_module ll_backend.opt_debug. :- import_module ll_backend.opt_util. @@ -166,6 +165,7 @@ :- import_module maybe. :- import_module pair. :- import_module queue. +:- import_module require. :- import_module set. :- import_module string. :- import_module svmap. diff --git a/compiler/globals.m b/compiler/globals.m index 7b1aabc7e..d7c377884 100644 --- a/compiler/globals.m +++ b/compiler/globals.m @@ -295,9 +295,8 @@ :- implementation. -:- import_module libs.compiler_util. - :- import_module int. +:- import_module require. :- import_module string. :- import_module univ. diff --git a/compiler/goal_form.m b/compiler/goal_form.m index fc38185ee..72e23b3bb 100644 --- a/compiler/goal_form.m +++ b/compiler/goal_form.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2002-2009 The University of Melbourne. +% Copyright (C) 2002-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -186,7 +186,6 @@ :- import_module hlds.code_model. :- import_module hlds.hlds_goal. -:- import_module libs.compiler_util. :- import_module transform_hlds.exception_analysis. :- import_module transform_hlds.term_constr_main. @@ -195,6 +194,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. %-----------------------------------------------------------------------------% diff --git a/compiler/goal_path.m b/compiler/goal_path.m index 1027b9320..ec1928ddc 100644 --- a/compiler/goal_path.m +++ b/compiler/goal_path.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 1997-2009 University of Melbourne. +% Copyright (C) 1997-2010 University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -61,8 +61,6 @@ :- import_module check_hlds.type_util. :- import_module hlds.hlds_clauses. :- import_module hlds.hlds_goal. -:- import_module libs. -:- import_module libs.compiler_util. :- import_module mdbcomp. :- import_module mdbcomp.program_representation. :- import_module parse_tree.prog_data. @@ -73,6 +71,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. %-----------------------------------------------------------------------------% diff --git a/compiler/goal_util.m b/compiler/goal_util.m index ec7da0dbb..41506f2ec 100644 --- a/compiler/goal_util.m +++ b/compiler/goal_util.m @@ -451,7 +451,6 @@ :- import_module check_hlds.type_util. :- import_module hlds.goal_form. :- import_module hlds.hlds_llds. -:- import_module libs.compiler_util. :- import_module parse_tree.prog_data. :- import_module parse_tree.prog_mode. :- import_module parse_tree.prog_type. @@ -460,6 +459,7 @@ :- import_module int. :- import_module map. :- import_module pair. +:- import_module require. :- import_module solutions. :- import_module string. :- import_module svmap. diff --git a/compiler/granularity.m b/compiler/granularity.m index 7ade7bc9f..256391c97 100644 --- a/compiler/granularity.m +++ b/compiler/granularity.m @@ -31,7 +31,6 @@ :- import_module hlds.instmap. :- import_module hlds.pred_table. :- import_module hlds.quantification. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module transform_hlds.dependency_graph. @@ -44,6 +43,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module string. %-----------------------------------------------------------------------------% diff --git a/compiler/graph_colour.m b/compiler/graph_colour.m index 02a3da1e8..2c4c186c6 100644 --- a/compiler/graph_colour.m +++ b/compiler/graph_colour.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 1995-1996, 2004-2006 The University of Melbourne. +% Copyright (C) 1995-1996, 2004-2006, 2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -33,9 +33,8 @@ :- implementation. -:- import_module libs.compiler_util. - :- import_module list. +:- import_module require. %-----------------------------------------------------------------------------% diff --git a/compiler/headvar_names.m b/compiler/headvar_names.m index 42e2f5b55..f195364c9 100644 --- a/compiler/headvar_names.m +++ b/compiler/headvar_names.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2007, 2009 The University of Melbourne. +% Copyright (C) 2007, 2009-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -36,7 +36,6 @@ :- import_module hlds.hlds_clauses. :- import_module hlds.hlds_goal. :- import_module hlds.goal_util. -:- import_module libs.compiler_util. :- import_module libs.options. :- import_module parse_tree.prog_data. @@ -44,6 +43,7 @@ :- import_module list. :- import_module map. :- import_module maybe. +:- import_module require. :- import_module set. :- import_module varset. :- import_module svmap. diff --git a/compiler/hhf.m b/compiler/hhf.m index 174e1e671..efdcb93e0 100644 --- a/compiler/hhf.m +++ b/compiler/hhf.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2001-2002, 2004-2009 The University of Melbourne. +% Copyright (C) 2001-2002, 2004-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -46,7 +46,6 @@ :- import_module hlds.hlds_args. :- import_module hlds.hlds_goal. :- import_module hlds.passes_aux. -:- import_module libs.compiler_util. :- import_module parse_tree.prog_data. :- import_module parse_tree.prog_type. :- import_module parse_tree.prog_util. @@ -56,6 +55,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module solutions. :- import_module term. diff --git a/compiler/higher_order.m b/compiler/higher_order.m index 94ed424f7..f7cb0ee7b 100644 --- a/compiler/higher_order.m +++ b/compiler/higher_order.m @@ -59,7 +59,6 @@ :- import_module hlds.pred_table. :- import_module hlds.quantification. :- import_module hlds.special_pred. -:- import_module libs.compiler_util. :- import_module libs.file_util. :- import_module libs.globals. :- import_module libs.options. @@ -79,6 +78,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. :- import_module svmap. @@ -88,10 +88,10 @@ %-----------------------------------------------------------------------------% - % Iterate collecting requests and processing them until there are no more - % requests remaining. - % specialize_higher_order(!ModuleInfo, !IO) :- + % Iterate collecting requests and process them until there are no more + % requests remaining. + module_info_get_globals(!.ModuleInfo, Globals), globals.lookup_bool_option(Globals, optimize_higher_order, HigherOrder), globals.lookup_bool_option(Globals, type_specialization, TypeSpec), diff --git a/compiler/hlds_args.m b/compiler/hlds_args.m index 8d9a14c2d..ffb70b94f 100644 --- a/compiler/hlds_args.m +++ b/compiler/hlds_args.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2006-2007 The University of Melbourne. +% Copyright (C) 2006-2007, 2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -219,12 +219,12 @@ :- implementation. -:- import_module libs.compiler_util. :- import_module parse_tree.prog_util. :- import_module parse_tree.prog_type. - % Require for apply_partial_map_to_list - % XXX that should really live in a different module. + % Required for apply_partial_map_to_list. + % XXX That should really live in a different module. +:- import_module require. :- import_module string. %-----------------------------------------------------------------------------% diff --git a/compiler/hlds_clauses.m b/compiler/hlds_clauses.m index 7ec175502..76bf2ef52 100644 --- a/compiler/hlds_clauses.m +++ b/compiler/hlds_clauses.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 1996-2007, 2009 The University of Melbourne. +% Copyright (C) 1996-2007, 2009-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -237,11 +237,11 @@ :- implementation. -:- import_module libs.compiler_util. :- import_module parse_tree.prog_util. :- import_module int. :- import_module map. +:- import_module require. :- import_module term. :- import_module varset. diff --git a/compiler/hlds_code_util.m b/compiler/hlds_code_util.m index e3644a9f3..edfac6e1d 100644 --- a/compiler/hlds_code_util.m +++ b/compiler/hlds_code_util.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2002-2009 The University of Melbourne. +% Copyright (C) 2002-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -48,7 +48,6 @@ :- import_module check_hlds.mode_util. :- import_module hlds.hlds_goal. :- import_module hlds.hlds_pred. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module mdbcomp.prim_data. @@ -57,6 +56,7 @@ :- import_module bool. :- import_module char. :- import_module map. +:- import_module require. :- import_module set. :- import_module string. diff --git a/compiler/hlds_data.m b/compiler/hlds_data.m index 74268966a..82e6460b3 100644 --- a/compiler/hlds_data.m +++ b/compiler/hlds_data.m @@ -34,13 +34,13 @@ :- implementation. :- import_module check_hlds.type_util. -:- import_module libs.compiler_util. :- import_module parse_tree.prog_type_subst. :- import_module parse_tree.prog_util. :- import_module cord. :- import_module int. :- import_module multi_map. +:- import_module require. :- import_module svmap. :- import_module varset. diff --git a/compiler/hlds_error_util.m b/compiler/hlds_error_util.m index 92faed510..16cbbde45 100644 --- a/compiler/hlds_error_util.m +++ b/compiler/hlds_error_util.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 1997-2007, 2009 The University of Melbourne. +% Copyright (C) 1997-2007, 2009-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -116,7 +116,6 @@ :- import_module hlds.special_pred. :- import_module mdbcomp.prim_data. -:- import_module libs.compiler_util. :- import_module parse_tree.mercury_to_mercury. :- import_module parse_tree.prog_mode. :- import_module parse_tree.prog_out. @@ -125,6 +124,7 @@ :- import_module int. :- import_module string. :- import_module list. +:- import_module require. :- import_module term. %-----------------------------------------------------------------------------% diff --git a/compiler/hlds_goal.m b/compiler/hlds_goal.m index ce418e9d2..96c680c2a 100644 --- a/compiler/hlds_goal.m +++ b/compiler/hlds_goal.m @@ -1785,7 +1785,6 @@ :- implementation. -:- import_module libs.compiler_util. :- import_module parse_tree.builtin_lib_types. :- import_module parse_tree.prog_mode. :- import_module parse_tree.prog_type. @@ -1793,6 +1792,7 @@ :- import_module assoc_list. :- import_module cord. :- import_module map. +:- import_module require. :- import_module string. :- import_module svmap. :- import_module svvarset. diff --git a/compiler/hlds_llds.m b/compiler/hlds_llds.m index 78da26e99..455e08bf4 100644 --- a/compiler/hlds_llds.m +++ b/compiler/hlds_llds.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2002-2007, 2009 The University of Melbourne. +% Copyright (C) 2002-2007, 2009-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -278,11 +278,11 @@ :- implementation. :- import_module hlds.goal_util. -:- import_module libs.compiler_util. :- import_module assoc_list. :- import_module list. :- import_module pair. +:- import_module require. :- import_module string. :- import_module varset. diff --git a/compiler/hlds_module.m b/compiler/hlds_module.m index 556618908..f3f986f49 100644 --- a/compiler/hlds_module.m +++ b/compiler/hlds_module.m @@ -661,13 +661,13 @@ :- implementation. -:- import_module libs.compiler_util. :- import_module parse_tree.file_names. :- import_module parse_tree.module_imports. :- import_module parse_tree.prog_util. :- import_module assoc_list. :- import_module counter. +:- import_module require. :- pred module_info_get_lambdas_per_context(module_info::in, map(prog_context, counter)::out) is det. diff --git a/compiler/hlds_out_mode.m b/compiler/hlds_out_mode.m index 2e3aaa554..907ce7de0 100644 --- a/compiler/hlds_out_mode.m +++ b/compiler/hlds_out_mode.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2009 The University of Melbourne. +% Copyright (C) 2009-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -72,13 +72,13 @@ :- import_module check_hlds.mode_util. :- import_module hlds.instmap. -:- import_module libs.compiler_util. :- import_module mdbcomp.prim_data. :- import_module parse_tree.mercury_to_mercury. :- import_module parse_tree.prog_io_util. :- import_module parse_tree.prog_util. :- import_module pair. +:- import_module require. :- import_module set. :- import_module term. :- import_module varset. diff --git a/compiler/hlds_out_module.m b/compiler/hlds_out_module.m index e158a1653..123ca4acf 100644 --- a/compiler/hlds_out_module.m +++ b/compiler/hlds_out_module.m @@ -45,7 +45,6 @@ :- import_module hlds.hlds_out.hlds_out_goal. :- import_module hlds.hlds_out.hlds_out_pred. :- import_module hlds.pred_table. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module parse_tree.mercury_to_mercury. @@ -56,6 +55,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. :- import_module term. diff --git a/compiler/hlds_out_pred.m b/compiler/hlds_out_pred.m index 0eaa9fa9b..56b348ebf 100644 --- a/compiler/hlds_out_pred.m +++ b/compiler/hlds_out_pred.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2009 The University of Melbourne. +% Copyright (C) 2009-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -78,7 +78,6 @@ :- import_module hlds.hlds_out.hlds_out_goal. :- import_module hlds.hlds_out.hlds_out_mode. :- import_module hlds.hlds_rtti. -:- import_module libs.compiler_util. :- import_module mdbcomp.program_representation. :- import_module parse_tree.mercury_to_mercury. :- import_module parse_tree.prog_ctgc. @@ -90,6 +89,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module string. :- import_module term. :- import_module varset. diff --git a/compiler/hlds_pred.m b/compiler/hlds_pred.m index 964f9e447..08d79163c 100644 --- a/compiler/hlds_pred.m +++ b/compiler/hlds_pred.m @@ -47,19 +47,24 @@ :- implementation. +:- import_module backend_libs. +:- import_module backend_libs.builtin_ops. :- import_module check_hlds.inst_match. +:- import_module check_hlds.mode_errors. :- import_module check_hlds.mode_util. :- import_module check_hlds.type_util. :- import_module hlds.goal_form. :- import_module hlds.goal_util. :- import_module hlds.hlds_args. :- import_module hlds.hlds_rtti. -:- import_module libs.compiler_util. +:- import_module hlds.special_pred. :- import_module libs.options. +:- import_module mdbcomp.program_representation. :- import_module parse_tree.prog_type. :- import_module parse_tree.prog_util. :- import_module int. +:- import_module require. :- import_module string. :- import_module term. :- import_module unit. @@ -2215,9 +2220,6 @@ attribute_list_to_attributes(Attributes, Attributes). :- implementation. -:- import_module check_hlds.mode_errors. -:- import_module mdbcomp.program_representation. - :- type proc_info ---> proc_info( % The context of the `:- mode' decl (or the context of the @@ -3114,10 +3116,6 @@ pred_info_is_field_access_function(ModuleInfo, PredInfo) :- :- implementation. -:- import_module backend_libs. -:- import_module backend_libs.builtin_ops. -:- import_module hlds.special_pred. - pred_info_is_builtin(PredInfo) :- ModuleName = pred_info_module(PredInfo), PredName = pred_info_name(PredInfo), diff --git a/compiler/hlds_rtti.m b/compiler/hlds_rtti.m index 961e64c8e..85250d86c 100644 --- a/compiler/hlds_rtti.m +++ b/compiler/hlds_rtti.m @@ -332,12 +332,12 @@ :- implementation. :- import_module check_hlds.mode_util. -:- import_module libs.compiler_util. :- import_module parse_tree.prog_type. :- import_module parse_tree.prog_type_subst. :- import_module map. :- import_module pair. +:- import_module require. :- import_module set_tree234. :- import_module string. :- import_module svmap. diff --git a/compiler/ilasm.m b/compiler/ilasm.m index 0275a6431..ffd7d7f6c 100644 --- a/compiler/ilasm.m +++ b/compiler/ilasm.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 1999-2007, 2009 The University of Melbourne. +% Copyright (C) 1999-2007, 2009-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -343,7 +343,6 @@ :- implementation. :- import_module backend_libs.c_util. % for output_float_literal -:- import_module libs.compiler_util. :- import_module libs.options. :- import_module char. @@ -351,6 +350,7 @@ :- import_module int. :- import_module pair. :- import_module pprint. +:- import_module require. :- import_module string. :- import_module term_io. :- import_module varset. diff --git a/compiler/ilds.m b/compiler/ilds.m index b3e5bba16..f577100fd 100644 --- a/compiler/ilds.m +++ b/compiler/ilds.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 1999-2006 The University of Melbourne. +% Copyright (C) 1999-2006, 2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -437,9 +437,8 @@ :- implementation. -:- import_module libs.compiler_util. - :- import_module int. +:- import_module require. %-----------------------------------------------------------------------------% diff --git a/compiler/implementation_defined_literals.m b/compiler/implementation_defined_literals.m index 545c82855..bc72a2021 100644 --- a/compiler/implementation_defined_literals.m +++ b/compiler/implementation_defined_literals.m @@ -35,7 +35,6 @@ :- import_module hlds.hlds_out.hlds_out_util. :- import_module hlds.hlds_pred. :- import_module libs. -:- import_module libs.compiler_util. :- import_module libs.handle_options. :- import_module mdbcomp. :- import_module mdbcomp.prim_data. @@ -44,6 +43,7 @@ :- import_module list. :- import_module map. +:- import_module require. :- import_module term. :- type subst_literals_info diff --git a/compiler/inlining.m b/compiler/inlining.m index 9a46529b0..b3d5b83c3 100644 --- a/compiler/inlining.m +++ b/compiler/inlining.m @@ -153,7 +153,6 @@ :- import_module hlds.goal_util. :- import_module hlds.passes_aux. :- import_module hlds.quantification. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module libs.trace_params. @@ -171,6 +170,7 @@ :- import_module maybe. :- import_module multi_map. :- import_module pair. +:- import_module require. :- import_module set. :- import_module svset. :- import_module term. diff --git a/compiler/inst_graph.m b/compiler/inst_graph.m index cde987a23..71f6ff003 100644 --- a/compiler/inst_graph.m +++ b/compiler/inst_graph.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2001-2007, 2009 The University of Melbourne. +% Copyright (C) 2001-2007, 2009-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -187,8 +187,8 @@ :- import_module hlds.hlds_out. :- import_module hlds.hlds_out.hlds_out_util. -:- import_module libs.compiler_util. +:- import_module require. :- import_module set. :- import_module term. :- import_module term_io. diff --git a/compiler/inst_match.m b/compiler/inst_match.m index 51bac5445..4eb3730fa 100644 --- a/compiler/inst_match.m +++ b/compiler/inst_match.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 1995-1998, 2000-2009 The University of Melbourne. +% Copyright (C) 1995-1998, 2000-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -319,8 +319,6 @@ :- import_module check_hlds.inst_util. :- import_module check_hlds.mode_util. :- import_module check_hlds.type_util. -:- import_module libs. -:- import_module libs.compiler_util. :- import_module mdbcomp. :- import_module mdbcomp.prim_data. :- import_module parse_tree.prog_data. @@ -331,6 +329,7 @@ :- import_module list. :- import_module map. :- import_module maybe. +:- import_module require. :- import_module set. :- import_module set_tree234. :- import_module svset. diff --git a/compiler/inst_util.m b/compiler/inst_util.m index 2adf1655e..6cfa7b0df 100644 --- a/compiler/inst_util.m +++ b/compiler/inst_util.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 1997-2009 The University of Melbourne. +% Copyright (C) 1997-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -152,8 +152,6 @@ :- import_module check_hlds.mode_util. :- import_module check_hlds.type_util. :- import_module hlds.hlds_data. -:- import_module libs. -:- import_module libs.compiler_util. :- import_module mdbcomp. :- import_module mdbcomp.prim_data. :- import_module parse_tree.prog_mode. @@ -163,6 +161,7 @@ :- import_module list. :- import_module map. :- import_module pair. +:- import_module require. :- import_module set. :- import_module svmap. :- import_module svset. diff --git a/compiler/instmap.m b/compiler/instmap.m index 7468fb536..eb111ac16 100644 --- a/compiler/instmap.m +++ b/compiler/instmap.m @@ -359,13 +359,13 @@ :- import_module check_hlds.inst_util. :- import_module check_hlds.mode_util. :- import_module check_hlds.type_util. -:- import_module libs.compiler_util. :- import_module parse_tree.prog_data. :- import_module bool. :- import_module int. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module std_util. :- import_module string. :- import_module svmap. diff --git a/compiler/intermod.m b/compiler/intermod.m index 54864a434..107335086 100644 --- a/compiler/intermod.m +++ b/compiler/intermod.m @@ -113,7 +113,6 @@ :- import_module hlds.hlds_pred. :- import_module hlds.pred_table. :- import_module hlds.special_pred. -:- import_module libs.compiler_util. :- import_module libs.file_util. :- import_module libs.globals. :- import_module libs.options. @@ -136,6 +135,7 @@ :- import_module maybe. :- import_module multi_map. :- import_module pair. +:- import_module require. :- import_module set. :- import_module solutions. :- import_module string. diff --git a/compiler/interval.m b/compiler/interval.m index 5ea55b5e3..930a17d38 100644 --- a/compiler/interval.m +++ b/compiler/interval.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2002-2009 The University of Melbourne. +% Copyright (C) 2002-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -192,13 +192,12 @@ :- import_module hlds.goal_util. :- import_module hlds.hlds_llds. :- import_module hlds.instmap. -:- import_module libs. -:- import_module libs.compiler_util. :- import_module ll_backend. :- import_module ll_backend.call_gen. :- import_module assoc_list. :- import_module pair. +:- import_module require. :- import_module svmap. :- import_module svset. :- import_module svvarset. diff --git a/compiler/ite_gen.m b/compiler/ite_gen.m index d12456b2b..c8f259bd5 100644 --- a/compiler/ite_gen.m +++ b/compiler/ite_gen.m @@ -1,7 +1,7 @@ %---------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %---------------------------------------------------------------------------% -% Copyright (C) 1994-2009 The University of Melbourne. +% Copyright (C) 1994-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %---------------------------------------------------------------------------% @@ -43,7 +43,6 @@ :- import_module hlds.hlds_module. :- import_module hlds.hlds_pred. :- import_module hlds.instmap. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module ll_backend.code_gen. @@ -64,6 +63,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. :- import_module term. diff --git a/compiler/jumpopt.m b/compiler/jumpopt.m index 79d8d2cf4..d6dcb6fda 100644 --- a/compiler/jumpopt.m +++ b/compiler/jumpopt.m @@ -64,7 +64,6 @@ :- implementation. :- import_module backend_libs.builtin_ops. -:- import_module libs.compiler_util. :- import_module ll_backend.code_util. :- import_module ll_backend.opt_util. :- import_module parse_tree.prog_data. @@ -72,6 +71,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module string. :- import_module svmap. diff --git a/compiler/lambda.m b/compiler/lambda.m index 7c3d970b0..7ee9451cd 100644 --- a/compiler/lambda.m +++ b/compiler/lambda.m @@ -92,7 +92,6 @@ :- import_module hlds.hlds_rtti. :- import_module hlds.pred_table. :- import_module hlds.quantification. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module mdbcomp.prim_data. @@ -109,6 +108,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module term. :- import_module varset. diff --git a/compiler/layout_out.m b/compiler/layout_out.m index 26a08448e..adaee722d 100644 --- a/compiler/layout_out.m +++ b/compiler/layout_out.m @@ -175,7 +175,6 @@ :- import_module hlds.hlds_goal. :- import_module hlds.hlds_rtti. :- import_module hlds.special_pred. -:- import_module libs.compiler_util. :- import_module libs.trace_params. :- import_module ll_backend.llds_out.llds_out_code_addr. :- import_module ll_backend.llds_out.llds_out_data. @@ -188,6 +187,7 @@ :- import_module int. :- import_module map. :- import_module pair. +:- import_module require. :- import_module string. :- import_module varset. diff --git a/compiler/lco.m b/compiler/lco.m index 14e401ae1..24b6bae84 100644 --- a/compiler/lco.m +++ b/compiler/lco.m @@ -178,7 +178,6 @@ :- import_module hlds.instmap. :- import_module hlds.pred_table. :- import_module hlds.quantification. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module mdbcomp.prim_data. @@ -196,6 +195,7 @@ :- import_module multi_map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. :- import_module svbag. diff --git a/compiler/live_vars.m b/compiler/live_vars.m index 8dd3c4ae1..59b735dbe 100644 --- a/compiler/live_vars.m +++ b/compiler/live_vars.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 1994-2008 The University of Melbourne. +% Copyright (C) 1994-2008, 2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -66,11 +66,11 @@ :- import_module hlds.hlds_llds. :- import_module hlds.hlds_rtti. :- import_module hlds.instmap. -:- import_module libs.compiler_util. :- import_module list. :- import_module map. :- import_module pair. +:- import_module require. %-----------------------------------------------------------------------------% diff --git a/compiler/livemap.m b/compiler/livemap.m index 698d60cf6..161bec24b 100644 --- a/compiler/livemap.m +++ b/compiler/livemap.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 1995-2007, 2009 The University of Melbourne. +% Copyright (C) 1995-2007, 2009-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -40,12 +40,12 @@ :- implementation. -:- import_module libs.compiler_util. :- import_module ll_backend.opt_util. :- import_module parse_tree.prog_data. :- import_module bool. :- import_module pair. +:- import_module require. :- import_module string. :- import_module svset. diff --git a/compiler/liveness.m b/compiler/liveness.m index fce0ccee8..a83bf9ee0 100644 --- a/compiler/liveness.m +++ b/compiler/liveness.m @@ -197,7 +197,6 @@ :- import_module hlds.hlds_rtti. :- import_module hlds.instmap. :- import_module hlds.quantification. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module libs.trace_params. @@ -211,6 +210,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module string. :- import_module svset. :- import_module term. diff --git a/compiler/llds.m b/compiler/llds.m index c35fde7b1..ab69b209d 100644 --- a/compiler/llds.m +++ b/compiler/llds.m @@ -1432,9 +1432,8 @@ :- implementation. -:- import_module libs.compiler_util. - :- import_module int. +:- import_module require. %-----------------------------------------------------------------------------% diff --git a/compiler/llds_out_data.m b/compiler/llds_out_data.m index 4515922e4..6ab31245c 100644 --- a/compiler/llds_out_data.m +++ b/compiler/llds_out_data.m @@ -1,7 +1,7 @@ %----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %----------------------------------------------------------------------------% -% Copyright (C) 2009 The University of Melbourne. +% Copyright (C) 2009-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %----------------------------------------------------------------------------% @@ -151,7 +151,6 @@ :- import_module backend_libs.c_util. :- import_module backend_libs.name_mangle. :- import_module backend_libs.rtti. -:- import_module libs.compiler_util. :- import_module ll_backend.layout_out. :- import_module ll_backend.llds_out.llds_out_code_addr. :- import_module ll_backend.rtti_out. @@ -161,6 +160,7 @@ :- import_module int. :- import_module map. :- import_module maybe. +:- import_module require. :- import_module string. %----------------------------------------------------------------------------% diff --git a/compiler/llds_out_file.m b/compiler/llds_out_file.m index 5992a53a2..51f6f51e2 100644 --- a/compiler/llds_out_file.m +++ b/compiler/llds_out_file.m @@ -1,7 +1,7 @@ %----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %----------------------------------------------------------------------------% -% Copyright (C) 2009 The University of Melbourne. +% Copyright (C) 2009-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %----------------------------------------------------------------------------% @@ -18,7 +18,6 @@ :- module ll_backend.llds_out.llds_out_file. :- interface. -% :- import_module hlds.hlds_llds. :- import_module libs.globals. :- import_module ll_backend.llds. @@ -73,7 +72,6 @@ :- import_module backend_libs.rtti. :- import_module hlds.hlds_module. :- import_module hlds.hlds_pred. -:- import_module libs.compiler_util. :- import_module libs.options. :- import_module libs.trace_params. :- import_module ll_backend.layout. @@ -97,6 +95,7 @@ :- import_module maybe. :- import_module multi_map. :- import_module pair. +:- import_module require. :- import_module set. :- import_module set_tree234. :- import_module string. diff --git a/compiler/llds_out_global.m b/compiler/llds_out_global.m index f2943435f..9e05ebebd 100644 --- a/compiler/llds_out_global.m +++ b/compiler/llds_out_global.m @@ -1,7 +1,7 @@ %----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %----------------------------------------------------------------------------% -% Copyright (C) 2009 The University of Melbourne. +% Copyright (C) 2009-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %----------------------------------------------------------------------------% @@ -54,7 +54,6 @@ :- import_module backend_libs.name_mangle. :- import_module backend_libs.rtti. :- import_module hlds.hlds_pred. -:- import_module libs.compiler_util. :- import_module ll_backend.llds_out.llds_out_data. :- import_module mdbcomp.prim_data. :- import_module parse_tree.prog_data. @@ -64,6 +63,7 @@ :- import_module int. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module string. %----------------------------------------------------------------------------% diff --git a/compiler/llds_out_instr.m b/compiler/llds_out_instr.m index 21cd7ad6b..8599cf99a 100644 --- a/compiler/llds_out_instr.m +++ b/compiler/llds_out_instr.m @@ -1,7 +1,7 @@ %----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %----------------------------------------------------------------------------% -% Copyright (C) 2009 The University of Melbourne. +% Copyright (C) 2009-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %----------------------------------------------------------------------------% @@ -60,7 +60,6 @@ :- import_module check_hlds.type_util. :- import_module hlds.hlds_data. :- import_module hlds.hlds_pred. -:- import_module libs.compiler_util. :- import_module ll_backend.layout. :- import_module ll_backend.layout_out. :- import_module ll_backend.llds_out.llds_out_code_addr. @@ -77,6 +76,7 @@ :- import_module int. :- import_module map. :- import_module maybe. +:- import_module require. :- import_module set. :- import_module string. :- import_module term. diff --git a/compiler/llds_to_x86_64.m b/compiler/llds_to_x86_64.m index ed503098f..241677a1a 100644 --- a/compiler/llds_to_x86_64.m +++ b/compiler/llds_to_x86_64.m @@ -49,7 +49,6 @@ :- import_module backend_libs.builtin_ops. :- import_module backend_libs.name_mangle. -:- import_module libs.compiler_util. :- import_module ll_backend.llds_out. :- import_module ll_backend.llds_out.llds_out_code_addr. :- import_module ll_backend.x86_64_out. @@ -60,6 +59,7 @@ :- import_module int. :- import_module io. :- import_module maybe. +:- import_module require. :- import_module set. :- import_module string. diff --git a/compiler/lookup_switch.m b/compiler/lookup_switch.m index e168a90a5..c1b465ff2 100644 --- a/compiler/lookup_switch.m +++ b/compiler/lookup_switch.m @@ -170,7 +170,6 @@ :- import_module check_hlds.type_util. :- import_module hlds.code_model. :- import_module hlds.goal_form. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module ll_backend.continuation_info. @@ -184,6 +183,7 @@ :- import_module int. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module std_util. :- import_module string. :- import_module svmap. diff --git a/compiler/lookup_util.m b/compiler/lookup_util.m index 082895953..39db6e659 100644 --- a/compiler/lookup_util.m +++ b/compiler/lookup_util.m @@ -82,7 +82,6 @@ :- import_module hlds.code_model. :- import_module hlds.hlds_module. :- import_module hlds.instmap. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module ll_backend.code_gen. :- import_module ll_backend.exprn_aux. @@ -92,6 +91,7 @@ :- import_module int. :- import_module maybe. :- import_module pair. +:- import_module require. figure_out_output_vars(CI, GoalInfo, OutVars) :- InstMapDelta = goal_info_get_instmap_delta(GoalInfo), diff --git a/compiler/loop_inv.m b/compiler/loop_inv.m index ac5f592cd..1595f9716 100644 --- a/compiler/loop_inv.m +++ b/compiler/loop_inv.m @@ -125,7 +125,6 @@ :- import_module hlds.hlds_goal. :- import_module hlds.instmap. :- import_module hlds.quantification. -:- import_module libs.compiler_util. :- import_module mdbcomp.prim_data. :- import_module parse_tree.prog_data. :- import_module parse_tree.prog_util. @@ -136,6 +135,7 @@ :- import_module list. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. :- import_module term. diff --git a/compiler/lp.m b/compiler/lp.m index b61ab5023..e71e47903 100644 --- a/compiler/lp.m +++ b/compiler/lp.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 1997,2002-2007 The University of Melbourne. +% Copyright (C) 1997,2002-2007, 2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -88,12 +88,11 @@ :- implementation. -:- import_module libs.compiler_util. - :- import_module bool. :- import_module float. :- import_module int. :- import_module maybe. +:- import_module require. :- import_module set. :- import_module solutions. :- import_module string. @@ -104,15 +103,16 @@ %-----------------------------------------------------------------------------% :- type lp_info - ---> lp( - varset :: varset, - urs_map :: map(var, pair(var)), - % Map from variables with URS to the - % corresponding pair of variables that - % represent that variable in the standard - % form (x = x' - x'', x', x'' >= 0). - slack_vars :: list(var), % slack variables - artificial_vars :: list(var) % artificial variables + ---> lp_info( + lpi_varset :: varset, + + % Map from variables with URS to the corresponding pair + % of variables that represent that variable in the standard + % form (x = x' - x'', x', x'' >= 0). + lpi_urs_map :: map(var, pair(var)), + + lpi_slack_vars :: list(var), + lpi_art_vars :: list(var) ). %-----------------------------------------------------------------------------% @@ -152,7 +152,7 @@ lp_solve_2(Eqns0, Dir, Obj0, Result, !Info, !IO) :- ), simplify_coeffs(Obj1, Obj2), - get_urs_vars(URS, !.Info, _), + get_urs_vars(!.Info, URS), expand_urs_vars(Obj2, URS, Obj), list.length(Eqns, Rows), collect_vars(Eqns, Obj, Vars), @@ -160,7 +160,7 @@ lp_solve_2(Eqns0, Dir, Obj0, Result, !Info, !IO) :- list.length(VarList, Cols), map.init(VarNums0), number_vars(VarList, 0, VarNums0, VarNums), - get_art_vars(ArtVars, !Info), + get_art_vars(!.Info, ArtVars), some [!Tableau] ( init_tableau(Rows, Cols, VarNums, URS, !:Tableau), insert_equations(Eqns, 1, Cols, VarNums, !Tableau), @@ -287,7 +287,7 @@ standardize_equation(Eqn0, Eqn, !Info) :- new_slack_var(Var, !Info), Coeffs = [Var - 1.0 | Coeffs0], simplify_eq(eqn(Coeffs, (=<), Const0), Eqn1), - get_urs_vars(URS, !Info), + get_urs_vars(!.Info, URS), expand_urs_vars_e(Eqn1, URS, Eqn) ). @@ -300,7 +300,7 @@ standardize_equation(Eqn0, Eqn, !Info) :- new_art_var(Var, !Info), Coeffs = [Var - 1.0 | Coeffs0], simplify_eq(eqn(Coeffs, (=<), Const0), Eqn1), - get_urs_vars(URS, !Info), + get_urs_vars(!.Info, URS), expand_urs_vars_e(Eqn1, URS, Eqn) ). @@ -314,7 +314,7 @@ standardize_equation(Eqn0, Eqn, !Info) :- new_art_var(AVar, !Info), Coeffs = [SVar - (-1.0), AVar - (1.0) | Coeffs0], simplify_eq(eqn(Coeffs, (>=), Const0), Eqn1), - get_urs_vars(URS, !Info), + get_urs_vars(!.Info, URS), expand_urs_vars_e(Eqn1, URS, Eqn) ). @@ -603,9 +603,7 @@ fix_basis_and_rem_cols([V | Vs], !Tableau) :- ) ), solutions.aggregate(all_rows(!.Tableau), BasisAgg, [], Res), - ( - Res = [1.0 - Row] - -> + ( Res = [1.0 - Row] -> PivGoal = (pred(Col1::out) is nondet :- all_cols(!.Tableau, Col1), Col \= Col1, @@ -630,7 +628,8 @@ fix_basis_and_rem_cols([V | Vs], !Tableau) :- %-----------------------------------------------------------------------------% -:- type cell ---> cell(int, int). +:- type cell + ---> cell(int, int). :- pred pivot(int::in, int::in, tableau::in, tableau::out) is det. @@ -686,15 +685,15 @@ row_op(Scale, From, To, !Tableau) :- %-----------------------------------------------------------------------------% :- type tableau - ---> tableau( - rows :: int, - cols :: int, - var_nums :: map(var, int), - urs_vars :: map(var, pair(var)), - shunned_rows :: list(int), - shunned_cols :: list(int), - cells :: map(pair(int), float) - ). + ---> tableau( + rows :: int, + cols :: int, + var_nums :: map(var, int), + urs_vars :: map(var, pair(var)), + shunned_rows :: list(int), + shunned_cols :: list(int), + cells :: map(pair(int), float) + ). :- pred init_tableau(int::in, int::in, map(var, int)::in, map(var, pair(var))::in, tableau::out) is det. @@ -832,75 +831,54 @@ lp_info_init(Varset0, URSVars, LPInfo) :- ), map.init(URSMap0), list.foldl(Introduce, URSVars, Varset0 - URSMap0, Varset - URSMap), - LPInfo = lp(Varset, URSMap, [], []). + LPInfo = lp_info(Varset, URSMap, [], []). :- pred new_slack_var(var::out, lp_info::in, lp_info::out) is det. new_slack_var(Var, !Info) :- some [!Varset] ( - get_varset(!:Varset, !Info), + get_varset(!.Info, !:Varset), svvarset.new_var(Var, !Varset), set_varset(!.Varset, !Info) ), - get_slack_vars(Vars, !Info), + get_slack_vars(!.Info, Vars), set_slack_vars([Var | Vars], !Info). :- pred new_art_var(var::out, lp_info::in, lp_info::out) is det. new_art_var(Var, !Info) :- some [!Varset] ( - get_varset(!:Varset, !Info), + get_varset(!.Info, !:Varset), svvarset.new_var(Var, !Varset), set_varset(!.Varset, !Info) ), - get_art_vars(Vars, !Info), + get_art_vars(!.Info, Vars), set_art_vars([Var | Vars], !Info). -:- pred get_varset(varset::out, lp_info::in, lp_info::out) is det. +:- pred get_varset(lp_info::in, varset::out) is det. +:- pred get_urs_vars(lp_info::in, map(var, pair(var))::out) is det. +:- pred get_slack_vars(lp_info::in, list(var)::out) is det. +:- pred get_art_vars(lp_info::in, list(var)::out) is det. -get_varset(Varset, Info, Info) :- - Info = lp(Varset, _URSVars, _Slack, _Art). +get_varset(Info, Info ^ lpi_varset). +get_urs_vars(Info, Info ^ lpi_urs_map). +get_slack_vars(Info, Info ^ lpi_slack_vars). +get_art_vars(Info, Info ^ lpi_art_vars). :- pred set_varset(varset::in, lp_info::in, lp_info::out) is det. - -set_varset(Varset, Info0, Info) :- - Info0 = lp(_Varset, URSVars, Slack, Art), - Info = lp(Varset, URSVars, Slack, Art). - -:- pred get_urs_vars(map(var, pair(var))::out, lp_info::in, lp_info::out) - is det. - -get_urs_vars(URSVars, Info, Info) :- - Info = lp(_Varset, URSVars, _Slack, _Art). - :- pred set_urs_vars(map(var, pair(var))::in, lp_info::in, lp_info::out) is det. - -set_urs_vars(URSVars, Info0, Info) :- - Info0 = lp(Varset, _URSVars, Slack, Art), - Info = lp(Varset, URSVars, Slack, Art). - -:- pred get_slack_vars(list(var)::out, lp_info::in, lp_info::out) is det. - -get_slack_vars(Slack, Info, Info) :- - Info = lp(_Varset, _URSVars, Slack, _Art). - :- pred set_slack_vars(list(var)::in, lp_info::in, lp_info::out) is det. - -set_slack_vars(Slack, Info0, Info) :- - Info0 = lp(Varset, URSVars, _Slack, Art), - Info = lp(Varset, URSVars, Slack, Art). - -:- pred get_art_vars(list(var)::out, lp_info::in, lp_info::out) is det. - -get_art_vars(Art, Info, Info) :- - Info = lp(_Varset, _URSVars, _Slack, Art). - :- pred set_art_vars(list(var)::in, lp_info::in, lp_info::out) is det. -set_art_vars(Art, Info0, Info) :- - Info0 = lp(Varset, URSVars, Slack, _Art), - Info = lp(Varset, URSVars, Slack, Art). +set_varset(Varset, !Info) :- + !Info ^ lpi_varset := Varset. +set_urs_vars(URSVars, !Info) :- + !Info ^ lpi_urs_map := URSVars. +set_slack_vars(Slack, !Info) :- + !Info ^ lpi_slack_vars := Slack. +set_art_vars(Art, !Info) :- + !Info ^ lpi_art_vars := Art. %-----------------------------------------------------------------------------% diff --git a/compiler/lp_rational.m b/compiler/lp_rational.m index a0ba470a3..d317d0814 100644 --- a/compiler/lp_rational.m +++ b/compiler/lp_rational.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 1997-2002, 2005-2007, 2009 The University of Melbourne. +% Copyright (C) 1997-2002, 2005-2007, 2009-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -177,7 +177,7 @@ %-----------------------------------------------------------------------------% % -% Bounding boxes and other approximations +% Bounding boxes and other approximations. % % Approximate the solution space of a set of constraints using % a bounding box. If the system is inconsistent then the resulting @@ -193,7 +193,7 @@ %-----------------------------------------------------------------------------% % -% Linear solver +% Linear solver. % :- type objective == lp_terms. @@ -223,7 +223,7 @@ %-----------------------------------------------------------------------------% % -% Projection +% Projection. % :- type projection_result @@ -260,7 +260,7 @@ %-----------------------------------------------------------------------------% % -% Entailment +% Entailment. % :- type entailment_result @@ -291,7 +291,7 @@ %-----------------------------------------------------------------------------% % -% Stuff for intermodule optimization +% Stuff for intermodule optimization. % % A function that converts an lp_var into a string. @@ -306,7 +306,7 @@ %-----------------------------------------------------------------------------% % -% Debugging predicates +% Debugging predicates. % % Print out the constraints using the names in the varset. If the @@ -328,11 +328,10 @@ :- implementation. -:- import_module libs.compiler_util. - :- import_module assoc_list. :- import_module bool. :- import_module int. +:- import_module require. :- import_module solutions. :- import_module string. :- import_module svmap. @@ -340,7 +339,7 @@ %-----------------------------------------------------------------------------% % -% Constraints +% Constraints. % % The following properties should hold for each constraint: @@ -761,31 +760,31 @@ nonneg_box(VarsToIgnore, Constraints) = NonNegConstraints :- % XXX Most of this came from lp.m. We should try to remove a lot of % nondeterminism here. -:- type lp_info - ---> lp( - varset :: lp_varset, - slack_vars :: lp_vars, % - slack variables. - art_vars :: lp_vars % - artificial variables. +:- type lpr_info + ---> lpr_info( + lpr_varset :: lp_varset, + lpr_slack_vars :: lp_vars, + lpr_art_vars :: lp_vars ). lp_rational.solve(Constraints, Direction, Objective, Varset) = Result :- - Info0 = lp_info_init(Varset), + Info0 = lpr_info_init(Varset), solve_2(Constraints, Direction, Objective, Result, Info0, _). - % solve_2(Eqns, Dir, Obj, Res, LPInfo0, LPInfo) takes a list + % solve_2(Eqns, Dir, Obj, Res, LPRInfo0, LPRInfo) takes a list % of inequalities `Eqns', a direction for optimization `Dir', an - % objective function `Obj' and an lp_info structure `LPInfo0'. + % objective function `Obj' and an lpr_info structure `LPRInfo0'. % See inline comments for details on the algorithm. % :- pred solve_2(constraints::in, direction::in, objective::in, - lp_result::out, lp_info::in, lp_info::out) is det. + lp_result::out, lpr_info::in, lpr_info::out) is det. -solve_2(!.Constraints, Direction, !.Objective, Result, !LPInfo) :- +solve_2(!.Constraints, Direction, !.Objective, Result, !LPRInfo) :- % Simplify the inequalities and convert them to standard form by % introducing slack/artificial variables. Obj = !.Objective, - lp_standardize_constraints(!Constraints, !LPInfo), + lp_standardize_constraints(!Constraints, !LPRInfo), % If we are maximizing the objective function then we need % to negate all the coefficients in the objective. @@ -801,7 +800,7 @@ solve_2(!.Constraints, Direction, !.Objective, Result, !LPInfo) :- VarList = set.to_sorted_list(Vars), Columns = list.length(VarList), VarNums = number_vars(VarList, 0), - ArtVars = !.LPInfo ^ art_vars, + ArtVars = !.LPRInfo ^ lpr_art_vars, Tableau0 = init_tableau(Rows, Columns, VarNums), insert_constraints(!.Constraints, 1, Columns, VarNums, Tableau0, Tableau), ( @@ -880,43 +879,43 @@ two_phase(Obj0, Obj, ArtVars, VarNums, !.Tableau) = Result :- %-----------------------------------------------------------------------------% :- pred lp_standardize_constraints(constraints::in, constraints::out, - lp_info::in, lp_info::out) is det. + lpr_info::in, lpr_info::out) is det. -lp_standardize_constraints(!Constraints, !LPInfo) :- - list.map_foldl(lp_standardize_constraint, !Constraints, !LPInfo). +lp_standardize_constraints(!Constraints, !LPRInfo) :- + list.map_foldl(lp_standardize_constraint, !Constraints, !LPRInfo). % standardize_constraint performs the following operations on a % constraint: - % - ensures the constant is >= 0 - % (multiplying by -1 if necessary) + % + % - ensures the constant is >= 0 (multiplying by -1 if necessary) % - introduces slack and artificial variables % :- pred lp_standardize_constraint(constraint::in, constraint::out, - lp_info::in, lp_info::out) is det. + lpr_info::in, lpr_info::out) is det. -lp_standardize_constraint(Constr0 @ lte(Coeffs, Const), Constr, !LPInfo) :- +lp_standardize_constraint(Constr0 @ lte(Coeffs, Const), Constr, !LPRInfo) :- ( Const < zero -> Constr1 = negate_constraint(Constr0), - lp_standardize_constraint(Constr1, Constr, !LPInfo) + lp_standardize_constraint(Constr1, Constr, !LPRInfo) ; - new_slack_var(Var, !LPInfo), + new_slack_var(Var, !LPRInfo), Constr = lte([Var - one | Coeffs], Const) ). -lp_standardize_constraint(Eqn0 @ eq(Coeffs, Const), Eqn, !LPInfo) :- +lp_standardize_constraint(Eqn0 @ eq(Coeffs, Const), Eqn, !LPRInfo) :- ( Const < zero -> Eqn1 = negate_constraint(Eqn0), - lp_standardize_constraint(Eqn1, Eqn, !LPInfo) + lp_standardize_constraint(Eqn1, Eqn, !LPRInfo) ; - new_art_var(Var, !LPInfo), + new_art_var(Var, !LPRInfo), Eqn = lte([Var - one | Coeffs], Const) ). -lp_standardize_constraint(Eqn0 @ gte(Coeffs, Const), Eqn, !LPInfo) :- +lp_standardize_constraint(Eqn0 @ gte(Coeffs, Const), Eqn, !LPRInfo) :- ( Const < zero -> Eqn1 = negate_constraint(Eqn0), - lp_standardize_constraint(Eqn1, Eqn, !LPInfo) + lp_standardize_constraint(Eqn1, Eqn, !LPRInfo) ; - new_slack_var(SVar, !LPInfo), - new_art_var(AVar, !LPInfo), + new_slack_var(SVar, !LPRInfo), + new_art_var(AVar, !LPRInfo), Eqn = gte([AVar - one, SVar - (-one) | Coeffs], Const) ). @@ -1362,25 +1361,25 @@ get_basis_vars(Tableau) = Vars :- %-----------------------------------------------------------------------------% -:- func lp_info_init(lp_varset) = lp_info. +:- func lpr_info_init(lp_varset) = lpr_info. -lp_info_init(Varset) = lp(Varset, [], []). +lpr_info_init(Varset) = lpr_info(Varset, [], []). -:- pred new_slack_var(lp_var::out, lp_info::in, lp_info::out) is det. +:- pred new_slack_var(lp_var::out, lpr_info::in, lpr_info::out) is det. -new_slack_var(Var, !LPInfo) :- - varset.new_var(!.LPInfo ^ varset, Var, Varset), - !:LPInfo = !.LPInfo ^ varset := Varset, - Vars = !.LPInfo ^ slack_vars, - !:LPInfo = !.LPInfo ^ slack_vars := [Var | Vars]. +new_slack_var(Var, !LPRInfo) :- + varset.new_var(!.LPRInfo ^ lpr_varset, Var, Varset), + !LPRInfo ^ lpr_varset := Varset, + Vars = !.LPRInfo ^ lpr_slack_vars, + !LPRInfo ^ lpr_slack_vars := [Var | Vars]. -:- pred new_art_var(lp_var::out, lp_info::in, lp_info::out) is det. +:- pred new_art_var(lp_var::out, lpr_info::in, lpr_info::out) is det. -new_art_var(Var, !LPInfo) :- - varset.new_var(!.LPInfo ^ varset, Var, Varset), - !:LPInfo = !.LPInfo ^ varset := Varset, - Vars = !.LPInfo ^ art_vars, - !:LPInfo = !.LPInfo ^ art_vars := [Var | Vars]. +new_art_var(Var, !LPRInfo) :- + varset.new_var(!.LPRInfo ^ lpr_varset, Var, Varset), + !LPRInfo ^ lpr_varset := Varset, + Vars = !.LPRInfo ^ lpr_art_vars, + !LPRInfo ^ lpr_art_vars := [Var | Vars]. %-----------------------------------------------------------------------------% @@ -1425,17 +1424,16 @@ between(Min, Max, I) :- %-----------------------------------------------------------------------------% :- type vector - ---> vector( - label :: set(int), - % The vector's label is for redundancy checking - % during Fourier elimination - see below. + ---> vector( + % The vector's label is for redundancy checking + % during Fourier elimination - see below. + label :: set(int), - terms :: map(lp_var, coefficient), - % A map from each variable in the vector to its - % coefficient + % A map from each variable in the vector to its coefficient. + terms :: map(lp_var, coefficient), - const :: constant - ). + const :: constant + ). :- type matrix == list(vector). @@ -1493,7 +1491,7 @@ project(!.Vars @ [_|_], Varset, MaybeThreshold, Constraints0, Result) :- %-----------------------------------------------------------------------------% % -% Convert each constraint into `=<' form and give each an initial label +% Convert each constraint into `=<' form and give each an initial label. % :- func constraints_to_matrix(constraints) = matrix. @@ -1931,10 +1929,10 @@ label_subsumed(VectorA, VectorB) :- % previous totals from the total number of constraints. % :- type coeff_info - ---> coeff_info( - pos :: int, - neg :: int - ). + ---> coeff_info( + pos :: int, + neg :: int + ). :- type cc_map == map(lp_var, coeff_info). @@ -1959,9 +1957,10 @@ duffin_heuristic(Vars0 @ [_,_|_], Matrix, TargetVar, Vars) :- collect_remaining_vars([], _) = []. collect_remaining_vars([Var - _ | Rest], TargetVar) = Result :- - ( if Var = TargetVar - then Result = collect_remaining_vars(Rest, TargetVar) - else Result = [ Var | collect_remaining_vars(Rest, TargetVar) ] + ( if Var = TargetVar then + Result = collect_remaining_vars(Rest, TargetVar) + else + Result = [Var | collect_remaining_vars(Rest, TargetVar)] ). :- func find_max(list(pair(lp_var, int))) = lp_var. @@ -1974,14 +1973,16 @@ find_max([Var0 - ExpnNum0 | Vars]) = fst(find_max_2(Vars, Var0 - ExpnNum0)). find_max_2([], Best) = Best. find_max_2([Var1 - ExpnNum1 | Vars], Var0 - ExpnNum0) = - ( if ExpnNum1 < ExpnNum0 - then find_max_2(Vars, Var1 - ExpnNum1) - else find_max_2(Vars, Var0 - ExpnNum0) + ( if ExpnNum1 < ExpnNum0 then + find_max_2(Vars, Var1 - ExpnNum1) + else + find_max_2(Vars, Var0 - ExpnNum0) ). :- pred relevant(pair(lp_var, int)::in) is semidet. -relevant(Var) :- Var \= _ - 0. +relevant(Var) :- + Var \= _ - 0. % Given a list of variables and a system of linear inequalities % generate the expansion number for each of the variables in the @@ -2080,16 +2081,18 @@ normalize_vector(Var, !.Terms, !.Constant, !:Terms, !:Constant) :- normalize_constraint(Var, Constraint0, Constraint) :- lp_rational.deconstruct_constraint(Constraint0, Terms0, Op0, Constant0), ( assoc_list.search(Terms0, Var, Coefficient) -> - ( if Coefficient = zero - then unexpected(this_file, - "normalize_constraint/3: zero coefficient constraint.") - else true + ( if Coefficient = zero then + unexpected(this_file, + "normalize_constraint/3: zero coefficient constraint.") + else + true ), Terms = list.map((func(V - C) = V - (C / Coefficient)), Terms0), Constant = Constant0 / Coefficient, - ( if Coefficient < zero - then Op = negate_operator(Op0) - else Op = Op0 + ( if Coefficient < zero then + Op = negate_operator(Op0) + else + Op = Op0 ) ; % In this case the the coefficient of the variable was zero @@ -2110,13 +2113,14 @@ add_vectors(TermsA, ConstA, TermsB, ConstB, Terms, ConstA + ConstB) :- ), AddVal = (pred(Var::in, Coeffs0::in, Coeffs::out) is det :- NumA = TermsA ^ det_elem(Var), - ( if Coeffs0 ^ elem(Var) = Num1 - then - ( if NumA + Num1 = zero - then Coeffs = map.delete(Coeffs0, Var) - else Coeffs = map.det_update(Coeffs0, Var, NumA + Num1) - ) - else Coeffs = map.det_insert(Coeffs0, Var, NumA) + ( if Coeffs0 ^ elem(Var) = Num1 then + ( if NumA + Num1 = zero then + Coeffs = map.delete(Coeffs0, Var) + else + Coeffs = map.det_update(Coeffs0, Var, NumA + Num1) + ) + else + Coeffs = map.det_insert(Coeffs0, Var, NumA) ) ), solutions.aggregate(IsMapKey, AddVal, TermsB, Terms). @@ -2130,8 +2134,7 @@ add_vectors(TermsA, ConstA, TermsB, ConstB, Terms, ConstA + ConstB) :- % XXX It would be preferable not to use this as it can be very slow. % remove_some_entailed_constraints(Varset, Constraints0, Constraints) :- - remove_some_entailed_constraints_2(Varset, Constraints0, [], - Constraints). + remove_some_entailed_constraints_2(Varset, Constraints0, [], Constraints). :- pred remove_some_entailed_constraints_2(lp_varset::in, constraints::in, constraints::in, constraints::out) is semidet. @@ -2161,9 +2164,10 @@ remove_some_entailed_constraints_2(Varset, [E, X | Es], !Constraints) :- restore_equalities([], []). restore_equalities([E0 | Es0], [E | Es]) :- - ( if check_for_equalities(E0, Es0, [], E1, Es1) - then E = E1, Es2 = Es1 - else Es2 = Es0, E = E0 + ( if check_for_equalities(E0, Es0, [], E1, Es1) then + E = E1, Es2 = Es1 + else + Es2 = Es0, E = E0 ), restore_equalities(Es2, Es). @@ -2171,9 +2175,7 @@ restore_equalities([E0 | Es0], [E | Es]) :- constraint::out, constraints::out) is semidet. check_for_equalities(Eqn0, [Eqn | Eqns], SoFar, NewEqn, NewEqnSet) :- - ( - opposing_inequalities(Eqn0 @ lte(Coeffs, Constant), Eqn) - -> + ( opposing_inequalities(Eqn0 @ lte(Coeffs, Constant), Eqn) -> NewEqn = standardize_constraint(eq(Coeffs, Constant)), NewEqnSet = SoFar ++ Eqns ; @@ -2200,7 +2202,7 @@ opposing_inequalities(lte(TermsA, Const), lte(TermsB, -Const)) :- %-----------------------------------------------------------------------------% %-----------------------------------------------------------------------------% % -% Entailment test +% Entailment test. % entailed(Varset, Constraints, lte(Objective, Constant)) = Result :- @@ -2281,16 +2283,18 @@ get_vars_from_terms([Var - _ | Coeffs], !SetVar) :- :- pred write_term(lp_varset::in, lp_term::in, io::di, io::uo) is det. write_term(Varset, Var - Coefficient, !IO) :- - ( if Coefficient > zero - then io.write_char('+', !IO) - else io.write_char('-', !IO) + ( if Coefficient > zero then + io.write_char('+', !IO) + else + io.write_char('-', !IO) ), io.write_string(" (", !IO), Num = abs(numer(Coefficient)), io.write_string(int_to_string(Num), !IO), - ( if denom(Coefficient) \= 1 - then io.format("/%s", [s(int_to_string(denom(Coefficient)))], !IO) - else true + ( if denom(Coefficient) = 1 then + true + else + io.format("/%s", [s(int_to_string(denom(Coefficient)))], !IO) ), io.write_char(')', !IO), io.write_string(varset.lookup_name(Varset, Var), !IO). @@ -2309,8 +2313,8 @@ write_constraint(Varset, Constr, !IO) :- deconstruct_constraint(Constr, Coeffs, Operator, Constant), io.write_char('\t', !IO), list.foldl(write_constr_term(Varset), Coeffs, !IO), - io.format("%s %s\n", [s(operator_to_string(Operator)), - s(rat.to_string(Constant))], !IO). + io.format("%s %s\n", + [s(operator_to_string(Operator)), s(rat.to_string(Constant))], !IO). :- pred write_constr_term(lp_varset::in, lp_term::in, io::di, io::uo) is det. @@ -2348,9 +2352,8 @@ write_vars_2(Varset, [V | Vs], !IO) :- var_to_string(Varset, Var) = varset.lookup_name(Varset, Var, "Unnamed"). - % Write out the matrix used during fourier elimination. If - % `Labels' is `yes' then write out the label for each vector - % as well. + % Write out the matrix used during fourier elimination. + % If `Labels' is `yes' then write out the label for each vector as well. % :- pred write_matrix(lp_varset::in, bool::in, matrix::in, io::di, io::uo) is det. diff --git a/compiler/make.m b/compiler/make.m index a239e2711..0d52395dc 100644 --- a/compiler/make.m +++ b/compiler/make.m @@ -65,7 +65,6 @@ :- import_module backend_libs.compile_target_code. :- import_module hlds. :- import_module libs. -:- import_module libs.compiler_util. :- import_module libs.handle_options. :- import_module libs.md4. :- import_module libs.options. @@ -88,6 +87,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module solutions. :- import_module string. diff --git a/compiler/make.module_target.m b/compiler/make.module_target.m index f2c046f0a..b1e6a8996 100644 --- a/compiler/make.module_target.m +++ b/compiler/make.module_target.m @@ -50,13 +50,13 @@ ---> foreign_code_file( foreign_language :: foreign_language, + % Name of the file produced by the Mercury compiler, + % e.g. module_c_code.c. target_file :: file_name, - % Name of the file produced by the Mercury - % compiler, e.g. module_c_code.c. + % Name of the file produced by the foreign language compiler, + % e.g. module_c_code.o. object_file :: file_name - % Name of the file produced by the foreign - % language compiler, e.g. module_c_code.o. ). % Find the foreign code files generated when a module is processed. @@ -72,7 +72,6 @@ :- implementation. :- import_module analysis. -:- import_module libs.compiler_util. :- import_module libs.process_util. :- import_module parse_tree.file_names. :- import_module parse_tree.module_cmds. @@ -84,6 +83,7 @@ :- import_module dir. :- import_module float. +:- import_module require. :- import_module svmap. %-----------------------------------------------------------------------------% diff --git a/compiler/make.program_target.m b/compiler/make.program_target.m index fc4177235..7b749c12c 100644 --- a/compiler/make.program_target.m +++ b/compiler/make.program_target.m @@ -40,7 +40,6 @@ :- implementation. :- import_module analysis. -:- import_module libs.compiler_util. :- import_module libs.handle_options. :- import_module libs.process_util. :- import_module parse_tree.file_names. @@ -56,6 +55,7 @@ :- import_module digraph. :- import_module dir. :- import_module getopt_io. +:- import_module require. :- import_module svmap. %-----------------------------------------------------------------------------% diff --git a/compiler/make.util.m b/compiler/make.util.m index 3f925bcce..6f8a89617 100644 --- a/compiler/make.util.m +++ b/compiler/make.util.m @@ -336,7 +336,6 @@ :- implementation. :- import_module analysis. -:- import_module libs.compiler_util. :- import_module libs.handle_options. :- import_module libs.process_util. :- import_module parse_tree.file_names. @@ -350,6 +349,7 @@ :- import_module exception. :- import_module getopt_io. :- import_module maybe. +:- import_module require. :- import_module set. :- import_module thread. :- import_module thread.channel. diff --git a/compiler/make_hlds_passes.m b/compiler/make_hlds_passes.m index 16420b305..5e9a60182 100644 --- a/compiler/make_hlds_passes.m +++ b/compiler/make_hlds_passes.m @@ -114,7 +114,6 @@ :- import_module hlds.make_hlds.qual_info. :- import_module hlds.pred_table. :- import_module hlds.special_pred. -:- import_module libs.compiler_util. :- import_module libs.file_util. :- import_module libs.globals. :- import_module libs.options. @@ -129,6 +128,7 @@ :- import_module map. :- import_module pair. +:- import_module require. :- import_module set. :- import_module solutions. :- import_module string. diff --git a/compiler/make_tags.m b/compiler/make_tags.m index a17779da9..f4c155311 100644 --- a/compiler/make_tags.m +++ b/compiler/make_tags.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 1994-1996, 1998-2009 The University of Melbourne. +% Copyright (C) 1994-1996, 1998-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -85,7 +85,6 @@ :- implementation. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module parse_tree.prog_type. @@ -94,6 +93,7 @@ :- import_module bool. :- import_module int. :- import_module map. +:- import_module require. :- import_module svmap. %-----------------------------------------------------------------------------% diff --git a/compiler/mark_static_terms.m b/compiler/mark_static_terms.m index f3a15c2c9..7c6f64893 100644 --- a/compiler/mark_static_terms.m +++ b/compiler/mark_static_terms.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2000-2009 The University of Melbourne. +% Copyright (C) 2000-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -37,12 +37,12 @@ :- implementation. :- import_module hlds.hlds_goal. -:- import_module libs.compiler_util. :- import_module parse_tree.prog_data. :- import_module list. :- import_module map. :- import_module pair. +:- import_module require. :- import_module set_tree234. :- import_module svmap. diff --git a/compiler/matching.m b/compiler/matching.m index c68539842..c7532ccb2 100644 --- a/compiler/matching.m +++ b/compiler/matching.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2001-2007 The University of Melbourne. +% Copyright (C) 2001-2007, 2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -85,12 +85,6 @@ :- implementation. -% Uncomment if you want to dump performance information into the .err file. -% :- import_module unsafe. - -:- import_module libs. -:- import_module libs.compiler_util. - :- import_module assoc_list. :- import_module int. :- import_module io. @@ -98,6 +92,7 @@ :- import_module maybe. :- import_module pair. :- import_module queue. +:- import_module require. :- import_module string. :- import_module term. :- import_module svmap. diff --git a/compiler/mcsolver.m b/compiler/mcsolver.m index 17e0b801f..f858c6712 100644 --- a/compiler/mcsolver.m +++ b/compiler/mcsolver.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2004-2007, 2009 The University of Melbourne. +% Copyright (C) 2004-2007, 2009-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -123,14 +123,12 @@ :- implementation. -:- import_module libs. -:- import_module libs.compiler_util. - :- import_module eqvclass. :- import_module io. :- import_module list. :- import_module map. :- import_module multi_map. +:- import_module require. :- import_module set. :- import_module string. :- import_module term. @@ -264,7 +262,7 @@ prepare_abstract_constraint(Constraint, !PCs) :- -> disjunction_of_assignments(DisjOfAssgts, !PCs) ; - compiler_util.sorry(this_file, + sorry(this_file, "Disjuction of constraints - general case.") ) ). @@ -277,19 +275,14 @@ prepare_abstract_constraint(Constraint, !PCs) :- prepare_var_constraint(equiv_bool(Var, Value), !PCs) :- assign(Var, Value, !PCs). - prepare_var_constraint(equivalent(Vars), !PCs) :- equivalent(Vars, !PCs). - prepare_var_constraint(implies(Var1, Var2), !PCs) :- implies(Var1, Var2, !PCs). - prepare_var_constraint(equiv_disj(X, Ys), !PCs) :- equivalent_to_disjunction(X, Ys, !PCs). - prepare_var_constraint(at_most_one(Vars), !PCs) :- at_most_one(Vars, !PCs). - prepare_var_constraint(exactly_one(Vars), !PCs) :- exactly_one(Vars, !PCs). diff --git a/compiler/mercury_compile.m b/compiler/mercury_compile.m index c25a2e4d9..529d69660 100644 --- a/compiler/mercury_compile.m +++ b/compiler/mercury_compile.m @@ -95,12 +95,12 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. :- import_module svmap. :- import_module unit. - %-----------------------------------------------------------------------------% real_main(!IO) :- diff --git a/compiler/mercury_compile_front_end.m b/compiler/mercury_compile_front_end.m index b950af5c6..c44bcc897 100644 --- a/compiler/mercury_compile_front_end.m +++ b/compiler/mercury_compile_front_end.m @@ -87,7 +87,6 @@ :- import_module check_hlds.unused_imports. :- import_module hlds.hlds_error_util. :- import_module hlds.hlds_statistics. -:- import_module libs.compiler_util. :- import_module libs.file_util. :- import_module libs.globals. :- import_module libs.options. @@ -102,6 +101,7 @@ :- import_module int. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. diff --git a/compiler/mercury_compile_llds_back_end.m b/compiler/mercury_compile_llds_back_end.m index 2fc5ffd3e..0eff0afbf 100644 --- a/compiler/mercury_compile_llds_back_end.m +++ b/compiler/mercury_compile_llds_back_end.m @@ -58,7 +58,6 @@ :- import_module hlds.hlds_out.hlds_out_util. :- import_module hlds.hlds_pred. :- import_module hlds.mark_tail_calls. -:- import_module libs.compiler_util. :- import_module libs.file_util. :- import_module libs.globals. :- import_module libs.options. @@ -94,6 +93,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module string. :- import_module term. diff --git a/compiler/mercury_compile_middle_passes.m b/compiler/mercury_compile_middle_passes.m index 28e752b67..7104a3f49 100644 --- a/compiler/mercury_compile_middle_passes.m +++ b/compiler/mercury_compile_middle_passes.m @@ -47,7 +47,6 @@ :- import_module bytecode_backend.bytecode_gen. :- import_module check_hlds.det_analysis. :- import_module hlds.hlds_module. -:- import_module libs.compiler_util. :- import_module libs.file_util. :- import_module libs.globals. :- import_module libs.options. @@ -100,6 +99,7 @@ :- import_module list. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. :- import_module univ. diff --git a/compiler/mercury_compile_mlds_back_end.m b/compiler/mercury_compile_mlds_back_end.m index a96b8c86e..32572df42 100644 --- a/compiler/mercury_compile_mlds_back_end.m +++ b/compiler/mercury_compile_mlds_back_end.m @@ -59,7 +59,6 @@ :- import_module backend_libs.type_ctor_info. :- import_module hlds.arg_info. :- import_module hlds.mark_static_terms. % HLDS -> HLDS -:- import_module libs.compiler_util. :- import_module libs.file_util. :- import_module libs.globals. :- import_module libs.options. @@ -86,6 +85,7 @@ :- import_module getopt_io. :- import_module list. :- import_module pprint. +:- import_module require. :- import_module string. %-----------------------------------------------------------------------------% diff --git a/compiler/mercury_to_mercury.m b/compiler/mercury_to_mercury.m index 80e0cd4cf..340c9e2c7 100644 --- a/compiler/mercury_to_mercury.m +++ b/compiler/mercury_to_mercury.m @@ -414,7 +414,6 @@ :- implementation. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module libs.rat. @@ -430,6 +429,7 @@ :- import_module map. :- import_module pair. :- import_module ops. +:- import_module require. :- import_module set. :- import_module string. :- import_module term. diff --git a/compiler/middle_rec.m b/compiler/middle_rec.m index a406fe02d..c3d216c7e 100644 --- a/compiler/middle_rec.m +++ b/compiler/middle_rec.m @@ -1,7 +1,7 @@ %---------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %---------------------------------------------------------------------------% -% Copyright (C) 1994-2009 The University of Melbourne. +% Copyright (C) 1994-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %---------------------------------------------------------------------------% @@ -34,7 +34,6 @@ :- import_module hlds.code_model. :- import_module hlds.hlds_data. :- import_module hlds.hlds_llds. -:- import_module libs.compiler_util. :- import_module ll_backend.code_gen. :- import_module ll_backend.code_util. :- import_module ll_backend.llds_out. @@ -50,6 +49,7 @@ :- import_module list. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. diff --git a/compiler/ml_call_gen.m b/compiler/ml_call_gen.m index 144118889..0833353ca 100644 --- a/compiler/ml_call_gen.m +++ b/compiler/ml_call_gen.m @@ -92,7 +92,6 @@ :- import_module check_hlds.mode_util. :- import_module check_hlds.type_util. :- import_module hlds.hlds_module. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module mdbcomp.prim_data. @@ -105,6 +104,7 @@ :- import_module int. :- import_module map. :- import_module maybe. +:- import_module require. :- import_module string. :- import_module term. diff --git a/compiler/ml_closure_gen.m b/compiler/ml_closure_gen.m index ad8283bb7..fadefb207 100644 --- a/compiler/ml_closure_gen.m +++ b/compiler/ml_closure_gen.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 1999-2009 The University of Melbourne. +% Copyright (C) 1999-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -77,7 +77,6 @@ :- import_module check_hlds.type_util. :- import_module hlds.code_model. :- import_module hlds.hlds_module. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module ll_backend. @@ -100,6 +99,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module set_tree234. :- import_module string. diff --git a/compiler/ml_code_gen.m b/compiler/ml_code_gen.m index 58230305a..da2ffe419 100644 --- a/compiler/ml_code_gen.m +++ b/compiler/ml_code_gen.m @@ -520,7 +520,6 @@ :- import_module hlds.goal_form. :- import_module hlds.hlds_module. :- import_module hlds.hlds_pred. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module ml_backend.ml_call_gen. @@ -541,6 +540,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. diff --git a/compiler/ml_code_util.m b/compiler/ml_code_util.m index 0cbd8bcca..263bb7260 100644 --- a/compiler/ml_code_util.m +++ b/compiler/ml_code_util.m @@ -556,7 +556,6 @@ :- import_module check_hlds.polymorphism. :- import_module check_hlds.type_util. :- import_module hlds.instmap. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module mdbcomp.program_representation. @@ -573,6 +572,7 @@ :- import_module int. :- import_module map. :- import_module pair. +:- import_module require. :- import_module set. :- import_module stack. :- import_module string. diff --git a/compiler/ml_disj_gen.m b/compiler/ml_disj_gen.m index 5f4245d3a..a171762b7 100644 --- a/compiler/ml_disj_gen.m +++ b/compiler/ml_disj_gen.m @@ -123,7 +123,6 @@ :- import_module backend_libs.builtin_ops. :- import_module hlds.goal_form. :- import_module hlds.hlds_module. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module ml_backend.ml_code_gen. @@ -135,6 +134,7 @@ :- import_module bool. :- import_module map. :- import_module maybe. +:- import_module require. :- import_module set. ml_gen_disj(Disjuncts, GoalInfo, CodeModel, Context, Statements, !Info) :- diff --git a/compiler/ml_elim_nested.m b/compiler/ml_elim_nested.m index 7b9201434..08eadcf7c 100644 --- a/compiler/ml_elim_nested.m +++ b/compiler/ml_elim_nested.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 1999-2009 The University of Melbourne. +% Copyright (C) 1999-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -442,7 +442,6 @@ :- import_module hlds.hlds_data. :- import_module hlds.hlds_pred. -:- import_module libs.compiler_util. :- import_module libs.options. :- import_module mdbcomp.prim_data. :- import_module ml_backend.ml_code_util. @@ -453,6 +452,7 @@ :- import_module int. :- import_module list. :- import_module maybe. +:- import_module require. :- import_module set. :- import_module solutions. :- import_module string. diff --git a/compiler/ml_foreign_proc_gen.m b/compiler/ml_foreign_proc_gen.m index 0301fa984..7121a4fc3 100644 --- a/compiler/ml_foreign_proc_gen.m +++ b/compiler/ml_foreign_proc_gen.m @@ -53,7 +53,6 @@ :- import_module check_hlds.mode_util. :- import_module check_hlds.type_util. :- import_module hlds.hlds_module. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module ml_backend.ml_code_util. @@ -62,6 +61,7 @@ :- import_module bool. :- import_module map. :- import_module pair. +:- import_module require. :- import_module string. %-----------------------------------------------------------------------------% diff --git a/compiler/ml_global_data.m b/compiler/ml_global_data.m index 66709e171..24884d80d 100644 --- a/compiler/ml_global_data.m +++ b/compiler/ml_global_data.m @@ -185,11 +185,11 @@ :- implementation. -:- import_module libs.compiler_util. :- import_module ml_backend.ml_type_gen. :- import_module int. :- import_module maybe. +:- import_module require. :- import_module string. :- import_module svmap. diff --git a/compiler/ml_lookup_switch.m b/compiler/ml_lookup_switch.m index 6eac7ff98..8b43f353e 100644 --- a/compiler/ml_lookup_switch.m +++ b/compiler/ml_lookup_switch.m @@ -49,7 +49,6 @@ :- import_module hlds.goal_form. :- import_module hlds.hlds_data. :- import_module hlds.hlds_module. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module ml_backend.ml_code_gen. :- import_module ml_backend.ml_code_util. @@ -62,6 +61,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module svmap. %-----------------------------------------------------------------------------% diff --git a/compiler/ml_optimize.m b/compiler/ml_optimize.m index bcca35194..15d9304d5 100644 --- a/compiler/ml_optimize.m +++ b/compiler/ml_optimize.m @@ -44,7 +44,6 @@ :- implementation. -:- import_module libs.compiler_util. :- import_module libs.options. :- import_module mdbcomp.prim_data. :- import_module ml_backend.ml_code_util. @@ -55,6 +54,7 @@ :- import_module list. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module std_util. :- import_module string. diff --git a/compiler/ml_proc_gen.m b/compiler/ml_proc_gen.m index 5934a1c17..6bc274ca0 100644 --- a/compiler/ml_proc_gen.m +++ b/compiler/ml_proc_gen.m @@ -39,7 +39,6 @@ :- import_module hlds.passes_aux. :- import_module hlds.pred_table. :- import_module hlds.quantification. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module mdbcomp.prim_data. @@ -60,6 +59,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module std_util. diff --git a/compiler/ml_simplify_switch.m b/compiler/ml_simplify_switch.m index 555e3a31d..0efc0d480 100644 --- a/compiler/ml_simplify_switch.m +++ b/compiler/ml_simplify_switch.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2000-2001, 2003-2009 The University of Melbourne. +% Copyright (C) 2000-2001, 2003-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -38,7 +38,6 @@ :- import_module backend_libs.builtin_ops. :- import_module backend_libs.switch_util. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module ml_backend.ml_code_util. @@ -51,6 +50,7 @@ :- import_module list. :- import_module map. :- import_module maybe. +:- import_module require. %-----------------------------------------------------------------------------% diff --git a/compiler/ml_string_switch.m b/compiler/ml_string_switch.m index e88bc40de..0fdb9af84 100644 --- a/compiler/ml_string_switch.m +++ b/compiler/ml_string_switch.m @@ -42,7 +42,6 @@ :- import_module backend_libs.switch_util. :- import_module hlds.hlds_data. :- import_module hlds.hlds_module. -:- import_module libs.compiler_util. :- import_module ml_backend.ml_code_gen. :- import_module ml_backend.ml_code_util. :- import_module ml_backend.ml_global_data. @@ -55,6 +54,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module string. :- import_module svmap. :- import_module unit. diff --git a/compiler/ml_switch_gen.m b/compiler/ml_switch_gen.m index 720ba68e1..320e8104b 100644 --- a/compiler/ml_switch_gen.m +++ b/compiler/ml_switch_gen.m @@ -105,7 +105,6 @@ :- import_module check_hlds.type_util. :- import_module hlds.hlds_data. :- import_module hlds.hlds_module. -:- import_module libs.compiler_util. :- import_module libs.options. :- import_module ml_backend.ml_code_gen. :- import_module ml_backend.ml_code_util. @@ -122,6 +121,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. %-----------------------------------------------------------------------------% diff --git a/compiler/ml_tag_switch.m b/compiler/ml_tag_switch.m index e37abb160..a65c36ba6 100644 --- a/compiler/ml_tag_switch.m +++ b/compiler/ml_tag_switch.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2000, 2003-2009 The University of Melbourne. +% Copyright (C) 2000, 2003-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -42,7 +42,6 @@ :- import_module backend_libs.rtti. :- import_module backend_libs.switch_util. :- import_module hlds.hlds_data. -:- import_module libs.compiler_util. :- import_module ml_backend.ml_code_gen. :- import_module ml_backend.ml_code_util. :- import_module ml_backend.ml_simplify_switch. @@ -53,6 +52,7 @@ :- import_module int. :- import_module map. :- import_module pair. +:- import_module require. :- import_module set. :- import_module svmap. :- import_module unit. diff --git a/compiler/ml_type_gen.m b/compiler/ml_type_gen.m index e2c9b87ff..00bd93e37 100644 --- a/compiler/ml_type_gen.m +++ b/compiler/ml_type_gen.m @@ -117,7 +117,6 @@ :- import_module check_hlds.polymorphism. :- import_module hlds.hlds_pred. -:- import_module libs.compiler_util. :- import_module libs.options. :- import_module ml_backend.ml_code_util. :- import_module ml_backend.ml_util. @@ -131,6 +130,7 @@ :- import_module list. :- import_module map. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. :- import_module term. diff --git a/compiler/ml_unify_gen.m b/compiler/ml_unify_gen.m index f1a187ef5..35a4e379a 100644 --- a/compiler/ml_unify_gen.m +++ b/compiler/ml_unify_gen.m @@ -128,7 +128,6 @@ :- import_module hlds.hlds_out. :- import_module hlds.hlds_out.hlds_out_util. :- import_module hlds.hlds_pred. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module mdbcomp.prim_data. @@ -147,6 +146,7 @@ :- import_module int. :- import_module map. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. :- import_module svmap. diff --git a/compiler/mlds.m b/compiler/mlds.m index b9cb5b6ac..628954d52 100644 --- a/compiler/mlds.m +++ b/compiler/mlds.m @@ -1847,7 +1847,6 @@ :- import_module backend_libs.foreign. :- import_module check_hlds.type_util. :- import_module hlds.hlds_data. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module parse_tree.file_names. :- import_module parse_tree.prog_type. @@ -1856,6 +1855,7 @@ :- import_module char. :- import_module int. +:- import_module require. :- import_module string. :- import_module term. diff --git a/compiler/mlds_to_c.m b/compiler/mlds_to_c.m index af14c85d4..1eb0e9e91 100644 --- a/compiler/mlds_to_c.m +++ b/compiler/mlds_to_c.m @@ -78,7 +78,6 @@ :- import_module hlds.code_model. :- import_module hlds.hlds_data. :- import_module hlds.hlds_pred. % for pred_proc_id. -:- import_module libs.compiler_util. :- import_module libs.file_util. :- import_module libs.options. :- import_module mdbcomp.prim_data. @@ -107,6 +106,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module solutions. :- import_module string. diff --git a/compiler/mlds_to_cs.m b/compiler/mlds_to_cs.m index 3848de221..b91c03ce9 100644 --- a/compiler/mlds_to_cs.m +++ b/compiler/mlds_to_cs.m @@ -50,7 +50,6 @@ :- import_module backend_libs.c_util. :- import_module backend_libs.rtti. :- import_module hlds.hlds_pred. % for pred_proc_id. -:- import_module libs.compiler_util. :- import_module libs.file_util. :- import_module libs.globals. :- import_module libs.options. @@ -79,6 +78,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. :- import_module svmap. diff --git a/compiler/mlds_to_gcc.m b/compiler/mlds_to_gcc.m index 7483f1289..966620169 100644 --- a/compiler/mlds_to_gcc.m +++ b/compiler/mlds_to_gcc.m @@ -159,7 +159,6 @@ :- import_module backend_libs.rtti. % for rtti.addr_to_string. :- import_module hlds.code_model. :- import_module hlds.hlds_pred. % for proc_id_to_int and invalid_pred_id -:- import_module libs.compiler_util. :- import_module libs.file_util. :- import_module libs.options. :- import_module mdbcomp.prim_data. @@ -180,6 +179,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module solutions. :- import_module string. diff --git a/compiler/mlds_to_il.m b/compiler/mlds_to_il.m index 023058ec3..643430d2a 100644 --- a/compiler/mlds_to_il.m +++ b/compiler/mlds_to_il.m @@ -149,7 +149,6 @@ :- import_module backend_libs.foreign. :- import_module backend_libs.rtti. :- import_module hlds.code_model. -:- import_module libs.compiler_util. :- import_module libs.options. :- import_module mdbcomp.prim_data. :- import_module ml_backend.ml_code_util. @@ -169,6 +168,7 @@ :- import_module int. :- import_module map. :- import_module pair. +:- import_module require. :- import_module string. :- import_module term. diff --git a/compiler/mlds_to_ilasm.m b/compiler/mlds_to_ilasm.m index dadb14a87..eabb5f667 100644 --- a/compiler/mlds_to_ilasm.m +++ b/compiler/mlds_to_ilasm.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 1999-2009 The University of Melbourne. +% Copyright (C) 1999-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -34,8 +34,6 @@ :- implementation. -% :- import_module hlds.passes_aux. -:- import_module libs.compiler_util. :- import_module libs.file_util. :- import_module libs.options. :- import_module ml_backend.ilasm. @@ -48,6 +46,7 @@ :- import_module bool. :- import_module list. :- import_module maybe. +:- import_module require. :- import_module set. :- import_module string. diff --git a/compiler/mlds_to_java.m b/compiler/mlds_to_java.m index 6bd91860b..c6f7a050f 100644 --- a/compiler/mlds_to_java.m +++ b/compiler/mlds_to_java.m @@ -89,7 +89,6 @@ :- import_module backend_libs.rtti. :- import_module check_hlds.type_util. :- import_module hlds.hlds_pred. % for pred_proc_id. -:- import_module libs.compiler_util. :- import_module libs.file_util. :- import_module libs.globals. :- import_module libs.options. @@ -122,6 +121,7 @@ :- import_module maybe. :- import_module multi_map. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. :- import_module svmap. diff --git a/compiler/mlds_to_managed.m b/compiler/mlds_to_managed.m index 0e6256403..f9cd1ab44 100644 --- a/compiler/mlds_to_managed.m +++ b/compiler/mlds_to_managed.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2002-2007, 2009 The University of Melbourne. +% Copyright (C) 2002-2007, 2009-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -41,7 +41,6 @@ :- implementation. :- import_module backend_libs.c_util. -:- import_module libs.compiler_util. :- import_module libs.options. :- import_module mdbcomp.prim_data. :- import_module ml_backend.ilds. @@ -59,6 +58,7 @@ :- import_module list. :- import_module map. :- import_module maybe. +:- import_module require. :- import_module set. :- import_module string. :- import_module term. diff --git a/compiler/mmc_analysis.m b/compiler/mmc_analysis.m index 4b2ccaf96..171058565 100644 --- a/compiler/mmc_analysis.m +++ b/compiler/mmc_analysis.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2003-2006, 2008-2009 The University of Melbourne. +% Copyright (C) 2003-2006, 2008-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -44,7 +44,6 @@ :- implementation. :- import_module hlds.pred_table. -:- import_module libs.compiler_util. :- import_module libs.file_util. :- import_module libs.globals. :- import_module libs.options. @@ -64,6 +63,7 @@ :- import_module bool. :- import_module list. :- import_module maybe. +:- import_module require. :- import_module string. :- import_module io. :- import_module unit. diff --git a/compiler/mode_constraints.m b/compiler/mode_constraints.m index c0afb3a7c..af09d15a6 100644 --- a/compiler/mode_constraints.m +++ b/compiler/mode_constraints.m @@ -62,7 +62,6 @@ :- import_module hlds.passes_aux. :- import_module hlds.quantification. :- import_module libs. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module mdbcomp. @@ -87,6 +86,7 @@ :- import_module maybe. :- import_module multi_map. :- import_module pair. +:- import_module require. :- import_module robdd. :- import_module set. :- import_module solutions. diff --git a/compiler/mode_errors.m b/compiler/mode_errors.m index df2fb3d47..e724673ce 100644 --- a/compiler/mode_errors.m +++ b/compiler/mode_errors.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 1994-2009 The University of Melbourne. +% Copyright (C) 1994-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -247,7 +247,6 @@ :- import_module hlds.hlds_out.hlds_out_mode. :- import_module hlds.hlds_out.hlds_out_util. :- import_module libs. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module parse_tree.mercury_to_mercury. @@ -261,6 +260,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module string. :- import_module term. :- import_module varset. diff --git a/compiler/mode_info.m b/compiler/mode_info.m index 2c409e76b..c1c9c7b88 100644 --- a/compiler/mode_info.m +++ b/compiler/mode_info.m @@ -336,13 +336,13 @@ :- import_module check_hlds.mode_errors. :- import_module hlds.hlds_clauses. :- import_module libs. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module int. :- import_module map. :- import_module pair. +:- import_module require. :- import_module string. :- import_module svbag. :- import_module term. diff --git a/compiler/mode_ordering.m b/compiler/mode_ordering.m index 51db34b01..941eacebc 100644 --- a/compiler/mode_ordering.m +++ b/compiler/mode_ordering.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2001-2009 The University of Melbourne. +% Copyright (C) 2001-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -51,8 +51,6 @@ % :- import_module mode_robdd.check. % :- import_module mode_robdd.tfeir. :- import_module mode_robdd.tfeirn. -:- import_module libs. -:- import_module libs.compiler_util. :- import_module mdbcomp. :- import_module mdbcomp.program_representation. :- import_module parse_tree. @@ -62,6 +60,7 @@ :- import_module cord. :- import_module digraph. :- import_module pair. +:- import_module require. :- import_module set. :- import_module solutions. :- import_module stack. diff --git a/compiler/mode_util.m b/compiler/mode_util.m index a25ddaaa8..7d19ec6c8 100644 --- a/compiler/mode_util.m +++ b/compiler/mode_util.m @@ -201,8 +201,6 @@ :- import_module check_hlds.inst_util. :- import_module check_hlds.type_util. :- import_module hlds.hlds_data. -:- import_module libs. -:- import_module libs.compiler_util. :- import_module mdbcomp. :- import_module mdbcomp.prim_data. :- import_module parse_tree.prog_mode. @@ -212,6 +210,7 @@ :- import_module int. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. :- import_module term. diff --git a/compiler/modecheck_call.m b/compiler/modecheck_call.m index 28b9be61f..b2f1fee4a 100644 --- a/compiler/modecheck_call.m +++ b/compiler/modecheck_call.m @@ -88,14 +88,13 @@ :- import_module check_hlds.modes. :- import_module check_hlds.unify_proc. :- import_module hlds.instmap. -:- import_module libs. -:- import_module libs.compiler_util. :- import_module parse_tree.prog_data. :- import_module parse_tree.prog_mode. :- import_module parse_tree.prog_type. :- import_module bool. :- import_module map. +:- import_module require. :- import_module set. :- import_module term. diff --git a/compiler/modecheck_conj.m b/compiler/modecheck_conj.m index 6963a6719..82ef8f5cc 100644 --- a/compiler/modecheck_conj.m +++ b/compiler/modecheck_conj.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2009 The University of Melbourne. +% Copyright (C) 2009-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -41,8 +41,6 @@ :- import_module hlds.hlds_module. :- import_module hlds.hlds_pred. :- import_module hlds.instmap. -:- import_module libs. -:- import_module libs.compiler_util. :- import_module parse_tree. :- import_module parse_tree.prog_data. @@ -53,6 +51,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. %-----------------------------------------------------------------------------% diff --git a/compiler/modecheck_goal.m b/compiler/modecheck_goal.m index 8d0cd17d5..dd0760c3e 100644 --- a/compiler/modecheck_goal.m +++ b/compiler/modecheck_goal.m @@ -132,8 +132,6 @@ :- import_module hlds.hlds_pred. :- import_module hlds.instmap. :- import_module hlds.pred_table. -:- import_module libs. -:- import_module libs.compiler_util. :- import_module mdbcomp. :- import_module mdbcomp.prim_data. :- import_module parse_tree. @@ -149,6 +147,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. :- import_module svmap. diff --git a/compiler/modecheck_unify.m b/compiler/modecheck_unify.m index b05d2f02a..c009abebc 100644 --- a/compiler/modecheck_unify.m +++ b/compiler/modecheck_unify.m @@ -62,7 +62,6 @@ :- import_module hlds.hlds_pred. :- import_module hlds.instmap. :- import_module libs. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module mdbcomp. @@ -79,6 +78,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. :- import_module term. diff --git a/compiler/modecheck_util.m b/compiler/modecheck_util.m index 75a17dabc..f7df8c5c9 100644 --- a/compiler/modecheck_util.m +++ b/compiler/modecheck_util.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2009 The University of Melbourne. +% Copyright (C) 2009-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -206,7 +206,6 @@ :- import_module hlds.quantification. :- import_module hlds.special_pred. :- import_module libs. -:- import_module libs.compiler_util. :- import_module libs.file_util. :- import_module libs.globals. :- import_module libs.options. @@ -229,6 +228,7 @@ :- import_module map. :- import_module pair. :- import_module queue. +:- import_module require. :- import_module set. :- import_module string. :- import_module svmap. diff --git a/compiler/modes.m b/compiler/modes.m index e6c24c2cb..d8bcbf23b 100644 --- a/compiler/modes.m +++ b/compiler/modes.m @@ -152,7 +152,6 @@ :- import_module hlds.pred_table. :- import_module hlds.quantification. :- import_module libs. -:- import_module libs.compiler_util. :- import_module libs.file_util. :- import_module libs.globals. :- import_module libs.options. @@ -167,6 +166,7 @@ :- import_module map. :- import_module maybe. :- import_module queue. +:- import_module require. :- import_module set. :- import_module string. :- import_module svmap. diff --git a/compiler/module_cmds.m b/compiler/module_cmds.m index cc1a9d750..b42fdabfb 100644 --- a/compiler/module_cmds.m +++ b/compiler/module_cmds.m @@ -192,7 +192,6 @@ :- implementation. -:- import_module libs.compiler_util. :- import_module libs.process_util. :- import_module libs.handle_options. % for grade_directory_component :- import_module libs.options. @@ -204,6 +203,7 @@ :- import_module dir. :- import_module getopt_io. :- import_module int. +:- import_module require. :- import_module set. :- import_module string. diff --git a/compiler/module_imports.m b/compiler/module_imports.m index 5170212bc..109e176e5 100644 --- a/compiler/module_imports.m +++ b/compiler/module_imports.m @@ -251,12 +251,12 @@ :- implementation. -:- import_module libs.compiler_util. :- import_module libs.options. :- import_module parse_tree.modules. % undesirable dependency :- import_module bool. :- import_module dir. +:- import_module require. :- import_module set. :- import_module svset. :- import_module term. diff --git a/compiler/module_qual.m b/compiler/module_qual.m index c7dd50b59..6d05950f8 100644 --- a/compiler/module_qual.m +++ b/compiler/module_qual.m @@ -128,7 +128,6 @@ :- implementation. -:- import_module libs.compiler_util. :- import_module libs.options. :- import_module parse_tree.module_imports. :- import_module parse_tree.prog_io_sym_name. @@ -138,6 +137,7 @@ :- import_module assoc_list. :- import_module map. :- import_module pair. +:- import_module require. :- import_module set. :- import_module solutions. :- import_module svmap. diff --git a/compiler/modules.m b/compiler/modules.m index fb6699090..d58959075 100644 --- a/compiler/modules.m +++ b/compiler/modules.m @@ -367,7 +367,6 @@ :- implementation. :- import_module hlds.passes_aux. -:- import_module libs.compiler_util. :- import_module libs.handle_options. :- import_module libs.options. :- import_module make. % XXX undesirable dependency @@ -395,6 +394,7 @@ :- import_module map. :- import_module multi_map. :- import_module pair. +:- import_module require. :- import_module set. :- import_module solutions. :- import_module sparse_bitset. diff --git a/compiler/opt_util.m b/compiler/opt_util.m index f990b0f08..88b810234 100644 --- a/compiler/opt_util.m +++ b/compiler/opt_util.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 1994-2009 The University of Melbourne. +% Copyright (C) 1994-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -323,12 +323,12 @@ :- import_module backend_libs.builtin_ops. :- import_module check_hlds.type_util. :- import_module hlds.special_pred. -:- import_module libs.compiler_util. :- import_module ll_backend.exprn_aux. :- import_module parse_tree.prog_data. :- import_module int. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. diff --git a/compiler/optimize.m b/compiler/optimize.m index 36e40e62c..5dcc01e1b 100644 --- a/compiler/optimize.m +++ b/compiler/optimize.m @@ -37,7 +37,6 @@ :- import_module hlds.code_model. :- import_module hlds.hlds_pred. -:- import_module libs.compiler_util. :- import_module libs.file_util. :- import_module libs.options. :- import_module ll_backend.continuation_info. @@ -63,6 +62,7 @@ :- import_module io. :- import_module map. :- import_module maybe. +:- import_module require. :- import_module set. :- import_module string. diff --git a/compiler/options.m b/compiler/options.m index 92c3a6a4c..07876239c 100644 --- a/compiler/options.m +++ b/compiler/options.m @@ -985,7 +985,6 @@ :- implementation. -:- import_module libs.compiler_util. :- import_module libs.handle_options. :- import_module assoc_list. @@ -996,6 +995,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module string. :- import_module svmap. diff --git a/compiler/options_file.m b/compiler/options_file.m index aa84d8759..bce831114 100644 --- a/compiler/options_file.m +++ b/compiler/options_file.m @@ -78,7 +78,6 @@ :- implementation. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module parse_tree.error_util. @@ -90,6 +89,7 @@ :- import_module dir. :- import_module exception. :- import_module map. +:- import_module require. :- import_module std_util. :- import_module string. :- import_module svmap. diff --git a/compiler/ordering_mode_constraints.m b/compiler/ordering_mode_constraints.m index b7091bc85..33c3b4fbe 100644 --- a/compiler/ordering_mode_constraints.m +++ b/compiler/ordering_mode_constraints.m @@ -107,7 +107,6 @@ :- import_module hlds.hlds_error_util. :- import_module hlds.hlds_goal. :- import_module libs. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module mdbcomp. :- import_module mdbcomp.program_representation. @@ -123,6 +122,7 @@ :- import_module maybe. :- import_module multi_map. :- import_module pair. +:- import_module require. :- import_module string. :- import_module svset. diff --git a/compiler/par_conj_gen.m b/compiler/par_conj_gen.m index f6e061a6d..fde833a15 100644 --- a/compiler/par_conj_gen.m +++ b/compiler/par_conj_gen.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 1998-2000,2002-2009 University of Melbourne. +% Copyright (C) 1998-2000,2002-2010 University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %---------------------------------------------------------------------------% @@ -109,7 +109,6 @@ :- import_module hlds.hlds_llds. :- import_module hlds.hlds_module. :- import_module hlds.instmap. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module ll_backend.code_gen. @@ -124,6 +123,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module unit. diff --git a/compiler/parallel_to_plain_conj.m b/compiler/parallel_to_plain_conj.m index 7c7ee50bb..0fd157e33 100644 --- a/compiler/parallel_to_plain_conj.m +++ b/compiler/parallel_to_plain_conj.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=8 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2008 The University of Melbourne. +% Copyright (C) 2008, 2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -33,10 +33,10 @@ :- implementation. :- import_module hlds.hlds_goal. -:- import_module libs.compiler_util. :- import_module bool. :- import_module list. +:- import_module require. %-----------------------------------------------------------------------------% diff --git a/compiler/passes_aux.m b/compiler/passes_aux.m index 2a9316d0f..fd44db7bf 100644 --- a/compiler/passes_aux.m +++ b/compiler/passes_aux.m @@ -207,7 +207,6 @@ :- import_module hlds.hlds_out. :- import_module hlds.hlds_out.hlds_out_module. :- import_module hlds.hlds_out.hlds_out_util. -:- import_module libs.compiler_util. :- import_module libs.file_util. :- import_module libs.globals. :- import_module libs.options. @@ -223,6 +222,7 @@ :- import_module int. :- import_module map. :- import_module pair. +:- import_module require. :- import_module set_tree234. :- import_module string. :- import_module varset. diff --git a/compiler/pd_cost.m b/compiler/pd_cost.m index eb21e4bd9..075361e63 100644 --- a/compiler/pd_cost.m +++ b/compiler/pd_cost.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 1998-2008 University of Melbourne. +% Copyright (C) 1998-2008, 2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -42,12 +42,12 @@ :- implementation. -:- import_module libs.compiler_util. :- import_module parse_tree.prog_data. :- import_module int. :- import_module list. :- import_module pair. +:- import_module require. :- import_module set. %-----------------------------------------------------------------------------% diff --git a/compiler/pd_info.m b/compiler/pd_info.m index 064693196..da4ed019c 100644 --- a/compiler/pd_info.m +++ b/compiler/pd_info.m @@ -119,7 +119,6 @@ :- import_module check_hlds.inst_match. :- import_module hlds.hlds_goal. :- import_module hlds.hlds_pred. -:- import_module libs.compiler_util. :- import_module mdbcomp.prim_data. :- import_module parse_tree.prog_data. :- import_module parse_tree.prog_util. @@ -129,6 +128,7 @@ :- import_module bool. :- import_module int. :- import_module io. +:- import_module require. :- import_module term. %-----------------------------------------------------------------------------% diff --git a/compiler/pd_term.m b/compiler/pd_term.m index a7f01d8d2..6bc2a0098 100644 --- a/compiler/pd_term.m +++ b/compiler/pd_term.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 1998-2001, 2003-2008 The University of Melbourne. +% Copyright (C) 1998-2001, 2003-2008, 2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -103,7 +103,6 @@ :- implementation. :- import_module hlds.hlds_pred. -:- import_module libs.compiler_util. :- import_module parse_tree.prog_data. :- import_module transform_hlds.pd_util. @@ -111,6 +110,7 @@ :- import_module bool. :- import_module int. :- import_module map. +:- import_module require. %-----------------------------------------------------------------------------% diff --git a/compiler/pd_util.m b/compiler/pd_util.m index 8c84f196f..4e05311a1 100644 --- a/compiler/pd_util.m +++ b/compiler/pd_util.m @@ -164,7 +164,6 @@ :- import_module hlds.goal_util. :- import_module hlds.instmap. :- import_module hlds.quantification. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module parse_tree.error_util. @@ -176,6 +175,7 @@ :- import_module int. :- import_module io. :- import_module pair. +:- import_module require. :- import_module set. :- import_module term. :- import_module svmap. diff --git a/compiler/pickle.m b/compiler/pickle.m index 13d14bb8b..3bf92ecd9 100644 --- a/compiler/pickle.m +++ b/compiler/pickle.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2008 The University of Melbourne. +% Copyright (C) 2008, 2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -94,8 +94,6 @@ :- implementation. -:- import_module libs.compiler_util. - :- import_module bitmap. :- import_module bool. :- import_module char. @@ -106,6 +104,7 @@ :- import_module io. :- import_module list. :- import_module map. +:- import_module require. :- import_module string. %-----------------------------------------------------------------------------% diff --git a/compiler/polyhedron.m b/compiler/polyhedron.m index 7da4ae997..9e00d76cd 100644 --- a/compiler/polyhedron.m +++ b/compiler/polyhedron.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2003, 2005-2007, 2009 The University of Melbourne. +% Copyright (C) 2003, 2005-2007, 2009-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -184,10 +184,10 @@ :- implementation. -:- import_module libs.compiler_util. :- import_module libs.rat. :- import_module pair. +:- import_module require. :- import_module svmap. :- import_module svvarset. :- import_module varset. diff --git a/compiler/polymorphism.m b/compiler/polymorphism.m index 81dc3ca05..beea75945 100644 --- a/compiler/polymorphism.m +++ b/compiler/polymorphism.m @@ -400,7 +400,6 @@ :- import_module hlds.special_pred. :- import_module libs. :- import_module libs.compiler_util. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module mdbcomp.prim_data. @@ -418,6 +417,7 @@ :- import_module io. :- import_module map. :- import_module pair. +:- import_module require. :- import_module set. :- import_module solutions. :- import_module string. diff --git a/compiler/post_term_analysis.m b/compiler/post_term_analysis.m index 0c585ccdd..2d4acd3b9 100644 --- a/compiler/post_term_analysis.m +++ b/compiler/post_term_analysis.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %----------------------------------------------------------------------------% -% Copyright (C) 2005-2007, 2009 The University of Melbourne. +% Copyright (C) 2005-2007, 2009-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %----------------------------------------------------------------------------% @@ -42,7 +42,6 @@ :- import_module hlds.hlds_out.hlds_out_util. :- import_module hlds.hlds_pred. :- import_module hlds.special_pred. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module mdbcomp.prim_data. @@ -55,6 +54,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module string. %----------------------------------------------------------------------------% diff --git a/compiler/post_typecheck.m b/compiler/post_typecheck.m index 0865817ae..8ff49e9bb 100644 --- a/compiler/post_typecheck.m +++ b/compiler/post_typecheck.m @@ -135,7 +135,6 @@ :- import_module hlds.hlds_out.hlds_out_util. :- import_module hlds.pred_table. :- import_module libs. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module mdbcomp.program_representation. @@ -151,6 +150,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module solutions. :- import_module string. diff --git a/compiler/pred_table.m b/compiler/pred_table.m index 949ca1169..f0833d386 100644 --- a/compiler/pred_table.m +++ b/compiler/pred_table.m @@ -30,7 +30,6 @@ :- implementation. -:- import_module libs.compiler_util. :- import_module parse_tree.error_util. :- import_module parse_tree.prog_out. :- import_module parse_tree.prog_type. @@ -39,6 +38,7 @@ :- import_module int. :- import_module multi_map. :- import_module pair. +:- import_module require. :- import_module string. :- import_module svmap. :- import_module svmulti_map. diff --git a/compiler/proc_gen.m b/compiler/proc_gen.m index 4f2d52591..8a73bf948 100644 --- a/compiler/proc_gen.m +++ b/compiler/proc_gen.m @@ -83,7 +83,6 @@ :- import_module hlds.hlds_out.hlds_out_util. :- import_module hlds.hlds_rtti. :- import_module hlds.instmap. -:- import_module libs.compiler_util. :- import_module libs.file_util. :- import_module libs.globals. :- import_module libs.options. @@ -111,6 +110,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module solutions. :- import_module string. diff --git a/compiler/proc_label.m b/compiler/proc_label.m index 1d8457efa..c11830a32 100644 --- a/compiler/proc_label.m +++ b/compiler/proc_label.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2003-2008 The University of Melbourne. +% Copyright (C) 2003-2008, 2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -47,13 +47,12 @@ :- implementation. :- import_module backend_libs.rtti. -:- import_module libs. -:- import_module libs.compiler_util. :- import_module parse_tree.prog_type. :- import_module bool. :- import_module list. :- import_module pair. +:- import_module require. :- import_module string. make_proc_label_from_rtti(RttiProcLabel) = ProcLabel :- diff --git a/compiler/prog_ctgc.m b/compiler/prog_ctgc.m index 161056ac8..ec8355b31 100644 --- a/compiler/prog_ctgc.m +++ b/compiler/prog_ctgc.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2006, 2008-2009 The University of Melbourne. +% Copyright (C) 2006, 2008-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -171,7 +171,6 @@ :- implementation. -:- import_module libs.compiler_util. :- import_module parse_tree.mercury_to_mercury. :- import_module parse_tree.prog_io_sym_name. :- import_module parse_tree.prog_io_util. @@ -182,6 +181,7 @@ :- import_module int. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. :- import_module varset. diff --git a/compiler/prog_data.m b/compiler/prog_data.m index cffc50f2a..c1bee59bf 100644 --- a/compiler/prog_data.m +++ b/compiler/prog_data.m @@ -43,8 +43,7 @@ :- implementation. :- import_module library. -:- import_module libs.compiler_util. - +:- import_module require. :- import_module string. %-----------------------------------------------------------------------------% diff --git a/compiler/prog_event.m b/compiler/prog_event.m index 7cc114983..a48181f2a 100644 --- a/compiler/prog_event.m +++ b/compiler/prog_event.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2006-2009 The University of Melbourne. +% Copyright (C) 2006-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -59,7 +59,6 @@ :- implementation. -:- import_module libs.compiler_util. :- import_module mdbcomp.prim_data. :- import_module parse_tree.builtin_lib_types. :- import_module parse_tree.prog_mode. @@ -74,6 +73,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. :- import_module svbimap. diff --git a/compiler/prog_foreign.m b/compiler/prog_foreign.m index 283dc36d5..ef95b3faf 100644 --- a/compiler/prog_foreign.m +++ b/compiler/prog_foreign.m @@ -27,6 +27,7 @@ :- module parse_tree.prog_foreign. :- interface. +:- import_module libs. :- import_module libs.globals. :- import_module parse_tree.prog_data. :- import_module mdbcomp.prim_data. diff --git a/compiler/prog_io.m b/compiler/prog_io.m index f092221ed..fcecfae29 100644 --- a/compiler/prog_io.m +++ b/compiler/prog_io.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------e % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------e -% Copyright (C) 1993-2009 The University of Melbourne. +% Copyright (C) 1993-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -184,7 +184,6 @@ :- implementation. -:- import_module libs.compiler_util. :- import_module libs.options. :- import_module parse_tree.file_names. :- import_module parse_tree.mercury_to_mercury. @@ -212,6 +211,7 @@ :- import_module map. :- import_module pair. :- import_module parser. +:- import_module require. :- import_module set. :- import_module string. :- import_module term_io. diff --git a/compiler/prog_io_pragma.m b/compiler/prog_io_pragma.m index 408388c75..0986caefb 100644 --- a/compiler/prog_io_pragma.m +++ b/compiler/prog_io_pragma.m @@ -43,7 +43,6 @@ :- implementation. -:- import_module libs.compiler_util. :- import_module libs.rat. :- import_module parse_tree.error_util. :- import_module parse_tree.mercury_to_mercury. @@ -59,6 +58,7 @@ :- import_module int. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. :- import_module unit. diff --git a/compiler/prog_io_type_defn.m b/compiler/prog_io_type_defn.m index 88c43f9ee..9fca40227 100644 --- a/compiler/prog_io_type_defn.m +++ b/compiler/prog_io_type_defn.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------e % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------e -% Copyright (C) 2008-2009 The University of Melbourne. +% Copyright (C) 2008-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -53,7 +53,6 @@ :- implementation. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module parse_tree.error_util. :- import_module parse_tree.mercury_to_mercury. @@ -65,6 +64,7 @@ :- import_module bool. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. :- import_module unit. diff --git a/compiler/prog_io_typeclass.m b/compiler/prog_io_typeclass.m index 8c1b1a52d..4fa4dfffb 100644 --- a/compiler/prog_io_typeclass.m +++ b/compiler/prog_io_typeclass.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 1997-2009 University of Melbourne. +% Copyright (C) 1997-2010 University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -58,7 +58,6 @@ :- implementation. -:- import_module libs.compiler_util. :- import_module parse_tree.error_util. :- import_module parse_tree.mercury_to_mercury. :- import_module parse_tree.prog_io. @@ -72,6 +71,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module solutions. :- import_module string. :- import_module term. diff --git a/compiler/prog_io_util.m b/compiler/prog_io_util.m index 361af21d3..a98626ec6 100644 --- a/compiler/prog_io_util.m +++ b/compiler/prog_io_util.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 1996-2009 The University of Melbourne. +% Copyright (C) 1996-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -232,12 +232,12 @@ :- implementation. -:- import_module libs.compiler_util. :- import_module parse_tree.mercury_to_mercury. :- import_module parse_tree.prog_io_sym_name. :- import_module parse_tree.prog_out. :- import_module parse_tree.prog_util. +:- import_module require. :- import_module set. :- import_module term. diff --git a/compiler/prog_mode.m b/compiler/prog_mode.m index fd99db704..60d90f764 100644 --- a/compiler/prog_mode.m +++ b/compiler/prog_mode.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2004-2006, 2008-2009 The University of Melbourne. +% Copyright (C) 2004-2006, 2008-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -133,10 +133,10 @@ :- implementation. -:- import_module libs.compiler_util. :- import_module mdbcomp.prim_data. :- import_module map. +:- import_module require. :- import_module set. :- import_module term. :- import_module varset. diff --git a/compiler/prog_out.m b/compiler/prog_out.m index 47b654247..570d06663 100644 --- a/compiler/prog_out.m +++ b/compiler/prog_out.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 1993-2009 The University of Melbourne. +% Copyright (C) 1993-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -152,12 +152,12 @@ :- implementation. -:- import_module libs.compiler_util. :- import_module mdbcomp.prim_data. :- import_module parse_tree.error_util. :- import_module parse_tree.prog_util. :- import_module pair. +:- import_module require. :- import_module string. :- import_module term. :- import_module term_io. diff --git a/compiler/prog_rep.m b/compiler/prog_rep.m index e76fc112a..976d09fe6 100644 --- a/compiler/prog_rep.m +++ b/compiler/prog_rep.m @@ -85,13 +85,13 @@ :- import_module hlds.code_model. :- import_module hlds.hlds_data. :- import_module hlds.hlds_pred. -:- import_module libs.compiler_util. :- import_module mdbcomp. :- import_module mdbcomp.prim_data. :- import_module parse_tree.prog_util. :- import_module int. :- import_module maybe. +:- import_module require. :- import_module set. :- import_module std_util. :- import_module string. diff --git a/compiler/prog_type.m b/compiler/prog_type.m index 03941ea35..f80678f2e 100644 --- a/compiler/prog_type.m +++ b/compiler/prog_type.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2005-2009 The University of Melbourne. +% Copyright (C) 2005-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -405,11 +405,11 @@ :- implementation. :- import_module libs.options. -:- import_module libs.compiler_util. :- import_module parse_tree.prog_out. :- import_module parse_tree.prog_util. :- import_module parse_tree.prog_type_subst. +:- import_module require. :- import_module string. :- import_module svmap. diff --git a/compiler/prog_type_subst.m b/compiler/prog_type_subst.m index 0adf554f5..0441cfff7 100644 --- a/compiler/prog_type_subst.m +++ b/compiler/prog_type_subst.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2005-2006, 2009 The University of Melbourne. +% Copyright (C) 2005-2006, 2009-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -121,10 +121,9 @@ :- implementation. -:- import_module libs.compiler_util. - :- import_module map. :- import_module maybe. +:- import_module require. :- import_module svmap. %-----------------------------------------------------------------------------% diff --git a/compiler/prog_util.m b/compiler/prog_util.m index 3819da7ea..2b4aa863e 100644 --- a/compiler/prog_util.m +++ b/compiler/prog_util.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 1994-2001, 2003-2009 The University of Melbourne. +% Copyright (C) 1994-2001, 2003-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -189,7 +189,6 @@ :- implementation. -:- import_module libs.compiler_util. :- import_module parse_tree.mercury_to_mercury. :- import_module parse_tree.prog_out. @@ -197,6 +196,7 @@ :- import_module int. :- import_module map. :- import_module pair. +:- import_module require. :- import_module string. :- import_module svmap. :- import_module term_io. diff --git a/compiler/prop_mode_constraints.m b/compiler/prop_mode_constraints.m index e70ca3c7c..b13b836ff 100644 --- a/compiler/prop_mode_constraints.m +++ b/compiler/prop_mode_constraints.m @@ -83,14 +83,13 @@ :- import_module hlds.hlds_clauses. :- import_module hlds.hlds_error_util. :- import_module hlds.hlds_goal. -:- import_module libs. -:- import_module libs.compiler_util. :- import_module parse_tree. :- import_module parse_tree.error_util. :- import_module parse_tree.prog_data. :- import_module bool. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. :- import_module svmap. diff --git a/compiler/pseudo_type_info.m b/compiler/pseudo_type_info.m index 8c836753b..eed76730b 100644 --- a/compiler/pseudo_type_info.m +++ b/compiler/pseudo_type_info.m @@ -1,7 +1,7 @@ %---------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %---------------------------------------------------------------------------% -% Copyright (C) 1996-2000,2002-2003, 2005-2009 The University of Melbourne. +% Copyright (C) 1996-2000,2002-2003, 2005-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %---------------------------------------------------------------------------% @@ -63,14 +63,13 @@ :- implementation. -:- import_module libs. -:- import_module libs.compiler_util. :- import_module mdbcomp. :- import_module mdbcomp.prim_data. :- import_module parse_tree.prog_type. :- import_module int. :- import_module list. +:- import_module require. :- import_module term. %---------------------------------------------------------------------------% diff --git a/compiler/purity.m b/compiler/purity.m index 06a51fe13..55b3e6ba1 100644 --- a/compiler/purity.m +++ b/compiler/purity.m @@ -177,7 +177,6 @@ :- import_module hlds.pred_table. :- import_module hlds.quantification. :- import_module libs. -:- import_module libs.compiler_util. :- import_module libs.file_util. :- import_module libs.globals. :- import_module libs.options. @@ -190,17 +189,18 @@ :- import_module parse_tree.prog_out. :- import_module parse_tree.prog_type. +:- import_module assoc_list. :- import_module bool. :- import_module int. :- import_module list. :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. :- import_module term. :- import_module varset. -:- import_module assoc_list. %-----------------------------------------------------------------------------% diff --git a/compiler/quantification.m b/compiler/quantification.m index 82c5e0a55..4fba06455 100644 --- a/compiler/quantification.m +++ b/compiler/quantification.m @@ -105,13 +105,13 @@ :- import_module hlds.goal_util. :- import_module hlds.instmap. -:- import_module libs.compiler_util. :- import_module assoc_list. :- import_module bool. :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module string. :- import_module tree_bitset. :- import_module term. @@ -2235,7 +2235,7 @@ goal_expr_vars_no_lambda_2(NonLocalsToRecompute, GoalExpr, !Set) :- unify_rhs_vars_maybe_lambda(NonLocalsToRecompute, RHS, !Set, !LambdaSet) :- ( - RHS = rhs_var(Y), + RHS = rhs_var(Y), insert(!.Set, Y, !:Set) ; RHS = rhs_functor(_, _, ArgVars), @@ -2256,7 +2256,7 @@ unify_rhs_vars_maybe_lambda(NonLocalsToRecompute, RHS, !Set, !LambdaSet) :- unify_rhs_vars_maybe_lambda_and_bi_impl(RHS, !Set, !LambdaSet) :- ( - RHS = rhs_var(Y), + RHS = rhs_var(Y), insert(!.Set, Y, !:Set) ; RHS = rhs_functor(_, _, ArgVars), @@ -2279,7 +2279,7 @@ unify_rhs_vars_maybe_lambda_and_bi_impl(RHS, !Set, !LambdaSet) :- unify_rhs_vars_no_lambda(NonLocalsToRecompute, RHS, MaybeSetArgs, !Set) :- ( - RHS = rhs_var(Y), + RHS = rhs_var(Y), insert(!.Set, Y, !:Set) ; RHS = rhs_functor(_, _, ArgVars), diff --git a/compiler/rat.m b/compiler/rat.m index eaa96ae4d..d32d9b074 100644 --- a/compiler/rat.m +++ b/compiler/rat.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 1997-1998, 2003, 2005-2006 The University of Melbourne. +% Copyright (C) 1997-1998, 2003, 2005-2006, 2010 The University of Melbourne. % This file may only be copied under the terms of the GNU Library General % Public License - see the file COPYING.LIB in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -79,9 +79,8 @@ :- implementation. -:- import_module libs.compiler_util. - :- import_module int. +:- import_module require. :- import_module string. %-----------------------------------------------------------------------------% @@ -245,4 +244,3 @@ this_file = "rat.m". %-----------------------------------------------------------------------------% :- end_module rat. %-----------------------------------------------------------------------------% -%-----------------------------------------------------------------------------% diff --git a/compiler/rbmm.add_rbmm_goal_infos.m b/compiler/rbmm.add_rbmm_goal_infos.m index 4f92da644..08192c0c4 100644 --- a/compiler/rbmm.add_rbmm_goal_infos.m +++ b/compiler/rbmm.add_rbmm_goal_infos.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2007-2009 The University of Melbourne. +% Copyright (C) 2007-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -62,7 +62,6 @@ :- import_module hlds.hlds_goal. :- import_module hlds.hlds_pred. :- import_module libs. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module mdbcomp. @@ -78,6 +77,7 @@ :- import_module list. :- import_module map. :- import_module maybe. +:- import_module require. :- import_module set. :- import_module string. diff --git a/compiler/rbmm.condition_renaming.m b/compiler/rbmm.condition_renaming.m index 56a82f931..52b24bbf4 100644 --- a/compiler/rbmm.condition_renaming.m +++ b/compiler/rbmm.condition_renaming.m @@ -132,8 +132,6 @@ :- import_module check_hlds. :- import_module check_hlds.goal_path. :- import_module hlds.hlds_goal. -:- import_module libs. -:- import_module libs.compiler_util. :- import_module transform_hlds.rbmm.points_to_graph. :- import_module transform_hlds.smm_common. @@ -141,6 +139,7 @@ :- import_module int. :- import_module list. :- import_module pair. +:- import_module require. :- import_module set. :- import_module svmap. :- import_module svset. diff --git a/compiler/rbmm.execution_path.m b/compiler/rbmm.execution_path.m index 4f2c21e3b..d04c20977 100644 --- a/compiler/rbmm.execution_path.m +++ b/compiler/rbmm.execution_path.m @@ -35,13 +35,12 @@ :- import_module hlds.hlds_data. :- import_module hlds.hlds_goal. :- import_module hlds.hlds_pred. -:- import_module libs. -:- import_module libs.compiler_util. :- import_module parse_tree. :- import_module parse_tree.prog_data. :- import_module transform_hlds.smm_common. :- import_module pair. +:- import_module require. :- import_module string. :- import_module svmap. :- import_module list. diff --git a/compiler/rbmm.interproc_region_lifetime.m b/compiler/rbmm.interproc_region_lifetime.m index 589212b26..7bef427ad 100644 --- a/compiler/rbmm.interproc_region_lifetime.m +++ b/compiler/rbmm.interproc_region_lifetime.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2005-2007, 2009 The University of Melbourne. +% Copyright (C) 2005-2007, 2009-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -64,8 +64,6 @@ :- import_module hlds.arg_info. :- import_module hlds.hlds_goal. :- import_module hlds.hlds_pred. -:- import_module libs. -:- import_module libs.compiler_util. :- import_module parse_tree. :- import_module parse_tree.mercury_to_mercury. :- import_module parse_tree.prog_data. @@ -80,6 +78,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module solutions. :- import_module string. diff --git a/compiler/rbmm.live_region_analysis.m b/compiler/rbmm.live_region_analysis.m index dd63e855d..370a12296 100644 --- a/compiler/rbmm.live_region_analysis.m +++ b/compiler/rbmm.live_region_analysis.m @@ -45,8 +45,6 @@ :- import_module hlds.arg_info. :- import_module hlds.hlds_goal. :- import_module hlds.hlds_pred. -:- import_module libs. -:- import_module libs.compiler_util. :- import_module parse_tree. :- import_module parse_tree.mercury_to_mercury. :- import_module parse_tree.prog_data. @@ -58,6 +56,7 @@ :- import_module list. :- import_module map. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. :- import_module svmap. diff --git a/compiler/rbmm.live_variable_analysis.m b/compiler/rbmm.live_variable_analysis.m index f32fb94d7..564ce88bf 100644 --- a/compiler/rbmm.live_variable_analysis.m +++ b/compiler/rbmm.live_variable_analysis.m @@ -37,8 +37,6 @@ :- import_module hlds.arg_info. :- import_module hlds.hlds_goal. :- import_module hlds.hlds_pred. -:- import_module libs. -:- import_module libs.compiler_util. :- import_module parse_tree. :- import_module parse_tree.mercury_to_mercury. :- import_module parse_tree.prog_data. @@ -49,6 +47,7 @@ :- import_module list. :- import_module map. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. :- import_module svmap. diff --git a/compiler/rbmm.points_to_analysis.m b/compiler/rbmm.points_to_analysis.m index 1d31ff9bb..2fb1620d2 100644 --- a/compiler/rbmm.points_to_analysis.m +++ b/compiler/rbmm.points_to_analysis.m @@ -52,8 +52,6 @@ :- import_module hlds.hlds_data. :- import_module hlds.hlds_goal. :- import_module hlds.hlds_pred. -:- import_module libs. -:- import_module libs.compiler_util. :- import_module parse_tree. :- import_module parse_tree.prog_data. :- import_module transform_hlds.dependency_graph. @@ -67,6 +65,7 @@ :- import_module list. :- import_module map. :- import_module maybe. +:- import_module require. :- import_module set. :- import_module string. :- import_module svmap. diff --git a/compiler/rbmm.points_to_graph.m b/compiler/rbmm.points_to_graph.m index 80b56461b..8df526dab 100644 --- a/compiler/rbmm.points_to_graph.m +++ b/compiler/rbmm.points_to_graph.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2005-2007, 2009 The University of Melbourne. +% Copyright (C) 2005-2007, 2009-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU Library General % Public License - see the file COPYING.LIB in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -269,13 +269,12 @@ :- implementation. -:- import_module libs. -:- import_module libs.compiler_util. :- import_module transform_hlds.smm_common. :- import_module assoc_list. :- import_module counter. :- import_module pair. +:- import_module require. :- import_module solutions. :- import_module svmap. :- import_module svset. diff --git a/compiler/rbmm.region_arguments.m b/compiler/rbmm.region_arguments.m index b71e971f9..fd25319f2 100644 --- a/compiler/rbmm.region_arguments.m +++ b/compiler/rbmm.region_arguments.m @@ -73,11 +73,11 @@ :- import_module check_hlds.goal_path. :- import_module hlds.hlds_goal. :- import_module libs. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module bool. +:- import_module require. :- import_module set. :- import_module string. :- import_module svmap. diff --git a/compiler/rbmm.region_instruction.m b/compiler/rbmm.region_instruction.m index 86e5d4205..bedd3977e 100644 --- a/compiler/rbmm.region_instruction.m +++ b/compiler/rbmm.region_instruction.m @@ -113,12 +113,11 @@ :- import_module hlds.hlds_data. :- import_module hlds.hlds_goal. :- import_module hlds.hlds_llds. -:- import_module libs. -:- import_module libs.compiler_util. :- import_module transform_hlds.rbmm.points_to_graph. :- import_module bool. :- import_module pair. +:- import_module require. :- import_module set. :- import_module svmap. :- import_module svset. diff --git a/compiler/rbmm.region_resurrection_renaming.m b/compiler/rbmm.region_resurrection_renaming.m index cfa8bf9c6..bf2a675ea 100644 --- a/compiler/rbmm.region_resurrection_renaming.m +++ b/compiler/rbmm.region_resurrection_renaming.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2007, 2009 The University of Melbourne. +% Copyright (C) 2007, 2009-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -152,8 +152,6 @@ :- implementation. :- import_module hlds.hlds_goal. -:- import_module libs. -:- import_module libs.compiler_util. :- import_module transform_hlds.rbmm.points_to_graph. :- import_module assoc_list. @@ -161,6 +159,7 @@ :- import_module counter. :- import_module int. :- import_module pair. +:- import_module require. :- import_module set. :- import_module svmap. :- import_module svset. diff --git a/compiler/rbmm.region_transformation.m b/compiler/rbmm.region_transformation.m index aac629f9a..0832fa7e7 100644 --- a/compiler/rbmm.region_transformation.m +++ b/compiler/rbmm.region_transformation.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2007-2009 The University of Melbourne. +% Copyright (C) 2007-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -83,8 +83,6 @@ :- import_module hlds.instmap. :- import_module hlds.pred_table. :- import_module hlds.quantification. -:- import_module libs. -:- import_module libs.compiler_util. :- import_module mdbcomp.prim_data. :- import_module parse_tree.builtin_lib_types. :- import_module parse_tree.prog_mode. @@ -96,6 +94,7 @@ :- import_module int. :- import_module list. :- import_module pair. +:- import_module require. :- import_module set. :- import_module svmap. :- import_module svvarset. diff --git a/compiler/reassign.m b/compiler/reassign.m index f765827f5..174d7321d 100644 --- a/compiler/reassign.m +++ b/compiler/reassign.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2002-2009 The University of Melbourne. +% Copyright (C) 2002-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -111,12 +111,12 @@ :- implementation. -:- import_module libs.compiler_util. :- import_module ll_backend.code_util. :- import_module int. :- import_module map. :- import_module pair. +:- import_module require. :- import_module set. :- import_module svmap. diff --git a/compiler/recompilation.check.m b/compiler/recompilation.check.m index b688dd69b..aa6d8391b 100644 --- a/compiler/recompilation.check.m +++ b/compiler/recompilation.check.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2002-2009 The University of Melbourne. +% Copyright (C) 2002-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -66,7 +66,6 @@ :- import_module hlds.hlds_data. % for type field_access_type :- import_module hlds.hlds_pred. % for field_access_function_name, % type pred_id. -:- import_module libs.compiler_util. :- import_module libs.options. :- import_module libs.timestamp. :- import_module parse_tree.error_util. @@ -89,6 +88,7 @@ :- import_module map. :- import_module maybe. :- import_module parser. +:- import_module require. :- import_module set. :- import_module string. :- import_module svmap. diff --git a/compiler/recompilation.usage.m b/compiler/recompilation.usage.m index 9ca770fa1..f787533d3 100644 --- a/compiler/recompilation.usage.m +++ b/compiler/recompilation.usage.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2001-2009 University of Melbourne. +% Copyright (C) 2001-2010 University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -86,7 +86,6 @@ :- import_module hlds.hlds_pred. :- import_module hlds.passes_aux. :- import_module hlds.pred_table. -:- import_module libs.compiler_util. :- import_module libs.file_util. :- import_module libs.globals. :- import_module libs.options. @@ -105,6 +104,7 @@ :- import_module bool. :- import_module int. :- import_module queue. +:- import_module require. :- import_module solutions. :- import_module string. :- import_module svmap. diff --git a/compiler/recompilation.version.m b/compiler/recompilation.version.m index 54d7bf3e0..74b41bbd0 100644 --- a/compiler/recompilation.version.m +++ b/compiler/recompilation.version.m @@ -48,7 +48,6 @@ :- import_module hlds.hlds_out. :- import_module hlds.hlds_out.hlds_out_mode. -:- import_module libs.compiler_util. :- import_module parse_tree.error_util. :- import_module parse_tree.mercury_to_mercury. :- import_module parse_tree.prog_io_sym_name. @@ -59,6 +58,7 @@ :- import_module bool. :- import_module list. :- import_module map. +:- import_module require. :- import_module string. :- import_module varset. diff --git a/compiler/rtti.m b/compiler/rtti.m index 9a1a2bdbf..a631a921b 100644 --- a/compiler/rtti.m +++ b/compiler/rtti.m @@ -30,6 +30,7 @@ :- import_module hlds.hlds_data. :- import_module hlds.hlds_pred. :- import_module hlds.hlds_rtti. +:- import_module libs. :- import_module libs.globals. :- import_module mdbcomp. :- import_module mdbcomp.prim_data. @@ -958,13 +959,12 @@ :- import_module check_hlds. % needed for type_util, mode_util :- import_module check_hlds.mode_util. :- import_module hlds.hlds_data. -:- import_module libs. -:- import_module libs.compiler_util. :- import_module parse_tree.prog_foreign. :- import_module parse_tree.prog_type. :- import_module int. :- import_module pair. +:- import_module require. :- import_module string. :- import_module table_builtin. :- import_module varset. diff --git a/compiler/rtti_out.m b/compiler/rtti_out.m index c793c3ece..a3f2db3a2 100644 --- a/compiler/rtti_out.m +++ b/compiler/rtti_out.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2000-2007, 2009 The University of Melbourne. +% Copyright (C) 2000-2007, 2009-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -107,7 +107,6 @@ :- import_module backend_libs.type_ctor_info. :- import_module hlds.hlds_data. :- import_module hlds.hlds_rtti. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module ll_backend.code_util. :- import_module ll_backend.layout_out. @@ -125,6 +124,7 @@ :- import_module maybe. :- import_module multi_map. :- import_module pair. +:- import_module require. :- import_module string. :- import_module svmulti_map. :- import_module univ. diff --git a/compiler/rtti_to_mlds.m b/compiler/rtti_to_mlds.m index 406c48d56..8631776f0 100644 --- a/compiler/rtti_to_mlds.m +++ b/compiler/rtti_to_mlds.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2001-2009 The University of Melbourne. +% Copyright (C) 2001-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -54,7 +54,6 @@ :- import_module backend_libs.type_ctor_info. :- import_module hlds.hlds_data. :- import_module hlds.hlds_rtti. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module mdbcomp.prim_data. :- import_module ml_backend.ml_closure_gen. @@ -73,6 +72,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module svmap. :- import_module term. diff --git a/compiler/saved_vars.m b/compiler/saved_vars.m index 56162186d..7779bda90 100644 --- a/compiler/saved_vars.m +++ b/compiler/saved_vars.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 1996-2009 The University of Melbourne. +% Copyright (C) 1996-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -50,7 +50,6 @@ :- import_module hlds.hlds_rtti. :- import_module hlds.passes_aux. :- import_module hlds.quantification. -:- import_module libs.compiler_util. :- import_module parse_tree.prog_data. :- import_module bool. @@ -58,6 +57,7 @@ :- import_module list. :- import_module map. :- import_module pair. +:- import_module require. :- import_module set. :- import_module term. :- import_module varset. diff --git a/compiler/simplify.m b/compiler/simplify.m index 72995327b..e62051885 100644 --- a/compiler/simplify.m +++ b/compiler/simplify.m @@ -139,7 +139,6 @@ :- import_module hlds.pred_table. :- import_module hlds.quantification. :- import_module hlds.special_pred. -:- import_module libs.compiler_util. :- import_module libs.file_util. :- import_module libs.options. :- import_module libs.trace_params. @@ -161,6 +160,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. :- import_module svvarset. diff --git a/compiler/size_prof.m b/compiler/size_prof.m index e51752d85..547cb8955 100644 --- a/compiler/size_prof.m +++ b/compiler/size_prof.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2003-2009 The University of Melbourne. +% Copyright (C) 2003-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -119,7 +119,6 @@ :- import_module hlds.passes_aux. :- import_module hlds.pred_table. :- import_module hlds.quantification. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module mdbcomp.prim_data. @@ -136,6 +135,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. :- import_module svmap. diff --git a/compiler/special_pred.m b/compiler/special_pred.m index dbb7b0c9c..89d4432d2 100644 --- a/compiler/special_pred.m +++ b/compiler/special_pred.m @@ -111,7 +111,6 @@ :- implementation. :- import_module check_hlds.type_util. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module parse_tree.builtin_lib_types. @@ -120,6 +119,7 @@ :- import_module bool. :- import_module maybe. +:- import_module require. :- import_module string. %-----------------------------------------------------------------------------% diff --git a/compiler/ssdebug.m b/compiler/ssdebug.m index fecfaedc0..a016a73b6 100755 --- a/compiler/ssdebug.m +++ b/compiler/ssdebug.m @@ -201,7 +201,6 @@ :- import_module hlds.passes_aux. :- import_module hlds.pred_table. :- import_module hlds.quantification. -:- import_module libs.compiler_util. :- import_module mdbcomp.prim_data. :- import_module parse_tree.builtin_lib_types. :- import_module parse_tree.file_names. @@ -213,6 +212,7 @@ :- import_module list. :- import_module map. :- import_module maybe. +:- import_module require. :- import_module string. :- import_module svmap. :- import_module svvarset. diff --git a/compiler/stack_layout.m b/compiler/stack_layout.m index e4cc829ab..6339840ba 100644 --- a/compiler/stack_layout.m +++ b/compiler/stack_layout.m @@ -107,7 +107,6 @@ :- import_module hlds.hlds_pred. :- import_module hlds.hlds_rtti. :- import_module hlds.instmap. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module libs.trace_params. @@ -123,6 +122,7 @@ :- import_module int. :- import_module map. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. :- import_module svmap. diff --git a/compiler/stack_opt.m b/compiler/stack_opt.m index b5776fea8..d2d2da991 100644 --- a/compiler/stack_opt.m +++ b/compiler/stack_opt.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2002-2009 The University of Melbourne. +% Copyright (C) 2002-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -97,7 +97,6 @@ :- import_module hlds.hlds_out.hlds_out_goal. :- import_module hlds.hlds_out.hlds_out_util. :- import_module hlds.quantification. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module ll_backend.live_vars. @@ -116,6 +115,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module svmap. :- import_module svset. diff --git a/compiler/state_var.m b/compiler/state_var.m index 7d4b1bae7..d1fe45cd4 100644 --- a/compiler/state_var.m +++ b/compiler/state_var.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2005-2009 The University of Melbourne. +% Copyright (C) 2005-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -348,13 +348,13 @@ :- implementation. -:- import_module libs.compiler_util. :- import_module parse_tree.prog_util. :- import_module char. :- import_module int. :- import_module io. :- import_module pair. +:- import_module require. :- import_module string. :- import_module svmap. :- import_module term. diff --git a/compiler/stdlabel.m b/compiler/stdlabel.m index 67b0de08a..ab6a9d570 100644 --- a/compiler/stdlabel.m +++ b/compiler/stdlabel.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2006-2007 The University of Melbourne. +% Copyright (C) 2006-2007, 2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -40,13 +40,13 @@ :- implementation. -:- import_module libs.compiler_util. :- import_module ll_backend.opt_util. :- import_module mdbcomp.prim_data. :- import_module bool. :- import_module map. :- import_module pair. +:- import_module require. :- import_module svmap. %-----------------------------------------------------------------------------% diff --git a/compiler/stm_expand.m b/compiler/stm_expand.m index e6ca845ca..f947fbe3d 100644 --- a/compiler/stm_expand.m +++ b/compiler/stm_expand.m @@ -184,7 +184,6 @@ :- import_module hlds.instmap. :- import_module hlds.pred_table. :- import_module hlds.quantification. -:- import_module libs.compiler_util. :- import_module mdbcomp.prim_data. :- import_module parse_tree.builtin_lib_types. :- import_module parse_tree.prog_data. @@ -199,6 +198,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. :- import_module svmap. diff --git a/compiler/store_alloc.m b/compiler/store_alloc.m index 36124d139..ab983305a 100644 --- a/compiler/store_alloc.m +++ b/compiler/store_alloc.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 1994-2008 The University of Melbourne. +% Copyright (C) 1994-2008, 2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -49,7 +49,6 @@ :- import_module hlds.hlds_goal. :- import_module hlds.hlds_llds. :- import_module hlds.instmap. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.trace_params. :- import_module ll_backend.code_util. @@ -66,6 +65,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. %-----------------------------------------------------------------------------% diff --git a/compiler/stratify.m b/compiler/stratify.m index d2ab788bb..3681f5bd6 100644 --- a/compiler/stratify.m +++ b/compiler/stratify.m @@ -58,7 +58,6 @@ :- import_module hlds.hlds_module. :- import_module hlds.hlds_pred. :- import_module libs. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module mdbcomp. @@ -73,6 +72,7 @@ :- import_module digraph. :- import_module map. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. diff --git a/compiler/string_switch.m b/compiler/string_switch.m index 381a194ca..f12ca4b97 100644 --- a/compiler/string_switch.m +++ b/compiler/string_switch.m @@ -75,7 +75,6 @@ :- import_module hlds.hlds_data. :- import_module hlds.hlds_goal. :- import_module hlds.hlds_llds. -:- import_module libs.compiler_util. :- import_module ll_backend.code_gen. :- import_module ll_backend.lookup_util. :- import_module ll_backend.switch_case. @@ -88,6 +87,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module std_util. :- import_module string. diff --git a/compiler/structure_reuse.analysis.m b/compiler/structure_reuse.analysis.m index cd85aeb34..b58a10de4 100644 --- a/compiler/structure_reuse.analysis.m +++ b/compiler/structure_reuse.analysis.m @@ -102,7 +102,6 @@ :- import_module hlds.hlds_out.hlds_out_util. :- import_module hlds.passes_aux. :- import_module hlds.pred_table. -:- import_module libs.compiler_util. :- import_module libs.file_util. :- import_module libs.globals. :- import_module libs.options. @@ -129,6 +128,7 @@ :- import_module list. :- import_module map. :- import_module maybe. +:- import_module require. :- import_module set. :- import_module string. :- import_module svmap. diff --git a/compiler/structure_reuse.direct.choose_reuse.m b/compiler/structure_reuse.direct.choose_reuse.m index ee1b46558..4780ccd10 100644 --- a/compiler/structure_reuse.direct.choose_reuse.m +++ b/compiler/structure_reuse.direct.choose_reuse.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2006-2009 The University of Melbourne. +% Copyright (C) 2006-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -112,7 +112,6 @@ :- import_module check_hlds.type_util. :- import_module hlds.hlds_data. -:- import_module libs.compiler_util. :- import_module parse_tree.prog_data. :- import_module float. @@ -120,6 +119,7 @@ :- import_module maybe. :- import_module multi_map. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. :- import_module svmulti_map. diff --git a/compiler/structure_reuse.direct.detect_garbage.m b/compiler/structure_reuse.direct.detect_garbage.m index d3897c983..8241159e3 100644 --- a/compiler/structure_reuse.direct.detect_garbage.m +++ b/compiler/structure_reuse.direct.detect_garbage.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2006-2009 The University of Melbourne. +% Copyright (C) 2006-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -37,7 +37,6 @@ :- implementation. :- import_module check_hlds.type_util. -:- import_module libs.compiler_util. :- import_module parse_tree.prog_data. :- import_module parse_tree.prog_out. :- import_module transform_hlds.ctgc.datastruct. @@ -46,6 +45,7 @@ :- import_module bool. :- import_module io. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. diff --git a/compiler/structure_reuse.domain.m b/compiler/structure_reuse.domain.m index 14def9148..510e1911c 100644 --- a/compiler/structure_reuse.domain.m +++ b/compiler/structure_reuse.domain.m @@ -271,13 +271,13 @@ :- import_module hlds.hlds_out. :- import_module hlds.hlds_out.hlds_out_util. -:- import_module libs.compiler_util. :- import_module parse_tree.prog_ctgc. :- import_module transform_hlds.ctgc.datastruct. :- import_module transform_hlds.ctgc.util. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module solutions. :- import_module string. diff --git a/compiler/structure_reuse.indirect.m b/compiler/structure_reuse.indirect.m index 93102e2ee..f5c526aad 100644 --- a/compiler/structure_reuse.indirect.m +++ b/compiler/structure_reuse.indirect.m @@ -1,7 +1,7 @@ %------------------------------------------------------------------------------% % vim: ft=mercury ff=unix ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2006-2009 The University of Melbourne. +% Copyright (C) 2006-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -73,7 +73,6 @@ :- import_module hlds.hlds_goal. :- import_module hlds.hlds_out. :- import_module hlds.hlds_out.hlds_out_util. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module parse_tree.mercury_to_mercury. @@ -93,6 +92,7 @@ :- import_module list. :- import_module map. :- import_module maybe. +:- import_module require. :- import_module solutions. :- import_module string. diff --git a/compiler/structure_reuse.lbu.m b/compiler/structure_reuse.lbu.m index 6a6e2fc38..008ef67c1 100644 --- a/compiler/structure_reuse.lbu.m +++ b/compiler/structure_reuse.lbu.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2006-2008 The University of Melbourne. +% Copyright (C) 2006-2008, 2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -41,12 +41,12 @@ :- import_module hlds.hlds_goal. :- import_module hlds.hlds_llds. -:- import_module libs.compiler_util. :- import_module parse_tree.prog_data. :- import_module parse_tree.prog_type. :- import_module list. :- import_module pair. +:- import_module require. :- import_module set. %-----------------------------------------------------------------------------% diff --git a/compiler/structure_reuse.lfu.m b/compiler/structure_reuse.lfu.m index 98a515654..b1d01ed7c 100644 --- a/compiler/structure_reuse.lfu.m +++ b/compiler/structure_reuse.lfu.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2006-2009 The University of Melbourne. +% Copyright (C) 2006-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -45,12 +45,12 @@ :- import_module hlds.hlds_goal. :- import_module hlds.hlds_llds. :- import_module hlds.hlds_pred. -:- import_module libs.compiler_util. :- import_module parse_tree.prog_type. :- import_module list. :- import_module map. :- import_module pair. +:- import_module require. %-----------------------------------------------------------------------------% diff --git a/compiler/structure_reuse.versions.m b/compiler/structure_reuse.versions.m index 21014b787..949cd2eef 100644 --- a/compiler/structure_reuse.versions.m +++ b/compiler/structure_reuse.versions.m @@ -1,7 +1,7 @@ %------------------------------------------------------------------------------% % vim: ft=mercury ff=unix ts=4 sw=4 et %------------------------------------------------------------------------------% -% Copyright (C) 2006-2009 The University of Melbourne. +% Copyright (C) 2006-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -65,7 +65,6 @@ :- import_module hlds.passes_aux. :- import_module hlds.pred_table. :- import_module hlds.quantification. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module mdbcomp. @@ -78,6 +77,7 @@ :- import_module list. :- import_module map. :- import_module maybe. +:- import_module require. :- import_module set. :- import_module string. diff --git a/compiler/structure_sharing.analysis.m b/compiler/structure_sharing.analysis.m index aa5a6b155..971a95e31 100644 --- a/compiler/structure_sharing.analysis.m +++ b/compiler/structure_sharing.analysis.m @@ -70,7 +70,6 @@ :- import_module hlds.hlds_out. :- import_module hlds.hlds_out.hlds_out_util. :- import_module hlds.passes_aux. -:- import_module libs.compiler_util. :- import_module libs.file_util. :- import_module libs.globals. :- import_module libs.options. @@ -95,6 +94,7 @@ :- import_module list. :- import_module map. :- import_module maybe. +:- import_module require. :- import_module set. :- import_module string. :- import_module svmap. diff --git a/compiler/structure_sharing.domain.m b/compiler/structure_sharing.domain.m index 0a3080254..864621188 100644 --- a/compiler/structure_sharing.domain.m +++ b/compiler/structure_sharing.domain.m @@ -5,18 +5,18 @@ % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% -% +% % File: structure_sharing.domain.m. % Main author: nancy. -% +% % This module defines the abstract domain for representing structure sharing % between data structures. -% +% % This domain forms a complete lattice. It has a bottom element (representing % the definite absence of any possible structure sharing), and a top element % (that represents any possible structure sharing), a least upper bound % operation, and a comparison predicate (is_subsumed_by). -% +% % The auxiliary functions needed for using the domain within the abstract % semantics on which the implementation of the analysis is based are: % @@ -36,7 +36,7 @@ % % * add: add the sharing created by a primitive operation (unification) % to any existing sharing. -% +% % Additional operations: % % * extend_datastruct: compute the set of datastructures referring to the @@ -46,7 +46,7 @@ % % * conversion operations between the public and private representation % for sharing sets. -% +% %-----------------------------------------------------------------------------% :- module transform_hlds.ctgc.structure_sharing.domain. @@ -118,7 +118,7 @@ % % Renaming of the formal description of data structure sharing to the % actual description of the sharing. The information about the formal - % variables needs to be extracted from the module information. + % variables needs to be extracted from the module information. % A list of variables and types is used as the actual variables and types. % The type variables set in the actual context must also be specified. % @@ -151,8 +151,8 @@ % Add the sharing created by a call to some foreign code. This % sharing corresponds to the sharing information with which the - % foreign code was manually annotated, or can be predicted to - % "bottom", and in the worst case to "top". + % foreign code was manually annotated, or can be predicted to + % "bottom", and in the worst case to "top". % :- pred add_foreign_proc_sharing(module_info::in, pred_info::in, proc_info::in, pred_proc_id::in, pragma_foreign_proc_attributes::in, @@ -187,7 +187,7 @@ % :- func extend_datastruct(module_info, proc_info, sharing_as, datastruct) = list(datastruct). -:- func extend_datastructs(module_info, proc_info, sharing_as, +:- func extend_datastructs(module_info, proc_info, sharing_as, list(datastruct)) = list(datastruct). % apply_widening(ModuleInfo, ProcInfo, WideningLimit, WideningDone, @@ -259,8 +259,8 @@ sharing_as::in, sharing_as::out) is det. % Lookup the sharing information in the sharing table, or if it is not - % in there, try to predict it using the information available in the - % module_info. + % in there, try to predict it using the information available in the + % module_info. % % Lookup the sharing information of a procedure identified by its % pred_proc_id. @@ -290,7 +290,7 @@ list(mer_mode)::in, list(mer_type)::in) is semidet. % Load all the structure sharing information present in the HLDS into - % a sharing table. + % a sharing table. % :- func load_structure_sharing_table(module_info) = sharing_as_table. @@ -303,7 +303,6 @@ :- import_module check_hlds.mode_util. :- import_module check_hlds.type_util. :- import_module hlds.hlds_llds. -:- import_module libs.compiler_util. :- import_module mdbcomp.prim_data. :- import_module parse_tree.prog_ctgc. :- import_module parse_tree.prog_out. @@ -317,6 +316,7 @@ :- import_module int. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module solutions. :- import_module string. :- import_module svmap. @@ -376,7 +376,7 @@ sharing_as_short_description(sharing_as_real_as(SharingSet)) = sharing_as_project(ListVars, !SharingAs) :- sharing_as_project_with_type(inproject, ListVars, !SharingAs). -sharing_as_project(ListVars, SharingAs) = NewSharingAs :- +sharing_as_project(ListVars, SharingAs) = NewSharingAs :- sharing_as_project(ListVars, SharingAs, NewSharingAs). :- pred sharing_as_project_with_type(projection_type::in, prog_vars::in, @@ -630,9 +630,9 @@ optimization_remove_deaths(ProcInfo, GoalInfo, Sharing0) = Sharing :- set.to_sorted_list(Deaths, DeathsList), sharing_as_project_with_type(outproject, DeathsList, Sharing0, Sharing). -add_foreign_proc_sharing(ModuleInfo, PredInfo, ProcInfo, ForeignPPId, - Attributes, Args, GoalContext, OldSharing, NewSharing) :- - ForeignSharing = sharing_as_for_foreign_proc(ModuleInfo, +add_foreign_proc_sharing(ModuleInfo, PredInfo, ProcInfo, ForeignPPId, + Attributes, Args, GoalContext, OldSharing, NewSharing) :- + ForeignSharing = sharing_as_for_foreign_proc(ModuleInfo, Attributes, ForeignPPId, GoalContext), ActualVars = list.map(foreign_arg_var, Args), @@ -645,13 +645,13 @@ add_foreign_proc_sharing(ModuleInfo, PredInfo, ProcInfo, ForeignPPId, ActualVars, ActualTypes, CallerTypeVarSet, CallerHeadTypeParams, ForeignSharing, ActualSharing), - NewSharing = sharing_as_comb(ModuleInfo, ProcInfo, ActualSharing, + NewSharing = sharing_as_comb(ModuleInfo, ProcInfo, ActualSharing, OldSharing). -:- func sharing_as_for_foreign_proc(module_info, +:- func sharing_as_for_foreign_proc(module_info, pragma_foreign_proc_attributes, pred_proc_id, prog_context) = sharing_as. -sharing_as_for_foreign_proc(ModuleInfo, Attributes, ForeignPPId, +sharing_as_for_foreign_proc(ModuleInfo, Attributes, ForeignPPId, ProgContext) = SharingAs :- ( sharing_as_from_user_annotated_sharing(Attributes, SharingAs0) @@ -662,8 +662,8 @@ sharing_as_for_foreign_proc(ModuleInfo, Attributes, ForeignPPId, -> SharingAs = sharing_as_bottom ; - context_to_string(ProgContext, ContextString), - Msg = "foreign proc with unknown sharing (" + context_to_string(ProgContext, ContextString), + Msg = "foreign proc with unknown sharing (" ++ ContextString ++ ")", SharingAs = sharing_as_top_sharing(top_cannot_improve(Msg)) ). @@ -671,9 +671,9 @@ sharing_as_for_foreign_proc(ModuleInfo, Attributes, ForeignPPId, :- pred sharing_as_from_user_annotated_sharing( pragma_foreign_proc_attributes::in, sharing_as::out) is semidet. -sharing_as_from_user_annotated_sharing(Attributes, UserSharingAs) :- +sharing_as_from_user_annotated_sharing(Attributes, UserSharingAs) :- UserSharing = get_user_annotated_sharing(Attributes), - UserSharing = user_sharing(SharingDomain, _MaybeTypes), + UserSharing = user_sharing(SharingDomain, _MaybeTypes), % Accept only the value "bottom" and "real" for the structure sharing. % If the user has annotated the sharing with unknown sharing, we might % try to predict bottom anyway. @@ -685,11 +685,11 @@ sharing_as_from_user_annotated_sharing(Attributes, UserSharingAs) :- SharingDomain = structure_sharing_real(_SharingPairs), !:SharingAs = from_structure_sharing_domain(SharingDomain) - % XXX + % XXX % I have the feeling that renaming should not be needed at this % place anymore, assuming that every foreign_proc call is - % correctly handled at the add_pragma stage? - ), + % correctly handled at the add_pragma stage? + ), UserSharingAs = !.SharingAs ). @@ -773,12 +773,12 @@ extend_datastruct(ModuleInfo, ProcInfo, SharingAs, Datastruct) unexpected(this_file, "extend_datastruct with top sharing set.") ). -extend_datastructs(ModuleInfo, ProcInfo, SharingAs, Datastructs) - = ExtendedDatastructs :- - DataLists = list.map(extend_datastruct(ModuleInfo, ProcInfo, +extend_datastructs(ModuleInfo, ProcInfo, SharingAs, Datastructs) + = ExtendedDatastructs :- + DataLists = list.map(extend_datastruct(ModuleInfo, ProcInfo, SharingAs), Datastructs), ExtendedDatastructs = list.foldl( - datastruct_lists_least_upper_bound(ModuleInfo, ProcInfo), + datastruct_lists_least_upper_bound(ModuleInfo, ProcInfo), DataLists, []). apply_widening(ModuleInfo, ProcInfo, WideningLimit, WideningDone, !Sharing):- @@ -843,8 +843,8 @@ sharing_as_table_set(PPId, SharingAs_Status, !Table) :- %-----------------------------------------------------------------------------% -lookup_sharing_and_comb(ModuleInfo, PredInfo, ProcInfo, SharingTable, - PredId, ProcId, ActualVars, !Sharing):- +lookup_sharing_and_comb(ModuleInfo, PredInfo, ProcInfo, SharingTable, + PredId, ProcId, ActualVars, !Sharing):- PPId = proc(PredId, ProcId), % XXX do we need to combine the analysis status of sharing information we @@ -852,16 +852,16 @@ lookup_sharing_and_comb(ModuleInfo, PredInfo, ProcInfo, SharingTable, lookup_sharing_or_predict(ModuleInfo, SharingTable, PPId, FormalSharing, _Status, _IsPredicted), - proc_info_get_vartypes(ProcInfo, VarTypes), + proc_info_get_vartypes(ProcInfo, VarTypes), map.apply_to_list(ActualVars, VarTypes, ActualTypes), - - pred_info_get_typevarset(PredInfo, CallerTypeVarSet), - pred_info_get_univ_quant_tvars(PredInfo, CallerHeadTypeParams), - sharing_as_rename_using_module_info(ModuleInfo, PPId, + + pred_info_get_typevarset(PredInfo, CallerTypeVarSet), + pred_info_get_univ_quant_tvars(PredInfo, CallerHeadTypeParams), + sharing_as_rename_using_module_info(ModuleInfo, PPId, ActualVars, ActualTypes, CallerTypeVarSet, CallerHeadTypeParams, FormalSharing, ActualSharing), - !:Sharing = sharing_as_comb(ModuleInfo, ProcInfo, + !:Sharing = sharing_as_comb(ModuleInfo, ProcInfo, ActualSharing, !.Sharing). lookup_sharing_or_predict(ModuleInfo, SharingTable, PPId, SharingAs, Status, @@ -932,7 +932,7 @@ top_sharing_not_found(PPId) = TopSharing :- ShroudedPredProcId = shroud_pred_proc_id(PPId), Reason = top_failed_lookup(ShroudedPredProcId), TopSharing = sharing_as_top_sharing(Reason). - + %-----------------------------------------------------------------------------% load_structure_sharing_table(ModuleInfo) = SharingTable :- @@ -1147,7 +1147,7 @@ sharing_set_project(ProjectionType, Vars, SharingSet0, SharingSet) :- :- pred project_and_update_sharing_set(projection_type::in, prog_vars::in, prog_var::in, selector_sharing_set::in, sharing_set::in, sharing_set::out) is det. - + project_and_update_sharing_set(ProjectionType, Vars, Var, SelSet0, !SS) :- selector_sharing_set_project(ProjectionType, Vars, SelSet0, SelSet), ( selector_sharing_set_is_empty(SelSet) -> diff --git a/compiler/superhomogeneous.m b/compiler/superhomogeneous.m index 8ad9e0109..2362b2d70 100644 --- a/compiler/superhomogeneous.m +++ b/compiler/superhomogeneous.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2005-2009 The University of Melbourne. +% Copyright (C) 2005-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -118,7 +118,6 @@ :- import_module hlds.make_hlds.add_clause. :- import_module hlds.make_hlds.field_access. :- import_module hlds.make_hlds.qual_info. -:- import_module libs.compiler_util. :- import_module libs.globals. % for get_maybe_from_ground_term_threshold :- import_module parse_tree.mercury_to_mercury. :- import_module parse_tree.module_qual. @@ -132,6 +131,7 @@ :- import_module int. :- import_module map. :- import_module pair. +:- import_module require. :- import_module set. :- import_module svvarset. :- import_module svset. diff --git a/compiler/switch_detection.m b/compiler/switch_detection.m index b3c96be6c..66f6df5d0 100644 --- a/compiler/switch_detection.m +++ b/compiler/switch_detection.m @@ -76,7 +76,6 @@ :- import_module hlds.passes_aux. :- import_module hlds.quantification. :- import_module libs. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module parse_tree.prog_data. @@ -90,6 +89,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module set_tree234. :- import_module string. diff --git a/compiler/switch_util.m b/compiler/switch_util.m index 07335e60f..dfecd35cd 100644 --- a/compiler/switch_util.m +++ b/compiler/switch_util.m @@ -343,7 +343,6 @@ :- import_module hlds.hlds_data. :- import_module hlds.hlds_code_util. :- import_module hlds.hlds_out. -:- import_module libs.compiler_util. :- import_module libs.options. :- import_module parse_tree.prog_type. @@ -351,6 +350,7 @@ :- import_module cord. :- import_module int. :- import_module io. +:- import_module require. :- import_module string. :- import_module svmap. diff --git a/compiler/table_gen.m b/compiler/table_gen.m index ece6d108f..88d2d975f 100644 --- a/compiler/table_gen.m +++ b/compiler/table_gen.m @@ -67,7 +67,6 @@ :- import_module hlds.hlds_rtti. :- import_module hlds.instmap. :- import_module hlds.pred_table. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module ll_backend. @@ -85,6 +84,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module solutions. :- import_module string. diff --git a/compiler/tabling_analysis.m b/compiler/tabling_analysis.m index 36e3283f7..8faf1185c 100644 --- a/compiler/tabling_analysis.m +++ b/compiler/tabling_analysis.m @@ -89,7 +89,6 @@ :- import_module hlds.hlds_error_util. :- import_module hlds.hlds_goal. :- import_module hlds.hlds_pred. -:- import_module libs.compiler_util. :- import_module libs.file_util. :- import_module libs.globals. :- import_module libs.options. @@ -106,6 +105,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. :- import_module term. diff --git a/compiler/tag_switch.m b/compiler/tag_switch.m index 2393d3fce..c6542a973 100644 --- a/compiler/tag_switch.m +++ b/compiler/tag_switch.m @@ -45,7 +45,6 @@ :- import_module hlds.hlds_llds. :- import_module hlds.hlds_out. :- import_module hlds.hlds_pred. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module ll_backend.code_gen. @@ -59,6 +58,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module string. :- import_module svmap. diff --git a/compiler/term_constr_build.m b/compiler/term_constr_build.m index 114f14bc7..7bb11f09e 100644 --- a/compiler/term_constr_build.m +++ b/compiler/term_constr_build.m @@ -67,7 +67,6 @@ :- import_module hlds.hlds_out. :- import_module hlds.hlds_out.hlds_out_util. :- import_module hlds.quantification. -:- import_module libs.compiler_util. :- import_module libs.lp_rational. :- import_module libs.polyhedron. :- import_module libs.rat. @@ -83,6 +82,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module std_util. :- import_module string. diff --git a/compiler/term_constr_data.m b/compiler/term_constr_data.m index f6a12990c..4f06078b1 100644 --- a/compiler/term_constr_data.m +++ b/compiler/term_constr_data.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2002, 2005-2009 The University of Melbourne. +% Copyright (C) 2002, 2005-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -384,10 +384,10 @@ :- import_module hlds.hlds_pred. :- import_module hlds.hlds_out. :- import_module hlds.hlds_out.hlds_out_util. -:- import_module libs.compiler_util. :- import_module parse_tree.prog_data. :- import_module int. +:- import_module require. :- import_module std_util. :- import_module string. :- import_module varset. diff --git a/compiler/term_constr_errors.m b/compiler/term_constr_errors.m index dbe92a530..0568f6f53 100644 --- a/compiler/term_constr_errors.m +++ b/compiler/term_constr_errors.m @@ -73,7 +73,6 @@ :- implementation. :- import_module hlds.hlds_error_util. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module parse_tree.error_util. @@ -82,6 +81,7 @@ :- import_module bool. :- import_module int. :- import_module maybe. +:- import_module require. :- import_module string. %-----------------------------------------------------------------------------% diff --git a/compiler/term_constr_fixpoint.m b/compiler/term_constr_fixpoint.m index f4f3a20b0..80be0d758 100644 --- a/compiler/term_constr_fixpoint.m +++ b/compiler/term_constr_fixpoint.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2002, 2005-2009 The University of Melbourne. +% Copyright (C) 2002, 2005-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -56,7 +56,6 @@ :- import_module hlds.hlds_out. :- import_module hlds.hlds_out.hlds_out_util. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.lp_rational. :- import_module libs.options. @@ -70,6 +69,7 @@ :- import_module int. :- import_module io. :- import_module maybe. +:- import_module require. :- import_module set. :- import_module string. :- import_module term. diff --git a/compiler/term_constr_initial.m b/compiler/term_constr_initial.m index 75c48a52e..ce99838ee 100644 --- a/compiler/term_constr_initial.m +++ b/compiler/term_constr_initial.m @@ -57,7 +57,6 @@ :- import_module hlds.hlds_pred. :- import_module hlds.passes_aux. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.lp_rational. :- import_module libs.options. @@ -78,6 +77,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module std_util. :- import_module string. diff --git a/compiler/term_constr_pass2.m b/compiler/term_constr_pass2.m index e8182728a..76057ccbf 100644 --- a/compiler/term_constr_pass2.m +++ b/compiler/term_constr_pass2.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2002, 2005-2009 The University of Melbourne. +% Copyright (C) 2002, 2005-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -53,7 +53,6 @@ :- import_module hlds.hlds_out. :- import_module hlds.hlds_out.hlds_out_util. :- import_module hlds.hlds_pred. -:- import_module libs.compiler_util. :- import_module libs.lp_rational. :- import_module libs.polyhedron. :- import_module libs.rat. @@ -69,6 +68,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module term. :- import_module varset. diff --git a/compiler/term_constr_util.m b/compiler/term_constr_util.m index 39979ccf4..5897edbaa 100644 --- a/compiler/term_constr_util.m +++ b/compiler/term_constr_util.m @@ -193,7 +193,6 @@ :- import_module hlds.hlds_out. :- import_module hlds.hlds_out.hlds_out_util. :- import_module hlds.hlds_pred. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module libs.rat. @@ -201,6 +200,7 @@ :- import_module transform_hlds.term_norm. :- import_module pair. +:- import_module require. :- import_module set. :- import_module std_util. :- import_module string. diff --git a/compiler/term_errors.m b/compiler/term_errors.m index 7cca697f6..4e2a8df67 100644 --- a/compiler/term_errors.m +++ b/compiler/term_errors.m @@ -165,7 +165,6 @@ :- implementation. :- import_module hlds.hlds_error_util. -:- import_module libs.compiler_util. :- import_module parse_tree.error_util. :- import_module transform_hlds.term_util. @@ -174,6 +173,7 @@ :- import_module int. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module string. :- import_module term. :- import_module varset. diff --git a/compiler/term_norm.m b/compiler/term_norm.m index 25e8f0664..3485fe479 100644 --- a/compiler/term_norm.m +++ b/compiler/term_norm.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 1997-2009 The University of Melbourne. +% Copyright (C) 1997-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -72,13 +72,13 @@ :- import_module check_hlds.type_util. :- import_module hlds.hlds_data. -:- import_module libs.compiler_util. :- import_module parse_tree.prog_type. :- import_module bool. :- import_module int. :- import_module map. :- import_module pair. +:- import_module require. :- import_module svmap. %-----------------------------------------------------------------------------% diff --git a/compiler/term_pass1.m b/compiler/term_pass1.m index 6886a8bac..9b734e1c2 100644 --- a/compiler/term_pass1.m +++ b/compiler/term_pass1.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 1997-1998, 2003-2008 The University of Melbourne. +% Copyright (C) 1997-1998, 2003-2008, 2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -57,7 +57,6 @@ :- import_module hlds.goal_util. :- import_module hlds.hlds_goal. -:- import_module libs.compiler_util. :- import_module libs.lp. :- import_module parse_tree.prog_data. :- import_module transform_hlds.term_traversal. @@ -67,6 +66,7 @@ :- import_module float. :- import_module map. :- import_module maybe. +:- import_module require. :- import_module set. :- import_module svmap. :- import_module svset. @@ -78,15 +78,16 @@ :- type pass1_result ---> term_pass1_ok( + % One entry for each path through the code. list(term_path_info), - % One entry for each path through the - % code. + + % The next output_supplier map. used_args, - % The next output_supplier map. + + % There is an entry in this list for each procedure in the SCC + % in which the set of active vars is not a subset of the + % input arguments. list(termination_error_context) - % There is an entry in this list for each procedure in - % the SCC in which the set of active vars is not a - % subset of the input arguments. ) ; term_pass1_error( list(termination_error_context) diff --git a/compiler/term_pass2.m b/compiler/term_pass2.m index 65fcba340..768961ef8 100644 --- a/compiler/term_pass2.m +++ b/compiler/term_pass2.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 1997-1998, 2003-2008 The University of Melbourne. +% Copyright (C) 1997-1998, 2003-2008, 2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -42,7 +42,6 @@ :- import_module check_hlds.mode_util. :- import_module hlds.goal_util. -:- import_module libs.compiler_util. :- import_module parse_tree.prog_data. :- import_module transform_hlds.term_errors. :- import_module transform_hlds.term_traversal. @@ -54,6 +53,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module term. :- import_module unit. diff --git a/compiler/term_traversal.m b/compiler/term_traversal.m index b3cc8ccd7..3079ee465 100644 --- a/compiler/term_traversal.m +++ b/compiler/term_traversal.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 1997-2009 The University of Melbourne. +% Copyright (C) 1997-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -108,13 +108,13 @@ :- implementation. -:- import_module libs.compiler_util. :- import_module parse_tree.prog_type. :- import_module assoc_list. :- import_module bool. :- import_module int. :- import_module map. +:- import_module require. :- import_module svset. %-----------------------------------------------------------------------------% diff --git a/compiler/term_util.m b/compiler/term_util.m index 595151fce..4bbb91b3c 100644 --- a/compiler/term_util.m +++ b/compiler/term_util.m @@ -173,10 +173,10 @@ :- import_module check_hlds.inst_match. :- import_module check_hlds.mode_util. -:- import_module libs.compiler_util. :- import_module parse_tree.prog_type. :- import_module pair. +:- import_module require. %-----------------------------------------------------------------------------% %-----------------------------------------------------------------------------% diff --git a/compiler/termination.m b/compiler/termination.m index 589e55949..df4dfe2bf 100644 --- a/compiler/termination.m +++ b/compiler/termination.m @@ -61,7 +61,6 @@ :- import_module hlds.hlds_error_util. :- import_module hlds.hlds_goal. :- import_module hlds.passes_aux. -:- import_module libs.compiler_util. :- import_module libs.file_util. :- import_module libs.globals. :- import_module libs.options. @@ -81,6 +80,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. :- import_module svmap. diff --git a/compiler/trace_gen.m b/compiler/trace_gen.m index 2555ccd2a..27328f122 100644 --- a/compiler/trace_gen.m +++ b/compiler/trace_gen.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 1997-2009 The University of Melbourne. +% Copyright (C) 1997-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -249,7 +249,6 @@ :- import_module hlds.code_model. :- import_module hlds.hlds_llds. :- import_module hlds.instmap. -:- import_module libs.compiler_util. :- import_module libs.options. :- import_module libs.trace_params. :- import_module ll_backend.code_util. @@ -262,6 +261,7 @@ :- import_module cord. :- import_module int. :- import_module list. +:- import_module require. :- import_module string. :- import_module term. :- import_module varset. diff --git a/compiler/trailing_analysis.m b/compiler/trailing_analysis.m index aed572100..bdb135003 100644 --- a/compiler/trailing_analysis.m +++ b/compiler/trailing_analysis.m @@ -89,7 +89,6 @@ :- import_module hlds.hlds_error_util. :- import_module hlds.hlds_goal. :- import_module hlds.hlds_pred. -:- import_module libs.compiler_util. :- import_module libs.file_util. :- import_module libs.globals. :- import_module libs.options. @@ -107,6 +106,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. :- import_module term. diff --git a/compiler/transform_llds.m b/compiler/transform_llds.m index 9663836e4..6bf33eb7a 100644 --- a/compiler/transform_llds.m +++ b/compiler/transform_llds.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 1998-2001,2003-2007, 2009 The University of Melbourne. +% Copyright (C) 1998-2001,2003-2007, 2009-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -38,7 +38,6 @@ :- import_module hlds.hlds_pred. :- import_module backend_libs.builtin_ops. :- import_module hlds.code_model. -:- import_module libs.compiler_util. :- import_module libs.options. :- import_module mdbcomp.prim_data. @@ -47,6 +46,7 @@ :- import_module list. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. diff --git a/compiler/try_expand.m b/compiler/try_expand.m index b8d08c5c5..20d64c370 100644 --- a/compiler/try_expand.m +++ b/compiler/try_expand.m @@ -227,8 +227,6 @@ :- import_module hlds.passes_aux. :- import_module hlds.pred_table. :- import_module hlds.quantification. -:- import_module libs. -:- import_module libs.compiler_util. :- import_module mdbcomp. :- import_module mdbcomp.prim_data. :- import_module parse_tree. @@ -241,6 +239,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. :- import_module term. diff --git a/compiler/tupling.m b/compiler/tupling.m index 45433911f..65b504b90 100644 --- a/compiler/tupling.m +++ b/compiler/tupling.m @@ -114,11 +114,11 @@ :- import_module libs.options. :- import_module ll_backend. :- import_module ll_backend.call_gen. -:- import_module ll_backend.liveness. :- import_module ll_backend.live_vars. +:- import_module ll_backend.liveness. :- import_module mdbcomp.prim_data. -:- import_module mdbcomp.trace_counts. :- import_module mdbcomp.program_representation. +:- import_module mdbcomp.trace_counts. :- import_module parse_tree.prog_data. :- import_module parse_tree.prog_mode. :- import_module parse_tree.prog_type. @@ -137,6 +137,7 @@ :- import_module maybe. :- import_module multi_map. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. :- import_module svmap. diff --git a/compiler/type_class_info.m b/compiler/type_class_info.m index ccd86e276..f8ce9c634 100644 --- a/compiler/type_class_info.m +++ b/compiler/type_class_info.m @@ -1,7 +1,7 @@ %---------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %---------------------------------------------------------------------------% -% Copyright (C) 2003-2006 The University of Melbourne. +% Copyright (C) 2003-2006, 2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %---------------------------------------------------------------------------% @@ -49,14 +49,13 @@ :- import_module hlds.hlds_data. :- import_module hlds.hlds_pred. :- import_module hlds.hlds_rtti. -:- import_module libs. -:- import_module libs.compiler_util. :- import_module mdbcomp. :- import_module mdbcomp.prim_data. :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module term. :- import_module varset. diff --git a/compiler/type_ctor_info.m b/compiler/type_ctor_info.m index 83422530a..69e7ffc13 100644 --- a/compiler/type_ctor_info.m +++ b/compiler/type_ctor_info.m @@ -1,7 +1,7 @@ %---------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %---------------------------------------------------------------------------% -% Copyright (C) 1996-2009 The University of Melbourne. +% Copyright (C) 1996-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %---------------------------------------------------------------------------% @@ -77,7 +77,6 @@ :- import_module hlds.pred_table. :- import_module hlds.special_pred. :- import_module libs. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module mdbcomp. @@ -93,6 +92,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. :- import_module svmap. diff --git a/compiler/type_util.m b/compiler/type_util.m index e624e0e35..34457b8a4 100644 --- a/compiler/type_util.m +++ b/compiler/type_util.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 1994-2009 The University of Melbourne. +% Copyright (C) 1994-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -349,7 +349,6 @@ :- import_module backend_libs. :- import_module backend_libs.foreign. :- import_module libs. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module parse_tree.builtin_lib_types. @@ -361,6 +360,7 @@ :- import_module char. :- import_module int. :- import_module map. +:- import_module require. :- import_module set. :- import_module svset. :- import_module term. diff --git a/compiler/typecheck.m b/compiler/typecheck.m index d6be27823..cf11fe83f 100644 --- a/compiler/typecheck.m +++ b/compiler/typecheck.m @@ -116,7 +116,6 @@ :- import_module hlds.pred_table. :- import_module hlds.special_pred. :- import_module libs. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module mdbcomp. @@ -136,6 +135,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module set_tree234. :- import_module std_util. diff --git a/compiler/typecheck_errors.m b/compiler/typecheck_errors.m index 8220ad3ab..ad6ae17e2 100644 --- a/compiler/typecheck_errors.m +++ b/compiler/typecheck_errors.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2005-2009 The University of Melbourne. +% Copyright (C) 2005-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -106,7 +106,6 @@ :- import_module hlds.hlds_out.hlds_out_util. :- import_module hlds.pred_table. :- import_module libs. -:- import_module libs.compiler_util. :- import_module libs.options. :- import_module parse_tree.mercury_to_mercury. :- import_module parse_tree.modules. @@ -122,6 +121,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module solutions. :- import_module string. diff --git a/compiler/typecheck_info.m b/compiler/typecheck_info.m index f4c84f3ed..b85e98f38 100644 --- a/compiler/typecheck_info.m +++ b/compiler/typecheck_info.m @@ -370,7 +370,6 @@ :- import_module check_hlds.type_util. :- import_module libs. -:- import_module libs.compiler_util. :- import_module libs.file_util. :- import_module libs.globals. :- import_module libs.options. @@ -381,6 +380,7 @@ :- import_module assoc_list. :- import_module int. :- import_module pair. +:- import_module require. :- import_module string. :- import_module set. :- import_module svmap. diff --git a/compiler/unify_gen.m b/compiler/unify_gen.m index db4016d7b..8c73566e4 100644 --- a/compiler/unify_gen.m +++ b/compiler/unify_gen.m @@ -69,7 +69,6 @@ :- import_module hlds.hlds_out.hlds_out_util. :- import_module hlds.hlds_pred. :- import_module hlds.hlds_rtti. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module ll_backend.code_util. @@ -89,6 +88,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. :- import_module svmap. diff --git a/compiler/unify_proc.m b/compiler/unify_proc.m index 7174834bb..286891bf4 100644 --- a/compiler/unify_proc.m +++ b/compiler/unify_proc.m @@ -147,7 +147,6 @@ :- import_module hlds.quantification. :- import_module hlds.special_pred. :- import_module libs. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module mdbcomp.prim_data. @@ -161,6 +160,7 @@ :- import_module int. :- import_module map. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. :- import_module svmap. diff --git a/compiler/unique_modes.m b/compiler/unique_modes.m index 7fd449250..30e72f40a 100644 --- a/compiler/unique_modes.m +++ b/compiler/unique_modes.m @@ -91,8 +91,6 @@ :- import_module check_hlds.modecheck_util. :- import_module check_hlds.modes. :- import_module hlds.instmap. -:- import_module libs. -:- import_module libs.compiler_util. :- import_module mdbcomp. :- import_module mdbcomp.prim_data. :- import_module parse_tree.prog_mode. @@ -103,6 +101,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module string. :- import_module term. diff --git a/compiler/unneeded_code.m b/compiler/unneeded_code.m index 5bc687b33..e7c54f30b 100644 --- a/compiler/unneeded_code.m +++ b/compiler/unneeded_code.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2000-2009 The University of Melbourne. +% Copyright (C) 2000-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -83,7 +83,6 @@ :- import_module hlds.instmap. :- import_module hlds.passes_aux. :- import_module hlds.quantification. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module mdbcomp.program_representation. @@ -98,6 +97,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. :- import_module svmap. diff --git a/compiler/untupling.m b/compiler/untupling.m index 1490076cf..51050acf1 100644 --- a/compiler/untupling.m +++ b/compiler/untupling.m @@ -107,7 +107,6 @@ :- import_module hlds.hlds_goal. :- import_module hlds.hlds_pred. :- import_module hlds.quantification. -:- import_module libs.compiler_util. :- import_module mdbcomp.prim_data. :- import_module parse_tree.prog_data. :- import_module parse_tree.prog_mode. @@ -121,6 +120,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module string. :- import_module svmap. :- import_module svvarset. diff --git a/compiler/unused_args.m b/compiler/unused_args.m index 33739d6f5..12a4cce36 100644 --- a/compiler/unused_args.m +++ b/compiler/unused_args.m @@ -97,7 +97,6 @@ :- import_module hlds.instmap. :- import_module hlds.pred_table. :- import_module hlds.quantification. -:- import_module libs.compiler_util. :- import_module libs.globals. :- import_module libs.options. :- import_module mdbcomp.prim_data. @@ -114,6 +113,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. :- import_module svmap. diff --git a/compiler/use_local_vars.m b/compiler/use_local_vars.m index e59da69e7..6c97b1a25 100644 --- a/compiler/use_local_vars.m +++ b/compiler/use_local_vars.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2001-2009 The University of Melbourne. +% Copyright (C) 2001-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -82,7 +82,6 @@ :- implementation. -:- import_module libs.compiler_util. :- import_module ll_backend.basic_block. :- import_module ll_backend.code_util. :- import_module ll_backend.exprn_aux. @@ -95,6 +94,7 @@ :- import_module map. :- import_module maybe. :- import_module pair. +:- import_module require. :- import_module set. :- import_module string. diff --git a/compiler/var_locn.m b/compiler/var_locn.m index 2132c644b..1c4c425dc 100644 --- a/compiler/var_locn.m +++ b/compiler/var_locn.m @@ -371,7 +371,6 @@ :- import_module backend_libs.builtin_ops. :- import_module check_hlds.type_util. -:- import_module libs.compiler_util. :- import_module libs.options. :- import_module ll_backend.code_util. :- import_module ll_backend.exprn_aux. @@ -380,6 +379,7 @@ :- import_module getopt_io. :- import_module int. :- import_module pair. +:- import_module require. :- import_module string. :- import_module svmap. :- import_module term. diff --git a/compiler/wrap_blocks.m b/compiler/wrap_blocks.m index 2757eb444..6feba1fbd 100644 --- a/compiler/wrap_blocks.m +++ b/compiler/wrap_blocks.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2001, 2003, 2005-2007 The University of Melbourne. +% Copyright (C) 2001, 2003, 2005-2007, 2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -34,12 +34,12 @@ :- implementation. -:- import_module libs.compiler_util. :- import_module ll_backend.opt_util. :- import_module bool. :- import_module int. :- import_module pair. +:- import_module require. %-----------------------------------------------------------------------------% diff --git a/compiler/write_deps_file.m b/compiler/write_deps_file.m index 4bed877ba..f1301ce91 100644 --- a/compiler/write_deps_file.m +++ b/compiler/write_deps_file.m @@ -81,7 +81,6 @@ :- implementation. -:- import_module libs.compiler_util. :- import_module libs.options. :- import_module make. % undesirable dependency :- import_module parse_tree.file_names. @@ -97,8 +96,9 @@ :- import_module dir. :- import_module library. :- import_module map. -:- import_module string. :- import_module pair. +:- import_module require. +:- import_module string. %-----------------------------------------------------------------------------% diff --git a/compiler/x86_64_out.m b/compiler/x86_64_out.m index c36d36b5f..8cff8ff99 100644 --- a/compiler/x86_64_out.m +++ b/compiler/x86_64_out.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2007 The University of Melbourne. +% Copyright (C) 2007, 2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -43,7 +43,6 @@ :- implementation. -:- import_module libs.compiler_util. :- import_module ll_backend.x86_64_regs. :- import_module bool. @@ -51,6 +50,7 @@ :- import_module int. :- import_module list. :- import_module maybe. +:- import_module require. :- import_module stream.string_writer. :- import_module string. :- import_module type_desc. diff --git a/compiler/x86_64_regs.m b/compiler/x86_64_regs.m index 3987f7d3b..e8d797fa1 100644 --- a/compiler/x86_64_regs.m +++ b/compiler/x86_64_regs.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2007 The University of Melbourne. +% Copyright (C) 2007, 2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -45,13 +45,14 @@ % is the slot in the fake reg array given by the argument. % :- type reg_locn - ---> actual(x86_64_reg) - ; virtual(int). % Index into fake reg array. + ---> actual(x86_64_reg) + ; virtual(int). % Index into fake reg array. % Create an association list of lvals and reg_lcons. This is identical to % the one defined in runtime/machdeps/x86_64_regs.h. % -:- pred default_x86_64_reg_mapping(assoc_list(llds.lval, reg_locn)::out) is det. +:- pred default_x86_64_reg_mapping(assoc_list(llds.lval, reg_locn)::out) + is det. % Create a reg_map given an association list of lvals and reg_locns. % Throws an exception if an l-value in the association list does not @@ -89,27 +90,26 @@ :- implementation. -:- import_module libs.compiler_util. - :- import_module bool. +:- import_module io. :- import_module list. :- import_module map. :- import_module pair. +:- import_module require. :- import_module string. -:- import_module io. - %----------------------------------------------------------------------------% % % LLDS -> x86_64 register mapping. % :- type reg_map - ---> reg_map( - scratch_reg_info :: list(x86_64_reg), + ---> reg_map( % A list of unused scratch registers. - map(llds.lval, reg_locn) - % Mapping lval to an actual or virtual register. + scratch_reg_info :: list(x86_64_reg), + + % Mapping lval to an actual or virtual register. + lval_reg_map :: map(llds.lval, reg_locn) ). %----------------------------------------------------------------------------% diff --git a/deep_profiler/analysis_utils.m b/deep_profiler/analysis_utils.m index 2e4631b2e..afd4726e4 100644 --- a/deep_profiler/analysis_utils.m +++ b/deep_profiler/analysis_utils.m @@ -31,22 +31,22 @@ :- import_module set. %----------------------------------------------------------------------------% - + % Instead of using the clique report above to find proc dynamics for a % clique, use this as it is much faster. % -:- pred find_clique_first_and_other_procs(deep::in, clique_ptr::in, +:- pred find_clique_first_and_other_procs(deep::in, clique_ptr::in, maybe(proc_dynamic_ptr)::out, list(proc_dynamic_ptr)::out) is det. %----------------------------------------------------------------------------% - + % Lookup a procedure representation from the deep structure. % % (Perhaps this should be a new report). % -:- pred deep_get_maybe_procrep(deep::in, proc_static_ptr::in, +:- pred deep_get_maybe_procrep(deep::in, proc_static_ptr::in, maybe_error(proc_rep)::out) is det. - + %----------------------------------------------------------------------------% :- type cost_and_callees @@ -66,7 +66,7 @@ ---> first_order_call ; higher_order_call. -:- pred build_call_site_cost_and_callee_map(deep::in, +:- pred build_call_site_cost_and_callee_map(deep::in, pair(call_site_static_ptr, call_site_array_slot)::in, map(goal_path, cost_and_callees)::in, map(goal_path, cost_and_callees)::out) is det. @@ -77,10 +77,10 @@ % current call to this procedure had a particular cost. % :- pred build_recursive_call_site_cost_map(deep, clique_ptr, - proc_dynamic_ptr, recursion_type, maybe(recursion_depth), + proc_dynamic_ptr, recursion_type, maybe(recursion_depth), maybe_error(map(goal_path, cs_cost_csq))) is det. :- mode build_recursive_call_site_cost_map(in, in, in, - in(recursion_type_known_costs), in(maybe_yes(ground)), + in(recursion_type_known_costs), in(maybe_yes(ground)), out(maybe_error_ok(ground))) is det. :- mode build_recursive_call_site_cost_map(in, in, in, in, in, out) is det. @@ -90,8 +90,8 @@ assoc_list(call_site_static_ptr, call_site_array_slot)::out) is det. %----------------------------------------------------------------------------% - -:- pred cost_and_callees_is_recursive(clique_ptr::in, cost_and_callees::in) + +:- pred cost_and_callees_is_recursive(clique_ptr::in, cost_and_callees::in) is semidet. %----------------------------------------------------------------------------% @@ -154,9 +154,9 @@ build_call_site_cost_and_callee_map(Deep, CSSPtr - Slot, !CallSitesMap) :- ( Slot = slot_normal(CSDPtr), ( valid_call_site_dynamic_ptr(Deep, CSDPtr) -> - call_site_dynamic_get_callee_and_costs(Deep, CSDPtr, Callee, + call_site_dynamic_get_callee_and_costs(Deep, CSDPtr, Callee, Own, Inherit), - CostCsq = build_cs_cost_csq(calls(Own), + CostCsq = build_cs_cost_csq(calls(Own), float(callseqs(Own) + inherit_callseqs(Inherit))), Callees = [Callee] ; @@ -166,11 +166,11 @@ build_call_site_cost_and_callee_map(Deep, CSSPtr - Slot, !CallSitesMap) :- ; Slot = slot_multi(_, CSDPtrsArray), to_list(CSDPtrsArray, CSDPtrs), - map3(call_site_dynamic_get_callee_and_costs(Deep), CSDPtrs, + map3(call_site_dynamic_get_callee_and_costs(Deep), CSDPtrs, Callees, Owns, Inherits), Own = sum_own_infos(Owns), Inherit = sum_inherit_infos(Inherits), - CostCsq = build_cs_cost_csq(calls(Own), + CostCsq = build_cs_cost_csq(calls(Own), float(callseqs(Own) + inherit_callseqs(Inherit))) ), CostAndCallees = cost_and_callees(CostCsq, set(Callees), HigherOrder), @@ -179,16 +179,16 @@ build_call_site_cost_and_callee_map(Deep, CSSPtr - Slot, !CallSitesMap) :- goal_path_from_string_det(CSS ^ css_goal_path, GoalPath), svmap.det_insert(GoalPath, CostAndCallees, !CallSitesMap). -:- pred call_site_dynamic_get_callee_and_costs(deep::in, - call_site_dynamic_ptr::in, callee::out, own_prof_info::out, +:- pred call_site_dynamic_get_callee_and_costs(deep::in, + call_site_dynamic_ptr::in, callee::out, own_prof_info::out, inherit_prof_info::out) is det. -call_site_dynamic_get_callee_and_costs(Deep, CSDPtr, +call_site_dynamic_get_callee_and_costs(Deep, CSDPtr, callee(CalleeCliquePtr, CSDPtr), Own, Inherit) :- lookup_call_site_dynamics(Deep ^ call_site_dynamics, CSDPtr, CSD), lookup_csd_desc(Deep ^ csd_desc, CSDPtr, Inherit), PDPtr = CSD ^ csd_callee, - lookup_clique_index(Deep ^ clique_index, PDPtr, CalleeCliquePtr), + lookup_clique_index(Deep ^ clique_index, PDPtr, CalleeCliquePtr), Own = CSD ^ csd_own_prof. :- pred call_site_kind_to_higher_order(call_site_kind_and_callee::in, @@ -222,25 +222,25 @@ build_recursive_call_site_cost_map(Deep, CliquePtr, PDPtr, RecursionType, DepthI = recursion_depth_to_int(Depth) ; MaybeDepth = no, - error(this_file ++ "Expected valid depth for known recursion type") + unexpected($module, + "Expected valid depth for known recursion type") ), - + get_recursive_calls_and_counts(Deep, CliquePtr, PDPtr, CallCountsMap), RecursiveCallSiteCostMap = map_values_only( - (func(Count) = + (func(Count) = build_cs_cost_csq_percall(float(Count), CostFn(DepthI))), CallCountsMap), MaybeRecursiveCallSiteCostMap = ok(RecursiveCallSiteCostMap), - + trace [compile_time(flag("debug_recursive_call_costs")), io(!IO)] ( format_recursive_call_site_cost_map( RecursiveCallSiteCostMap, PrettyCostMapCord), PrettyCostMap = append_list(cord.list(PrettyCostMapCord)), - io.format("D: In clique %s recursive call site cost map" - ++ " is:\n%s\n", - [s(string(CliquePtr)), s(PrettyCostMap)], - !IO), + io.format( + "D: In clique %s recursive call site cost map is:\n%s\n", + [s(string(CliquePtr)), s(PrettyCostMap)], !IO), io.flush_output(!IO) ) ; @@ -264,19 +264,20 @@ build_recursive_call_site_cost_map(Deep, CliquePtr, PDPtr, RecursionType, MaybeRecursiveCallSiteCostMap = error(Error) ). -:- pred get_recursive_calls_and_counts(deep::in, clique_ptr::in, +:- pred get_recursive_calls_and_counts(deep::in, clique_ptr::in, proc_dynamic_ptr::in, map(goal_path, int)::out) is det. get_recursive_calls_and_counts(Deep, CliquePtr, PDPtr, CallCountsMap) :- proc_dynamic_paired_call_site_slots(Deep, PDPtr, SiteSlots), - foldl(build_recursive_call_site_counts_map(Deep, CliquePtr), SiteSlots, + foldl(build_recursive_call_site_counts_map(Deep, CliquePtr), SiteSlots, map.init, CallCountsMap). -:- pred build_recursive_call_site_counts_map(deep::in, clique_ptr::in, +:- pred build_recursive_call_site_counts_map(deep::in, clique_ptr::in, pair(call_site_static_ptr, call_site_array_slot)::in, map(goal_path, int)::in, map(goal_path, int)::out) is det. -build_recursive_call_site_counts_map(Deep, CliquePtr, CSSPtr - CSDSlot, !Map) :- +build_recursive_call_site_counts_map(Deep, CliquePtr, CSSPtr - CSDSlot, + !Map) :- ( CSDSlot = slot_normal(CSDPtr), ( valid_call_site_dynamic_ptr(Deep, CSDPtr) -> @@ -289,7 +290,7 @@ build_recursive_call_site_counts_map(Deep, CliquePtr, CSSPtr - CSDSlot, !Map) :- ) ; Recursive = no, - Count = 0 + Count = 0 ) ; CSDSlot = slot_multi(_, CSDPtrs), @@ -319,7 +320,7 @@ build_recursive_call_site_counts_map(Deep, CliquePtr, CSSPtr - CSDSlot, !Map) :- maybe_equals_or_is_no(_, no). maybe_equals_or_is_no(X, yes(X)). -:- pred call_site_dynamic_get_count_and_callee(deep::in, +:- pred call_site_dynamic_get_count_and_callee(deep::in, call_site_dynamic_ptr::in, int::out, maybe(clique_ptr)::out) is det. call_site_dynamic_get_count_and_callee(Deep, CSDPtr, Count, MaybeCallee) :- @@ -332,13 +333,13 @@ call_site_dynamic_get_count_and_callee(Deep, CSDPtr, Count, MaybeCallee) :- MaybeCallee = no ). -:- pred format_recursive_call_site_cost_map(map(goal_path, cs_cost_csq)::in, +:- pred format_recursive_call_site_cost_map(map(goal_path, cs_cost_csq)::in, cord(string)::out) is det. format_recursive_call_site_cost_map(Map, Result) :- map.foldl(format_recursive_call_site_cost, Map, cord.empty, Result). -:- pred format_recursive_call_site_cost(goal_path::in, cs_cost_csq::in, +:- pred format_recursive_call_site_cost(goal_path::in, cs_cost_csq::in, cord(string)::in, cord(string)::out) is det. format_recursive_call_site_cost(GoalPath, Cost, !Result) :- @@ -372,6 +373,6 @@ cost_and_callees_is_recursive(ParentCliquePtr, CostAndCallees) :- :- func this_file = string. -this_file = "analysis_utils.m: ". +this_file = "analysis_utils.m". %----------------------------------------------------------------------------% diff --git a/deep_profiler/array_util.m b/deep_profiler/array_util.m index 7a7b7557d..704fea592 100644 --- a/deep_profiler/array_util.m +++ b/deep_profiler/array_util.m @@ -90,7 +90,7 @@ % Performs a foldl3 on all the elements of the given array, starting at % index 1. % -:- pred array_foldl3_from_1(pred(int, T, U, U, V, V, W, W), array(T), U, U, +:- pred array_foldl3_from_1(pred(int, T, U, U, V, V, W, W), array(T), U, U, V, V, W, W). :- mode array_foldl3_from_1(pred(in, in, array_di, array_uo, array_di, array_uo, array_di, array_uo) is det, @@ -214,7 +214,7 @@ array_foldl3_from_1(P, Array, !A, !B, !C) :- :- pred do_array_foldl3(int, int, pred(int, T, U, U, V, V, W, W), array(T), U, U, V, V, W, W). -:- mode do_array_foldl3(in, in, pred(in, in, array_di, array_uo, +:- mode do_array_foldl3(in, in, pred(in, in, array_di, array_uo, array_di, array_uo, array_di, array_uo) is det, in, array_di, array_uo, array_di, array_uo, array_di, array_uo) is det. diff --git a/deep_profiler/branch_and_bound.m b/deep_profiler/branch_and_bound.m index b99d5b711..8bb5fa403 100644 --- a/deep_profiler/branch_and_bound.m +++ b/deep_profiler/branch_and_bound.m @@ -12,7 +12,7 @@ % This module contains a generic branch and bound solver. It is designed to be % generic and easy to use. To use it write non-deterministic search code that % uses test_incomplete_solution after every choice point. Call this code using -% branch_and_bound. +% branch_and_bound. % % This module may be compiled with the debug_branch_and_bound trace flag to % enable the debugging trace goals. @@ -62,7 +62,7 @@ % :- pred branch_and_bound(impure pred(bnb_state(T), T), func(T) = float, set(T), bnb_profile). -:- mode branch_and_bound(pred(in, out) is nondet, +:- mode branch_and_bound(pred(in, out) is nondet, func(in) = out is det, out, out) is det. % test_incomplete_solution(State, PartialSolution). @@ -114,7 +114,7 @@ :- import_module unit. %-----------------------------------------------------------------------------% - + % The best solutions found so far and the value of the objective % function for these solutions. % @@ -148,13 +148,14 @@ branch_and_bound(Generator, ObjectiveFn, BestSolutions, Profile) :- ), Profile = Profile0 ^ bnbp_time_msecs := Time. -:- pred branch_and_bound_2(impure pred(bnb_state(T), T), - func(T) = float, unit, +:- pred branch_and_bound_2(impure pred(bnb_state(T), T), + func(T) = float, unit, pair(set(T), bnb_profile)). -:- mode branch_and_bound_2(pred(in, out) is nondet, +:- mode branch_and_bound_2(pred(in, out) is nondet, func(in) = out is det, in, out) is det. -branch_and_bound_2(Generator, ObjectiveFn, unit, FinalBestSolutions - FinalProfile) :- +branch_and_bound_2(Generator, ObjectiveFn, unit, + FinalBestSolutions - FinalProfile) :- % Use a failure driven loop to implement a branch and bound solver. promise_pure ( trace [compile_time(flag("debug_branch_and_bound")), io(!IO)] ( @@ -167,7 +168,7 @@ branch_and_bound_2(Generator, ObjectiveFn, unit, FinalBestSolutions - FinalProfi ( impure Generator(State, CurrentSolution), - impure test_complete_solution(State, CurrentSolution), + impure test_complete_solution(State, CurrentSolution), trace [compile_time(flag("debug_branch_and_bound")), io(!IO)] ( CurrentObjective = ObjectiveFn(CurrentSolution), io.format( @@ -178,13 +179,13 @@ branch_and_bound_2(Generator, ObjectiveFn, unit, FinalBestSolutions - FinalProfi semidet_fail -> - error(this_file ++ "Failure driven loop must fail") + unexpected($module, "Failure driven loop must fail") ; true ), % Return results. - impure get_mutvar(BestSolutionsMutvar, FinalBestSolutions0), + impure get_mutvar(BestSolutionsMutvar, FinalBestSolutions0), impure get_mutvar(ProfileMutvar, FinalProfile), trace [compile_time(flag("debug_branch_and_bound")), io(!IO)] ( io.write_string("D: Branch and bound loop finished\n", !IO), @@ -206,13 +207,13 @@ branch_and_bound_2(Generator, ObjectiveFn, unit, FinalBestSolutions - FinalProfi % True of Solution is the best or equal best solution so far. % % The current best solutions are updated. - % + % :- impure pred test_complete_solution(bnb_state(T)::in, T::in) is semidet. -test_complete_solution(State, CurrentSolution) :- +test_complete_solution(State, CurrentSolution) :- State = bnb_state(BestSolutionsMutvar, ObjectiveFn, ProfileMutvar), CurrentObjective = ObjectiveFn(CurrentSolution), - + impure get_mutvar(BestSolutionsMutvar, BestSolutions0), impure get_mutvar(ProfileMutvar, Profile0), ( @@ -356,7 +357,7 @@ profile_num_alternatives(Profile, Open, Closed) :- :- func this_file = string. -this_file = "branch_and_bound.m: ". +this_file = "branch_and_bound.m". %-----------------------------------------------------------------------------% :- end_module branch_and_bound. diff --git a/deep_profiler/callgraph.m b/deep_profiler/callgraph.m index c761fd71f..7461cc88a 100644 --- a/deep_profiler/callgraph.m +++ b/deep_profiler/callgraph.m @@ -57,11 +57,11 @@ find_cliques(InitDeep, BottomUpPDPtrCliqueList) :- % algorithm works bottom up. callgraph.foldl(accumulate_pdptr_lists, TopDownPDICliqueList, [], BottomUpPDPtrCliqueList). - + % This version of foldl is safer when tail recursion isn't available. % -:- pred foldl(pred(X, A, A), list(X), A, A). -:- mode foldl(pred(in, in, out) is det, in, in, out) is det. +:- pred foldl(pred(X, A, A)::in(pred(in, in, out) is det), list(X)::in, + A::in, A::out) is det. foldl(P, !.L, !A) :- foldl_2(100000, P, !L, !A), @@ -72,8 +72,8 @@ foldl(P, !.L, !A) :- callgraph.foldl(P, !.L, !A) ). -:- pred foldl_2(int, pred(X, A, A), list(X), list(X), A, A). -:- mode foldl_2(in, pred(in, in, out) is det, in, out, in, out) is det. +:- pred foldl_2(int::in, pred(X, A, A)::in(pred(in, in, out) is det), + list(X)::in, list(X)::out, A::in, A::out) is det. foldl_2(Depth, P, !Xs, !A) :- ( Depth > 0 -> diff --git a/deep_profiler/canonical.m b/deep_profiler/canonical.m index be5def3a4..d343c0317 100644 --- a/deep_profiler/canonical.m +++ b/deep_profiler/canonical.m @@ -54,10 +54,10 @@ :- type redirect ---> redirect( - csd_redirect :: array(call_site_dynamic_ptr), - % index: call_site_dynamic_ptr - pd_redirect :: array(proc_dynamic_ptr) - % index: proc_dynamic_ptr + csd_redirect :: array(call_site_dynamic_ptr), + % index: call_site_dynamic_ptr + pd_redirect :: array(proc_dynamic_ptr) + % index: proc_dynamic_ptr ). canonicalize_cliques(!InitDeep) :- @@ -262,7 +262,7 @@ merge_proc_dynamics(MergeInfo, Clique, CandidatePDPtrs, ChosenPDPtr, % special calls, but only before we added callcode to the % unify/compare routines of builtin types. % ChosenPDPtr = proc_dynamic_ptr(0), - error("merge_proc_dynamics: no valid pdptrs") + unexpected($module, $pred, "no valid pdptrs") ). :- pred merge_proc_dynamic_slots(merge_info::in, int::in, @@ -496,7 +496,7 @@ lookup_normal_sites([RestArray | RestArrays], SlotNum, [CSDPtr | CSDPtrs]) :- Slot = slot_normal(CSDPtr) ; Slot = slot_multi(_, _), - error("lookup_normal_sites: found slot_multi") + unexpected($module, $pred, "found slot_multi") ), lookup_normal_sites(RestArrays, SlotNum, CSDPtrs). @@ -508,7 +508,7 @@ lookup_multi_sites([RestArray | RestArrays], SlotNum, [CSDList | CSDLists]) :- array.lookup(RestArray, SlotNum, Slot), ( Slot = slot_normal(_), - error("lookup_multi_sites: found normal") + unexpected($module, $pred, "found normal") ; Slot = slot_multi(_, CSDArray), array.to_list(CSDArray, CSDList) @@ -531,7 +531,7 @@ record_pd_redirect(RestPDPtrs, PrimePDPtr, !Redirect) :- ( OldRedirect = proc_dynamic_ptr(0) -> record_pd_redirect_2(RestPDPtrs, PrimePDPtr, !Redirect) ; - error("record_pd_redirect: prime is redirected") + unexpected($module, $pred, "prime is redirected") ). :- pred record_pd_redirect_2(list(proc_dynamic_ptr)::in, proc_dynamic_ptr::in, @@ -545,7 +545,7 @@ record_pd_redirect_2([RestPDPtr | RestPDPtrs], PrimePDPtr, !Redirect) :- set_pd_redirect(u(ProcRedirect0), RestPDPtr, PrimePDPtr, ProcRedirect) ; - error("record_pd_redirect_2: already redirected") + unexpected($module, $pred, "already redirected") ), !:Redirect = !.Redirect ^ pd_redirect := ProcRedirect, record_pd_redirect_2(RestPDPtrs, PrimePDPtr, !Redirect). @@ -566,7 +566,7 @@ record_csd_redirect(RestCSDPtrs, PrimeCSDPtr, !Redirect) :- ( OldRedirect = call_site_dynamic_ptr(0) -> record_csd_redirect_2(RestCSDPtrs, PrimeCSDPtr, !Redirect) ; - error("record_pd_redirect: prime is redirected") + unexpected($module, $pred, "prime is redirected") ). :- pred record_csd_redirect_2(list(call_site_dynamic_ptr)::in, @@ -580,7 +580,7 @@ record_csd_redirect_2([RestCSDPtr | RestCSDPtrs], PrimeCSDPtr, !Redirect) :- set_csd_redirect(u(CallSiteRedirect0), RestCSDPtr, PrimeCSDPtr, CallSiteRedirect) ; - error("record_csd_redirect_2: already redirected") + unexpected($module, $pred, "already redirected") ), !:Redirect = !.Redirect ^ csd_redirect := CallSiteRedirect, record_csd_redirect_2(RestCSDPtrs, PrimeCSDPtr, !Redirect). @@ -851,7 +851,7 @@ do_merge_profiles(BaseInitDeep, OtherInitDeeps, MergedInitDeep) :- extract_num_callseqs(BaseInitDeep, BaseNumCallSeqs), list.map(extract_num_callseqs, OtherInitDeeps, OtherNumCallSeqs), list.foldl(int_add, OtherNumCallSeqs, BaseNumCallSeqs, ConcatNumCallSeqs), - + % The program names are not checked. The new profile is named after the % base profile. BaseProgramName = BaseInitDeep ^ init_profile_stats ^ prs_program_name, @@ -862,7 +862,7 @@ do_merge_profiles(BaseInitDeep, OtherInitDeeps, MergedInitDeep) :- ConcatFlags = BaseFlags ^ df_canonical_flag := is_canonical, ConcatProfileStats = profile_stats(BaseProgramName, ConcatMaxCSD, BaseMaxCSS, ConcatMaxPD, BaseMaxPS, ConcatNumCallSeqs, - BaseTicksPerSec, InstrumentQuanta, UserQuanta, ConcatFlags), + BaseTicksPerSec, InstrumentQuanta, UserQuanta, ConcatFlags), % The root part is a temporary lie. MergedInitDeep = initial_deep(ConcatProfileStats, BaseInitDeep ^ init_root, diff --git a/deep_profiler/conf.m b/deep_profiler/conf.m index b117d9c44..93aea3e97 100644 --- a/deep_profiler/conf.m +++ b/deep_profiler/conf.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2001-2002, 2004-2008 The University of Melbourne. +% Copyright (C) 2001-2002, 2004-2008, 2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -52,7 +52,7 @@ make_pipe_cmd(PipeName) = Cmd :- mkfifo_cmd(CmdName), ( CmdName = "" -> - error("make_pipe_cmd: do not know what command to use") + unexpected($module, $pred, "do not know what command to use") ; string.format("%s %s", [s(CmdName), s(PipeName)], Cmd) ). @@ -102,24 +102,27 @@ server_name_2(ServerName, !IO) :- -> ServerName = ServerNamePrime ; - error("malformed server name") + unexpected($module, $pred, "malformed server name") ) ; TmpReadRes = error(_, _), - error("cannot read server's name") + unexpected($module, $pred, "cannot read server's name") ), io.close_input(TmpStream, !IO) ; TmpRes = error(_), - error("cannot open file to find the server's name") + unexpected($module, $pred, + "cannot open file to find the server's name") ), io.remove_file(TmpFile, _, !IO) ; - error("cannot execute cmd to find the server's name") + unexpected($module, $pred, + "cannot execute cmd to find the server's name") ) ; Res1 = error(_), - error("cannot execute cmd to find the server's name") + unexpected($module, $pred, + "cannot execute cmd to find the server's name") ). :- pred maybe_server_port(maybe(string)::out, io::di, io::uo) is det. diff --git a/deep_profiler/coverage.m b/deep_profiler/coverage.m index 908f2551e..31ad02ba2 100644 --- a/deep_profiler/coverage.m +++ b/deep_profiler/coverage.m @@ -147,7 +147,7 @@ get_coverage_after_det(Coverage, After) :- :- pred complete_coverage_error is erroneous. complete_coverage_error :- - error(this_file ++ "Expected complete coverage information"). + unexpected($module, $pred, "Expected complete coverage information"). %-----------------------------------------------------------------------------% @@ -156,7 +156,7 @@ coverage_point_arrays_to_list(StaticArray, DynamicArray, CoveragePoints) :- ( array.bounds(DynamicArray, Min, Max) -> true ; - error("coverage_point_arrays_to_list: Bounds do not match") + unexpected($module, $pred, "bounds do not match") ), coverage_point_arrays_to_list_2(Min, Max, StaticArray, DynamicArray, [], CoveragePoints). @@ -307,7 +307,8 @@ goal_annotate_coverage(Info, GoalPath, Before, After, Goal0, Goal) :- "Coverage before call doesn't match calls port on call site"), After0 = after_coverage(Exits) ; - error("Couldn't look up call site for port counts GP: " ++ + unexpected($module, $pred, + "Couldn't look up call site for port counts GP: " ++ goal_path_to_string(GoalPath)) ) ; @@ -351,16 +352,18 @@ goal_annotate_coverage(Info, GoalPath, Before, After, Goal0, Goal) :- ( check_coverage_complete(GoalCoverage, GoalExpr) -> true ; - error(string.format("check_coverage_complete failed\n" ++ - "\tCoverage: %s\n\tGoalPath: %s\n\tProc: %s\n", - [s(string(GoalCoverage)), - s(goal_path_to_string(GoalPath)), - s(string(Info ^ cri_proc))])) + error( + string.format("check_coverage_complete failed\n" ++ + "\tCoverage: %s\n\tGoalPath: %s\n\tProc: %s\n", + [s(string(GoalCoverage)), + s(goal_path_to_string(GoalPath)), + s(string(Info ^ cri_proc))])) ), ( check_coverage_regarding_detism(GoalCoverage, Detism) -> true ; - error(string.format("check_coverage_regarding_detism failed: %s %s", + error( + string.format("check_coverage_regarding_detism failed: %s %s", [s(string(GoalCoverage)), s(string(Detism))])) ) ). diff --git a/deep_profiler/create_report.m b/deep_profiler/create_report.m index da2352561..c7ab7f4f8 100644 --- a/deep_profiler/create_report.m +++ b/deep_profiler/create_report.m @@ -52,14 +52,14 @@ % :- pred create_dynamic_procrep_coverage_report(deep::in, proc_dynamic_ptr::in, maybe_error(procrep_coverage_info)::out) is det. - + % Create a top procs report, from the given data with the specified % parameters. % :- pred create_top_procs_report(deep::in, display_limit::in, cost_kind::in, include_descendants::in, measurement_scope::in, maybe_error(top_procs_report)::out) is det. - + % Create a clique report, from the given data with the specified % parameters. % @@ -214,7 +214,7 @@ create_report(Cmd, Deep, Report) :- Report = report_call_site_dynamic_var_use(MaybeVarUse) ; Cmd = deep_cmd_restart, - error("create_report/3", "unexpected restart command") + unexpected($module, $pred, "restart command") ). %-----------------------------------------------------------------------------% @@ -297,7 +297,7 @@ find_start_of_action_callee(Percent, RowData, !ActionCliquePtrs) :- MaybeTotalPerf = RowData ^ perf_row_maybe_total, ( MaybeTotalPerf = no, - error("find_start_of_action_callee: no total perf") + unexpected($module, $pred, "no total perf") ; MaybeTotalPerf = yes(TotalPerf), CallSeqsPercent = TotalPerf ^ perf_row_callseqs_percent, @@ -400,7 +400,7 @@ proc_group_contains(EntryPDPtr, _ - PDPtrs) :- create_clique_proc_report(Deep, CliquePtr, PSPtr - PDPtrs, CliqueProcReport) :- ( PDPtrs = [], - error("create_clique_proc_report", "PDPtrs = []") + unexpected($module, $pred, "PDPtrs = []") ; PDPtrs = [FirstPDPtr | LaterPDPtrs], ProcDesc = describe_proc(Deep, PSPtr), @@ -436,7 +436,7 @@ create_clique_proc_dynamic_report(Deep, _CliquePtr, ProcDesc, PDPtr, CliquePDReport = clique_proc_dynamic_report(PDRowData, CliqueCallSiteReports) ; - error("invalid proc_dynamic index") + unexpected($module, $pred, "invalid proc_dynamic index") ). :- pred create_child_call_site_reports(deep::in, proc_dynamic_ptr::in, @@ -464,7 +464,7 @@ create_child_call_site_report(Deep, Pair, CliqueCallSiteReport) :- CallSiteArraySlot = slot_normal(CSDPtr) ; CallSiteArraySlot = slot_multi(_, _), - error("create_child_call_site_report: normal_call error") + unexpected($module, $pred, "normal_call is multi") ), ( valid_call_site_dynamic_ptr(Deep, CSDPtr) -> create_callee_clique_perf_row_data(Deep, CSDPtr, Own, Desc, @@ -491,7 +491,7 @@ create_child_call_site_report(Deep, Pair, CliqueCallSiteReport) :- ), ( CallSiteArraySlot = slot_normal(_), - error("create_child_call_site_report: non-normal_call error") + unexpected($module, $pred, "non-normal_call is normal") ; CallSiteArraySlot = slot_multi(_IsZeroed, CSDPtrsArray), array.to_list(CSDPtrsArray, CSDPtrs) @@ -704,7 +704,7 @@ gather_getters_setters(Deep, PSPtr, !GSDSRawMap) :- ( FieldData0 = gs_field_both(_, _, _) ; FieldData0 = gs_field_getter(_) ), - error("gather_getters_setters: redundant getter") + unexpected($module, $pred, "redundant getter") ; FieldData0 = gs_field_setter(SetterRawData), FieldData = gs_field_both(RawData, SetterRawData, unit) @@ -715,7 +715,7 @@ gather_getters_setters(Deep, PSPtr, !GSDSRawMap) :- ( FieldData0 = gs_field_both(_, _, _) ; FieldData0 = gs_field_setter(_) ), - error("gather_getters_setters: redundant setter") + unexpected($module, $pred, "redundant setter") ; FieldData0 = gs_field_getter(GetterRawData), FieldData = gs_field_both(GetterRawData, RawData, unit) @@ -743,7 +743,8 @@ gather_getters_setters(Deep, PSPtr, !GSDSRawMap) :- :- pred is_getter_or_setter(string_proc_label::in, getter_or_setter::out, data_struct_name::out, field_name::out) is semidet. -is_getter_or_setter(StringProcLabel, GetterSetter, DataStructName, FieldName) :- +is_getter_or_setter(StringProcLabel, GetterSetter, DataStructName, + FieldName) :- StringProcLabel = str_ordinary_proc_label(_PorF, DeclModule, DefModule, Name, Arity, _Mode), DeclModule = DefModule, @@ -874,7 +875,7 @@ create_call_site_summary(Deep, CSSPtr) = CallSitePerf :- CallSiteCalleePerf = call_site_callee_perf(_, Own, Desc) ; CallSiteCalls = [_, _ | _], - error("create_call_site_summary: >1 proc called at site") + unexpected($module, $pred, ">1 proc called at normal site") ), own_and_inherit_to_perf_row_data(Deep, CallSiteDesc, Own, Desc, SummaryRowData), @@ -1105,13 +1106,13 @@ create_static_procrep_coverage_report(Deep, PSPtr, MaybeReport) :- deep_lookup_ps_coverage(Deep, PSPtr, StaticCoverage), MaybeCoveragePoints = static_coverage_maybe_get_coverage_points(StaticCoverage), - + % Gather call site information. deep_lookup_proc_statics(Deep, PSPtr, PS), CallSitesArray = PS ^ ps_sites, CallSitesMap = array.foldl(add_ps_calls_and_exits_to_map(Deep), CallSitesArray, map.init), - + % Gather information about the procedure. deep_lookup_ps_own(Deep, PSPtr, Own), @@ -1120,7 +1121,7 @@ create_static_procrep_coverage_report(Deep, PSPtr, MaybeReport) :- ; PSPtr = proc_static_ptr(PSId), MaybeReport = error( - format("Proc static pointer is invalid %d", [i(PSId)])) + string.format("Proc static pointer is invalid %d", [i(PSId)])) ). create_dynamic_procrep_coverage_report(Deep, PDPtr, MaybeReport) :- @@ -1128,16 +1129,16 @@ create_dynamic_procrep_coverage_report(Deep, PDPtr, MaybeReport) :- deep_lookup_proc_dynamics(Deep, PDPtr, PD), PSPtr = PD ^ pd_proc_static, MaybeCoveragePoints = PD ^ pd_maybe_coverage_points, - + % Gather call site information. deep_lookup_proc_statics(Deep, PSPtr, PS), StaticCallSitesArray = PS ^ ps_sites, DynamicCallSitesArray = PD ^ pd_sites, foldl_corresponding( add_pd_calls_and_exits_to_map(Deep), - to_list(StaticCallSitesArray), to_list(DynamicCallSitesArray), + to_list(StaticCallSitesArray), to_list(DynamicCallSitesArray), map.init, CallSitesMap), - + % Gather information about the procedure. deep_lookup_pd_own(Deep, PDPtr, Own), @@ -1146,18 +1147,18 @@ create_dynamic_procrep_coverage_report(Deep, PDPtr, MaybeReport) :- ; PDPtr = proc_dynamic_ptr(PDId), MaybeReport = error( - format("Proc dynamic pointer is invalid %d", [i(PDId)])) + string.format("Proc dynamic pointer is invalid %d", [i(PDId)])) ). :- pred maybe_create_procrep_coverage_report(deep::in, proc_static_ptr::in, - own_prof_info::in, maybe(array(int))::in, + own_prof_info::in, maybe(array(int))::in, map(goal_path, calls_and_exits)::in, maybe_error(procrep_coverage_info)::out) is det. maybe_create_procrep_coverage_report(_, _, _, no, _, error(Error)) :- Error = "No coverage information available". -maybe_create_procrep_coverage_report(Deep, PSPtr, Own, yes(CoveragePointsArray), - CallSitesMap, MaybeReport) :- +maybe_create_procrep_coverage_report(Deep, PSPtr, Own, + yes(CoveragePointsArray), CallSitesMap, MaybeReport) :- deep_lookup_proc_statics(Deep, PSPtr, PS), coverage_point_arrays_to_list(PS ^ ps_coverage_point_infos, CoveragePointsArray, CoveragePoints), @@ -1168,7 +1169,7 @@ maybe_create_procrep_coverage_report(Deep, PSPtr, Own, yes(CoveragePointsArray), ; MaybeProcRep0 = ok(ProcRep0), - foldl2(add_coverage_point_to_map, + foldl2(add_coverage_point_to_map, CoveragePoints, map.init, SolnsCoveragePointMap, map.init, BranchCoveragePointMap), @@ -1194,7 +1195,7 @@ add_ps_calls_and_exits_to_map(Deep, CSSPtr, !.Map) = !:Map :- svmap.det_insert(GoalPath, calls_and_exits(calls(Own), exits(Own)), !Map). :- pred add_pd_calls_and_exits_to_map(deep::in, call_site_static_ptr::in, - call_site_array_slot::in, + call_site_array_slot::in, map(goal_path, calls_and_exits)::in, map(goal_path, calls_and_exits)::out) is det. @@ -1204,14 +1205,14 @@ add_pd_calls_and_exits_to_map(Deep, CSSPtr, Slot, !Map) :- csd_get_calls_and_exits(Deep, CSDPtr, Calls, Exits) ; Slot = slot_multi(_, CSDs), - foldl2(csd_get_calls_and_exits_accum(Deep), CSDs, + foldl2(csd_get_calls_and_exits_accum(Deep), CSDs, 0, Calls, 0, Exits) ), deep_lookup_call_site_statics(Deep, CSSPtr, CSS), goal_path_from_string_det(CSS ^ css_goal_path, GoalPath), svmap.det_insert(GoalPath, calls_and_exits(Calls, Exits), !Map). -:- pred csd_get_calls_and_exits(deep::in, call_site_dynamic_ptr::in, +:- pred csd_get_calls_and_exits(deep::in, call_site_dynamic_ptr::in, int::out, int::out) is det. csd_get_calls_and_exits(Deep, CSDPtr, Calls, Exits) :- @@ -1229,7 +1230,7 @@ csd_get_calls_and_exits(Deep, CSDPtr, Calls, Exits) :- :- pred csd_get_calls_and_exits_accum(deep::in, call_site_dynamic_ptr::in, int::in, int::out, int::in, int::out) is det. -csd_get_calls_and_exits_accum(Deep, CSDPtr, Calls0, Calls0 + NewCalls, +csd_get_calls_and_exits_accum(Deep, CSDPtr, Calls0, Calls0 + NewCalls, Exits0, Exits0 + NewExits) :- csd_get_calls_and_exits(Deep, CSDPtr, NewCalls, NewExits). @@ -1262,7 +1263,7 @@ create_proc_static_dump_report(Deep, PSPtr, MaybeProcStaticDumpInfo) :- % Should we dump some other fields? PS = proc_static(_ProcId, _DeclModule, UnQualRefinedName, QualRefinedName, RawName, FileName, LineNumber, - _InInterface, CallSites, CoveragePointInfos, _MaybeCoveragePoints, + _InInterface, CallSites, CoveragePointInfos, _MaybeCoveragePoints, _IsZeroed), array.max(CallSites, MaxCallSiteIdx), NumCallSites = MaxCallSiteIdx + 1, @@ -1389,12 +1390,13 @@ create_call_site_dynamic_var_use_report(Deep, CSDPtr, MaybeVarUseInfo) :- ( MaybeCost = ok(Cost), map_foldl(call_site_dynamic_var_use_arg(Deep, CSDPtr, - RecursionType, Cost, VarTable), + RecursionType, Cost, VarTable), HeadVars, Uses0, 0, _), list_maybe_error_to_maybe_error_list(Uses0, MaybeUses), ( MaybeUses = ok(Uses), - VarUseInfo = call_site_dynamic_var_use_info(Cost, Uses), + VarUseInfo = + call_site_dynamic_var_use_info(Cost, Uses), MaybeVarUseInfo = ok(VarUseInfo) ; MaybeUses = error(Error), @@ -1414,8 +1416,8 @@ create_call_site_dynamic_var_use_report(Deep, CSDPtr, MaybeVarUseInfo) :- ) ; CSDPtr = call_site_dynamic_ptr(CSDNum), - MaybeVarUseInfo = error(format( - "Invalid call site dynamic %d", [i(CSDNum)])) + MaybeVarUseInfo = error( + string.format("Invalid call site dynamic %d", [i(CSDNum)])) ). :- pred call_site_dynamic_var_use_arg(deep::in, call_site_dynamic_ptr::in, @@ -1428,7 +1430,7 @@ call_site_dynamic_var_use_arg(Deep, CSDPtr, RecursionType, Cost, VarTable, var_mode_to_var_use_type(Mode, UseType), % XXX: Allow user to configure var use options. UseOptions = var_use_options(Deep, follow_any_call, UseType), - call_site_dynamic_var_use_info(CSDPtr, !.ArgNum, RecursionType, + call_site_dynamic_var_use_info(CSDPtr, !.ArgNum, RecursionType, Cost, UseOptions, MaybeUse), ( MaybeUse = ok(Use), @@ -1461,8 +1463,8 @@ list_maybe_error_to_maybe_error_list([ok(X) | MaybeXs0], MaybeXs) :- get_recursive_csd_cost(Deep, CSDPtr, RecursionType, MaybeCost) :- ( RecursionType = rt_not_recursive, - MaybeCost = error( - "get_recursive_csd_cost called for non-recursive clique") + MaybeCost = + error("get_recursive_csd_cost called for non-recursive clique") ; RecursionType = rt_single(_, _, AvgMaxDepth, _, CostFn), deep_lookup_csd_own(Deep, CSDPtr, Own), @@ -1473,8 +1475,7 @@ get_recursive_csd_cost(Deep, CSDPtr, RecursionType, MaybeCost) :- ; RecursionType = rt_mutual_recursion(_) ; RecursionType = rt_other(_) ), - MaybeCost = error( - "get_recursive_csd_cost: Unhandled recursion type") + MaybeCost = error("get_recursive_csd_cost: unhandled recursion type") ; RecursionType = rt_errors(Errors), MaybeCost = error(join_list("\n", Errors)) @@ -1704,10 +1705,10 @@ describe_clique(Deep, CliquePtr, MaybeEntryPDPtr) = CliqueDesc :- list.map(describe_clique_member(Deep), OtherPDPtrs), CliqueDesc = clique_desc(CliquePtr, EntryProcDesc, OtherProcDescs) ; - error("describe_clique", "entry pdptr not a member") + unexpected($module, $pred, "entry pdptr not a member") ) ; - error("describe_clique", "invalid clique_ptr") + unexpected($module, $pred, "invalid clique_ptr") ). :- func describe_clique_member(deep, proc_dynamic_ptr) = proc_desc. @@ -1716,29 +1717,6 @@ describe_clique_member(Deep, PDPtr) = ProcDesc :- deep_lookup_proc_dynamics(Deep, PDPtr, PD), ProcDesc = describe_proc(Deep, PD ^ pd_proc_static). -%-----------------------------------------------------------------------------% -% -% Code shared across entire module. -% - -:- func this_file = string. - -this_file = "create_report.m". - -%-----------------------------------------------------------------------------% - -:- func error_message(string, string) = string. - -error_message(Pred, Message) = Error :- - Error = this_file ++ ": " ++ Pred ++ ": " ++ Message. - -%-----------------------------------------------------------------------------% - -:- pred error(string::in, string::in) is erroneous. - -error(Pred, Message) :- - throw(software_error(error_message(Pred, Message))). - %-----------------------------------------------------------------------------% :- end_module create_report. %-----------------------------------------------------------------------------% diff --git a/deep_profiler/dense_bitset.m b/deep_profiler/dense_bitset.m index 771b9ed70..9efad8a86 100644 --- a/deep_profiler/dense_bitset.m +++ b/deep_profiler/dense_bitset.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2001, 2003, 2005-2006 The University of Melbourne. +% Copyright (C) 2001, 2003, 2005-2006, 2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -87,7 +87,7 @@ insert(A0, I) = A :- Word = Word0 \/ bit(I), set(A0, word(I), Word, A) ; - error("insert: cannot use indexes < 0") + unexpected($module, $pred, "cannot use indexes < 0") ). delete(A0, I) = A :- @@ -99,7 +99,7 @@ delete(A0, I) = A :- Word = Word0 /\ \ bit(I), set(A0, word(I), Word, A) ; - error("delete: cannot use indexes < 0") + unexpected($module, $pred, "cannot use indexes < 0") ). union(A, B) = C :- diff --git a/deep_profiler/display.m b/deep_profiler/display.m index 33721ff6c..fec217ab6 100644 --- a/deep_profiler/display.m +++ b/deep_profiler/display.m @@ -212,7 +212,7 @@ %-----------------------------------------------------------------------------% % -% List specific structures +% List specific structures. % :- type list_class @@ -223,7 +223,7 @@ %-----------------------------------------------------------------------------% % -% Link specific structures +% Link specific structures. % :- type deep_link diff --git a/deep_profiler/display_report.m b/deep_profiler/display_report.m index eb8145ce3..1bad84d1a 100644 --- a/deep_profiler/display_report.m +++ b/deep_profiler/display_report.m @@ -22,7 +22,7 @@ :- import_module report. % XXX: This include should be removed or replaced. Some data structures -% such as preferences are currently defined in query, they should be moved +% such as preferences are currently defined in query; they should be moved % into a different module so that this module doesn't need to include % the whole of query. :- import_module query. @@ -165,7 +165,8 @@ report_to_display(Deep, Prefs, Report) = Display :- Report = report_proc_callers(MaybeProcCallersReport), ( MaybeProcCallersReport = ok(ProcCallersReport), - display_report_proc_callers(Deep, Prefs, ProcCallersReport, Display) + display_report_proc_callers(Deep, Prefs, ProcCallersReport, + Display) ; MaybeProcCallersReport = error(Msg), Display = display(no, [display_heading(Msg)]) @@ -222,7 +223,8 @@ report_to_display(Deep, Prefs, Report) = Display :- Report = report_call_site_dynamic_var_use(MaybeVarUseInfo), ( MaybeVarUseInfo = ok(VarUseInfo), - display_report_call_site_dynamic_var_use(Prefs, VarUseInfo, Display) + display_report_call_site_dynamic_var_use(Prefs, VarUseInfo, + Display) ; MaybeVarUseInfo = error(Msg), Display = display(no, [display_heading(Msg)]) @@ -263,7 +265,7 @@ display_report_menu(Deep, Prefs, MenuReport, Display) :- ( ShouldDisplayTimes = yes, - + Top100SelfCmd = deep_cmd_top_procs(rank_range(1, 100), cost_time, self, overall), Top100SelfAndDescCmd = deep_cmd_top_procs(rank_range(1, 100), @@ -277,7 +279,7 @@ display_report_menu(Deep, Prefs, MenuReport, Display) :- ] ; ShouldDisplayTimes = no, - LinksTopProcsByLimitTime = [] + LinksTopProcsByLimitTime = [] ), TopLimitCallSeqsSelf = deep_cmd_top_procs(rank_range(1, 100), @@ -352,7 +354,7 @@ display_report_menu(Deep, Prefs, MenuReport, Display) :- link_base(WordsAbove2Megawords, yes(Prefs), "Procedures above 2M words threshold: words, self+descendants.") ], - + LinkCmds = LinksExploration ++ LinksTopProcsByLimitTime ++ LinksTopProcsByLimit ++ LinksTopProcsByPercentTime ++ LinksTopProcsByPercent, @@ -365,15 +367,16 @@ display_report_menu(Deep, Prefs, MenuReport, Display) :- % Produce the developer-only options list. % RecursionTypeFrequenciesCmd = deep_cmd_recursion_types_frequency, - + LinksDeveloperCmds = [ link_base(RecursionTypeFrequenciesCmd, yes(Prefs), "Frequencies of different types of recursion used in the program.") ], list.map(make_link, LinksDeveloperCmds, DeveloperLinksList), - DeveloperLinks = display_developer(display_list(list_class_vertical_bullets, - yes("Options that are only useful to Mercury developers"), - DeveloperLinksList)), + DeveloperLinks = display_developer( + display_list(list_class_vertical_bullets, + yes("Options that are only useful to Mercury developers"), + DeveloperLinksList)), % Display the table section of the report. ProfilingStatistics = @@ -639,7 +642,7 @@ clique_call_site_to_rows(MaybeCurModuleName, ModuleQual, Prefs, Rows = [Row] ; CalleePerfs = [_, _ | _], - error("clique_call_site_to_rows: more than one callee at normal") + unexpected($module, $pred, "more than one callee at normal") ) ; ( @@ -705,7 +708,7 @@ clique_call_site_callee_to_row(MaybeCurModuleName, ModuleQual, Prefs, clique_recursion_report::in, display::out) is det. display_report_clique_recursion(Prefs, CliqueRecursionReport, Display) :- - CliqueRecursionReport = clique_recursion_report(CliquePtr, RecursionType, + CliqueRecursionReport = clique_recursion_report(CliquePtr, RecursionType, _NumProcs), Cmd = deep_cmd_clique_recursive_costs(CliquePtr), CliquePtr = clique_ptr(CliqueNum), @@ -714,14 +717,14 @@ display_report_clique_recursion(Prefs, CliqueRecursionReport, Display) :- display_recursion_type(RecursionType, DisplayRecursionType), - CliqueReportsControls = clique_reports_controls(Prefs, CliquePtr, Cmd), - + CliqueReportsControls = clique_reports_controls(Prefs, CliquePtr, Cmd), + MenuRestartQuitControls = cmds_menu_restart_quit(yes(Prefs)), Display = display(yes(Title), DisplayRecursionType ++ [display_paragraph_break, CliqueReportsControls, display_paragraph_break, MenuRestartQuitControls]). -:- pred display_recursion_type(recursion_type::in, list(display_item)::out) +:- pred display_recursion_type(recursion_type::in, list(display_item)::out) is det. display_recursion_type(RecursionType, Items) :- @@ -731,7 +734,7 @@ display_recursion_type(RecursionType, Items) :- Text = "Clique is non-recursive" ; RecursionType = rt_mutual_recursion(NumProcs), - Text = format("Mutual recursion between %d procedures", + Text = format("Mutual recursion between %d procedures", [i(NumProcs)]) ), Items = [display_text(Text)] @@ -742,21 +745,21 @@ display_recursion_type(RecursionType, Items) :- yes("Unknown, error(s) occured"), ErrorItems)] ; ( - RecursionType = rt_single(BaseLevel, RecLevel, AvgDepth, + RecursionType = rt_single(BaseLevel, RecLevel, AvgDepth, AvgRecCost, AnyRecCost), RowData = [ - {"Base case", BaseLevel}, + {"Base case", BaseLevel}, {"Recursive case", RecLevel}], Text = "Single-recursion:", MaxDepthI = round_to_int(AvgDepth), - ExtraTableRows0 = - [{"Average recursion depth:", AvgDepth}, - {"Average recursive call cost (excluding the call it's self):", + ExtraTableRows0 = + [{"Average recursion depth:", AvgDepth}, + {"Average recursive call cost (excluding the call itself):", AvgRecCost}] ++ map( (func(Level) = - {format("Cost at depth %d:", [i(Level)]), + {string.format("Cost at depth %d:", [i(Level)]), AnyRecCost(Level)}), [0, 1, 2, round_to_int(AvgDepth / 2.0), MaxDepthI - 2, MaxDepthI - 1, MaxDepthI]), @@ -771,42 +774,43 @@ display_recursion_type(RecursionType, Items) :- Text = "Double-recursion (Probably Divide and Conquer):", ExtraTableRows = [] - ; + ; RecursionType = rt_other(Levels), RowData = map((func(Level) = {Label, Level} :- - Label = format("Case for %d recursive calls", + Label = string.format("Case for %d recursive calls", [i(Level ^ rlr_level)]) - ), Levels), + ), Levels), Text = "Unknown recursion type:", ExtraTableRows = [] ), Rows = map(make_recursion_table_row, RowData), - - ExtraTable = display_table(table(table_class_do_not_box, 2, no, + + ExtraTable = display_table(table(table_class_do_not_box, 2, no, ExtraTableRows)), Header = table_header(map( - (func({Name, Class}) = + (func({Name, Class}) = table_header_group(table_header_group_single(td_s(Name)), Class, column_do_not_colour) - ), + ), [{"Recursion type", table_column_class_field_name}, {"Exec count", table_column_class_number}, - {"Non recursive calls per-call cost", table_column_class_callseqs}, - {"Recursive calls per-call cost (ex children)", + {"Non recursive calls per-call cost", + table_column_class_callseqs}, + {"Recursive calls per-call cost (ex children)", table_column_class_callseqs}])), - Table = display_table(table(table_class_box_if_pref, 4, yes(Header), + Table = display_table(table(table_class_box_if_pref, 4, yes(Header), Rows)), Description = display_text(Text), - Items = [Description, + Items = [Description, display_paragraph_break, Table, display_paragraph_break, ExtraTable] ). :- func make_recursion_table_row({string, recursion_level_report}) = table_row. -make_recursion_table_row({Label, Report}) = +make_recursion_table_row({Label, Report}) = table_row([table_cell(td_s(Label)), table_cell(td_i(Report ^ rlr_calls)), table_cell(td_f(Report ^ rlr_non_rec_calls_cost)), @@ -822,8 +826,9 @@ display_report_recursion_types_frequency(Prefs, Report, Display) :- Title = "Frequencies of recognized recursion types", % Build the table. - RecursionTypeLink = deep_link(Cmd, yes(Prefs ^ pref_criteria := by_context), - attr_str([], "Recursion Type"), link_class_link), + RecursionTypeLink = deep_link(Cmd, + yes(Prefs ^ pref_criteria := by_context), + attr_str([], "Recursion Type"), link_class_link), RecursionTypeHeaderGroup = make_single_table_header_group( td_l(RecursionTypeLink), table_column_class_no_class, column_do_not_colour), @@ -833,7 +838,7 @@ display_report_recursion_types_frequency(Prefs, Report, Display) :- PercentageHeaderGroup = make_single_table_header_group( td_s("Percentage"), table_column_class_no_class, column_do_not_colour), - perf_table_header(total_columns_meaningful, Prefs, + perf_table_header(total_columns_meaningful, Prefs, override_order_criteria_header_data(Cmd), PerfHeaderGroups), AllHeaderGroups = [RecursionTypeHeaderGroup, FreqHeaderGroup, PercentageHeaderGroup] ++ PerfHeaderGroups, @@ -841,7 +846,8 @@ display_report_recursion_types_frequency(Prefs, Report, Display) :- Histogram1 = map.to_assoc_list(Histogram0), sort_recursion_types_by_preferences(Prefs, Histogram1, Histogram), - map(display_report_rec_type_freq_rows(Prefs, NumColumns), Histogram, Rowss), + list.map(display_report_rec_type_freq_rows(Prefs, NumColumns), + Histogram, Rowss), list.condense(Rowss, Rows), RecursionTypesTable = display_table(table(table_class_box_if_pref, NumColumns, yes(Header), Rows)), @@ -850,7 +856,7 @@ display_report_recursion_types_frequency(Prefs, Report, Display) :- FieldControls = field_controls(Prefs, Cmd), FormatControls = format_controls(Prefs, Cmd), MenuRestartQuitControls = cmds_menu_restart_quit(yes(Prefs)), - + Display = display(yes(Title), [RecursionTypesTable, display_paragraph_break, ModuleQualControls, display_paragraph_break, FieldControls, @@ -871,7 +877,8 @@ sort_recursion_types_by_preferences(Prefs, !RecursionTypes) :- list.sort(compare_recursion_type_row_by_rec_type, !RecursionTypes) ; OrderCriteria = by_cost(CostKind, InclDesc, Scope), - list.sort(compare_rec_type_row_datas_by_cost(CostKind, InclDesc, Scope), + list.sort( + compare_rec_type_row_datas_by_cost(CostKind, InclDesc, Scope), !RecursionTypes), % We want the most expensive rows to appear first. list.reverse(!RecursionTypes) @@ -879,7 +886,7 @@ sort_recursion_types_by_preferences(Prefs, !RecursionTypes) :- :- pred sort_recursion_type_procs_by_preferences(preferences::in, list(recursion_type_proc_freq_data)::in, - list(recursion_type_proc_freq_data)::out) is det. + list(recursion_type_proc_freq_data)::out) is det. sort_recursion_type_procs_by_preferences(Prefs, !RecursionTypeProcs) :- OrderCriteria = Prefs ^ pref_criteria, @@ -907,8 +914,6 @@ sort_recursion_type_procs_by_preferences(Prefs, !RecursionTypeProcs) :- compare_recursion_type_row_by_rec_type(RTA - _, RTB - _, Result) :- compare(Result, RTA, RTB). - % This is reversed so that entries with larger frequencies are listed first. - % :- pred compare_recursion_proc_row_by_frequency_rev( recursion_type_proc_freq_data::in, recursion_type_proc_freq_data::in, comparison_result::out) is det. @@ -916,6 +921,7 @@ compare_recursion_type_row_by_rec_type(RTA - _, RTB - _, Result) :- compare_recursion_proc_row_by_frequency_rev( recursion_type_proc_freq_data(FreqA, _, _), recursion_type_proc_freq_data(FreqB, _, _), Result) :- + % The reverse is so that entries with larger frequencies are listed first. compare(Result, FreqB, FreqA). :- pred compare_rec_type_row_datas_by_cost(cost_kind::in, @@ -924,14 +930,14 @@ compare_recursion_proc_row_by_frequency_rev( pair(T, recursion_type_freq_data)::in, comparison_result::out) is det. -compare_rec_type_row_datas_by_cost(CostKind, IncDesc, Scope, _ - DataA, - _ - DataB, Result) :- +compare_rec_type_row_datas_by_cost(CostKind, IncDesc, Scope, _ - DataA, + _ - DataB, Result) :- MaybePerfA = DataA ^ rtfd_maybe_summary, MaybePerfB = DataB ^ rtfd_maybe_summary, ( MaybePerfA = yes(PerfA), MaybePerfB = yes(PerfB), - compare_perf_row_datas_by_cost(CostKind, IncDesc, Scope, + compare_perf_row_datas_by_cost(CostKind, IncDesc, Scope, PerfA, PerfB, Result) ; MaybePerfA = yes(_), @@ -952,18 +958,18 @@ compare_rec_type_row_datas_by_cost(CostKind, IncDesc, Scope, _ - DataA, recursion_type_proc_freq_data::in, recursion_type_proc_freq_data::in, comparison_result::out) is det. -compare_rec_proc_row_datas_by_cost(CostKind, InclDesc, Scope, +compare_rec_proc_row_datas_by_cost(CostKind, InclDesc, Scope, recursion_type_proc_freq_data(_, _, PerfA), recursion_type_proc_freq_data(_, _, PerfB), Result) :- compare_perf_row_datas_by_cost(CostKind, InclDesc, Scope, PerfA, PerfB, Result). :- pred display_report_rec_type_freq_rows(preferences::in, int::in, - pair(recursion_type_simple, recursion_type_freq_data)::in, + pair(recursion_type_simple, recursion_type_freq_data)::in, list(table_row)::out) is det. display_report_rec_type_freq_rows(Prefs, NumColumns, Type - FreqData, Rows) :- - FreqData = recursion_type_freq_data(Frequency, Percent, MaybeSummary, + FreqData = recursion_type_freq_data(Frequency, Percent, MaybeSummary, ProcsMap), % Make the header row. @@ -974,7 +980,7 @@ display_report_rec_type_freq_rows(Prefs, NumColumns, Type - FreqData, Rows) :- ( MaybeSummary = yes(Summary), perf_table_row(total_columns_meaningful, Prefs ^ pref_fields, Summary, - SummaryCells) + SummaryCells) ; MaybeSummary = no, duplicate(NumColumns - 3, table_empty_cell, SummaryCells) @@ -988,18 +994,18 @@ display_report_rec_type_freq_rows(Prefs, NumColumns, Type - FreqData, Rows) :- take_upto(Prefs ^ pref_proc_statics_per_rec_type, Procs1, Procs), map(display_report_rec_type_proc_rows(Prefs), Procs, ProcRows), - Rows = [HeaderRow | [Row | ProcRows ++ + Rows = [HeaderRow | [Row | ProcRows ++ [table_separator_row]]]. :- pred display_report_rec_type_proc_rows(preferences::in, recursion_type_proc_freq_data::in, table_row::out) is det. -display_report_rec_type_proc_rows(Prefs, +display_report_rec_type_proc_rows(Prefs, recursion_type_proc_freq_data(Freq, Percent, Summary), Row) :- perf_table_row(total_columns_meaningful, Prefs ^ pref_fields, Summary, SummaryCells), ProcDesc = Summary ^ perf_row_subject, - ProcCell = proc_desc_to_proc_name_cell(no, Prefs ^ pref_module_qual, Prefs, + ProcCell = proc_desc_to_proc_name_cell(no, Prefs ^ pref_module_qual, Prefs, ProcDesc), Row = table_row([ProcCell, table_cell(td_i(Freq)), table_cell(td_p(Percent))] ++ SummaryCells). @@ -1009,14 +1015,16 @@ display_report_rec_type_proc_rows(Prefs, display_report_recursion_type_simple(rts_not_recursive, "Not recursive"). display_report_recursion_type_simple(rts_single, "Single-recursion"). -display_report_recursion_type_simple(rts_divide_and_conquer, "Divide and conquer"). +display_report_recursion_type_simple(rts_divide_and_conquer, + "Divide and conquer"). display_report_recursion_type_simple(rts_mutual_recursion(NumProcs), String) :- format("Mutual recursion between %d procs", [i(NumProcs)], String). display_report_recursion_type_simple(rts_other(Levels), String) :- LevelsStr = join_list(", ", map(string, set.to_sorted_list(Levels))), format("Other recursion with levels: %s", [s(LevelsStr)], String). -display_report_recursion_type_simple(rts_total_error_instances, "Total errors"). -display_report_recursion_type_simple(rts_error(Error), "Error: " ++ Error). +display_report_recursion_type_simple(rts_total_error_instances, + "Total errors"). +display_report_recursion_type_simple(rts_error(Error), "Error: " ++ Error). %-----------------------------------------------------------------------------% % @@ -2027,7 +2035,7 @@ display_report_procrep_coverage_info(Prefs, ProcrepCoverageReport, Display) :- % Print the coverage information for a goal, this is used by % print_proc_to_strings. % -:- pred coverage_to_cord_string(var_table::in, coverage_info::in, +:- pred coverage_to_cord_string(var_table::in, coverage_info::in, cord(cord(string))::out) is det. coverage_to_cord_string(_, Coverage, singleton(singleton(String))) :- @@ -2127,7 +2135,7 @@ display_report_proc_dynamic_dump(_Deep, Prefs, ProcDynamicDumpInfo, Display) :- list.map(format_coverage_point_row, CoveragePoints, CoveragePointsRows), CoveragePointsTableHeader = table_header([ - table_header_group(table_header_group_single(td_s("Goal Path")), + table_header_group(table_header_group_single(td_s("Goal Path")), table_column_class_no_class, column_do_not_colour), table_header_group(table_header_group_single(td_s("Type")), table_column_class_no_class, column_do_not_colour), @@ -2137,7 +2145,8 @@ display_report_proc_dynamic_dump(_Deep, Prefs, ProcDynamicDumpInfo, Display) :- yes(CoveragePointsTableHeader), CoveragePointsRows), CoveragePointsTableItem = display_table(CoveragePointsTable), - CoveragePointsItems = [CoveragePointsTitleItem, CoveragePointsTableItem] + CoveragePointsItems = + [CoveragePointsTitleItem, CoveragePointsTableItem] ; MaybeCoveragePoints = no, CoveragePointsItems = [] @@ -2146,7 +2155,7 @@ display_report_proc_dynamic_dump(_Deep, Prefs, ProcDynamicDumpInfo, Display) :- make_link(link_base(deep_cmd_dynamic_procrep_coverage(PDPtr), yes(Prefs), "Dynamic coverage annotated procedure representation"), CoverageAnnotatedProcrepItem), - RelatedReportsList = display_list(list_class_horizontal_except_title, + RelatedReportsList = display_list(list_class_horizontal_except_title, yes("Related reports:"), [CoverageAnnotatedProcrepItem]), Display = display(yes(Title), @@ -2364,7 +2373,7 @@ display_report_call_site_dynamic_var_use(_Prefs, CSDVarUseInfo, Display) :- {"Name", table_column_class_no_class}, {"Type", table_column_class_no_class}, {"Percent into proc", table_column_class_no_class}, - {"Time into proc (Callseqs)", table_column_class_callseqs}])), + {"Time into proc (Callseqs)", table_column_class_callseqs}])), Table = table(table_class_box_if_pref, 5, yes(Header), VarUseRows), Title = "Dump of var use info", @@ -2376,7 +2385,7 @@ display_report_call_site_dynamic_var_use(_Prefs, CSDVarUseInfo, Display) :- format_var_uses([], _, []). format_var_uses([VarUse | VarUses], RowNum, [Row | Rows]) :- HeaderCell = table_cell(td_s(format("Argument: %i", [i(RowNum)]))), - VarUse = var_use_and_name(Name, + VarUse = var_use_and_name(Name, var_use_info(CostUntilUse, ProcCost, UseType)), NameCell = table_cell(td_s(Name)), ( @@ -2438,6 +2447,7 @@ dummy_order_criteria_header_data(_, _, Label) = td_s(Label). % % Each pair of predicates should follow the exact same logic when selecting % what columns to display, and in what order. +% :- type total_columns_meaning ---> total_columns_meaningful @@ -2600,7 +2610,7 @@ perf_table_row_time(TotalsMeaningful, Fields, RowData, TimeCells) :- MaybeTotal = yes(Total) ; MaybeTotal = no, - error("perf_table_row_time: no total") + unexpected($module, $pred, "no total") ), TotalTicks = Total ^ perf_row_ticks, TotalTime = Total ^ perf_row_time, @@ -2799,7 +2809,7 @@ perf_table_row_callseqs(TotalsMeaningful, Fields, RowData, CallSeqsCells) :- MaybeTotal = yes(Total) ; MaybeTotal = no, - error("perf_table_row_callseqs: no total") + unexpected($module, $pred, "no total") ), TotalCallSeqs = Total ^ perf_row_callseqs, TotalCallSeqsPercent = Total ^ perf_row_callseqs_percent, @@ -2926,7 +2936,7 @@ perf_table_row_allocs(TotalsMeaningful, Fields, RowData, AllocCells) :- MaybeTotal = yes(Total) ; MaybeTotal = no, - error("perf_table_row_allocs: no total") + unexpected($module, $pred, "no total") ), TotalAllocs = Total ^ perf_row_allocs, TotalAllocsPercent = Total ^ perf_row_allocs_percent, @@ -3053,7 +3063,7 @@ perf_table_row_memory(TotalsMeaningful, Fields, RowData, MemoryCells) :- MaybeTotal = yes(Total) ; MaybeTotal = no, - error("perf_table_row_memory: no total") + unexpected($module, $pred, "no total") ), TotalMem = Total ^ perf_row_mem, TotalMemPerCall = Total ^ perf_row_mem_percall, @@ -3800,7 +3810,8 @@ set_box_tables(Box, !Prefs) :- % Controls for related procedure and clique reports. % -:- func proc_reports_controls(preferences, proc_static_ptr, cmd) = display_item. +:- func proc_reports_controls(preferences, proc_static_ptr, cmd) + = display_item. proc_reports_controls(Prefs, Proc, NotCmd) = ControlsItem :- solutions((pred(Control::out) is nondet :- @@ -3825,10 +3836,11 @@ proc_reports_controls(Prefs, Proc, NotCmd) = ControlsItem :- ControlsItem = display_list(list_class_vertical_no_bullets, yes("Related procedure reports:"), ProcReportControls). -:- func clique_reports_controls(preferences, clique_ptr, cmd) = display_item. +:- func clique_reports_controls(preferences, clique_ptr, cmd) = display_item. clique_reports_controls(Perfs, CliquePtr, NotCmd) = ControlsItem :- - solutions((pred(Control::out) is nondet :- + MakeControls = + ( pred(Control::out) is nondet :- ( Cmd = deep_cmd_clique(CliquePtr), Label = "Clique", @@ -3844,7 +3856,8 @@ clique_reports_controls(Perfs, CliquePtr, NotCmd) = ControlsItem :- ), Cmd \= NotCmd, make_control(yes(Perfs), Cmd, Label, Developer, Control) - ), CliqueReportControls), + ), + solutions(MakeControls, CliqueReportControls), ControlsItem = display_list(list_class_vertical_no_bullets, yes("Related clique reports:"), CliqueReportControls). @@ -4167,17 +4180,17 @@ general_options_controls(Cmd, Prefs) = ControlsItem :- ( DeveloperMode = developer_options_visible, DeveloperText = "Disable developer options", - DeveloperPrefs = + DeveloperPrefs = Prefs ^ pref_developer_mode := developer_options_invisible ; DeveloperMode = developer_options_invisible, DeveloperText = "Enable developer options", - DeveloperPrefs = + DeveloperPrefs = Prefs ^ pref_developer_mode := developer_options_visible ), DeveloperControl = display_link(deep_link(Cmd, yes(DeveloperPrefs), attr_str([], DeveloperText), link_class_control)), - List = [DeveloperControl], + List = [DeveloperControl], ControlsItem = display_list(list_class_horizontal_except_title, yes("General options:"), List). @@ -4883,8 +4896,8 @@ compare_module_name_rows_by_name(ModuleRowDataA, ModuleRowDataB, Result) :- % :- pred sort_clique_rows_by_preferences(preferences::in, - list(perf_row_data(clique_desc))::in, list(perf_row_data(clique_desc))::out) - is det. + list(perf_row_data(clique_desc))::in, + list(perf_row_data(clique_desc))::out) is det. sort_clique_rows_by_preferences(Prefs, !CliqueRowDatas) :- OrderCriteria = Prefs ^ pref_criteria, @@ -5107,7 +5120,7 @@ compare_perf_row_datas_by_time(InclDesc, Scope, PerfA, PerfB, Result) :- compare(Result, TimeA, TimeB) ) ; - error("compare_perf_row_datas_by_cost: self_and_desc") + unexpected($module, $pred, "self_and_desc") ) ). @@ -5151,7 +5164,7 @@ compare_perf_row_datas_by_callseqs(InclDesc, Scope, PerfA, PerfB, Result) :- compare(Result, CallSeqsA, CallSeqsB) ) ; - error("compare_perf_row_datas_by_cost: self_and_desc") + unexpected($module, $pred, "self_and_desc") ) ). @@ -5195,7 +5208,7 @@ compare_perf_row_datas_by_allocs(InclDesc, Scope, PerfA, PerfB, Result) :- compare(Result, AllocsA, AllocsB) ) ; - error("compare_perf_row_datas_by_cost: self_and_desc") + unexpected($module, $pred, "self_and_desc") ) ). @@ -5239,7 +5252,7 @@ compare_perf_row_datas_by_words(InclDesc, Scope, PerfA, PerfB, Result) :- compare_memory(MemoryA, MemoryB, Result) ) ; - error("compare_perf_row_datas_by_cost: self_and_desc") + unexpected($module, $pred, "self_and_desc") ) ). diff --git a/deep_profiler/dump.m b/deep_profiler/dump.m index cdb312350..d28dfecf9 100644 --- a/deep_profiler/dump.m +++ b/deep_profiler/dump.m @@ -316,7 +316,7 @@ dump_init_profile_stats(Stats, !IO) :- Compression = no_compression, io.write_string("none\n", !IO) ), - io.format("\tcoverage_data_type = %s\n", [s(string(CoverageDataType))], + io.format("\tcoverage_data_type = %s\n", [s(string(CoverageDataType))], !IO), io.nl(!IO). @@ -540,7 +540,7 @@ dump_proc_static(Restriction, Index, ProcStatic, !IO) :- -> ProcStatic = proc_static(Id, DeclModule, _UnQualRefinedId, QualRefinedId, RawId, FileName, LineNumber, - InInterface, Sites, CoveragePointInfos, MaybeCoveragePoints, + InInterface, Sites, CoveragePointInfos, MaybeCoveragePoints, IsZeroed), IdStr = dump_proc_id(Id), io.format("ps%d:\n", [i(Index)], !IO), @@ -586,7 +586,7 @@ dump_proc_static(Restriction, Index, ProcStatic, !IO) :- MaybeCoveragePoints = no, io.write_string("\tCoverage counts not present in proc static\n", !IO), - array_foldl_from_0(dump_coverage_point_info, CoveragePointInfos, + array_foldl_from_0(dump_coverage_point_info, CoveragePointInfos, !IO) ), io.nl(!IO) @@ -611,7 +611,7 @@ dump_coverage_point(CoveragePoint, !Num, !IO) :- io.format("\t%s: %d\n", [s(CPInfoStr), i(Count)], !IO), !:Num = !.Num + 1. -:- pred dump_coverage_point_info(int::in, coverage_point_info::in, +:- pred dump_coverage_point_info(int::in, coverage_point_info::in, io::di, io::uo) is det. dump_coverage_point_info(Num, CoveragePointInfo, !IO) :- @@ -622,7 +622,7 @@ dump_coverage_point_info(Num, CoveragePointInfo, !IO) :- format_cp_info(Num, coverage_point_info(Path, CPType), String) :- goal_path_to_string(Path) = PathString, - format("coverage_point[%d]: %s, %s", + format("coverage_point[%d]: %s, %s", [i(Num), s(string(CPType)), s(PathString)], String). %----------------------------------------------------------------------------% @@ -766,7 +766,8 @@ dump_deep_rev_links(Deep, !IO) :- io.nl(!IO), CallSiteStaticMap = Deep ^ call_site_static_map, - io.write_string("SECTION MAP FROM CALL SITE DYNAMICS TO STATICS:\n\n", !IO), + io.write_string("SECTION MAP FROM CALL SITE DYNAMICS TO STATICS:\n\n", + !IO), array_foldl_from_1(dump_call_site_dynamic_to_static, CallSiteStaticMap, !IO), io.nl(!IO), diff --git a/deep_profiler/html_format.m b/deep_profiler/html_format.m index 22b64f4bc..78d96d579 100644 --- a/deep_profiler/html_format.m +++ b/deep_profiler/html_format.m @@ -429,7 +429,7 @@ update_style_control_map(ColumnClassStr, !HeaderGroupNumber, Colour = "White" ), ( set.member(ColumnClassStr, !.ColouredClassStrs) -> - error("update_style_control_map: repeated table_column_class") + unexpected($module, $pred, "repeated table_column_class") ; set.insert(!.ColouredClassStrs, ColumnClassStr, !:ColouredClassStrs) ), @@ -498,7 +498,7 @@ table_cell_to_html(FormatInfo, MaybeClassMap, !StyleControlMap, !ColumnNum, Msg = string.format( "Class map had no class for col %d, check table structure", [i(!.ColumnNum)]), - error(Msg) + unexpected($module, $pred, Msg) ) ; MaybeClassMap = no, @@ -725,7 +725,7 @@ default_style_control_map = % Transform a list of items into HTML. % -:- pred list_to_html(format_info::in, +:- pred list_to_html(format_info::in, style_control_map::in, style_control_map::out, list_class::in, maybe(string)::in, list(display_item)::in, html::out) is det. @@ -842,7 +842,7 @@ pseudo_link_to_html(_FormatInfo, PseudoLink) = HTML :- :- func init_format_info(deep, preferences) = format_info. init_format_info(Deep, Prefs) = FormatInfo :- - FormatInfo = format_info(Prefs ^ pref_colour, Prefs ^ pref_box, + FormatInfo = format_info(Prefs ^ pref_colour, Prefs ^ pref_box, Prefs ^ pref_developer_mode, Deep ^ server_name_port, Deep ^ script_name, Deep ^ data_file_name). diff --git a/deep_profiler/io_combinator.m b/deep_profiler/io_combinator.m index 54c5e6943..b5a7c6eec 100644 --- a/deep_profiler/io_combinator.m +++ b/deep_profiler/io_combinator.m @@ -693,7 +693,7 @@ pred(maybe_error(T11), io, io), pred(maybe_error(T12), io, io), pred(maybe_error(T13), io, io), - pred(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, + pred(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, maybe_error(T)), maybe_error(T), io, io). :- mode io_combinator.maybe_error_sequence_13( diff --git a/deep_profiler/mdprof_cgi.m b/deep_profiler/mdprof_cgi.m index 48782e88d..2083dba59 100644 --- a/deep_profiler/mdprof_cgi.m +++ b/deep_profiler/mdprof_cgi.m @@ -176,7 +176,7 @@ decode_input_lines(Decode, DecodeCmd, DecodePrefs, !IO) :- io.nl(!IO) ; MaybeQuery = no, - io.write_string("invalid query string: " ++ + io.write_string("invalid query string: " ++ "cannot split into components\n", !IO) ) ), @@ -496,7 +496,7 @@ handle_query_from_new_server(Cmd, PrefInd, FileName, ToServerPipe, % of the critical region. % :- pred start_server(option_table::in, string::in, string::in, - maybe(io.output_stream)::in, string::in, string::in, + maybe(io.output_stream)::in, string::in, string::in, deep::in, io::di, io::uo) is cc_multi. start_server(Options, ToServerPipe, FromServerPipe, MaybeStartupStream, @@ -582,7 +582,7 @@ start_server(Options, ToServerPipe, FromServerPipe, MaybeStartupStream, ). :- pred server_loop(string::in, string::in, int::in, - maybe(io.output_stream)::in, bool::in, bool::in, int::in, + maybe(io.output_stream)::in, bool::in, bool::in, int::in, deep::in, io::di, io::uo) is cc_multi. server_loop(ToServerPipe, FromServerPipe, TimeOut0, MaybeStartupStream, diff --git a/deep_profiler/mdprof_fb.automatic_parallelism.m b/deep_profiler/mdprof_fb.automatic_parallelism.m index a67ec4390..83b901b8f 100644 --- a/deep_profiler/mdprof_fb.automatic_parallelism.m +++ b/deep_profiler/mdprof_fb.automatic_parallelism.m @@ -92,6 +92,7 @@ %----------------------------------------------------------------------------% % % The code in this section has some trace goals that can be enabled with: +% % --trace-flag=debug_cpc_search % Debug the traversal through the clique tree. % @@ -103,12 +104,12 @@ % candidate_parallel_conjunctions(Params, Deep, Messages, !Feedback) :- - % Find opertunities for parallelism by walking the clique tree. Don't - % Descened into cliques cheaper than the threshold. + % Find opportunities for parallelism by walking the clique tree. + % Do not descend into cliques cheaper than the threshold. deep_lookup_clique_index(Deep, Deep ^ root, RootCliquePtr), % The +1 here accounts for the cost of the pseudo call into the mercury - % runtime since it is modeled here as a call site that in reality does not - % exist. + % runtime since it is modeled here as a call site that in reality + % does not exist. RootParallelism = no_parallelism, candidate_parallel_conjunctions_clique(Params, Deep, RootParallelism, RootCliquePtr, ConjunctionsMap, Messages), @@ -148,10 +149,10 @@ pard_goal_detail_annon_to_pard_goal_annon(SharedVarsSet, PGD, PG) :- Coverage = PGD ^ pgd_coverage, get_coverage_before_det(Coverage, Calls), ( Calls > 0 -> - foldl(build_var_use_list(PGD ^ pgd_var_production_map), SharedVars, - [], Productions), - foldl(build_var_use_list(PGD ^ pgd_var_consumption_map), SharedVars, - [], Consumptions) + list.foldl(build_var_use_list(PGD ^ pgd_var_production_map), + SharedVars, [], Productions), + list.foldl(build_var_use_list(PGD ^ pgd_var_consumption_map), + SharedVars, [], Consumptions) ; Productions = [], Consumptions = [] @@ -199,35 +200,35 @@ build_var_use_list(Map, Var, !List) :- :- type pard_goal_detail_annotation ---> pard_goal_detail( + % The type and type-specific values of the pard goal. pgd_pg_type :: pard_goal_type, - % The type and type-specific values of the pard goal. + % The inst map info attached to the original goal. pgd_inst_map_info :: inst_map_info, - % The inst map info attached to the original goal. + % The original goal path of this goal. pgd_original_path :: goal_path, - % The original goal path of this goal. + % Coverage data for this goal. pgd_coverage :: coverage_info, - % Coverage data for this goal. + % The per-call cost of this call in call sequence counts. pgd_cost :: goal_cost_csq, - % The per-call cost of this call in call sequence counts. pgd_cost_above_threshold :: cost_above_par_threshold, + % Variable production and consumption information. pgd_var_production_map :: map(var_rep, lazy(var_use_info)), pgd_var_consumption_map :: map(var_rep, lazy(var_use_info)) - % Variable production and consumption information. ). :- type pard_goal_type ---> pgt_call( + % The argument modes and use information. pgtc_args :: list(var_and_mode), - % The argument modes and use information. + % The call site report from the deep profiler. pgtc_call_site :: cost_and_callees - % The call site report from the deep profiler. ) ; pgt_other_atomic_goal ; pgt_non_atomic_goal. @@ -252,10 +253,11 @@ build_var_use_list(Map, Var, !List) :- % ParentUsedParallelism, CliquePtr, CandidateParallelConjunctions, % Messages) % - % Find any CandidateParallelConjunctions in this clique and it's children. - % We stop searching when ParentCSCost is too low that the overheads of - % parallelism are too great or if ParentUsedParallelism becomes greater - % than the desired amount of parallelism. + % Find any CandidateParallelConjunctions in this clique and its children. + % We stop searching when ParentCSCost is too low (in which case the + % relative overheads of parallelism would be too great), or if + % ParentUsedParallelism becomes greater than the desired amount + % of parallelism. % :- pred candidate_parallel_conjunctions_clique( candidate_par_conjunctions_params::in, deep::in, @@ -277,8 +279,8 @@ candidate_parallel_conjunctions_clique(Opts, Deep, ParentParallelism, PDPtrs = OtherPDPtrs ; CliquePtr = clique_ptr(CliqueNum), - error(format("%sClique %d has no entry proc", - [s(this_file), i(CliqueNum)])) + string.format("Clique %d has no entry proc", [i(CliqueNum)], Msg), + unexpected($module, $pred, Msg) ) ), @@ -293,27 +295,29 @@ candidate_parallel_conjunctions_clique(Opts, Deep, ParentParallelism, ), % Look for parallelisation opportunities in this clique. - map2(candidate_parallel_conjunctions_clique_proc(Opts, Deep, + list.map2( + candidate_parallel_conjunctions_clique_proc(Opts, Deep, RecursionType, CliquePtr), - PDPtrs, Candidatess, Messagess), - foldl(union(merge_candidate_par_conjs_proc), Candidatess, + PDPtrs, CandidateLists, MessageCords), + list.foldl(map.union(merge_candidate_par_conjs_proc), CandidateLists, map.init, CliqueCandidates), - CliqueMessages = cord_list_to_cord(Messagess), + CliqueMessages = cord_list_to_cord(MessageCords), % Look in descendent cliques. some [!ChildCliques] ( map(proc_dynamic_callees(Deep, ParentParallelism), PDPtrs, ChildCliquess), !:ChildCliques = cord_list_to_cord(ChildCliquess), - map2(candidate_parallel_conjunctions_callee(Opts, Deep, + list.map2( + candidate_parallel_conjunctions_callee(Opts, Deep, CliquePtr, CliqueCandidates), - list(!.ChildCliques), CSCandidatess, CSMessagess) + list(!.ChildCliques), CSCandidateLists, CSMessageCords) ), - foldl(union(merge_candidate_par_conjs_proc), CSCandidatess, + list.foldl(map.union(merge_candidate_par_conjs_proc), CSCandidateLists, map.init, CSCandidates), - CSMessages = cord_list_to_cord(CSMessagess), + CSMessages = cord_list_to_cord(CSMessageCords), - union(merge_candidate_par_conjs_proc, CliqueCandidates, CSCandidates, + map.union(merge_candidate_par_conjs_proc, CliqueCandidates, CSCandidates, Candidates), Messages = CliqueMessages ++ CSMessages. @@ -340,8 +344,9 @@ proc_dynamic_callees(Deep, Parallelism, PDPtr, ChildCliques) :- deep_lookup_proc_statics(Deep, PSPtr, PS), ProcLabel = PS ^ ps_id, proc_dynamic_paired_call_site_slots(Deep, PDPtr, Slots), - map(pd_slot_callees(Deep, Parallelism, ProcLabel), Slots, ChildCliquess), - ChildCliques = cord_list_to_cord(ChildCliquess). + list.map(pd_slot_callees(Deep, Parallelism, ProcLabel), + Slots, ChildCliqueCords), + ChildCliques = cord_list_to_cord(ChildCliqueCords). :- pred pd_slot_callees(deep::in, parallelism_amount::in, string_proc_label::in, @@ -357,9 +362,10 @@ pd_slot_callees(Deep, Parallelism, ProcLabel, CSSPtr - Slot, ChildCliques) :- CSDPtr, ChildCliques) ; Slot = slot_multi(_, CSDPtrs), - map(call_site_dynamic_callees(Deep, Parallelism, ProcLabel, GoalPath), - to_list(CSDPtrs), ChildCliquess), - ChildCliques = cord_list_to_cord(ChildCliquess) + list.map( + call_site_dynamic_callees(Deep, Parallelism, ProcLabel, GoalPath), + to_list(CSDPtrs), ChildCliqueCords), + ChildCliques = cord_list_to_cord(ChildCliqueCords) ). :- pred call_site_dynamic_callees(deep::in, parallelism_amount::in, @@ -402,7 +408,7 @@ candidate_parallel_conjunctions_callee(Opts, Deep, CliquePtr, CliqueCandidates, AnalyzeChild = yes ; trace [compile_time(flag("debug_cpc_search")), io(!IO)] ( - debug_cliques_exeeded_parallelism(!.Callee, !IO) + debug_cliques_exceeded_parallelism(!.Callee, !IO) ), AnalyzeChild = no ) @@ -419,8 +425,7 @@ candidate_parallel_conjunctions_callee(Opts, Deep, CliquePtr, CliqueCandidates, ( AnalyzeChild = yes, Parallelism = !.Callee ^ ccc_parallelism, - ChildCliquePtr = - !.Callee ^ ccc_clique, + ChildCliquePtr = !.Callee ^ ccc_clique, candidate_parallel_conjunctions_clique(Opts, Deep, Parallelism, ChildCliquePtr, Candidates, Messages) ; @@ -470,8 +475,9 @@ update_parallelism_available_conj(Conj, !ChildClique) :- goal_path_from_string_det(Conj ^ cpc_goal_path, ConjGoalPath), % XXX: This needs revisiting if we allow parallelised conjuncts to be % re-ordered. - FirstConjunct = Conj ^ cpc_first_conj_num + length(Conj ^ cpc_goals_before), - Length = foldl((func(seq_conj(ConjsI), Acc) = Acc + length(ConjsI)), + FirstConjunct = Conj ^ cpc_first_conj_num + + length(Conj ^ cpc_goals_before), + Length = list.foldl((func(seq_conj(ConjsI), Acc) = Acc + length(ConjsI)), Conj ^ cpc_conjs, 0), ( GoalPath \= ConjGoalPath, @@ -555,8 +561,7 @@ merge_candidate_par_conjs_proc(A, B, Result) :- ( VarTableA = VarTableB -> true ; - error(this_file ++ - "merge_candidate_par_conjs_proc: var tables do not match") + unexpected($module, $pred, "var tables do not match") ). %----------------------------------------------------------------------------% @@ -591,8 +596,8 @@ candidate_parallel_conjunctions_proc(Opts, Deep, PDPtr, RecursionType, ; ModuleName = "exception" ) -> - % Silently skip over any code from the runtime, we can't expect to - % find it's procedure representation. + % Silently skip over any code from the runtime, since + % we can't expect to find its procedure representation. Candidates = map.init ; create_dynamic_procrep_coverage_report(Deep, PDPtr, @@ -608,9 +613,9 @@ candidate_parallel_conjunctions_proc(Opts, Deep, PDPtr, RecursionType, proc_dynamic_paired_call_site_slots(Deep, PDPtr, Slots), foldl(build_call_site_cost_and_callee_map(Deep), Slots, map.init, CallSitesMap), - Info = implicit_parallelism_info(Deep, ProgRep, Opts, CliquePtr, - CallSitesMap, RecursiveCallSiteCostMap, RecursionType, - VarTable, ProcLabel), + Info = implicit_parallelism_info(Deep, ProgRep, Opts, + CliquePtr, CallSitesMap, RecursiveCallSiteCostMap, + RecursionType, VarTable, ProcLabel), some [!Goal] ( !:Goal = Goal0, goal_annotate_with_instmap(!Goal, @@ -624,7 +629,8 @@ candidate_parallel_conjunctions_proc(Opts, Deep, PDPtr, RecursionType, ( SeenDuplicateInstantiation = have_not_seen_duplicate_instantiation, - list.foldl(build_candidate_par_conjunction_maps(ProcLabel, + list.foldl( + build_candidate_par_conjunction_maps(ProcLabel, VarTable), Candidates0, map.init, Candidates) ; @@ -651,10 +657,11 @@ candidate_parallel_conjunctions_proc(Opts, Deep, PDPtr, RecursionType, ). :- instance goal_annotation_add_instmap(coverage_info, - coverage_and_instmap_info) where [ - add_instmap(InstMap, Coverage, - coverage_and_instmap_info(Coverage, InstMap)) - ]. + coverage_and_instmap_info) where +[ + add_instmap(InstMap, Coverage, + coverage_and_instmap_info(Coverage, InstMap)) +]. :- pred build_candidate_par_conjunction_maps(string_proc_label::in, var_table::in, candidate_par_conjunction(pard_goal_detail)::in, @@ -667,8 +674,7 @@ build_candidate_par_conjunction_maps(ProcLabel, VarTable, Candidate, !Map) :- ( VarTable = VarTablePrime -> true ; - error(this_file ++ - "build_candidate_par_conjunction_maps: Var tables do not match") + unexpected($module, $pred, "var tables do not match") ) ; CPCs = [ Candidate ] @@ -690,8 +696,8 @@ goal_get_conjunctions_worth_parallelising(Info, GoalPath, !Goal, Candidates, ( ( GoalExpr0 = conj_rep(Conjs0), - map3_foldl(conj_get_conjunctions_worth_parallelising(Info, - GoalPath), + list.map3_foldl( + conj_get_conjunctions_worth_parallelising(Info, GoalPath), Conjs0, Conjs, Candidatess, Messagess, 1, _), conj_build_candidate_conjunctions(Info, GoalPath, Conjs, MaybeCost, MessagesB, MaybeCandidate), @@ -712,8 +718,8 @@ goal_get_conjunctions_worth_parallelising(Info, GoalPath, !Goal, Candidates, ) ; GoalExpr0 = disj_rep(Disjs0), - map3_foldl(disj_get_conjunctions_worth_parallelising(Info, - GoalPath), + list.map3_foldl( + disj_get_conjunctions_worth_parallelising(Info, GoalPath), Disjs0, Disjs, Candidatess, Messagess, 1, _), disj_calc_cost(Disjs, Calls, Cost), GoalExpr = disj_rep(Disjs), @@ -721,7 +727,8 @@ goal_get_conjunctions_worth_parallelising(Info, GoalPath, !Goal, Candidates, Candidates = condense(Candidatess) ; GoalExpr0 = switch_rep(Var, CanFail, Cases0), - map3_foldl(switch_case_get_conjunctions_worth_parallelising(Info, + list.map3_foldl( + switch_case_get_conjunctions_worth_parallelising(Info, GoalPath), Cases0, Cases, Candidatess, Messagess, 1, _), switch_calc_cost(Cases, Calls, Cost), @@ -823,13 +830,13 @@ ite_get_conjunctions_worth_parallelising(Info, GoalPath, !Cond, !Then, !Else, Candidates = CondCandidates ++ ThenCandidates ++ ElseCandidates, Messages = CondMessages ++ ThenMessages ++ ElseMessages. - % At the end of every conjunction we call this predicate to check the list - % of calls we've found and make any parallelisation decisions. + % At the end of every conjunction, we call this predicate to check + % the list of calls we have found and make any parallelisation decisions. % :- pred conj_build_candidate_conjunctions(implicit_parallelism_info::in, goal_path::in, list(pard_goal_detail)::in, maybe(goal_cost_csq)::out, - cord(message)::out, maybe(candidate_par_conjunction(pard_goal_detail))::out) - is det. + cord(message)::out, + maybe(candidate_par_conjunction(pard_goal_detail))::out) is det. conj_build_candidate_conjunctions(Info, GoalPath, Conjs, MaybeCost, Messages, MaybeCandidate) :- @@ -943,8 +950,8 @@ pardgoals_build_candidate_conjunction(Info, Location, GoalPath, Goals, ++ "proc or goal") ), - convert_candidate_par_conjunction(pard_goal_detail_to_pard_goal, - Candidate, FBCandidate), + convert_candidate_par_conjunction( + pard_goal_detail_to_pard_goal, Candidate, FBCandidate), VarTable = Info ^ ipi_var_table, create_candidate_parallel_conj_report(VarTable, ProcLabel, FBCandidate, Report), @@ -1117,7 +1124,7 @@ preprocess_conjunction(Goals, MaybeGoalsForParallelisation, Location, FirstCostlyGoalIndex = FirstCostlyGoalIndexPrime, LastCostlyGoalIndex = LastCostlyGoalIndexPrime ; - error(this_file ++ "too few costly goals") + unexpected($module, $pred, "too few costly goals") ), % Phase 3: Check that all the middle goals are model det. @@ -1216,7 +1223,7 @@ goal_accumulate_detism(_, Goal, !Detism) :- -> !:Detism = FinalDetism ; - error(this_file ++ "Cannot compute detism from components.") + unexpected($module, $pred, "cannot compute detism from components.") ). % foldl(preprocess_conjunction_into_groups, Goals, FirstCostlyGoalIndex, @@ -1306,9 +1313,10 @@ find_best_parallelisation_complete_bnb(Info, Location, Algorithm, ) ). - % The objective function for the branch and bound search. This is ParTime - % + ParOverheads * 2. That is we're willing to pay 1 unit of parallel - % overheads to get a 2 unit improvement of parallel execution time. + % The objective function for the branch and bound search. + % This is ParTime + ParOverheads * 2. That is we are willing to pay + % 1 unit of parallel overheads to get a 2 unit improvement + % of parallel execution time. % :- func parallelisation_get_objective_value(best_parallelisation) = float. @@ -1334,8 +1342,8 @@ generate_parallelisations(Info, Algorithm, GoalsForParallelisation, ( semipure should_expand_search(BNBState, Algorithm) -> - % Try to push goals into the first and last parallel conjuncts from - % outside the parallel conjunction. + % Try to push goals into the first and last parallel conjuncts + % from outside the parallel conjunction. semipure add_goals_into_first_par_conj(BNBState, !Parallelisation), semipure add_goals_into_last_par_conj(BNBState, !Parallelisation) ; @@ -1390,8 +1398,8 @@ add_goals_into_last_par_conj(BNBState, !Parallelisation) :- ). % Set the last scheduled goal to the goal at the end of the first group, - % popping the first group off the list. This initialises the - % parallelistion with the first goal group occurring first in the first + % popping the first group off the list. This initialises the + % parallelisation with the first goal group occurring first in the first % parallel conjunction. % % This is done outside of the loop below since the first goal group will @@ -1404,7 +1412,7 @@ add_goals_into_last_par_conj(BNBState, !Parallelisation) :- start_first_par_conjunct(!GoalGroups, !Parallelisation) :- ( !.GoalGroups = [], - error(this_file ++ "No goal groups.") + unexpected($module, $pred, "no goal groups") ; !.GoalGroups = [Group | !:GoalGroups], gg_get_details(Group, Index, Num, _), @@ -1431,7 +1439,8 @@ generate_parallelisations_body(Info, BNBState, Algorithm, !:AddToNewParallelisation = !.Parallelisation, % Consider adding this goal to the last parallel conjunct. - !AddToLastParallelisation ^ ip_last_scheduled_goal := LastScheduledGoal, + !AddToLastParallelisation ^ ip_last_scheduled_goal + := LastScheduledGoal, score_parallelisation(BNBState, MaybeAddToLastScore, !AddToLastParallelisation), @@ -1523,7 +1532,8 @@ should_expand_search(BNBState, Algorithm) :- % bound solver. % :- semipure pred test_parallelisation(bnb_state(best_parallelisation)::in, - incomplete_parallelisation::in, incomplete_parallelisation::out) is semidet. + incomplete_parallelisation::in, incomplete_parallelisation::out) + is semidet. test_parallelisation(BNBState, !Parallelisation) :- calculate_parallel_cost(CostData, !Parallelisation), @@ -1551,8 +1561,8 @@ score_parallelisation(BNBState, MaybeScore, !Parallelisation) :- MaybeScore = no ). - % Test that the parallelisation only included dependant parallelism if - % permitted by the user. + % Test that the parallelisation only included dependant parallelism + % if permitted by the user. % :- pred test_dependance(implicit_parallelism_info::in, parallelisation_cost_data::in) is semidet. @@ -1583,7 +1593,7 @@ test_dependance(Info, CostData) :- % The index of the last goal in the parallel conjunction. ip_last_par_goal :: int, - % The index of the last goal that has been (tentativly) + % The index of the last goal that has been (tentatively) % scheduled. All goals between this +1 and ip_last_par_goal % have not been scheduled. ip_last_scheduled_goal :: int, @@ -1677,8 +1687,9 @@ start_building_parallelisation(Info, PreprocessedGoals, Parallelisation) :- LastParGoal = PreprocessedGoals ^ gfp_last_costly_goal, NumCalls = PreprocessedGoals ^ gfp_num_calls, DependencyGraphs = PreprocessedGoals ^ gfp_dependency_graphs, - Parallelisation = incomplete_parallelisation(Info, GoalsArray, FirstParGoal, - LastParGoal, FirstParGoal, [], NumCalls, DependencyGraphs, no, no, no). + Parallelisation = incomplete_parallelisation(Info, GoalsArray, + FirstParGoal, LastParGoal, FirstParGoal, [], NumCalls, + DependencyGraphs, no, no, no). % Finalise the parallelisation. % @@ -1694,8 +1705,7 @@ finalise_parallelisation(Incomplete, Best) :- MaybeCostData = yes(CostData) ; MaybeCostData = no, - error(this_file ++ "finalise_parallelisation: " - ++ "Parallelisation has no cost data") + unexpected($module, $pred, "parallelisation has no cost data") ), CostData = parallelisation_cost_data(Overlap, Metrics0, _), @@ -1744,17 +1754,17 @@ add_one_goal_into_last_par_conj(!Parallelisation) :- :- type dependent_conjunct_execution ---> dependent_conjunct_execution( + % Pairs of start and stop times of the execution. + % Assume that the list is not sorted. dce_execution :: assoc_list(float, float), - % Pairs of start and stop times of the execution. Assume - % that the list is not sorted. + % The variable productions. This may be a superset of the + % dependent variables. dce_productions :: map(var_rep, float), - % The variable productions. This may be a superset of the - % dependent variables. + % The variable consumptions. This will contain only + % references for those variables that will become futures. dce_consumptions :: map(var_rep, float) - % The variable consumptions. This will contain only - % references for those variables that will become futures. ). % calculate_parallel_cost(Info, !Parallelisation). @@ -1858,13 +1868,13 @@ calculate_parallel_cost_step(Info, IsLastConjunct, Conjunct, !ConjNum, Vars = set.intersect(ProducedVars, RightConsumedVars), % This conjunct will actually start after it has been sparked by - % the prevous conjunct. Which in turn may have been sparked by an + % the previous conjunct, which in turn may have been sparked by an % earlier conjunct. SparkDelay = Info ^ ipi_opts ^ cpcp_sparking_delay, StartTime0 = float((!.ConjNum - 1) * SparkDelay), - % If there are conjuncts after this conjunct we will have the - % additional cost of sparking them. + % If there are conjuncts after this conjunct, we will have + % the additional cost of sparking them. ( IsLastConjunct = not_last_par_conjunct, SparkCost = Info ^ ipi_opts ^ cpcp_sparking_cost, @@ -1877,8 +1887,8 @@ calculate_parallel_cost_step(Info, IsLastConjunct, Conjunct, !ConjNum, ( Algorithm = parallelise_dep_conjs_overlap, - % Get the list of variables consumed by this conjunct that will be - % turned into futures. + % Get the list of variables consumed by this conjunct + % that will be turned into futures. foldl3(get_consumptions_list, Conjunct, Vars, _, 0.0, _, [], ConsumptionsList0), reverse(ConsumptionsList0, ConsumptionsList), @@ -1889,8 +1899,8 @@ calculate_parallel_cost_step(Info, IsLastConjunct, Conjunct, !ConjNum, StartTime, LastParConsumeTime, StartTime, LastResumeTime, [], RevExecution0, map.init, ConsumptionsMap), - % Calculate the point at which this conjunct finishes execution and - % complete the RevExecutions structure.. + % Calculate the point at which this conjunct finishes execution + % and complete the RevExecutions structure.. reverse(RevExecution, Execution), CostBPar = LastParConsumeTime + (CostB - LastSeqConsumeTime), RevExecution = [ (LastResumeTime - CostBPar) | RevExecution0 ], @@ -1912,8 +1922,8 @@ calculate_parallel_cost_step(Info, IsLastConjunct, Conjunct, !ConjNum, !:Metrics = init_parallel_exec_metrics_incomplete(!.Metrics, CostSignals, CostB, CostBPar), - % Build the productions map for the next conjunct. This map contains all - % the variables produced by this code, not just that are used for + % Build the productions map for the next conjunct. This map contains + % all the variables produced by this code, not just that are used for % dependent parallelisation. foldl3(get_productions_map, Conjunct, StartTime, _, Execution, _, !ProductionsMap), @@ -1968,11 +1978,11 @@ calculate_dependent_parallel_cost_2(Info, ProductionsMap, Var - SeqConsTime, % Consider (P & Q): % - % Q cannot consume the variable until P produces it. Also Q cannot consume - % the variable until it is ready for it. These are the two parameters to + % Q cannot consume the variable until P produces it. Also Q cannot consume + % the variable until it is ready for it. These are the two parameters to % max/2. % - % The second parameter can be explained further, Q may have waited on a + % The second parameter can be explained further. Q may have waited on a % future previously, if so !.PrevParConsumeTime is when it finished % waiting, and SeqConsTime - !.PrevSeqConsumeTime is how long Q will take % between the two waits. @@ -1984,8 +1994,8 @@ calculate_dependent_parallel_cost_2(Info, ProductionsMap, Var - SeqConsTime, float(Info ^ ipi_opts ^ cpcp_future_wait_cost), ( - % True if Q had to suspend waiting for P, Not that we don't include - % FutureSyncTime here. This is true if Q has to block at all even if + % True if Q had to suspend waiting for P. Note that we don't include + % FutureSyncTime here. This is true if Q has to block at all even if % it can be made runable before the context switch is complete. ProdTime > ParConsTimeNotBlocked -> @@ -1993,7 +2003,7 @@ calculate_dependent_parallel_cost_2(Info, ProductionsMap, Var - SeqConsTime, ParConsTime = ParConsTime0 + float(Info ^ ipi_opts ^ cpcp_context_wakeup_delay), !:RevExecution = - [ (!.ResumeTime - ParConsTimeNotBlocked) | !.RevExecution ], + [(!.ResumeTime - ParConsTimeNotBlocked) | !.RevExecution], !:ResumeTime = ParConsTime ; ParConsTime = ParConsTime0 @@ -2024,27 +2034,26 @@ par_conj_overlap_is_dependent(peo_conjunction(Left, _, VarSet0), IsDependent) :- ). :- type dependency_graphs - ---> dependency_graphs( - dm_forward :: digraph(int), - dm_forward_tc :: digraph(int) - ). + ---> dependency_graphs( + dm_forward :: digraph(int), + dm_forward_tc :: digraph(int) + ). :- pred build_dependency_graphs(list(pard_goal_detail)::in, dependency_graphs::out) is det. build_dependency_graphs(Goals, Maps) :- Graph0 = digraph.init, - build_dependency_graph(Goals, 1, map.init, _VarDepMap, - Graph0, Graph), + build_dependency_graph(Goals, 1, map.init, _VarDepMap, Graph0, Graph), Maps = dependency_graphs(Graph, tc(Graph)). :- pred depends_lookup(dependency_graphs::in, int::in, set(int)::out) is det. depends_lookup(DependencyGraphs, GoalNum, Deps) :- - graph_do_lookup(lookup_from, DependencyGraphs ^ dm_forward, GoalNum, - Deps). + graph_do_lookup(lookup_from, DependencyGraphs ^ dm_forward, GoalNum, Deps). -:- pred depends_lookup_tc(dependency_graphs::in, int::in, set(int)::out) is det. +:- pred depends_lookup_tc(dependency_graphs::in, int::in, set(int)::out) + is det. depends_lookup_tc(DependencyGraphs, GoalNum, Deps) :- graph_do_lookup(lookup_from, DependencyGraphs ^ dm_forward_tc, GoalNum, @@ -2213,11 +2222,11 @@ get_consumptions_list(Goal, !Vars, !Time, !List) :- ConsumptionVars = intersect(!.Vars, AllConsumptionVars), map(var_consumptions(!.Time, Goal), ConsumptionVars, ConsumptionTimesSet0), - % Since we re-sort the list we don't need a sorted one to start with, but - % the set module doesn't export a "to_list" predicate, (Sorting has no - % cost since the set is a sorted list internally). + % Since we re-sort the list we don't need a sorted one to start with, + % but the set module doesn't export a "to_list" predicate. (Getting + % a sorted list has no cost since the set is a sorted list internally). set.to_sorted_list(ConsumptionTimesSet0, ConsumptionTimes0), - sort((pred((_ - TimeA)::in, (_ - TimeB)::in, Result::out) is det :- + list.sort((pred((_ - TimeA)::in, (_ - TimeB)::in, Result::out) is det :- % Note that the Time arguments are swapped, this list must be % produced in latest to earliest order. compare(Result, TimeB, TimeA) @@ -2302,7 +2311,7 @@ pardgoal_consumed_vars_accum(Goal, !Vars) :- RefedVars = Goal ^ goal_annotation ^ pgd_inst_map_info ^ im_consumed_vars, set.union(RefedVars, !Vars). - % Check if it is appropriate to parallelise this call. That is it must be + % Check if it is appropriate to parallelise this call. That is it must be % model_det and have a cost above the call site cost threshold. % :- pred can_parallelise_goal(goal_rep(T)::in) is semidet. @@ -2432,12 +2441,12 @@ compute_var_use_lazy(Info, GoalPath, Var, Args, VarUseType) = Use :- Uses = [Use] ; Uses = [_, _ | _], - error(this_file ++ "Too many solutions to compute_var_use_lazy_arg" - ++ " for a production") + unexpected($module, $pred, "Too many solutions ") ) ). -:- pred earliest_use(var_use_info::in, var_use_info::in, var_use_info::out) is det. +:- pred earliest_use(var_use_info::in, var_use_info::in, var_use_info::out) + is det. earliest_use(A, B, Ealiest) :- TimeA = A ^ vui_cost_until_use, @@ -2452,7 +2461,8 @@ earliest_use(A, B, Ealiest) :- list(var_rep)::in, cost_and_callees::in, cs_cost_csq::in, var_use_type::in, var_use_info::out) is multi. -compute_var_use_lazy_arg(Info, Var, Args, CostAndCallee, Cost, VarUseType, Use) :- +compute_var_use_lazy_arg(Info, Var, Args, CostAndCallee, Cost, VarUseType, + Use) :- ( 0.0 < cs_cost_get_calls(Cost) -> CostPercall = cs_cost_get_percall(Cost), ( member_index0(Var, Args, ArgNum) -> @@ -2466,8 +2476,8 @@ compute_var_use_lazy_arg(Info, Var, Args, CostAndCallee, Cost, VarUseType, Use) ( singleton_set(CostAndCallee ^ cac_callees, CalleePrime) -> Callee = CalleePrime ; - error(this_file ++ - "First-order call site has wrong number of CSDs") + unexpected($module, $pred, + "first-order call site has wrong number of CSDs") ), CSDPtr = Callee ^ c_csd, RecursionType = Info ^ ipi_recursion_type, @@ -2482,8 +2492,13 @@ compute_var_use_lazy_arg(Info, Var, Args, CostAndCallee, Cost, VarUseType, Use) ) ; Use = var_use_info(0.0, CostPercall, VarUseType), - require(unify(VarUseType, var_use_consumption), this_file ++ - "Var use type most be consumption if \\+ member(Var, Args)") + ( unify(VarUseType, var_use_consumption) -> + true + ; + unexpected($module, $pred, + "Var use type most be consumption if " ++ + "\\+ member(Var, Args)") + ) ) ; % This call site is never called. @@ -2626,7 +2641,7 @@ identify_costly_goal(Goal, Costly) :- Costly = is_costly_atomic_goal ; GoalType = pgt_other_atomic_goal, - error(this_file ++ "pgt_other_atomic_goal is never costly") + unexpected($module, $pred, "pgt_other_atomic_goal is never costly") ; GoalType = pgt_non_atomic_goal, % TODO: distinguish between compound goals with one branch that is @@ -2641,8 +2656,8 @@ identify_costly_goal(Goal, Costly) :- Costly = is_not_costly_goal ). -:- pred var_get_mode(inst_map::in, inst_map::in, var_rep::in, var_mode_rep::out) - is det. +:- pred var_get_mode(inst_map::in, inst_map::in, var_rep::in, + var_mode_rep::out) is det. var_get_mode(InstMapBefore, InstMapAfter, VarRep, VarModeRep) :- inst_map_get(InstMapBefore, VarRep, InstBefore, _), @@ -2663,20 +2678,20 @@ goal_to_pard_goal(Info, GoalPath, !Goal, !Messages) :- ( ( GoalExpr0 = conj_rep(Conjs0), - map_foldl2(conj_to_pard_goals(Info, GoalPath), Conjs0, Conjs, 1, _, - !Messages), + list.map_foldl2(conj_to_pard_goals(Info, GoalPath), Conjs0, Conjs, + 1, _, !Messages), conj_calc_cost(Conjs, Before, Cost), GoalExpr = conj_rep(Conjs) ; GoalExpr0 = disj_rep(Disjs0), - map_foldl2(disj_to_pard_goals(Info, GoalPath), Disjs0, Disjs, 1, _, - !Messages), + list.map_foldl2(disj_to_pard_goals(Info, GoalPath), Disjs0, Disjs, + 1, _, !Messages), disj_calc_cost(Disjs, Before, Cost), GoalExpr = disj_rep(Disjs) ; GoalExpr0 = switch_rep(Var, CanFail, Cases0), - map_foldl2(case_to_pard_goal(Info, GoalPath), Cases0, Cases, 1, _, - !Messages), + list.map_foldl2(case_to_pard_goal(Info, GoalPath), Cases0, Cases, + 1, _, !Messages), switch_calc_cost(Cases, Before, Cost), GoalExpr = switch_rep(Var, CanFail, Cases) ; @@ -2709,7 +2724,8 @@ goal_to_pard_goal(Info, GoalPath, !Goal, !Messages) :- PardGoalType = pgt_non_atomic_goal, BoundVars = to_sorted_list(InstMapInfo ^ im_bound_vars), - foldl(goal_build_use_map(!.Goal, GoalPath, Cost, Info, + list.foldl( + goal_build_use_map(!.Goal, GoalPath, Cost, Info, var_use_production), BoundVars, map.init, ProductionUseMap), ConsumedVars = to_sorted_list(InstMapInfo ^ im_consumed_vars), @@ -2723,11 +2739,13 @@ goal_to_pard_goal(Info, GoalPath, !Goal, !Messages) :- PardGoalType, Messages), atomic_pard_goal_cost(Info, GoalPath, Coverage, AtomicGoal, Cost), - foldl(atomic_goal_build_use_map(AtomicGoal, GoalPath, Info, + list.foldl( + atomic_goal_build_use_map(AtomicGoal, GoalPath, Info, var_use_production), BoundVars, map.init, ProductionUseMap), ConsumedVars = InstMapInfo ^ im_consumed_vars, - foldl(atomic_goal_build_use_map(AtomicGoal, GoalPath, Info, + list.foldl( + atomic_goal_build_use_map(AtomicGoal, GoalPath, Info, var_use_consumption), to_sorted_list(ConsumedVars), map.init, ConsumptionUseMap), @@ -2855,31 +2873,30 @@ simple_goal_cost(Calls) = Cost :- % Annotate a goal with instantiation information. % - % inst_map_info now contains information that it's not necessary to - % contain. Namely the im_after field can be calculated from the im_before - % and im_bound_vars fields. However since this information will probably + % inst_map_info now contains information that it does not need to contain. + % Namely, the im_after field can be calculated from the im_before and + % im_bound_vars fields. However since this information will probably % be attached to a different goal there is not much extra cost in having a % pointer to it from here. % :- type inst_map_info ---> inst_map_info( + % The inst map before this goal is executed. im_before :: inst_map, - % The inst map before this goal is executed. + % The inst map after this goal was executed. im_after :: inst_map, - % The inst map after this goal was executed. + % Variables consumed (read but not bound) by this goal. im_consumed_vars :: set(var_rep), - % Variables consumed (read but not bound) by this goal. + % The variables produced by this goal. im_bound_vars :: set(var_rep) - % The variables produced by this goal. ). :- typeclass goal_annotation_add_instmap(A, B) where [ - pred add_instmap(inst_map_info, A, B), - mode add_instmap(in, in, out) is det - ]. + pred add_instmap(inst_map_info::in, A::in, B::out) is det +]. % Note: It may be useful to add other annotations such as goal path or cost % information. @@ -3055,8 +3072,9 @@ switch_annotate_with_instmap([Case0 | Cases0], [Case | Cases], seen_duplicate_instantiation::out, set(var_rep)::out, set(var_rep)::out) is det <= goal_annotation_add_instmap(A, B). -ite_annotate_with_instmap(Cond0, Cond, Then0, Then, Else0, Else, InstMap0, InstMap, - SeenDuplicateInstantiation, ConsumedVars, BoundVars) :- +ite_annotate_with_instmap(Cond0, Cond, Then0, Then, Else0, Else, + InstMap0, InstMap, SeenDuplicateInstantiation, + ConsumedVars, BoundVars) :- goal_annotate_with_instmap(Cond0, Cond, InstMap0, InstMapAfterCond, SeenDuplicateInstantiationCond, ConsumedVarsCond, _BoundVarsCond), goal_annotate_with_instmap(Then0, Then, InstMapAfterCond, InstMapAfterThen, @@ -3202,12 +3220,6 @@ css_to_call(Deep, CSS, Call) :- % Useful utility predicates. % -:- func this_file = string. - -this_file = "mdprof_fb.automatic_parallelism.m: ". - -%-----------------------------------------------------------------------------% - create_candidate_parallel_conj_proc_report(Proc - CandidateParConjunctionProc, Report) :- CandidateParConjunctionProc = @@ -3228,7 +3240,6 @@ create_candidate_parallel_conj_report(VarTable, Proc, CandidateParConjunction, GoalsAfter, GoalsAfterCost, ParExecMetrics), ParExecMetrics = parallel_exec_metrics(NumCalls, SeqTime, ParTime, ParOverheads, FirstConjDeadTime, FutureDeadTime), - ( IsDependent = conjuncts_are_independent, DependanceString = "no" @@ -3241,18 +3252,19 @@ create_candidate_parallel_conj_report(VarTable, Proc, CandidateParConjunction, Speedup = parallel_exec_metrics_get_speedup(ParExecMetrics), TimeSaving = parallel_exec_metrics_get_time_saving(ParExecMetrics), TotalDeadTime = FirstConjDeadTime + FutureDeadTime, - format(" %s\n" ++ - " Path: %s\n" ++ - " Dependent: %s\n" ++ - " NumCalls: %s\n" ++ - " SeqTime: %s\n" ++ - " ParTime: %s\n" ++ - " ParOverheads: %s\n" ++ - " Speedup: %s\n" ++ - " Time saving: %s\n" ++ - " First conj dead time: %s\n" ++ - " Future dead time: %s\n" ++ - " Total dead time: %s\n\n", + string.format( + " %s\n" ++ + " Path: %s\n" ++ + " Dependent: %s\n" ++ + " NumCalls: %s\n" ++ + " SeqTime: %s\n" ++ + " ParTime: %s\n" ++ + " ParOverheads: %s\n" ++ + " Speedup: %s\n" ++ + " Time saving: %s\n" ++ + " First conj dead time: %s\n" ++ + " Future dead time: %s\n" ++ + " Total dead time: %s\n\n", [s(ProcString), s(GoalPathString), s(DependanceString), @@ -3271,7 +3283,7 @@ create_candidate_parallel_conj_report(VarTable, Proc, CandidateParConjunction, ( goal_path_from_string(GoalPathString, GoalPathPrime) -> GoalPath = GoalPathPrime ; - error(this_file ++ "couldn't parse goal path.") + unexpected($module, $pred, "couldn't parse goal path") ), some [!ConjNum] ( !:ConjNum = FirstConjNum, @@ -3310,8 +3322,8 @@ format_parallel_conjunction(VarTable, Indent, GoalPath0, ConjNum, Conjs, int::in, list(seq_conj(pard_goal))::in, cord(string)::in, cord(string)::out) is det. -format_parallel_conjuncts(_VarTable, Indent, _GoalPath, _ConjNum0, [], - !Report) :- +format_parallel_conjuncts(_VarTable, Indent, _GoalPath, _ConjNum0, + [], !Report) :- IndentStr = indent(Indent), !:Report = snoc(!.Report ++ IndentStr, ")\n"). format_parallel_conjuncts(VarTable, Indent, GoalPath0, ConjNum0, @@ -3319,7 +3331,7 @@ format_parallel_conjuncts(VarTable, Indent, GoalPath0, ConjNum0, Conj = seq_conj(Goals), ( Goals = [], - error(this_file ++ " empty conjunct in parallel conjunction") + unexpected($module, $pred, "empty conjunct in parallel conjunction") ; Goals = [Goal | GoalsTail], GoalPath = goal_path_add_at_end(GoalPath0, step_conj(ConjNum0)), @@ -3361,7 +3373,8 @@ format_sequential_conjunction(VarTable, Indent, GoalPath, Goals, Cost, singleton(format("%% conjunction: %s", [s(goal_path_to_string(GoalPath))])) ++ nl_indent(Indent) ++ - singleton(format("%% Cost: %s", [s(two_decimal_fraction(Cost))])) ++ + singleton(format("%% Cost: %s", + [s(two_decimal_fraction(Cost))])) ++ nl ++ nl ; true @@ -3390,9 +3403,8 @@ format_sequential_conjuncts(VarTable, Indent, GoalPath0, [Conj | Conjs], ). :- instance goal_annotation(pard_goal_annotation) where [ - pred(print_goal_annotation_to_strings/3) is - format_pard_goal_annotation - ]. + pred(print_goal_annotation_to_strings/3) is format_pard_goal_annotation +]. :- pred format_pard_goal_annotation(var_table::in, pard_goal_annotation::in, cord(cord(string))::out) is det. @@ -3408,8 +3420,7 @@ format_pard_goal_annotation(VarTable, GoalAnnotation, Report) :- CostAboveThresholdStr = "not above threshold" ), CostLine = singleton(format("cost: %s (%s)", - [s(two_decimal_fraction(CostPercall)), - s(CostAboveThresholdStr)])), + [s(two_decimal_fraction(CostPercall)), s(CostAboveThresholdStr)])), format_var_use_report(VarTable, productions, Productions, ProductionsReport), format_var_use_report(VarTable, consumptions, Consumptions, @@ -3454,19 +3465,21 @@ debug_cliques_below_threshold(Clique, !IO) :- CliquePtr = clique_ptr(CliqueNum), Calls = cs_cost_get_calls(Clique ^ ccc_cs_cost), PercallCost = cs_cost_get_percall(Clique ^ ccc_cs_cost), - io.format("D: Not entering clique: %d, " ++ - "it is below the clique threashold\n " ++ + io.format( + "D: Not entering clique: %d, " ++ + "it is below the clique threshold\n " ++ "It has per-call cost %f and is called %f times\n\n", [i(CliqueNum), f(PercallCost), f(Calls)], !IO). -:- pred debug_cliques_exeeded_parallelism(candidate_child_clique::in, +:- pred debug_cliques_exceeded_parallelism(candidate_child_clique::in, io::di, io::uo) is det. -debug_cliques_exeeded_parallelism(Clique, !IO) :- +debug_cliques_exceeded_parallelism(Clique, !IO) :- CliquePtr = Clique ^ ccc_clique, CliquePtr = clique_ptr(CliqueNum), - io.format("D: Not entiring clique %d, " ++ - "no-more parallelisation resources available at this context\n\n", + io.format( + "D: Not entiring clique %d, " ++ + "no more parallelisation resources available at this context\n\n", [i(CliqueNum)], !IO). %-----------------------------------------------------------------------------% diff --git a/deep_profiler/mdprof_fb.m b/deep_profiler/mdprof_fb.m index 42b3d1b43..b5c7bfd1a 100644 --- a/deep_profiler/mdprof_fb.m +++ b/deep_profiler/mdprof_fb.m @@ -1,7 +1,7 @@ %-----------------------------------------------------------------------------% % vim: ft=mercury ts=4 sw=4 et %-----------------------------------------------------------------------------% -% Copyright (C) 2009 The University of Melbourne. +% Copyright (C) 2009-2010 The University of Melbourne. % This file may only be copied under the terms of the GNU General % Public License - see the file COPYING in the Mercury distribution. %-----------------------------------------------------------------------------% @@ -9,7 +9,7 @@ % File: mdprof_fb.m. % Author: pbone. % -% Deep Profiling feedback procuedres. Each sub-module gathers some deep +% Deep profiling feedback procedures. Each submodule gathers some deep % profiling feedback information for use by the compiler. % %-----------------------------------------------------------------------------% diff --git a/deep_profiler/mdprof_feedback.m b/deep_profiler/mdprof_feedback.m index 3209e9de9..213ba28c8 100644 --- a/deep_profiler/mdprof_feedback.m +++ b/deep_profiler/mdprof_feedback.m @@ -9,10 +9,11 @@ % File: mdprof_feedback.m. % Author: tannier, pbone. % -% This module contains the code for writing to a file the CSSs whose CSDs' +% This module contains the code for writing to a file the CSSs whose CSD's % mean/median call sequence counts (own and desc) exceed the given threshold. % -% The generated file will then be used by the compiler for implicit parallelism. +% The generated file will then be used by the compiler for +% implicit parallelism. % %-----------------------------------------------------------------------------% @@ -181,24 +182,33 @@ create_feedback_report(feedback_data_candidate_parallel_conjunctions( ContextWakeupDelay, CliqueThreshold, CallSiteThreshold, ParalleliseDepConjs, BestParAlgorithm), best_par_algorithm_string(BestParAlgorithm, BestParAlgorithmStr), - ReportHeader = singleton(format(" Candidate Parallel Conjunctions:\n" ++ - " Desired parallelism: %f\n" ++ - " Intermodule var use: %s\n" ++ - " Sparking cost: %d\n" ++ - " Sparking delay: %d\n" ++ - " Future signal cost: %d\n" ++ - " Future wait cost: %d\n" ++ - " Context wakeup delay: %d\n" ++ - " Clique threshold: %d\n" ++ - " Call site threshold: %d\n" ++ - " Parallelise dependant conjunctions: %s\n" ++ - " BestParallelisationAlgorithm: %s\n" ++ - " Number of Parallel Conjunctions: %d\n" ++ - " Parallel Conjunctions:\n\n", - [f(DesiredParallelism), s(string(IntermoduleVarUse)), i(SparkingCost), - i(SparkingDelay), i(SignalCost), i(WaitCost), i(ContextWakeupDelay), - i(CliqueThreshold), i(CallSiteThreshold), s(ParalleliseDepConjsStr), - s(BestParAlgorithmStr), i(NumConjs)])), + ReportHeader = singleton(format( + " Candidate Parallel Conjunctions:\n" ++ + " Desired parallelism: %f\n" ++ + " Intermodule var use: %s\n" ++ + " Sparking cost: %d\n" ++ + " Sparking delay: %d\n" ++ + " Future signal cost: %d\n" ++ + " Future wait cost: %d\n" ++ + " Context wakeup delay: %d\n" ++ + " Clique threshold: %d\n" ++ + " Call site threshold: %d\n" ++ + " Parallelise dependant conjunctions: %s\n" ++ + " BestParallelisationAlgorithm: %s\n" ++ + " Number of Parallel Conjunctions: %d\n" ++ + " Parallel Conjunctions:\n\n", + [f(DesiredParallelism), + s(string(IntermoduleVarUse)), + i(SparkingCost), + i(SparkingDelay), + i(SignalCost), + i(WaitCost), + i(ContextWakeupDelay), + i(CliqueThreshold), + i(CallSiteThreshold), + s(ParalleliseDepConjsStr), + s(BestParAlgorithmStr), + i(NumConjs)])), ( ParalleliseDepConjs = parallelise_dep_conjs_overlap, ParalleliseDepConjsStr = "yes, use overlap calculation" @@ -264,7 +274,7 @@ help_message = call sequence counts. --implicit-parallelism-sparking-delay The time taken from the time a spark is created until the spark - is executed by another processor assuming that there is a free + is executed by another processor, assuming that there is a free processor. --implicit-parallelism-future-signal-cost The cost of the signal() call for the producer of a shared @@ -284,25 +294,25 @@ help_message = The cost of a call site to be considered for parallelism against another call site. --implicit-parallelism-dependant-conjunctions - Advise the compiler to parallelism dependant conjunctions. + Advise the compiler to parallelise dependant conjunctions. This will become the default once the implementation is complete. - --implicit-parallelism-dependant-conjunctions-algorithm