[m-rev.] diff: change the representation of pragma items
Zoltan Somogyi
zs at unimelb.edu.au
Wed Sep 5 16:17:51 AEST 2012
This diff changes data representations, but has no significant changes
in algorithms.
This diff is performance neutral; the difference in performance it makes
is in the noise. This is not surprising. Since the compiler does not spend
much time handling pragmas, how we handle them does not affect speed much.
compiler/prog_item.m:
Change the representation of items representing pragmas.
The first change is providing a bunch of types that each store
all the information needed for one or more kinds of pragma.
This allows the information about a pragma to be passed around
and manipulated as an entity of its own. This is the main
reason for the change; I want to add a new pragma type,
and I want new pragma types to be easy to add.
The second change is factoring out some commonalities in these types,
specifically, the various different ways of specifying predicates
and procedures.
compiler/hlds_module.m:
Take advantage of the first change above to make a data type
tighter.
compiler/add_pragma.m:
compiler/add_solver.m:
compiler/equiv_type.m:
compiler/exception_analysis.m:
compiler/intermod.m:
compiler/make_hlds_passes.m:
compiler/mercury_to_mercury.m:
compiler/module_imports.m:
compiler/module_qual.m:
compiler/modules.m:
compiler/prog_io.m:
compiler/prog_io_pragma.m:
compiler/recompilation.usage.m:
compiler/recompilation.version.m:
compiler/structure_reuse.analysis.m:
compiler/structure_sharing.analysis.m:
compiler/tabling_analysis.m:
compiler/term_info.m:
compiler/termination.m:
compiler/trailing_analysis.m:
compiler/unused_args.m:
Conform to the changes above.
Zoltan.
cvs diff: Diffing .
cvs diff: Diffing analysis
cvs diff: Diffing bindist
cvs diff: Diffing boehm_gc
cvs diff: Diffing boehm_gc/Mac_files
cvs diff: Diffing boehm_gc/cord
cvs diff: Diffing boehm_gc/cord/private
cvs diff: Diffing boehm_gc/doc
cvs diff: Diffing boehm_gc/extra
cvs diff: Diffing boehm_gc/include
cvs diff: Diffing boehm_gc/include/extra
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing boehm_gc/libatomic_ops
cvs diff: Diffing boehm_gc/libatomic_ops/doc
cvs diff: Diffing boehm_gc/libatomic_ops/pkgconfig
cvs diff: Diffing boehm_gc/libatomic_ops/src
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/armcc
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/gcc
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/hpc
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/ibmc
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/icc
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/msftc
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/sunc
cvs diff: Diffing boehm_gc/libatomic_ops/tests
cvs diff: Diffing boehm_gc/libatomic_ops-1.2
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/doc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/tests
cvs diff: Diffing boehm_gc/m4
cvs diff: Diffing boehm_gc/tests
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
Index: compiler/add_pragma.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/add_pragma.m,v
retrieving revision 1.128
diff -u -b -r1.128 add_pragma.m
--- compiler/add_pragma.m 2 Jul 2012 01:16:32 -0000 1.128
+++ compiler/add_pragma.m 5 Sep 2012 04:59:59 -0000
@@ -14,7 +14,6 @@
:- import_module hlds.make_hlds.make_hlds_passes.
:- import_module hlds.make_hlds.qual_info.
:- import_module libs.globals.
-:- import_module mdbcomp.prim_data.
:- import_module parse_tree.error_util.
:- import_module parse_tree.prog_data.
:- import_module parse_tree.prog_item.
@@ -30,71 +29,56 @@
item_status::in, item_status::out, module_info::in, module_info::out,
list(error_spec)::in, list(error_spec)::out) is det.
-:- pred add_pragma_foreign_export(item_origin::in, foreign_language::in,
- sym_name::in, pred_or_func::in, list(mer_mode)::in, string::in,
- prog_context::in, module_info::in, module_info::out,
+:- pred add_pragma_foreign_export(item_origin::in,
+ pragma_info_foreign_export::in, prog_context::in,
+ module_info::in, module_info::out,
list(error_spec)::in, list(error_spec)::out) is det.
-:- pred add_pragma_reserve_tag(sym_name::in, arity::in, import_status::in,
+:- pred add_pragma_reserve_tag(type_ctor::in, import_status::in,
prog_context::in, module_info::in, module_info::out,
list(error_spec)::in, list(error_spec)::out) is det.
-:- pred add_pragma_foreign_export_enum(foreign_language::in, sym_name::in,
- arity::in, export_enum_attributes::in, assoc_list(sym_name, string)::in,
+:- pred add_pragma_foreign_export_enum(pragma_info_foreign_export_enum::in,
import_status::in, prog_context::in, module_info::in, module_info::out,
list(error_spec)::in, list(error_spec)::out) is det.
-:- pred add_pragma_foreign_enum(foreign_language::in, sym_name::in,
- arity::in, assoc_list(sym_name, string)::in, import_status::in,
- prog_context::in, module_info::in, module_info::out,
+:- pred add_pragma_foreign_enum(pragma_info_foreign_enum::in,
+ import_status::in, prog_context::in, module_info::in, module_info::out,
list(error_spec)::in, list(error_spec)::out) is det.
-:- pred add_pragma_type_spec(pragma_type::in(pragma_type_spec),
- term.context::in, module_info::in, module_info::out,
- qual_info::in, qual_info::out,
+:- pred add_pragma_type_spec(pragma_info_type_spec::in, term.context::in,
+ module_info::in, module_info::out, qual_info::in, qual_info::out,
list(error_spec)::in, list(error_spec)::out) is det.
-:- pred add_pragma_termination2_info(pred_or_func::in, sym_name::in,
- list(mer_mode)::in, maybe(pragma_constr_arg_size_info)::in,
- maybe(pragma_constr_arg_size_info)::in,
- maybe(pragma_termination_info)::in, prog_context::in,
- module_info::in, module_info::out,
+:- pred add_pragma_termination_info(pragma_info_termination_info::in,
+ prog_context::in, module_info::in, module_info::out,
list(error_spec)::in, list(error_spec)::out) is det.
-:- pred add_pragma_termination_info(pred_or_func::in, sym_name::in,
- list(mer_mode)::in, maybe(pragma_arg_size_info)::in,
- maybe(pragma_termination_info)::in, prog_context::in,
- module_info::in, module_info::out,
+:- pred add_pragma_termination2_info(pragma_info_termination2_info::in,
+ prog_context::in, module_info::in, module_info::out,
list(error_spec)::in, list(error_spec)::out) is det.
-:- pred add_pragma_structure_sharing(pred_or_func::in, sym_name::in,
- list(mer_mode)::in, list(prog_var)::in, list(mer_type)::in,
- maybe(structure_sharing_domain)::in, prog_context::in,
- module_info::in, module_info::out,
+:- pred add_pragma_structure_sharing(pragma_info_structure_sharing::in,
+ prog_context::in, module_info::in, module_info::out,
list(error_spec)::in, list(error_spec)::out) is det.
-:- pred add_pragma_structure_reuse(pred_or_func::in, sym_name::in,
- list(mer_mode)::in, list(prog_var)::in, list(mer_type)::in,
- maybe(structure_reuse_domain)::in, prog_context::in,
- module_info::in, module_info::out,
+:- pred add_pragma_structure_reuse(pragma_info_structure_reuse::in,
+ prog_context::in, module_info::in, module_info::out,
list(error_spec)::in, list(error_spec)::out) is det.
-:- pred module_add_pragma_foreign_proc(pragma_foreign_proc_attributes::in,
- sym_name::in, pred_or_func::in, list(pragma_var)::in, prog_varset::in,
- inst_varset::in, pragma_foreign_code_impl::in, import_status::in,
- prog_context::in, maybe(int)::in, module_info::in, module_info::out,
- qual_info::in, qual_info::out,
+ % ZZZ 1
+:- pred module_add_pragma_foreign_proc(pragma_info_foreign_proc::in,
+ import_status::in, prog_context::in, maybe(int)::in,
+ module_info::in, module_info::out, qual_info::in, qual_info::out,
list(error_spec)::in, list(error_spec)::out) is det.
-:- pred module_add_pragma_tabled(eval_method::in, sym_name::in, int::in,
- maybe(pred_or_func)::in, maybe(list(mer_mode))::in,
- maybe(table_attributes)::in, prog_context::in,
+:- pred module_add_pragma_tabled(pragma_info_tabled::in, prog_context::in,
import_status::in, import_status::out, module_info::in, module_info::out,
qual_info::in, qual_info::out,
list(error_spec)::in, list(error_spec)::out) is det.
- % module_add_pragma_fact_table(PredName, Arity, FileName,
- % Status, Context, Module0, Module, !Info):
+ % module_add_pragma_fact_table(FTInfo, Status, Context,
+ % !ModuleInfo, !Info):
%
% Add a `pragma fact_table' declaration to the HLDS. This predicate calls
% the fact table compiler (fact_table_compile_facts) to create a separate
@@ -102,7 +86,7 @@
% `pragma c_code' to access the table in each mode of the fact table
% predicate.
%
-:- pred module_add_pragma_fact_table(sym_name::in, arity::in, string::in,
+:- pred module_add_pragma_fact_table(pragma_info_fact_table::in,
import_status::in, prog_context::in, module_info::in, module_info::out,
qual_info::in, qual_info::out,
list(error_spec)::in, list(error_spec)::out) is det.
@@ -146,6 +130,7 @@
:- import_module ll_backend.
:- import_module ll_backend.fact_table.
:- import_module ll_backend.rtti_out.
+:- import_module mdbcomp.prim_data.
:- import_module ml_backend.
:- import_module ml_backend.mlds.
:- import_module ml_backend.mlds_to_c.
@@ -207,90 +192,92 @@
% with elsewhere.
Pragma = pragma_source_file(_)
;
- Pragma = pragma_foreign_code(Lang, Body_Code),
+ Pragma = pragma_foreign_code(FCInfo),
+ FCInfo = pragma_info_foreign_code(Lang, Body_Code),
module_add_foreign_body_code(Lang, Body_Code, Context, !ModuleInfo)
;
- Pragma = pragma_foreign_decl(Lang, IsLocal, C_Header),
+ Pragma = pragma_foreign_decl(FDInfo),
+ FDInfo = pragma_info_foreign_decl(Lang, IsLocal, C_Header),
module_add_foreign_decl(Lang, IsLocal, C_Header, Context, !ModuleInfo)
;
- Pragma = pragma_foreign_import_module(Lang, Import),
+ Pragma = pragma_foreign_import_module(FIMInfo),
+ FIMInfo = pragma_info_foreign_import_module(Lang, Import),
module_add_foreign_import_module(Lang, Import, Context, !ModuleInfo)
;
% Handle pragma foreign procs later on (when we process clauses).
- Pragma = pragma_foreign_proc(_, _, _, _, _, _, _)
+ Pragma = pragma_foreign_proc(_)
;
% Handle pragma foreign_export_enum (after we have added all the
% types).
- Pragma = pragma_foreign_export_enum(_, _, _, _, _)
+ Pragma = pragma_foreign_export_enum(_)
;
% Likewise for pragma foreign_enum.
- Pragma = pragma_foreign_enum(_, _, _, _)
+ Pragma = pragma_foreign_enum(_)
;
% Handle pragma tabled decls later on (when we process clauses).
- Pragma = pragma_tabled(_, _, _, _, _, _)
+ Pragma = pragma_tabled(_)
;
- Pragma = pragma_inline(Name, Arity),
+ Pragma = pragma_inline(PredNameArity),
+ PredNameArity = pred_name_arity(Name, Arity),
add_pred_marker("inline", Name, Arity, ImportStatus, Context,
marker_user_marked_inline, [marker_user_marked_no_inline],
!ModuleInfo, !Specs)
;
- Pragma = pragma_no_inline(Name, Arity),
+ Pragma = pragma_no_inline(PredNameArity),
+ PredNameArity = pred_name_arity(Name, Arity),
add_pred_marker("no_inline", Name, Arity, ImportStatus, Context,
marker_user_marked_no_inline, [marker_user_marked_inline],
!ModuleInfo, !Specs)
;
- Pragma = pragma_obsolete(Name, Arity),
+ Pragma = pragma_obsolete(PredNameArity),
+ PredNameArity = pred_name_arity(Name, Arity),
add_pred_marker("obsolete", Name, Arity, ImportStatus,
Context, marker_obsolete, [], !ModuleInfo, !Specs)
;
- Pragma = pragma_no_detism_warning(Name, Arity),
+ Pragma = pragma_no_detism_warning(PredNameArity),
+ PredNameArity = pred_name_arity(Name, Arity),
add_pred_marker("no_determinism_warning", Name, Arity, ImportStatus,
Context, marker_no_detism_warning, [], !ModuleInfo, !Specs)
;
% Handle pragma foreign_export decls later on, after default
% function modes have been added.
- Pragma = pragma_foreign_export(_, _, _, _, _)
+ Pragma = pragma_foreign_export(_)
;
% Used for inter-module unused argument elimination.
% This can only appear in .opt files.
- Pragma = pragma_unused_args(PredOrFunc, SymName, Arity, ModeNum,
- UnusedArgs),
+ Pragma = pragma_unused_args(UnusedArgsInfo),
( ImportStatus \= status_opt_imported ->
Pieces = [words("Error: illegal use of pragma `unused_args'.")],
Msg = simple_msg(Context, [always(Pieces)]),
Spec = error_spec(severity_error, phase_parse_tree_to_hlds, [Msg]),
!:Specs = [Spec | !.Specs]
;
- add_pragma_unused_args(PredOrFunc, SymName, Arity, ModeNum,
- UnusedArgs, Context, !ModuleInfo, !Specs)
+ add_pragma_unused_args(UnusedArgsInfo, Context,
+ !ModuleInfo, !Specs)
)
;
- Pragma = pragma_exceptions(PredOrFunc, SymName, Arity, ModeNum,
- ThrowStatus),
+ Pragma = pragma_exceptions(ExceptionsInfo),
( ImportStatus \= status_opt_imported ->
Pieces = [words("Error: illegal use of pragma `exceptions'.")],
Msg = simple_msg(Context, [always(Pieces)]),
Spec = error_spec(severity_error, phase_parse_tree_to_hlds, [Msg]),
!:Specs = [Spec | !.Specs]
;
- add_pragma_exceptions(PredOrFunc, SymName, Arity, ModeNum,
- ThrowStatus, Context, !ModuleInfo, !Specs)
+ add_pragma_exceptions(ExceptionsInfo, Context, !ModuleInfo, !Specs)
)
;
- Pragma = pragma_trailing_info(PredOrFunc, SymName, Arity, ModeNum,
- TrailingStatus),
+ Pragma = pragma_trailing_info(TrailingInfo),
( ImportStatus \= status_opt_imported ->
Pieces = [words("Error: illegal use of pragma `trailing_info'.")],
Msg = simple_msg(Context, [always(Pieces)]),
Spec = error_spec(severity_error, phase_parse_tree_to_hlds, [Msg]),
!:Specs = [Spec | !.Specs]
;
- add_pragma_trailing_info(PredOrFunc, SymName, Arity, ModeNum,
- TrailingStatus, Context, !ModuleInfo, !Specs)
+ add_pragma_trailing_info(TrailingInfo, Context,
+ !ModuleInfo, !Specs)
)
;
- Pragma = pragma_mm_tabling_info(PredOrFunc, SymName, Arity, ModeNum,
- MM_TablingStatus),
+ Pragma = pragma_mm_tabling_info(MMTablingInfo),
( ImportStatus \= status_opt_imported ->
Pieces =
[words("Error: illegal use of pragma `mm_tabling_info',")],
@@ -298,31 +285,34 @@
Spec = error_spec(severity_error, phase_parse_tree_to_hlds, [Msg]),
!:Specs = [Spec | !.Specs]
;
- add_pragma_mm_tabling_info(PredOrFunc, SymName, Arity, ModeNum,
- MM_TablingStatus, Context, !ModuleInfo, !Specs)
+ add_pragma_mm_tabling_info(MMTablingInfo, Context,
+ !ModuleInfo, !Specs)
)
;
% Handle pragma type_spec decls later on (when we process clauses).
- Pragma = pragma_type_spec(_, _, _, _, _, _, _, _)
+ Pragma = pragma_type_spec(_)
;
% Handle pragma fact_table decls later on (when we process clauses
% -- since these decls take the place of clauses).
- Pragma = pragma_fact_table(_, _, _)
+ Pragma = pragma_fact_table(_)
;
% Handle pragma reserve_tag decls later on (when we process clauses
% -- they need to be handled after the type definitions
% have been added).
- Pragma = pragma_reserve_tag(_, _)
+ Pragma = pragma_reserve_tag(_)
;
- Pragma = pragma_promise_pure(Name, Arity),
+ Pragma = pragma_promise_pure(PredNameArity),
+ PredNameArity = pred_name_arity(Name, Arity),
add_pred_marker("promise_pure", Name, Arity, ImportStatus,
Context, marker_promised_pure, [], !ModuleInfo, !Specs)
;
- Pragma = pragma_promise_semipure(Name, Arity),
+ Pragma = pragma_promise_semipure(PredNameArity),
+ PredNameArity = pred_name_arity(Name, Arity),
add_pred_marker("promise_semipure", Name, Arity, ImportStatus,
Context, marker_promised_semipure, [], !ModuleInfo, !Specs)
;
- Pragma = pragma_promise_equivalent_clauses(Name, Arity),
+ Pragma = pragma_promise_eqv_clauses(PredNameArity),
+ PredNameArity = pred_name_arity(Name, Arity),
add_pred_marker("promise_equivalent_clauses", Name, Arity,
ImportStatus, Context, marker_promised_equivalent_clauses, [],
!ModuleInfo, !Specs)
@@ -330,33 +320,37 @@
% Handle pragma termination_info decls later on, in pass 3 --
% we need to add function default modes before handling
% these pragmas
- Pragma = pragma_termination_info(_, _, _, _, _)
+ Pragma = pragma_termination_info(_)
;
% As for termination_info pragmas
- Pragma = pragma_termination2_info(_, _, _, _, _, _)
+ Pragma = pragma_termination2_info(_)
;
- Pragma = pragma_terminates(Name, Arity),
+ Pragma = pragma_terminates(PredNameArity),
+ PredNameArity = pred_name_arity(Name, Arity),
add_pred_marker("terminates", Name, Arity, ImportStatus, Context,
marker_terminates,
[marker_check_termination, marker_does_not_terminate],
!ModuleInfo, !Specs)
;
- Pragma = pragma_does_not_terminate(Name, Arity),
+ Pragma = pragma_does_not_terminate(PredNameArity),
+ PredNameArity = pred_name_arity(Name, Arity),
add_pred_marker("does_not_terminate", Name, Arity, ImportStatus,
Context, marker_does_not_terminate,
[marker_check_termination, marker_terminates], !ModuleInfo, !Specs)
;
- Pragma = pragma_check_termination(Name, Arity),
+ Pragma = pragma_check_termination(PredNameArity),
+ PredNameArity = pred_name_arity(Name, Arity),
add_pred_marker("check_termination", Name, Arity, ImportStatus,
Context, marker_check_termination,
[marker_terminates, marker_does_not_terminate],
!ModuleInfo, !Specs)
;
- Pragma = pragma_structure_sharing(_, _, _, _, _, _)
+ Pragma = pragma_structure_sharing(_)
;
- Pragma = pragma_structure_reuse(_, _, _, _, _, _)
+ Pragma = pragma_structure_reuse(_)
;
- Pragma = pragma_mode_check_clauses(Name, Arity),
+ Pragma = pragma_mode_check_clauses(PredNameArity),
+ PredNameArity = pred_name_arity(Name, Arity),
add_pred_marker("mode_check_clauses", Name, Arity, ImportStatus,
Context, marker_mode_check_clauses, [], !ModuleInfo, !Specs),
@@ -369,13 +363,15 @@
Context, marker_user_marked_no_inline, [marker_user_marked_inline],
!ModuleInfo, !Specs)
;
- Pragma = pragma_require_feature_set(FeatureSet),
+ Pragma = pragma_require_feature_set(RFSInfo),
+ RFSInfo = pragma_info_require_feature_set(FeatureSet),
check_required_feature_set(FeatureSet, ImportStatus, Context,
!ModuleInfo, !Specs)
).
-add_pragma_foreign_export(Origin, Lang, Name, PredOrFunc, Modes,
- ExportedName, Context, !ModuleInfo, !Specs) :-
+add_pragma_foreign_export(Origin, FEInfo, Context, !ModuleInfo, !Specs) :-
+ FEInfo = pragma_info_foreign_export(Lang, PrednameModesPF, ExportedName),
+ PrednameModesPF = pred_name_modes_pf(Name, Modes, PredOrFunc),
module_info_get_predicate_table(!.ModuleInfo, PredTable),
list.length(Modes, Arity),
(
@@ -518,8 +514,7 @@
%-----------------------------------------------------------------------------%
-add_pragma_reserve_tag(TypeName, TypeArity, PragmaStatus, Context, !ModuleInfo,
- !Specs) :-
+add_pragma_reserve_tag(TypeCtor, PragmaStatus, Context, !ModuleInfo, !Specs) :-
TypeCtor = type_ctor(TypeName, TypeArity),
module_info_get_type_table(!.ModuleInfo, TypeTable0),
ContextPieces = [
@@ -617,8 +612,10 @@
%-----------------------------------------------------------------------------%
-add_pragma_foreign_export_enum(Lang, TypeName, TypeArity, Attributes,
- Overrides, _ImportStatus, Context, !ModuleInfo, !Specs) :-
+add_pragma_foreign_export_enum(FEEInfo, _ImportStatus, Context,
+ !ModuleInfo, !Specs) :-
+ FEEInfo = pragma_info_foreign_export_enum(Lang, TypeName, TypeArity,
+ Attributes, Overrides),
TypeCtor = type_ctor(TypeName, TypeArity),
module_info_get_type_table(!.ModuleInfo, TypeTable),
ContextPieces = [
@@ -977,8 +974,9 @@
%-----------------------------------------------------------------------------%
-add_pragma_foreign_enum(Lang, TypeName, TypeArity, ForeignTagValues,
- ImportStatus, Context, !ModuleInfo, !Specs) :-
+add_pragma_foreign_enum(FEInfo, ImportStatus, Context, !ModuleInfo, !Specs) :-
+ FEInfo = pragma_info_foreign_enum(Lang, TypeName, TypeArity,
+ ForeignTagValues),
TypeCtor = type_ctor(TypeName, TypeArity),
module_info_get_type_table(!.ModuleInfo, TypeTable0),
ContextPieces = [
@@ -1291,13 +1289,14 @@
%-----------------------------------------------------------------------------%
-:- pred add_pragma_unused_args(pred_or_func::in, sym_name::in, arity::in,
- mode_num::in, list(int)::in, prog_context::in,
- module_info::in, module_info::out,
+:- pred add_pragma_unused_args(pragma_info_unused_args::in,
+ prog_context::in, module_info::in, module_info::out,
list(error_spec)::in, list(error_spec)::out) is det.
-add_pragma_unused_args(PredOrFunc, SymName, Arity, ModeNum, UnusedArgs,
- Context, !ModuleInfo, !Specs) :-
+add_pragma_unused_args(UnusedArgsInfo, Context, !ModuleInfo, !Specs) :-
+ UnusedArgsInfo = pragma_info_unused_args(PredNameArityPFMn, UnusedArgs),
+ PredNameArityPFMn = pred_name_arity_pf_mn(SymName, Arity, PredOrFunc,
+ ModeNum),
module_info_get_predicate_table(!.ModuleInfo, Preds),
(
predicate_table_search_pf_sym_arity(Preds, is_fully_qualified,
@@ -1319,27 +1318,26 @@
%-----------------------------------------------------------------------------%
-:- pred add_pragma_exceptions(pred_or_func::in, sym_name::in, arity::in,
- mode_num::in, exception_status::in, prog_context::in,
+:- pred add_pragma_exceptions(pragma_info_exceptions::in, prog_context::in,
module_info::in, module_info::out,
list(error_spec)::in, list(error_spec)::out) is det.
-add_pragma_exceptions(PredOrFunc, SymName, Arity, ModeNum, ThrowStatus,
- _Context, !ModuleInfo, !Specs) :-
+add_pragma_exceptions(ExceptionsInfo, _Context, !ModuleInfo, !Specs) :-
+ ExceptionsInfo = pragma_info_exceptions(PredNameArityPFMn, ThrowStatus),
+ PredNameArityPFMn = pred_name_arity_pf_mn(SymName, Arity, PredOrFunc,
+ ModeNum),
module_info_get_predicate_table(!.ModuleInfo, Preds),
(
predicate_table_search_pf_sym_arity(Preds, is_fully_qualified,
PredOrFunc, SymName, Arity, [PredId])
->
- some [!ExceptionInfo] (
- module_info_get_exception_info(!.ModuleInfo, !:ExceptionInfo),
+ module_info_get_exception_info(!.ModuleInfo, ExceptionInfo0),
% convert the mode number to a proc_id
proc_id_to_int(ProcId, ModeNum),
ProcExceptionInfo = proc_exception_info(ThrowStatus, no),
map.set(proc(PredId, ProcId), ProcExceptionInfo,
- !ExceptionInfo),
- module_info_set_exception_info(!.ExceptionInfo, !ModuleInfo)
- )
+ ExceptionInfo0, ExceptionInfo),
+ module_info_set_exception_info(ExceptionInfo, !ModuleInfo)
;
% XXX We'll just ignore this for the time being -
% it causes errors with transitive-intermodule optimization.
@@ -1350,23 +1348,25 @@
%-----------------------------------------------------------------------------%
-:- pred add_pragma_trailing_info(pred_or_func::in, sym_name::in, arity::in,
- mode_num::in, trailing_status::in, prog_context::in,
- module_info::in, module_info::out,
+:- pred add_pragma_trailing_info(pragma_info_trailing_info::in,
+ prog_context::in, module_info::in, module_info::out,
list(error_spec)::in, list(error_spec)::out) is det.
-add_pragma_trailing_info(PredOrFunc, SymName, Arity, ModeNum, TrailingStatus,
- _Context, !ModuleInfo, !Specs) :-
+add_pragma_trailing_info(TrailingInfo, _Context, !ModuleInfo, !Specs) :-
+ TrailingInfo = pragma_info_trailing_info(PredNameArityPFMn,
+ TrailingStatus),
+ PredNameArityPFMn = pred_name_arity_pf_mn(SymName, Arity, PredOrFunc,
+ ModeNum),
module_info_get_predicate_table(!.ModuleInfo, Preds),
(
predicate_table_search_pf_sym_arity(Preds, is_fully_qualified,
PredOrFunc, SymName, Arity, [PredId])
->
- module_info_get_trailing_info(!.ModuleInfo, TrailingInfo0),
+ module_info_get_trailing_info(!.ModuleInfo, TrailingMap0),
proc_id_to_int(ProcId, ModeNum),
map.set(proc(PredId, ProcId), proc_trailing_info(TrailingStatus, no),
- TrailingInfo0, TrailingInfo),
- module_info_set_trailing_info(TrailingInfo, !ModuleInfo)
+ TrailingMap0, TrailingMap),
+ module_info_set_trailing_info(TrailingMap, !ModuleInfo)
;
% XXX We'll just ignore this for the time being -
% it causes errors with transitive-intermodule optimization.
@@ -1377,25 +1377,25 @@
%-----------------------------------------------------------------------------%
-:- pred add_pragma_mm_tabling_info(pred_or_func::in, sym_name::in, arity::in,
- mode_num::in, mm_tabling_status::in, prog_context::in,
- module_info::in, module_info::out,
+:- pred add_pragma_mm_tabling_info(pragma_info_mm_tabling_info::in,
+ prog_context::in, module_info::in, module_info::out,
list(error_spec)::in, list(error_spec)::out) is det.
-add_pragma_mm_tabling_info(PredOrFunc, SymName, Arity, ModeNum,
- TablingStatus, _Context, !ModuleInfo, !Specs) :-
+add_pragma_mm_tabling_info(MMTablingInfo, _Context, !ModuleInfo, !Specs) :-
+ MMTablingInfo = pragma_info_mm_tabling_info(PredNameArityPFMn,
+ TablingStatus),
+ PredNameArityPFMn = pred_name_arity_pf_mn(SymName, Arity, PredOrFunc,
+ ModeNum),
module_info_get_predicate_table(!.ModuleInfo, Preds),
(
predicate_table_search_pf_sym_arity(Preds, is_fully_qualified,
PredOrFunc, SymName, Arity, [PredId])
->
- some [!TablingInfo] (
- module_info_get_mm_tabling_info(!.ModuleInfo, !:TablingInfo),
+ module_info_get_mm_tabling_info(!.ModuleInfo, TablingInfo0),
proc_id_to_int(ProcId, ModeNum),
- map.set(proc(PredId, ProcId),
- proc_mm_tabling_info(TablingStatus, no), !TablingInfo),
- module_info_set_mm_tabling_info(!.TablingInfo, !ModuleInfo)
- )
+ map.set(proc(PredId, ProcId), proc_mm_tabling_info(TablingStatus, no),
+ TablingInfo0, TablingInfo),
+ module_info_set_mm_tabling_info(TablingInfo, !ModuleInfo)
;
% XXX We'll just ignore this for the time being -
% it causes errors with transitive-intermodule optimization.
@@ -1406,8 +1406,9 @@
%-----------------------------------------------------------------------------%
-add_pragma_type_spec(Pragma, Context, !ModuleInfo, !QualInfo, !Specs) :-
- Pragma = pragma_type_spec(SymName, _, Arity, MaybePredOrFunc, _, _, _, _),
+add_pragma_type_spec(TSInfo, Context, !ModuleInfo, !QualInfo, !Specs) :-
+ TSInfo = pragma_info_type_spec(SymName, _, Arity, MaybePredOrFunc,
+ _, _, _, _),
module_info_get_predicate_table(!.ModuleInfo, Preds),
(
(
@@ -1422,22 +1423,22 @@
),
PredIds = [_ | _]
->
- list.foldl3(add_pragma_type_spec_2(Pragma, Context), PredIds,
+ list.foldl3(add_pragma_type_spec_2(TSInfo, Context), PredIds,
!ModuleInfo, !QualInfo, !Specs)
;
undefined_pred_or_func_error(SymName, Arity, Context,
"`:- pragma type_spec' declaration", !Specs)
).
-:- pred add_pragma_type_spec_2(pragma_type::in(pragma_type_spec),
+:- pred add_pragma_type_spec_2(pragma_info_type_spec::in,
prog_context::in, pred_id::in, module_info::in, module_info::out,
qual_info::in, qual_info::out,
list(error_spec)::in, list(error_spec)::out) is det.
-add_pragma_type_spec_2(Pragma0, Context, PredId, !ModuleInfo, !QualInfo,
+add_pragma_type_spec_2(TSInfo0, Context, PredId, !ModuleInfo, !QualInfo,
!Specs) :-
- Pragma0 = pragma_type_spec(SymName, SpecName, Arity, _, MaybeModes, Subst,
- TVarSet0, ExpandedItems),
+ TSInfo0 = pragma_info_type_spec(SymName, SpecName, Arity, _, MaybeModes,
+ Subst, TVarSet0, ExpandedItems),
module_info_pred_info(!.ModuleInfo, PredId, PredInfo0),
handle_pragma_type_spec_subst(Context, Subst, PredInfo0,
TVarSet0, TVarSet, Types, ExistQVars, ClassContext, SubstOk,
@@ -1557,10 +1558,10 @@
;
SpecMap = SpecMap0
),
- Pragma = pragma_type_spec(SymName, SpecName, Arity,
+ TSInfo = pragma_info_type_spec(SymName, SpecName, Arity,
yes(PredOrFunc), MaybeModes, map.to_assoc_list(RenamedSubst),
TVarSet, ExpandedItems),
- multi_map.set(PredId, Pragma, PragmaMap0, PragmaMap),
+ multi_map.set(PredId, TSInfo, PragmaMap0, PragmaMap),
TypeSpecInfo = type_spec_info(ProcsToSpec, ForceVersions, SpecMap,
PragmaMap),
module_info_set_type_spec_info(TypeSpecInfo, !ModuleInfo),
@@ -1845,9 +1846,11 @@
%-----------------------------------------------------------------------------%
-add_pragma_termination2_info(PredOrFunc, SymName, ModeList,
+add_pragma_termination2_info(Term2Info, Context, !ModuleInfo, !Specs) :-
+ Term2Info = pragma_info_termination2_info(PredModesPF,
MaybePragmaSuccessArgSizeInfo, MaybePragmaFailureArgSizeInfo,
- MaybePragmaTerminationInfo, Context, !ModuleInfo, !Specs) :-
+ MaybePragmaTerminationInfo),
+ PredModesPF = pred_name_modes_pf(SymName, ModeList, PredOrFunc),
module_info_get_predicate_table(!.ModuleInfo, Preds),
list.length(ModeList, Arity),
(
@@ -1914,10 +1917,14 @@
%-----------------------------------------------------------------------------%
-add_pragma_structure_sharing(_PredOrFunc, _SymName, _ModeList, _HeadVars,
- _Types, no, _Context, !ModuleInfo, !Specs).
-add_pragma_structure_sharing(PredOrFunc, SymName, ModeList, HeadVars,
- Types, yes(SharingDomain), Context, !ModuleInfo, !Specs):-
+add_pragma_structure_sharing(SharingInfo, Context, !ModuleInfo, !Specs):-
+ SharingInfo = pragma_info_structure_sharing(PredNameModesPF,
+ HeadVars, Types, MaybeSharingDomain),
+ (
+ MaybeSharingDomain = no
+ ;
+ MaybeSharingDomain = yes(SharingDomain),
+ PredNameModesPF = pred_name_modes_pf(SymName, ModeList, PredOrFunc),
module_info_get_predicate_table(!.ModuleInfo, Preds),
list.length(ModeList, Arity),
(
@@ -1957,7 +1964,8 @@
words("in"), quote("pragma structure_sharing."),
suffix("."), nl],
Msg = simple_msg(Context, [always(Pieces)]),
- Spec = error_spec(severity_error, phase_parse_tree_to_hlds, [Msg]),
+ Spec = error_spec(severity_error, phase_parse_tree_to_hlds,
+ [Msg]),
!:Specs = [Spec | !.Specs]
)
;
@@ -1967,12 +1975,17 @@
% undefined_pred_or_func_error(SymName, Arity, Context,
% "`:- pragma structure_sharing' declaration",
% !Specs)
+ )
).
-add_pragma_structure_reuse(_PredOrFunc, _SymName, _ModeList, _HeadVars,
- _Types, no, _Context, !ModuleInfo, !Specs).
-add_pragma_structure_reuse(PredOrFunc, SymName, ModeList, HeadVars,
- Types, yes(ReuseDomain), Context, !ModuleInfo, !Specs):-
+add_pragma_structure_reuse(ReuseInfo, Context, !ModuleInfo, !Specs):-
+ ReuseInfo = pragma_info_structure_reuse(PredNameModesPF, HeadVars,
+ Types, MaybeReuseDomain),
+ (
+ MaybeReuseDomain = no
+ ;
+ MaybeReuseDomain = yes(ReuseDomain),
+ PredNameModesPF = pred_name_modes_pf(SymName, ModeList, PredOrFunc),
module_info_get_predicate_table(!.ModuleInfo, Preds),
list.length(ModeList, Arity),
(
@@ -1999,7 +2012,8 @@
;
Pieces = [words("Error: `:- pragma structure_reuse'"),
words("declaration for undeclared mode of"),
- simple_call(simple_call_id(PredOrFunc, SymName, Arity)),
+ simple_call(
+ simple_call_id(PredOrFunc, SymName, Arity)),
suffix("."), nl],
Msg = simple_msg(Context, [always(Pieces)]),
Spec = error_spec(severity_error, phase_parse_tree_to_hlds,
@@ -2009,9 +2023,11 @@
;
Pieces = [words("Error: ambiguous predicate name"),
simple_call(simple_call_id(PredOrFunc, SymName, Arity)),
- words("in"), quote("pragma structure_reuse"), suffix("."), nl],
+ words("in"), quote("pragma structure_reuse"), suffix("."),
+ nl],
Msg = simple_msg(Context, [always(Pieces)]),
- Spec = error_spec(severity_error, phase_parse_tree_to_hlds, [Msg]),
+ Spec = error_spec(severity_error, phase_parse_tree_to_hlds,
+ [Msg]),
!:Specs = [Spec | !.Specs]
)
;
@@ -2021,12 +2037,15 @@
% undefined_pred_or_func_error(SymName, Arity, Context,
% "`:- pragma structure_sharing' declaration",
% !Specs)
+ )
).
+
%-----------------------------------------------------------------------------%
-add_pragma_termination_info(PredOrFunc, SymName, ModeList,
- MaybePragmaArgSizeInfo, MaybePragmaTerminationInfo,
- Context, !ModuleInfo, !Specs) :-
+add_pragma_termination_info(TermInfo, Context, !ModuleInfo, !Specs) :-
+ TermInfo = pragma_info_termination_info(PredModesPF,
+ MaybePragmaArgSizeInfo, MaybePragmaTerminationInfo),
+ PredModesPF = pred_name_modes_pf(SymName, ModeList, PredOrFunc),
module_info_get_predicate_table(!.ModuleInfo, Preds),
list.length(ModeList, Arity),
(
@@ -2086,9 +2105,11 @@
%-----------------------------------------------------------------------------%
-module_add_pragma_foreign_proc(Attributes0, PredName, PredOrFunc, PVars,
- ProgVarSet, _InstVarset, PragmaImpl, Status, Context, MaybeItemNumber,
+module_add_pragma_foreign_proc(FPInfo, Status, Context, MaybeItemNumber,
!ModuleInfo, !QualInfo, !Specs) :-
+ FPInfo = pragma_info_foreign_proc(Attributes0, PredName, PredOrFunc,
+ PVars, ProgVarSet, _InstVarset, PragmaImpl),
+
% Begin by replacing any maybe_thread_safe foreign_proc attributes
% with the actual thread safety attributes which we get from the
% `--maybe-thread-safe' option.
@@ -2247,9 +2268,11 @@
%-----------------------------------------------------------------------------%
-module_add_pragma_tabled(EvalMethod, PredName, Arity, MaybePredOrFunc,
- MaybeModes, MaybeAttributes, Context, !Status, !ModuleInfo,
+module_add_pragma_tabled(TabledInfo, Context, !Status, !ModuleInfo,
!QualInfo, !Specs) :-
+ TabledInfo = pragma_info_tabled(EvalMethod, PredNameArityMPF,
+ MaybeModes, MaybeAttributes),
+ PredNameArityMPF = pred_name_arity_mpf(PredName, Arity, MaybePredOrFunc),
module_info_get_predicate_table(!.ModuleInfo, PredicateTable0),
EvalMethodStr = eval_method_to_string(EvalMethod),
(
@@ -2677,8 +2700,9 @@
ProcId),
StatsCode = "MR_get_tabling_stats(&" ++ Global ++ ", &Stats);",
StatsImpl = fc_impl_ordinary(StatsCode, yes(Context)),
- StatsPragma = pragma_foreign_proc(!.Attrs, StatsPredSymName,
+ StatsPragmaFCInfo = pragma_info_foreign_proc(!.Attrs, StatsPredSymName,
pf_predicate, [Arg1, Arg2, Arg3], !.VarSet, InstVarSet, StatsImpl),
+ StatsPragma = pragma_foreign_proc(StatsPragmaFCInfo),
StatsPragmaInfo = item_pragma_info(compiler(pragma_memo_attribute),
StatsPragma, Context, -1),
StatsImplItem = item_pragma(StatsPragmaInfo)
@@ -2761,8 +2785,9 @@
ResetCode = ""
),
ResetImpl = fc_impl_ordinary(ResetCode, yes(Context)),
- ResetPragma = pragma_foreign_proc(!.Attrs, ResetPredSymName,
+ ResetPragmaFCInfo = pragma_info_foreign_proc(!.Attrs, ResetPredSymName,
pf_predicate, [Arg1, Arg2], !.VarSet, InstVarSet, ResetImpl),
+ ResetPragma = pragma_foreign_proc(ResetPragmaFCInfo),
ResetPragmaInfo = item_pragma_info(compiler(pragma_memo_attribute),
ResetPragma, Context, -1),
ResetImplItem = item_pragma(ResetPragmaInfo)
@@ -2933,8 +2958,6 @@
PragmaVar = pragma_var(Var, _Name, _Mode, _BoxPolicy),
pragma_get_vars(PragmaVars, Vars).
-%---------------------------------------------------------------------------%
-
% Extract the names from the list of pragma_vars.
%
:- pred pragma_get_var_infos(list(pragma_var)::in,
@@ -2946,8 +2969,12 @@
Info = yes(Name - Mode) - BoxPolicy,
pragma_get_var_infos(PragmaVars, Infos).
-module_add_pragma_fact_table(Pred, Arity, FileName, Status, Context,
+%---------------------------------------------------------------------------%
+
+module_add_pragma_fact_table(FTInfo, Status, Context,
!ModuleInfo, !QualInfo, !Specs) :-
+ FTInfo = pragma_info_fact_table(PredArity, FileName),
+ PredArity = pred_name_arity(Pred, Arity),
module_info_get_predicate_table(!.ModuleInfo, PredicateTable),
(
predicate_table_search_sym_arity(PredicateTable, is_fully_qualified,
@@ -3061,9 +3088,10 @@
set_purity(purity_pure, Attrs2, Attrs3),
add_extra_attribute(refers_to_llds_stack, Attrs3, Attrs),
MaybeItemNumber = no,
- module_add_pragma_foreign_proc(Attrs, SymName, PredOrFunc, PragmaVars,
- ProgVarSet, InstVarSet, fc_impl_ordinary(C_ProcCode, no), Status,
- Context, MaybeItemNumber, !ModuleInfo, !QualInfo, !Specs),
+ FCInfo = pragma_info_foreign_proc(Attrs, SymName, PredOrFunc, PragmaVars,
+ ProgVarSet, InstVarSet, fc_impl_ordinary(C_ProcCode, no)),
+ module_add_pragma_foreign_proc(FCInfo, Status, Context, MaybeItemNumber,
+ !ModuleInfo, !QualInfo, !Specs),
( C_ExtraCode = "" ->
true
;
Index: compiler/add_solver.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/add_solver.m,v
retrieving revision 1.25
diff -u -b -r1.25 add_solver.m
--- compiler/add_solver.m 4 Jul 2011 03:27:13 -0000 1.25
+++ compiler/add_solver.m 5 Sep 2012 04:59:59 -0000
@@ -250,8 +250,8 @@
XTGPragmaVar = pragma_var(X, "X", in_mode, native_if_possible),
YTGPragmaVar = pragma_var(Y, "Y", OutGroundMode, native_if_possible),
ToGroundRepnArgs = [XTGPragmaVar, YTGPragmaVar],
- ToGroundRepnForeignProc =
- pragma_foreign_proc(
+ ToGroundRepnForeignProc = pragma_foreign_proc(
+ pragma_info_foreign_proc(
Attrs,
ToGroundRepnSymName,
pf_function,
@@ -259,6 +259,7 @@
ProgVarSet,
InstVarSet,
Impl
+ )
),
ToGroundRepnItemPragma = item_pragma_info(compiler(solver_type),
ToGroundRepnForeignProc, Context, -1),
@@ -272,8 +273,8 @@
XTAPragmaVar = pragma_var(X, "X", in_any_mode, native_if_possible),
YTAPragmaVar = pragma_var(Y, "Y", OutAnyMode, native_if_possible),
ToAnyRepnArgs = [XTAPragmaVar, YTAPragmaVar],
- ToAnyRepnForeignProc =
- pragma_foreign_proc(
+ ToAnyRepnForeignProc = pragma_foreign_proc(
+ pragma_info_foreign_proc(
Attrs,
ToAnyRepnSymName,
pf_function,
@@ -281,6 +282,7 @@
ProgVarSet,
InstVarSet,
Impl
+ )
),
ToAnyRepnItemPragma = item_pragma_info(compiler(solver_type),
ToAnyRepnForeignProc, Context, -1),
@@ -294,8 +296,8 @@
XFGPragmaVar = pragma_var(X, "X", InGroundMode, native_if_possible),
YFGPragmaVar = pragma_var(Y, "Y", out_mode, native_if_possible),
FromGroundRepnArgs = [XFGPragmaVar, YFGPragmaVar],
- FromGroundRepnForeignProc =
- pragma_foreign_proc(
+ FromGroundRepnForeignProc = pragma_foreign_proc(
+ pragma_info_foreign_proc(
Attrs,
FromGroundRepnSymName,
pf_function,
@@ -303,6 +305,7 @@
ProgVarSet,
InstVarSet,
Impl
+ )
),
FromGroundRepnItemPragma = item_pragma_info(compiler(solver_type),
FromGroundRepnForeignProc, Context, -1),
@@ -316,8 +319,8 @@
XFAPragmaVar = pragma_var(X, "X", InAnyMode, native_if_possible),
YFAPragmaVar = pragma_var(Y, "Y", out_any_mode, native_if_possible),
FromAnyRepnArgs = [XFAPragmaVar, YFAPragmaVar],
- FromAnyRepnForeignProc =
- pragma_foreign_proc(
+ FromAnyRepnForeignProc = pragma_foreign_proc(
+ pragma_info_foreign_proc(
Attrs,
FromAnyRepnSymName,
pf_function,
@@ -325,6 +328,7 @@
ProgVarSet,
InstVarSet,
Impl
+ )
),
FromAnyRepnItemPragma = item_pragma_info(compiler(solver_type),
FromAnyRepnForeignProc, Context, -1),
Index: compiler/equiv_type.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/equiv_type.m,v
retrieving revision 1.97
diff -u -b -r1.97 equiv_type.m
--- compiler/equiv_type.m 5 Jun 2012 15:14:26 -0000 1.97
+++ compiler/equiv_type.m 5 Sep 2012 04:59:59 -0000
@@ -578,7 +578,8 @@
Info0, Info, !RecompInfo, !UsedModules, []) :-
Info0 = item_pragma_info(Origin, Pragma0, Context, SeqNum),
(
- Pragma0 = pragma_type_spec(PredName, NewName, Arity,
+ Pragma0 = pragma_type_spec(TypeSpecInfo0),
+ TypeSpecInfo0 = pragma_info_type_spec(PredName, NewName, Arity,
PorF, Modes, Subst0, VarSet0, ItemIds0),
(
( !.RecompInfo = no
@@ -597,10 +598,12 @@
;
ExpandedItems = yes(_ - ItemIds)
),
- Pragma = pragma_type_spec(PredName, NewName, Arity,
- PorF, Modes, Subst, VarSet, ItemIds)
+ TypeSpecInfo = pragma_info_type_spec(PredName, NewName, Arity,
+ PorF, Modes, Subst, VarSet, ItemIds),
+ Pragma = pragma_type_spec(TypeSpecInfo)
;
- Pragma0 = pragma_foreign_proc(Attrs0, PName, PredOrFunc,
+ Pragma0 = pragma_foreign_proc(FPInfo0),
+ FPInfo0 = pragma_info_foreign_proc(Attrs0, PName, PredOrFunc,
ProcVars, ProcVarset, ProcInstVarset, ProcImpl),
some [!EquivTypeInfo] (
maybe_start_recording_expanded_items(ModuleName, PName,
@@ -627,39 +630,40 @@
finish_recording_expanded_items(ItemId, !.EquivTypeInfo,
!RecompInfo)
),
- Pragma = pragma_foreign_proc(Attrs, PName, PredOrFunc,
- ProcVars, ProcVarset, ProcInstVarset, ProcImpl)
+ FPInfo = pragma_info_foreign_proc(Attrs, PName, PredOrFunc,
+ ProcVars, ProcVarset, ProcInstVarset, ProcImpl),
+ Pragma = pragma_foreign_proc(FPInfo)
;
- ( Pragma0 = pragma_check_termination(_, _)
- ; Pragma0 = pragma_does_not_terminate(_, _)
- ; Pragma0 = pragma_exceptions(_, _, _, _, _)
- ; Pragma0 = pragma_fact_table(_, _, _)
- ; Pragma0 = pragma_foreign_code(_, _)
- ; Pragma0 = pragma_foreign_decl(_, _, _)
- ; Pragma0 = pragma_foreign_enum(_, _, _, _)
- ; Pragma0 = pragma_foreign_export(_, _, _, _, _)
- ; Pragma0 = pragma_foreign_export_enum(_, _, _, _, _)
- ; Pragma0 = pragma_foreign_import_module(_, _)
- ; Pragma0 = pragma_inline(_, _)
- ; Pragma0 = pragma_mm_tabling_info(_, _, _, _, _)
- ; Pragma0 = pragma_mode_check_clauses(_, _)
- ; Pragma0 = pragma_no_inline(_, _)
- ; Pragma0 = pragma_obsolete(_, _)
- ; Pragma0 = pragma_no_detism_warning(_, _)
- ; Pragma0 = pragma_promise_equivalent_clauses(_, _)
- ; Pragma0 = pragma_promise_pure(_, _)
- ; Pragma0 = pragma_promise_semipure(_, _)
+ ( Pragma0 = pragma_check_termination(_)
+ ; Pragma0 = pragma_does_not_terminate(_)
+ ; Pragma0 = pragma_exceptions(_)
+ ; Pragma0 = pragma_fact_table(_)
+ ; Pragma0 = pragma_foreign_code(_)
+ ; Pragma0 = pragma_foreign_decl(_)
+ ; Pragma0 = pragma_foreign_enum(_)
+ ; Pragma0 = pragma_foreign_export(_)
+ ; Pragma0 = pragma_foreign_export_enum(_)
+ ; Pragma0 = pragma_foreign_import_module(_)
+ ; Pragma0 = pragma_inline(_)
+ ; Pragma0 = pragma_mm_tabling_info(_)
+ ; Pragma0 = pragma_mode_check_clauses(_)
+ ; Pragma0 = pragma_no_inline(_)
+ ; Pragma0 = pragma_obsolete(_)
+ ; Pragma0 = pragma_no_detism_warning(_)
+ ; Pragma0 = pragma_promise_eqv_clauses(_)
+ ; Pragma0 = pragma_promise_pure(_)
+ ; Pragma0 = pragma_promise_semipure(_)
; Pragma0 = pragma_require_feature_set(_)
- ; Pragma0 = pragma_reserve_tag(_, _)
+ ; Pragma0 = pragma_reserve_tag(_)
; Pragma0 = pragma_source_file(_)
- ; Pragma0 = pragma_structure_reuse(_, _, _, _, _, _)
- ; Pragma0 = pragma_structure_sharing(_, _, _, _, _, _)
- ; Pragma0 = pragma_tabled(_, _, _, _, _, _)
- ; Pragma0 = pragma_terminates(_, _)
- ; Pragma0 = pragma_termination2_info(_, _, _, _, _, _)
- ; Pragma0 = pragma_termination_info(_, _, _, _, _)
- ; Pragma0 = pragma_trailing_info(_, _, _, _, _)
- ; Pragma0 = prog_item.pragma_unused_args(_, _, _, _, _)
+ ; Pragma0 = pragma_structure_reuse(_)
+ ; Pragma0 = pragma_structure_sharing(_)
+ ; Pragma0 = pragma_tabled(_)
+ ; Pragma0 = pragma_terminates(_)
+ ; Pragma0 = pragma_termination2_info(_)
+ ; Pragma0 = pragma_termination_info(_)
+ ; Pragma0 = pragma_trailing_info(_)
+ ; Pragma0 = prog_item.pragma_unused_args(_)
),
Pragma = Pragma0
),
Index: compiler/exception_analysis.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/exception_analysis.m,v
retrieving revision 1.61
diff -u -b -r1.61 exception_analysis.m
--- compiler/exception_analysis.m 2 Jul 2012 01:16:33 -0000 1.61
+++ compiler/exception_analysis.m 5 Sep 2012 04:59:59 -0000
@@ -136,6 +136,7 @@
:- import_module mdbcomp.prim_data.
:- import_module parse_tree.mercury_to_mercury.
:- import_module parse_tree.file_names.
+:- import_module parse_tree.prog_item.
:- import_module parse_tree.prog_type.
:- import_module transform_hlds.dependency_graph.
:- import_module transform_hlds.mmc_analysis.
@@ -1260,7 +1261,7 @@
:- pred write_pragma_exceptions_2(module_info::in, exception_info::in,
pred_id::in, pred_info::in, proc_id::in, io::di, io::uo) is det.
-write_pragma_exceptions_2(ModuleInfo, ExceptionInfo, PredId, PredInfo, ProcId,
+write_pragma_exceptions_2(ModuleInfo, ExceptionMap, PredId, PredInfo, ProcId,
!IO) :-
should_write_exception_info(ModuleInfo, PredId, ProcId, PredInfo,
for_pragma, ShouldWrite),
@@ -1271,10 +1272,13 @@
Arity = pred_info_orig_arity(PredInfo),
PredOrFunc = pred_info_is_pred_or_func(PredInfo),
proc_id_to_int(ProcId, ModeNum),
- ( map.search(ExceptionInfo, proc(PredId, ProcId), ProcExceptionInfo) ->
+ ( map.search(ExceptionMap, proc(PredId, ProcId), ProcExceptionInfo) ->
ProcExceptionInfo = proc_exception_info(Status, _),
- mercury_output_pragma_exceptions(PredOrFunc,
- qualified(ModuleName, Name), Arity, ModeNum, Status, !IO)
+ PredSymName = qualified(ModuleName, Name),
+ PredNameArityPFMn = pred_name_arity_pf_mn(PredSymName, Arity,
+ PredOrFunc, ModeNum),
+ ExceptionInfo = pragma_info_exceptions(PredNameArityPFMn, Status),
+ mercury_output_pragma_exceptions(ExceptionInfo, !IO)
;
true
)
Index: compiler/hlds_module.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/hlds_module.m,v
retrieving revision 1.176
diff -u -b -r1.176 hlds_module.m
--- compiler/hlds_module.m 8 Jun 2012 15:46:20 -0000 1.176
+++ compiler/hlds_module.m 5 Sep 2012 04:59:59 -0000
@@ -138,9 +138,8 @@
).
% List of procedures for which there are user-requested type
- % specializations, and a list of predicates which should be
- % processed by higher_order.m to ensure the production of those
- % versions.
+ % specializations, and a list of predicates which should be processed
+ % by higher_order.m to ensure the production of those versions.
:- type type_spec_info
---> type_spec_info(
% Procedures for which there are user-requested type
@@ -160,12 +159,12 @@
% Type spec pragmas to be placed in the `.opt' file if a
% predicate becomes exported.
- pragma_map :: multi_map(pred_id, pragma_type)
+ pragma_map :: multi_map(pred_id,
+ pragma_info_type_spec)
).
- % Maps the full names of procedures (in the sense of
- % complexity_proc_name in complexity.m) to the number of their slot
- % in MR_complexity_proc_table.
+ % Maps the full names of procedures (in the sense of complexity_proc_name
+ % in complexity.m) to the number of their slot in MR_complexity_proc_table.
:- type complexity_proc_map == map(string, int).
:- type complexity_proc_info
@@ -195,7 +194,7 @@
%-----------------------------------------------------------------------------%
%
-% Types for foreign exported enumerations
+% Types for foreign exported enumerations.
%
:- type exported_enum_info
@@ -208,7 +207,7 @@
%-----------------------------------------------------------------------------%
%
-% Various predicates for manipulating the module_info data structure
+% Various predicates for manipulating the module_info data structure.
%
% Create an empty module_info for a given module name (and the
Index: compiler/intermod.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/intermod.m,v
retrieving revision 1.273
diff -u -b -r1.273 intermod.m
--- compiler/intermod.m 11 Jul 2012 04:00:59 -0000 1.273
+++ compiler/intermod.m 5 Sep 2012 04:59:59 -0000
@@ -1331,8 +1331,8 @@
list.foldl(
(pred(ForeignImport::in, IO0::di, IO::uo) is det :-
ForeignImport = foreign_import_module_info(Lang, Import, _),
- mercury_output_pragma_foreign_import_module(Lang, Import,
- IO0, IO)
+ FIMInfo = pragma_info_foreign_import_module(Lang, Import),
+ mercury_output_pragma_foreign_import_module(FIMInfo, IO0, IO)
), ForeignImports, !IO)
;
WriteHeader = no
@@ -1474,7 +1474,7 @@
->
% The pragma_origin doesn't matter here.
ReserveItemPragma = item_pragma_info(user,
- pragma_reserve_tag(Name, Arity), Context, -1),
+ pragma_reserve_tag(TypeCtor), Context, -1),
ReserveItem = item_pragma(ReserveItemPragma),
mercury_output_item(MercInfo, ReserveItem, !IO)
;
@@ -1486,8 +1486,8 @@
->
map.foldl(gather_foreign_enum_value_pair, ConsTagVals, [],
ForeignEnumVals),
- ForeignPragma = pragma_foreign_enum(Lang, Name, Arity,
- ForeignEnumVals),
+ FEInfo = pragma_info_foreign_enum(Lang, Name, Arity, ForeignEnumVals),
+ ForeignPragma = pragma_foreign_enum(FEInfo),
ForeignItemPragma = item_pragma_info(user, ForeignPragma, Context, -1),
ForeignItem = item_pragma(ForeignItemPragma),
mercury_output_item(MercInfo, ForeignItem, !IO)
@@ -1862,8 +1862,9 @@
get_pragma_foreign_code_vars(Args, ArgModes,
ProgVarset0, ProgVarset, PragmaVars),
proc_info_get_inst_varset(ProcInfo, InstVarset),
- mercury_output_pragma_foreign_code(Attributes, SymName,
- PredOrFunc, PragmaVars, ProgVarset, InstVarset, PragmaImpl, !IO)
+ FPInfo = pragma_info_foreign_proc(Attributes, SymName,
+ PredOrFunc, PragmaVars, ProgVarset, InstVarset, PragmaImpl),
+ mercury_output_pragma_foreign_proc(FPInfo, !IO)
;
MaybeArgModes = no,
unexpected($module, $pred, "no mode declaration")
@@ -1996,20 +1997,11 @@
module_info_get_type_spec_info(ModuleInfo, TypeSpecInfo),
PragmaMap = TypeSpecInfo ^ pragma_map,
( multi_map.search(PragmaMap, PredId, TypeSpecPragmas) ->
- list.foldl(intermod_write_type_spec_pragma, TypeSpecPragmas, !IO)
- ;
- true
- ).
-
-:- pred intermod_write_type_spec_pragma(pragma_type::in, io::di, io::uo)
- is det.
-
-intermod_write_type_spec_pragma(Pragma, !IO) :-
- ( Pragma = pragma_type_spec(_, _, _, _, _, _, _, _) ->
AppendVarnums = yes,
- mercury_output_pragma_type_spec(Pragma, AppendVarnums, !IO)
+ list.foldl(mercury_output_pragma_type_spec(AppendVarnums),
+ TypeSpecPragmas, !IO)
;
- unexpected($module, $pred, "no pragma_type_spec")
+ true
).
% Is a pragma declaration required in the `.opt' file for
@@ -2459,10 +2451,10 @@
ItemPragma = item_pragma_info(_, Pragma, _, _),
(
UnusedArgs = yes,
- Pragma = pragma_unused_args(_, _, _, _, _)
+ Pragma = pragma_unused_args(_)
;
StructureReuse = yes,
- Pragma = pragma_structure_reuse(_, _, _, _, _, _)
+ Pragma = pragma_structure_reuse(_)
)
),
cord.filter(KeepPragma, LocalItemsCord, PragmaItemsCord),
Index: compiler/make_hlds_passes.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/make_hlds_passes.m,v
retrieving revision 1.120
diff -u -b -r1.120 make_hlds_passes.m
--- compiler/make_hlds_passes.m 25 Jul 2012 04:48:09 -0000 1.120
+++ compiler/make_hlds_passes.m 5 Sep 2012 04:59:59 -0000
@@ -1161,7 +1161,8 @@
(
IOStateInterface = yes,
SetPredName = mutable_set_pred_sym_name(ModuleName, Name),
- IOSetPromisePurePragma = pragma_promise_pure(SetPredName, 3),
+ SetPredNameArity = pred_name_arity(SetPredName, 3),
+ IOSetPromisePurePragma = pragma_promise_pure(SetPredNameArity),
IOSetPromisePureItemPragma = item_pragma_info(
compiler(mutable_decl), IOSetPromisePurePragma, Context,
-1),
@@ -1441,29 +1442,26 @@
add_pass_3_pragma(ItemPragma, !Status, !ModuleInfo, !QualInfo, !Specs) :-
ItemPragma = item_pragma_info(Origin, Pragma, Context, SeqNum),
(
- Pragma = pragma_foreign_proc(Attributes, Pred, PredOrFunc,
- Vars, ProgVarSet, InstVarSet, PragmaImpl),
- module_add_pragma_foreign_proc(Attributes, Pred, PredOrFunc,
- Vars, ProgVarSet, InstVarSet, PragmaImpl, !.Status, Context,
+ Pragma = pragma_foreign_proc(FPInfo),
+ module_add_pragma_foreign_proc(FPInfo, !.Status, Context,
yes(SeqNum), !ModuleInfo, !QualInfo, !Specs)
;
- Pragma = pragma_fact_table(Pred, Arity, File),
- module_add_pragma_fact_table(Pred, Arity, File, !.Status,
- Context, !ModuleInfo, !QualInfo, !Specs)
+ Pragma = pragma_fact_table(FTInfo),
+ module_add_pragma_fact_table(FTInfo, !.Status, Context,
+ !ModuleInfo, !QualInfo, !Specs)
;
- Pragma = pragma_tabled(Type, Name, Arity, PredOrFunc, MaybeModes,
- MaybeAttributes),
+ Pragma = pragma_tabled(TabledInfo),
module_info_get_globals(!.ModuleInfo, Globals),
globals.lookup_bool_option(Globals, type_layout, TypeLayout),
(
TypeLayout = yes,
- module_add_pragma_tabled(Type, Name, Arity, PredOrFunc, MaybeModes,
- MaybeAttributes, Context, !Status, !ModuleInfo, !QualInfo,
- !Specs)
+ module_add_pragma_tabled(TabledInfo, Context, !Status,
+ !ModuleInfo, !QualInfo, !Specs)
;
TypeLayout = no,
+ TabledInfo = pragma_info_tabled(EvalMethod, _, _, _),
Pieces = [words("Error:"),
- quote(":- pragma " ++ eval_method_to_string(Type)),
+ quote(":- pragma " ++ eval_method_to_string(EvalMethod)),
words("declaration requires type_ctor_layout structures."),
words("Don't use --no-type-layout to disable them."),
nl],
@@ -1472,73 +1470,59 @@
!:Specs = [Spec | !.Specs]
)
;
- Pragma = pragma_type_spec(_, _, _, _, _, _, _, _),
- add_pragma_type_spec(Pragma, Context, !ModuleInfo, !QualInfo, !Specs)
+ Pragma = pragma_type_spec(TypeSpecInfo),
+ add_pragma_type_spec(TypeSpecInfo, Context,
+ !ModuleInfo, !QualInfo, !Specs)
;
- Pragma = pragma_termination_info(PredOrFunc, SymName, ModeList,
- MaybeArgSizeInfo, MaybeTerminationInfo),
- add_pragma_termination_info(PredOrFunc, SymName, ModeList,
- MaybeArgSizeInfo, MaybeTerminationInfo, Context,
- !ModuleInfo, !Specs)
+ Pragma = pragma_termination_info(TermInfo),
+ add_pragma_termination_info(TermInfo, Context, !ModuleInfo, !Specs)
;
- Pragma = pragma_termination2_info(PredOrFunc, SymName, ModeList,
- MaybeSuccessArgSizeInfo, MaybeFailureArgSizeInfo,
- MaybeTerminationInfo),
- add_pragma_termination2_info(PredOrFunc, SymName, ModeList,
- MaybeSuccessArgSizeInfo, MaybeFailureArgSizeInfo,
- MaybeTerminationInfo, Context, !ModuleInfo, !Specs)
- ;
- Pragma = pragma_structure_sharing(PredOrFunc, SymName, ModeList,
- HeadVars, Types, SharingDomain),
- add_pragma_structure_sharing(PredOrFunc, SymName, ModeList,
- HeadVars, Types, SharingDomain, Context, !ModuleInfo, !Specs)
- ;
- Pragma = pragma_structure_reuse(PredOrFunc, SymName, ModeList,
- HeadVars, Types, MaybeReuseDomain),
- add_pragma_structure_reuse(PredOrFunc, SymName, ModeList,
- HeadVars, Types, MaybeReuseDomain, Context, !ModuleInfo, !Specs)
+ Pragma = pragma_termination2_info(Term2Info),
+ add_pragma_termination2_info(Term2Info, Context, !ModuleInfo, !Specs)
;
- Pragma = pragma_reserve_tag(TypeName, TypeArity),
- add_pragma_reserve_tag(TypeName, TypeArity, !.Status, Context,
+ Pragma = pragma_structure_sharing(SharingInfo),
+ add_pragma_structure_sharing(SharingInfo, Context, !ModuleInfo, !Specs)
+ ;
+ Pragma = pragma_structure_reuse(ReuseInfo),
+ add_pragma_structure_reuse(ReuseInfo, Context, !ModuleInfo, !Specs)
+ ;
+ Pragma = pragma_reserve_tag(TypeCtor),
+ add_pragma_reserve_tag(TypeCtor, !.Status, Context,
!ModuleInfo, !Specs)
;
- Pragma = pragma_foreign_export_enum(Lang, TypeName, TypeArity,
- Attributes, Overrides),
- add_pragma_foreign_export_enum(Lang, TypeName, TypeArity, Attributes,
- Overrides, !.Status, Context, !ModuleInfo, !Specs)
- ;
- Pragma = pragma_foreign_enum(Lang, TypeName, TypeArity, TagValues),
- add_pragma_foreign_enum(Lang, TypeName, TypeArity, TagValues,
- !.Status, Context, !ModuleInfo, !Specs)
- ;
- Pragma = pragma_foreign_export(Lang, Name, PredOrFunc, Modes,
- C_Function),
- add_pragma_foreign_export(Origin, Lang, Name, PredOrFunc, Modes,
- C_Function, Context, !ModuleInfo, !Specs)
+ Pragma = pragma_foreign_export_enum(FEEInfo),
+ add_pragma_foreign_export_enum(FEEInfo, !.Status, Context,
+ !ModuleInfo, !Specs)
+ ;
+ Pragma = pragma_foreign_enum(FEInfo),
+ add_pragma_foreign_enum(FEInfo, !.Status, Context, !ModuleInfo, !Specs)
+ ;
+ Pragma = pragma_foreign_export(FEInfo),
+ add_pragma_foreign_export(Origin, FEInfo, Context, !ModuleInfo, !Specs)
;
% Don't worry about any pragma declarations other than the
% clause-like pragmas (c_code, tabling and fact_table),
% foreign_type and the termination_info pragma here,
% since they've already been handled earlier, in pass 2.
- ( Pragma = pragma_check_termination(_, _)
- ; Pragma = pragma_does_not_terminate(_, _)
- ; Pragma = pragma_exceptions(_, _, _, _, _)
- ; Pragma = pragma_foreign_code(_, _)
- ; Pragma = pragma_foreign_decl(_, _, _)
- ; Pragma = pragma_foreign_import_module(_, _)
- ; Pragma = pragma_inline(_, _)
- ; Pragma = pragma_mm_tabling_info(_, _, _, _, _)
- ; Pragma = pragma_mode_check_clauses(_, _)
- ; Pragma = pragma_no_inline(_, _)
- ; Pragma = pragma_obsolete(_, _)
- ; Pragma = pragma_no_detism_warning(_, _)
- ; Pragma = pragma_promise_equivalent_clauses(_, _)
- ; Pragma = pragma_promise_pure(_, _)
- ; Pragma = pragma_promise_semipure(_, _)
+ ( Pragma = pragma_check_termination(_)
+ ; Pragma = pragma_does_not_terminate(_)
+ ; Pragma = pragma_exceptions(_)
+ ; Pragma = pragma_foreign_code(_)
+ ; Pragma = pragma_foreign_decl(_)
+ ; Pragma = pragma_foreign_import_module(_)
+ ; Pragma = pragma_inline(_)
+ ; Pragma = pragma_mm_tabling_info(_)
+ ; Pragma = pragma_mode_check_clauses(_)
+ ; Pragma = pragma_no_inline(_)
+ ; Pragma = pragma_obsolete(_)
+ ; Pragma = pragma_no_detism_warning(_)
+ ; Pragma = pragma_promise_eqv_clauses(_)
+ ; Pragma = pragma_promise_pure(_)
+ ; Pragma = pragma_promise_semipure(_)
; Pragma = pragma_source_file(_)
- ; Pragma = pragma_terminates(_, _)
- ; Pragma = pragma_trailing_info(_, _, _, _, _)
- ; Pragma = pragma_unused_args(_, _, _, _, _)
+ ; Pragma = pragma_terminates(_)
+ ; Pragma = pragma_trailing_info(_)
+ ; Pragma = pragma_unused_args(_)
; Pragma = pragma_require_feature_set(_)
)
).
@@ -1621,8 +1605,11 @@
->
module_info_new_user_init_pred(SymName, Arity, CName,
!ModuleInfo),
- ExportPragma = pragma_foreign_export(ExportLang, SymName,
- pf_predicate, [di_mode, uo_mode], CName),
+ PredNameModesPF = pred_name_modes_pf(SymName,
+ [di_mode, uo_mode], pf_predicate),
+ FEInfo = pragma_info_foreign_export(ExportLang,
+ PredNameModesPF, CName),
+ ExportPragma = pragma_foreign_export(FEInfo),
ExportItemPragma = item_pragma_info(compiler(initialise_decl),
ExportPragma, Context, -1),
ExportItem = item_pragma(ExportItemPragma),
@@ -1643,8 +1630,11 @@
->
module_info_new_user_init_pred(SymName, Arity, CName,
!ModuleInfo),
- ExportPragma = pragma_foreign_export(ExportLang, SymName,
- pf_predicate, [], CName),
+ PredNameModesPF = pred_name_modes_pf(SymName,
+ [], pf_predicate),
+ FEInfo = pragma_info_foreign_export(ExportLang,
+ PredNameModesPF, CName),
+ ExportPragma = pragma_foreign_export(FEInfo),
ExportItemPragma = item_pragma_info(compiler(initialise_decl),
ExportPragma, Context, -1),
ExportItem = item_pragma(ExportItemPragma),
@@ -1714,8 +1704,10 @@
(
MaybeExportLang = yes(ExportLang),
module_info_new_user_init_pred(SymName, Arity, CName, !ModuleInfo),
- ExportPragma = pragma_foreign_export(ExportLang, SymName,
- pf_predicate, [], CName),
+ PredNameModesPF = pred_name_modes_pf(SymName, [], pf_predicate),
+ FEInfo = pragma_info_foreign_export(ExportLang, PredNameModesPF,
+ CName),
+ ExportPragma = pragma_foreign_export(FEInfo),
ExportItemPragma = item_pragma_info(compiler(mutable_decl),
ExportPragma, Context, -1),
ExportItem = item_pragma(ExportItemPragma),
@@ -1790,8 +1782,11 @@
->
module_info_new_user_final_pred(SymName, Arity, CName,
!ModuleInfo),
- ExportPragma = pragma_foreign_export(ExportLang, SymName,
- pf_predicate, [di_mode, uo_mode], CName),
+ PredNameModesPF = pred_name_modes_pf(SymName,
+ [di_mode, uo_mode], pf_predicate),
+ FEInfo = pragma_info_foreign_export(ExportLang,
+ PredNameModesPF, CName),
+ ExportPragma = pragma_foreign_export(FEInfo),
ExportItemPragma = item_pragma_info(compiler(finalise_decl),
ExportPragma, Context, -1),
ExportItem = item_pragma(ExportItemPragma),
@@ -1812,8 +1807,11 @@
->
module_info_new_user_final_pred(SymName, Arity, CName,
!ModuleInfo),
- ExportPragma = pragma_foreign_export(ExportLang, SymName,
- pf_predicate, [], CName),
+ PredNameModesPF = pred_name_modes_pf(SymName,
+ [], pf_predicate),
+ FEInfo = pragma_info_foreign_export(ExportLang,
+ PredNameModesPF, CName),
+ ExportPragma = pragma_foreign_export(FEInfo),
ExportItemPragma = item_pragma_info(compiler(finalise_decl),
ExportPragma, Context, -1),
ExportItem = item_pragma(ExportItemPragma),
@@ -2072,8 +2070,9 @@
" extern ", LowLevelTypeName, " ", TargetMutableName, ";\n",
"#endif\n" | LockDecl]),
- DeclPragma =
- pragma_foreign_decl(lang_c, foreign_decl_is_exported, DeclBody),
+ FDInfo =
+ pragma_info_foreign_decl(lang_c, foreign_decl_is_exported, DeclBody),
+ DeclPragma = pragma_foreign_decl(FDInfo),
DeclItemPragma = item_pragma_info(compiler(mutable_decl), DeclPragma,
Context, -1),
DeclItem = item_pragma(DeclItemPragma).
@@ -2120,7 +2119,8 @@
DefnBody = string.append_list([
TypeName, " ", TargetMutableName, ";\n" | LockDefn]),
- DefnPragma = pragma_foreign_code(lang_c, DefnBody),
+ FCInfo = pragma_info_foreign_code(lang_c, DefnBody),
+ DefnPragma = pragma_foreign_code(FCInfo),
DefnItemPragma = item_pragma_info(compiler(mutable_decl), DefnPragma,
Context, -1),
DefnItem = item_pragma(DefnItemPragma).
@@ -2202,7 +2202,7 @@
InstVarSet = varset.init,
set_purity(purity_pure, Attrs, ConstantGetAttrs0),
set_thread_safe(proc_thread_safe, ConstantGetAttrs0, ConstantGetAttrs),
- ConstantGetForeignProc = pragma_foreign_proc(
+ ConstantGetFCInfo = pragma_info_foreign_proc(
ConstantGetAttrs,
mutable_get_pred_sym_name(ModuleName, MutableName),
pf_predicate,
@@ -2211,6 +2211,7 @@
InstVarSet,
fc_impl_ordinary("X = " ++ TargetMutableName ++ ";\n", yes(Context))
),
+ ConstantGetForeignProc = pragma_foreign_proc(ConstantGetFCInfo),
ConstantGetItemPragma = item_pragma_info(compiler(mutable_decl),
ConstantGetForeignProc, Context, -1),
ConstantGetItem = item_pragma(ConstantGetItemPragma),
@@ -2219,7 +2220,7 @@
% NOTE: we don't need to trail the set action, since it is executed
% only once at initialization time.
- ConstantSetForeignProc = pragma_foreign_proc(Attrs,
+ ConstantSetFCInfo = pragma_info_foreign_proc(Attrs,
mutable_secret_set_pred_sym_name(ModuleName, MutableName),
pf_predicate,
[pragma_var(X, "X", in_mode(Inst), BoxPolicy)],
@@ -2227,6 +2228,7 @@
InstVarSet,
fc_impl_ordinary(TargetMutableName ++ " = X;\n", yes(Context))
),
+ ConstantSetForeignProc = pragma_foreign_proc(ConstantSetFCInfo),
ConstantSetItemPragma = item_pragma_info(compiler(mutable_decl),
ConstantSetForeignProc, Context, -1),
ConstantSetItem = item_pragma(ConstantSetItemPragma),
@@ -2265,7 +2267,7 @@
IsThreadLocal = mutable_thread_local,
LockForeignProcBody = ""
),
- LockForeignProc = pragma_foreign_proc(LockAndUnlockAttrs,
+ LockFCInfo = pragma_info_foreign_proc(LockAndUnlockAttrs,
mutable_lock_pred_sym_name(ModuleName, MutableName),
pf_predicate,
[],
@@ -2273,6 +2275,7 @@
varset.init, % Inst varset.
fc_impl_ordinary(LockForeignProcBody, yes(Context))
),
+ LockForeignProc = pragma_foreign_proc(LockFCInfo),
LockItemPragma = item_pragma_info(compiler(mutable_decl),
LockForeignProc, Context, -1),
LockItem = item_pragma(LockItemPragma),
@@ -2293,7 +2296,7 @@
IsThreadLocal = mutable_thread_local,
UnlockForeignProcBody = ""
),
- UnlockForeignProc = pragma_foreign_proc(LockAndUnlockAttrs,
+ UnlockFCInfo = pragma_info_foreign_proc(LockAndUnlockAttrs,
mutable_unlock_pred_sym_name(ModuleName, MutableName),
pf_predicate,
[],
@@ -2301,6 +2304,7 @@
varset.init, % Inst varset.
fc_impl_ordinary(UnlockForeignProcBody, yes(Context))
),
+ UnlockForeignProc = pragma_foreign_proc(UnlockFCInfo),
UnlockItemPragma = item_pragma_info(compiler(mutable_decl),
UnlockForeignProc, Context, -1),
UnlockItem = item_pragma(UnlockItemPragma),
@@ -2319,7 +2323,7 @@
UnsafeGetCode = "MR_get_thread_local_mutable(" ++
TypeName ++ ", X, " ++ TargetMutableName ++ ");\n"
),
- UnsafeGetForeignProc = pragma_foreign_proc(UnsafeGetAttrs,
+ UnsafeGetFCInfo = pragma_info_foreign_proc(UnsafeGetAttrs,
mutable_unsafe_get_pred_sym_name(ModuleName, MutableName),
pf_predicate,
[pragma_var(X, "X", out_mode(Inst), BoxPolicy)],
@@ -2327,6 +2331,7 @@
varset.init, % Inst varset.
fc_impl_ordinary(UnsafeGetCode, yes(Context))
),
+ UnsafeGetForeignProc = pragma_foreign_proc(UnsafeGetFCInfo),
UnsafeGetItemPragma = item_pragma_info(compiler(mutable_decl),
UnsafeGetForeignProc, Context, -1),
UnsafeGetItem = item_pragma(UnsafeGetItemPragma),
@@ -2370,7 +2375,7 @@
SetCode = "MR_set_thread_local_mutable(" ++
TypeName ++ ", X, " ++ TargetMutableName ++ ");\n"
),
- UnsafeSetForeignProc = pragma_foreign_proc(UnsafeSetAttrs,
+ UnsafeSetFCInfo = pragma_info_foreign_proc(UnsafeSetAttrs,
mutable_unsafe_set_pred_sym_name(ModuleName, MutableName),
pf_predicate,
[pragma_var(X, "X", in_mode(Inst), BoxPolicy)],
@@ -2378,6 +2383,7 @@
varset.init, % Inst varset.
fc_impl_ordinary(TrailCode ++ SetCode, yes(Context))
),
+ UnsafeSetForeignProc = pragma_foreign_proc(UnsafeSetFCInfo),
UnsafeSetItemPragma = item_pragma_info(compiler(mutable_decl),
UnsafeSetForeignProc, Context, -1),
UnsafeSetItem = item_pragma(UnsafeSetItemPragma),
@@ -2537,7 +2543,7 @@
),
PreInitPredName = mutable_pre_init_pred_sym_name(ModuleName,
MutableName),
- PreInitForeignProc = pragma_foreign_proc(Attrs,
+ PreInitFCInfo = pragma_info_foreign_proc(Attrs,
PreInitPredName,
pf_predicate,
[],
@@ -2545,6 +2551,7 @@
varset.init, % InstVarSet
fc_impl_ordinary(PreInitCode, yes(Context))
),
+ PreInitForeignProc = pragma_foreign_proc(PreInitFCInfo),
PreInitItemPragma = item_pragma_info(compiler(mutable_decl),
PreInitForeignProc, Context, -1),
PreInitItem = item_pragma(PreInitItemPragma),
@@ -2588,7 +2595,8 @@
Context, !ModuleInfo, !QualInfo, !Specs) :-
get_csharp_java_mutable_global_foreign_defn(Lang, TargetMutableName,
Type, IsThreadLocal, Context, DefnBody),
- DefnPragma = pragma_foreign_code(Lang, DefnBody),
+ DefnFCInfo = pragma_info_foreign_code(Lang, DefnBody),
+ DefnPragma = pragma_foreign_code(DefnFCInfo),
DefnItemPragma = item_pragma_info(compiler(mutable_decl), DefnPragma,
Context, -1),
ForeignDefn = item_pragma(DefnItemPragma),
@@ -2718,7 +2726,7 @@
]),
PreInitPredName = mutable_pre_init_pred_sym_name(ModuleName,
MutableName),
- PreInitForeignProc = pragma_foreign_proc(Attrs,
+ PreInitFCInfo = pragma_info_foreign_proc(Attrs,
PreInitPredName,
pf_predicate,
[],
@@ -2726,6 +2734,7 @@
varset.init, % InstVarSet
fc_impl_ordinary(PreInitCode, yes(Context))
),
+ PreInitForeignProc = pragma_foreign_proc(PreInitFCInfo),
PreInitItemPragma = item_pragma_info(compiler(mutable_decl),
PreInitForeignProc, Context, -1),
PreInitItem = item_pragma(PreInitItemPragma),
@@ -2776,7 +2785,7 @@
TargetMutableName, ");\n"
])
),
- GetForeignProc = pragma_foreign_proc(GetAttrs,
+ GetFCInfo = pragma_info_foreign_proc(GetAttrs,
mutable_unsafe_get_pred_sym_name(ModuleName, MutableName),
pf_predicate,
[pragma_var(X, "X", out_mode(Inst), BoxPolicy)],
@@ -2784,6 +2793,7 @@
varset.init, % Inst varset.
fc_impl_ordinary(GetCode, yes(Context))
),
+ GetForeignProc = pragma_foreign_proc(GetFCInfo),
GetItemPragma = item_pragma_info(compiler(mutable_decl),
GetForeignProc, Context, -1),
GetItem = item_pragma(GetItemPragma),
@@ -2818,7 +2828,7 @@
SetCode = "\truntime.ThreadLocalMutables.set(" ++
TargetMutableName ++ ", X);\n"
),
- SetForeignProc = pragma_foreign_proc(SetAttrs,
+ SetFCInfo = pragma_info_foreign_proc(SetAttrs,
mutable_unsafe_set_pred_sym_name(ModuleName, MutableName),
pf_predicate,
[pragma_var(X, "X", in_mode(Inst), BoxPolicy)],
@@ -2826,6 +2836,7 @@
varset.init, % Inst varset.
fc_impl_ordinary(TrailCode ++ SetCode, yes(Context))
),
+ SetForeignProc = pragma_foreign_proc(SetFCInfo),
SetItemPragma = item_pragma_info(compiler(mutable_decl),
SetForeignProc, Context, -1),
SetItem = item_pragma(SetItemPragma),
@@ -2924,7 +2935,7 @@
% Getter.
GetCode = erlang_mutable_get_code(TargetMutableName),
- ConstantGetForeignProc = pragma_foreign_proc(
+ ConstantGetFCInfo = pragma_info_foreign_proc(
ConstantGetAttrs,
mutable_get_pred_sym_name(ModuleName, MutableName),
pf_predicate,
@@ -2933,6 +2944,7 @@
InstVarSet,
fc_impl_ordinary(GetCode, yes(Context))
),
+ ConstantGetForeignProc = pragma_foreign_proc(ConstantGetFCInfo),
ConstantGetItemPragma = item_pragma_info(compiler(mutable_decl),
ConstantGetForeignProc, Context, -1),
ConstantGetItem = item_pragma(ConstantGetItemPragma),
@@ -2940,7 +2952,7 @@
% Secret setter.
SetCode = erlang_mutable_set_code(TargetMutableName),
- ConstantSetForeignProc = pragma_foreign_proc(Attrs,
+ ConstantSetFCInfo = pragma_info_foreign_proc(Attrs,
mutable_secret_set_pred_sym_name(ModuleName, MutableName),
pf_predicate,
[pragma_var(X, "X", in_mode(Inst), native_if_possible)],
@@ -2948,6 +2960,7 @@
InstVarSet,
fc_impl_ordinary(SetCode, yes(Context))
),
+ ConstantSetForeignProc = pragma_foreign_proc(ConstantSetFCInfo),
ConstantSetItemPragma = item_pragma_info(compiler(mutable_decl),
ConstantSetForeignProc, Context, -1),
ConstantSetItem = item_pragma(ConstantSetItemPragma),
@@ -2986,7 +2999,7 @@
TargetMutableName ++ "})"
),
GetPredName = mutable_get_pred_sym_name(ModuleName, MutableName),
- GetForeignProc = pragma_foreign_proc(GetAttrs,
+ GetFCInfo = pragma_info_foreign_proc(GetAttrs,
GetPredName,
pf_predicate,
[pragma_var(X, "X", out_mode(Inst), native_if_possible)],
@@ -2994,6 +3007,7 @@
varset.init, % Inst varset.
fc_impl_ordinary(GetCode, yes(Context))
),
+ GetForeignProc = pragma_foreign_proc(GetFCInfo),
GetItemPragma = item_pragma_info(compiler(mutable_decl), GetForeignProc,
Context, -1),
GetItem = item_pragma(GetItemPragma),
@@ -3012,7 +3026,7 @@
TargetMutableName ++ "}, X)"
),
SetPredName = mutable_set_pred_sym_name(ModuleName, MutableName),
- SetForeignProc = pragma_foreign_proc(SetAttrs,
+ SetFCInfo = pragma_info_foreign_proc(SetAttrs,
SetPredName,
pf_predicate,
[pragma_var(X, "X", in_mode(Inst), native_if_possible)],
@@ -3020,6 +3034,7 @@
varset.init, % Inst varset.
fc_impl_ordinary(SetCode, yes(Context))
),
+ SetForeignProc = pragma_foreign_proc(SetFCInfo),
SetItemPragma = item_pragma_info(compiler(mutable_decl), SetForeignProc,
Context, -1),
SetItem = item_pragma(SetItemPragma),
Index: compiler/mercury_to_mercury.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/mercury_to_mercury.m,v
retrieving revision 1.361
diff -u -b -r1.361 mercury_to_mercury.m
--- compiler/mercury_to_mercury.m 5 Jul 2012 04:29:39 -0000 1.361
+++ compiler/mercury_to_mercury.m 5 Sep 2012 04:59:59 -0000
@@ -144,40 +144,37 @@
io::di, io::uo) is det.
:- func mercury_foreign_language_to_string(foreign_language) = string.
-:- pred mercury_output_pragma_foreign_code(pragma_foreign_proc_attributes::in,
- sym_name::in, pred_or_func::in, list(pragma_var)::in, prog_varset::in,
- inst_varset::in, pragma_foreign_code_impl::in, io::di, io::uo)
- is det.
-:- func mercury_pragma_foreign_code_to_string(pragma_foreign_proc_attributes,
- sym_name, pred_or_func, list(pragma_var), prog_varset, inst_varset,
- pragma_foreign_code_impl) = string.
+:- pred mercury_output_pragma_foreign_proc(pragma_info_foreign_proc::in,
+ io::di, io::uo) is det.
+:- func mercury_pragma_foreign_proc_to_string(pragma_info_foreign_proc)
+ = string.
- % mercury_output_pragma_type_spec(Pragma, AppendVarnums).
+ % mercury_output_pragma_type_spec(AppendVarnums, PragmaTypeSpec).
%
-:- pred mercury_output_pragma_type_spec((pragma_type)::in(pragma_type_spec),
- bool::in, io::di, io::uo) is det.
+:- pred mercury_output_pragma_type_spec(bool::in, pragma_info_type_spec::in,
+ io::di, io::uo) is det.
-:- pred mercury_output_pragma_unused_args(pred_or_func::in, sym_name::in,
- int::in, mode_num::in, list(int)::in, io::di, io::uo) is det.
+:- pred mercury_output_pragma_unused_args(pragma_info_unused_args::in,
+ io::di, io::uo) is det.
-:- pred mercury_output_pragma_exceptions(pred_or_func::in, sym_name::in,
- int::in, mode_num::in, exception_status::in, io::di, io::uo) is det.
+:- pred mercury_output_pragma_exceptions(pragma_info_exceptions::in,
+ io::di, io::uo) is det.
-:- pred mercury_output_pragma_trailing_info(pred_or_func::in, sym_name::in,
- arity::in, mode_num::in, trailing_status::in, io::di, io::uo) is det.
+:- pred mercury_output_pragma_trailing_info(pragma_info_trailing_info::in,
+ io::di, io::uo) is det.
-:- pred mercury_output_pragma_mm_tabling_info(pred_or_func::in, sym_name::in,
- arity::in, mode_num::in, mm_tabling_status::in, io::di, io::uo) is det.
+:- pred mercury_output_pragma_mm_tabling_info(pragma_info_mm_tabling_info::in,
+ io::di, io::uo) is det.
% Output the given foreign_decl declaration.
%
-:- pred mercury_output_pragma_foreign_decl(foreign_language::in,
- foreign_decl_is_local::in, string::in, io::di, io::uo) is det.
-:- func mercury_pragma_foreign_decl_to_string(foreign_language,
- foreign_decl_is_local, string) = string.
+:- pred mercury_output_pragma_foreign_decl(pragma_info_foreign_decl::in,
+ io::di, io::uo) is det.
+:- func mercury_pragma_foreign_decl_to_string(pragma_info_foreign_decl)
+ = string.
-:- pred mercury_output_pragma_foreign_import_module(foreign_language::in,
- module_name::in, io::di, io::uo) is det.
+:- pred mercury_output_pragma_foreign_import_module(
+ pragma_info_foreign_import_module::in, io::di, io::uo) is det.
:- pred mercury_output_ctor(constructor::in, tvarset::in, io::di, io::uo)
is det.
@@ -355,20 +352,18 @@
% This predicate outputs termination_info pragmas;
% such annotations can be part of .opt and .trans_opt files.
%
-:- pred write_pragma_termination_info(pred_or_func::in, sym_name::in,
- list(mer_mode)::in, prog_context::in,
- maybe(generic_arg_size_info(T))::in,
- maybe(generic_termination_info(S, T))::in, io::di, io::uo) is det.
-
-:- pred write_pragma_structure_sharing_info(pred_or_func::in, sym_name::in,
- list(mer_mode)::in, prog_context::in, prog_vars::in,
- maybe(prog_varset)::in, list(mer_type)::in, maybe(tvarset)::in,
- maybe(structure_sharing_domain)::in, io::di, io::uo) is det.
-
-:- pred write_pragma_structure_reuse_info(pred_or_func::in, sym_name::in,
- list(mer_mode)::in, prog_context::in, prog_vars::in,
- maybe(prog_varset)::in, list(mer_type)::in, maybe(tvarset)::in,
- maybe(structure_reuse_domain)::in, io::di, io::uo) is det.
+:- pred write_pragma_termination_info_components(pred_or_func::in,
+ sym_name::in, list(mer_mode)::in, maybe(generic_arg_size_info(T))::in,
+ maybe(generic_termination_info(S, T))::in, prog_context::in,
+ io::di, io::uo) is det.
+
+:- pred write_pragma_structure_sharing_info(pragma_info_structure_sharing::in,
+ maybe(prog_varset)::in, maybe(tvarset)::in, prog_context::in,
+ io::di, io::uo) is det.
+
+:- pred write_pragma_structure_reuse_info(pragma_info_structure_reuse::in,
+ maybe(prog_varset)::in, maybe(tvarset)::in, prog_context::in,
+ io::di, io::uo) is det.
% Write the given arg size info. Verbose if the second arg is yes.
%
@@ -443,6 +438,7 @@
:- import_module parse_tree.prog_io_util.
:- import_module parse_tree.prog_out.
:- import_module parse_tree.prog_util.
+:- import_module recompilation.
:- import_module recompilation.version.
:- import_module assoc_list.
@@ -693,147 +689,74 @@
ItemPragma = item_pragma_info(_, Pragma, Context, _SeqNum),
maybe_output_line_number(Info, Context, !IO),
(
- Pragma = pragma_source_file(SourceFile),
- mercury_output_pragma_source_file(SourceFile, !IO)
+ Pragma = pragma_source_file(SourceFileInfo),
+ mercury_output_pragma_source_file(SourceFileInfo, !IO)
;
- Pragma = pragma_foreign_decl(Lang, IsLocal, ForeignHeaderString),
- mercury_output_pragma_foreign_decl(Lang, IsLocal, ForeignHeaderString,
- !IO)
+ Pragma = pragma_foreign_decl(FDInfo),
+ mercury_output_pragma_foreign_decl(FDInfo, !IO)
;
- Pragma = pragma_foreign_import_module(Lang, ModuleName),
- mercury_output_pragma_foreign_import_module(Lang, ModuleName, !IO)
+ Pragma = pragma_foreign_import_module(FIMInfo),
+ mercury_output_pragma_foreign_import_module(FIMInfo, !IO)
;
- Pragma = pragma_foreign_code(Lang, Code),
- mercury_output_pragma_foreign_body_code(Lang, Code, !IO)
+ Pragma = pragma_foreign_code(FCInfo),
+ mercury_output_pragma_foreign_body_code(FCInfo, !IO)
;
- Pragma = pragma_foreign_proc(Attributes, Pred, PredOrFunc, Vars,
- ProgVarset, InstVarset, PragmaCode),
- mercury_output_pragma_foreign_code(Attributes, Pred,
- PredOrFunc, Vars, ProgVarset, InstVarset, PragmaCode, !IO)
+ Pragma = pragma_foreign_proc(FPInfo),
+ mercury_output_pragma_foreign_proc(FPInfo, !IO)
;
- Pragma = pragma_foreign_export(Lang, Pred, PredOrFunc, ModeList,
- ExportName),
- mercury_format_pragma_foreign_export(Lang, Pred, PredOrFunc, ModeList,
- ExportName, !IO)
+ Pragma = pragma_foreign_export(FEInfo),
+ mercury_format_pragma_foreign_export(FEInfo, !IO)
;
- Pragma = pragma_foreign_export_enum(Lang, TypeName, TypeArity,
- Attributes, Overrides),
- mercury_format_pragma_foreign_export_enum(Lang, TypeName, TypeArity,
- Attributes, Overrides, !IO)
+ Pragma = pragma_foreign_export_enum(FEEInfo),
+ mercury_format_pragma_foreign_export_enum(FEEInfo, !IO)
;
- Pragma = pragma_foreign_enum(Lang, TypeName, TypeArity, Values),
- mercury_format_pragma_foreign_enum(Lang, TypeName, TypeArity,
- Values, !IO)
+ Pragma = pragma_foreign_enum(FEInfo),
+ mercury_format_pragma_foreign_enum(FEInfo, !IO)
;
- Pragma = pragma_obsolete(Pred, Arity),
+ Pragma = pragma_obsolete(PredNameArity),
+ PredNameArity = pred_name_arity(Pred, Arity),
mercury_output_pragma_decl(Pred, Arity, pf_predicate,
"obsolete", no, !IO)
;
- Pragma = pragma_no_detism_warning(Pred, Arity),
+ Pragma = pragma_no_detism_warning(PredNameArity),
+ PredNameArity = pred_name_arity(Pred, Arity),
mercury_output_pragma_decl(Pred, Arity, pf_predicate,
"no_determinism_warning", no, !IO)
;
- Pragma = pragma_tabled(Type, Pred, Arity, _PredOrFunc, _Mode,
- MaybeAttributes),
- PragmaName = eval_method_to_pragma_name(Type),
- (
- MaybeAttributes = yes(Attributes),
- Attributes = table_attributes(Strictness, MaybeSizeLimit, Stats,
- AllowReset),
- some [!Strs] (
- !:Strs = [],
- (
- Strictness = all_strict
- ;
- Strictness = all_fast_loose,
- !:Strs = ["fast_loose" | !.Strs]
- ;
- Strictness = specified(Args, HiddenArgMethod),
- ArgStrs = list.map(maybe_arg_tabling_method_to_string,
- Args),
- ArgsStr = string.join_list(", ", ArgStrs),
- (
- HiddenArgMethod = hidden_arg_value,
- HiddenArgStr = "hidden_arg_value"
- ;
- HiddenArgMethod = hidden_arg_addr,
- HiddenArgStr = "hidden_arg_addr"
- ),
- SpecifiedStr = "specified([" ++ ArgsStr ++ "], " ++
- HiddenArgStr ++ ")",
- !:Strs = [SpecifiedStr | !.Strs]
- ),
- (
- MaybeSizeLimit = yes(SizeLimit),
- LimitStr = "limit(" ++ int_to_string(SizeLimit) ++ ")",
- !:Strs = [LimitStr | !.Strs]
- ;
- MaybeSizeLimit = no
- ),
- (
- Stats = table_gather_statistics,
- !:Strs = ["statistics" | !.Strs]
- ;
- Stats = table_dont_gather_statistics
- ),
- (
- AllowReset = table_allow_reset,
- !:Strs = ["allow_reset" | !.Strs]
+ Pragma = pragma_tabled(TabledInfo),
+ mercury_output_pragma_tabled(TabledInfo, !IO)
;
- AllowReset = table_dont_allow_reset
- ),
- (
- !.Strs = [],
- MaybeAfter = no
- ;
- !.Strs = [_ | _],
- MaybeAfter =
- yes("[" ++ string.join_list(", ", !.Strs) ++ "]")
- )
- )
- ;
- MaybeAttributes = no,
- MaybeAfter = no
- ),
- mercury_output_pragma_decl(Pred, Arity, pf_predicate, PragmaName,
- MaybeAfter, !IO)
- ;
- Pragma = pragma_type_spec(_, _, _, _, _, _, _, _),
+ Pragma = pragma_type_spec(TypeSpecInfo),
AppendVarnums = no,
- mercury_output_pragma_type_spec(Pragma, AppendVarnums, !IO)
+ mercury_output_pragma_type_spec(AppendVarnums, TypeSpecInfo, !IO)
;
- Pragma = pragma_inline(Pred, Arity),
+ Pragma = pragma_inline(PredNameArity),
+ PredNameArity = pred_name_arity(Pred, Arity),
mercury_output_pragma_decl(Pred, Arity, pf_predicate, "inline", no,
!IO)
;
- Pragma = pragma_no_inline(Pred, Arity),
+ Pragma = pragma_no_inline(PredNameArity),
+ PredNameArity = pred_name_arity(Pred, Arity),
mercury_output_pragma_decl(Pred, Arity, pf_predicate, "no_inline", no,
!IO)
;
- Pragma = pragma_unused_args(PredOrFunc, PredName, Arity, ModeNum,
- UnusedArgs),
- mercury_output_pragma_unused_args(PredOrFunc,
- PredName, Arity, ModeNum, UnusedArgs, !IO)
- ;
- Pragma = pragma_exceptions(PredOrFunc, PredName, Arity, ModeNum,
- ThrowStatus),
- mercury_output_pragma_exceptions(PredOrFunc, PredName, Arity, ModeNum,
- ThrowStatus, !IO)
- ;
- Pragma = pragma_trailing_info(PredOrFunc, PredName, Arity, ModeNum,
- TrailingStatus),
- mercury_output_pragma_trailing_info(PredOrFunc, PredName, Arity,
- ModeNum, TrailingStatus, !IO)
+ Pragma = pragma_unused_args(UnusedArgsInfo),
+ mercury_output_pragma_unused_args(UnusedArgsInfo, !IO)
;
- Pragma = pragma_mm_tabling_info(PredOrFunc, PredName, Arity, ModeNum,
- MM_TablingStatus),
- mercury_output_pragma_mm_tabling_info(PredOrFunc, PredName, Arity,
- ModeNum, MM_TablingStatus, !IO)
+ Pragma = pragma_exceptions(ExceptionsInfo),
+ mercury_output_pragma_exceptions(ExceptionsInfo, !IO)
+ ;
+ Pragma = pragma_trailing_info(TrailingInfo),
+ mercury_output_pragma_trailing_info(TrailingInfo, !IO)
;
- Pragma = pragma_fact_table(Pred, Arity, FileName),
- mercury_format_pragma_fact_table(Pred, Arity, FileName, !IO)
+ Pragma = pragma_mm_tabling_info(TablingInfo),
+ mercury_output_pragma_mm_tabling_info(TablingInfo, !IO)
;
- Pragma = pragma_reserve_tag(TypeName, TypeArity),
+ Pragma = pragma_fact_table(FactTableInfo),
+ mercury_format_pragma_fact_table(FactTableInfo, !IO)
+ ;
+ Pragma = pragma_reserve_tag(TypeCtor),
+ TypeCtor = type_ctor(TypeName, TypeArity),
add_string(":- pragma reserve_tag(", !IO),
mercury_format_bracketed_sym_name_ngt(TypeName, next_to_graphic_token,
!IO),
@@ -841,57 +764,59 @@
add_int(TypeArity, !IO),
add_string(").\n", !IO)
;
- Pragma = pragma_promise_pure(Pred, Arity),
+ Pragma = pragma_promise_pure(PredNameArity),
+ PredNameArity = pred_name_arity(Pred, Arity),
mercury_output_pragma_decl(Pred, Arity, pf_predicate,
"promise_pure", no, !IO)
;
- Pragma = pragma_promise_semipure(Pred, Arity),
+ Pragma = pragma_promise_semipure(PredNameArity),
+ PredNameArity = pred_name_arity(Pred, Arity),
mercury_output_pragma_decl(Pred, Arity, pf_predicate,
"promise_semipure", no, !IO)
;
- Pragma = pragma_promise_equivalent_clauses(Pred, Arity),
+ Pragma = pragma_promise_eqv_clauses(PredNameArity),
+ PredNameArity = pred_name_arity(Pred, Arity),
mercury_output_pragma_decl(Pred, Arity, pf_predicate,
"promise_equivalent_clauses", no, !IO)
;
- Pragma = pragma_termination_info(PredOrFunc, PredName, ModeList,
- MaybePragmaArgSizeInfo, MaybePragmaTerminationInfo),
- write_pragma_termination_info(PredOrFunc, PredName, ModeList,
- Context, MaybePragmaArgSizeInfo, MaybePragmaTerminationInfo, !IO)
- ;
- Pragma = pragma_termination2_info(PredOrFunc, PredName,
- ModeList, SuccessInfo, FailureInfo, MaybeTermination),
- write_pragma_termination2_info(PredOrFunc, PredName,
- ModeList, SuccessInfo, FailureInfo,
- MaybeTermination, Context, !IO)
+ Pragma = pragma_termination_info(TermInfo),
+ TermInfo = pragma_info_termination_info(PredNameModesPF,
+ MaybeArgSize, MaybeTermination),
+ PredNameModesPF = pred_name_modes_pf(SymName, ModeList, PredOrFunc),
+ write_pragma_termination_info_components(PredOrFunc, SymName, ModeList,
+ MaybeArgSize, MaybeTermination, Context, !IO)
+ ;
+ Pragma = pragma_termination2_info(Term2Info),
+ write_pragma_termination2_info(Term2Info, Context, !IO)
;
- Pragma = pragma_terminates(Pred, Arity),
+ Pragma = pragma_terminates(PredNameArity),
+ PredNameArity = pred_name_arity(Pred, Arity),
mercury_output_pragma_decl(Pred, Arity, pf_predicate,
"terminates", no, !IO)
;
- Pragma = pragma_does_not_terminate(Pred, Arity),
+ Pragma = pragma_does_not_terminate(PredNameArity),
+ PredNameArity = pred_name_arity(Pred, Arity),
mercury_output_pragma_decl(Pred, Arity, pf_predicate,
"does_not_terminate", no, !IO)
;
- Pragma = pragma_check_termination(Pred, Arity),
+ Pragma = pragma_check_termination(PredNameArity),
+ PredNameArity = pred_name_arity(Pred, Arity),
mercury_output_pragma_decl(Pred, Arity, pf_predicate,
"check_termination", no, !IO)
;
- Pragma = pragma_structure_sharing(PredOrFunc, PredName, ModesList,
- HeadVars, Types, MaybeStructureSharing),
- write_pragma_structure_sharing_info(PredOrFunc, PredName, ModesList,
- Context, HeadVars, no, Types, no, MaybeStructureSharing, !IO)
- ;
- Pragma = pragma_structure_reuse(PredOrFunc, PredName, ModesList,
- HeadVars, Types, MaybeStructureReuseDomain),
- write_pragma_structure_reuse_info(PredOrFunc, PredName, ModesList,
- Context, HeadVars, no, Types, no, MaybeStructureReuseDomain, !IO)
+ Pragma = pragma_structure_sharing(SharingInfo),
+ write_pragma_structure_sharing_info(SharingInfo, no, no, Context, !IO)
+ ;
+ Pragma = pragma_structure_reuse(ReuseInfo),
+ write_pragma_structure_reuse_info(ReuseInfo, no, no, Context, !IO)
;
- Pragma = pragma_mode_check_clauses(Pred, Arity),
+ Pragma = pragma_mode_check_clauses(PredNameArity),
+ PredNameArity = pred_name_arity(Pred, Arity),
mercury_output_pragma_decl(Pred, Arity, pf_predicate,
"mode_check_clauses", no, !IO)
;
- Pragma = pragma_require_feature_set(Features),
- mercury_output_pragma_require_feature_set(Features, !IO)
+ Pragma = pragma_require_feature_set(RFSInfo),
+ mercury_output_pragma_require_feature_set(RFSInfo, !IO)
).
:- pred mercury_output_item_promise(merc_out_info::in, item_promise_info::in,
@@ -3411,19 +3336,17 @@
%-----------------------------------------------------------------------------%
-mercury_output_pragma_foreign_decl(Lang, IsLocal, ForeignDeclString, !IO) :-
- mercury_format_pragma_foreign_decl(Lang, IsLocal, ForeignDeclString, !IO).
+mercury_output_pragma_foreign_decl(FDInfo, !IO) :-
+ mercury_format_pragma_foreign_decl(FDInfo, !IO).
-mercury_pragma_foreign_decl_to_string(Lang, IsLocal, ForeignDeclString)
- = String :-
- mercury_format_pragma_foreign_decl(Lang, IsLocal, ForeignDeclString,
- "", String).
+mercury_pragma_foreign_decl_to_string(FDInfo) = String :-
+ mercury_format_pragma_foreign_decl(FDInfo, "", String).
-:- pred mercury_format_pragma_foreign_decl(foreign_language::in,
- foreign_decl_is_local::in, string::in, U::di, U::uo) is det
- <= output(U).
+:- pred mercury_format_pragma_foreign_decl(pragma_info_foreign_decl::in,
+ U::di, U::uo) is det <= output(U).
-mercury_format_pragma_foreign_decl(Lang, IsLocal, ForeignDeclString, !U) :-
+mercury_format_pragma_foreign_decl(FDInfo, !U) :-
+ FDInfo = pragma_info_foreign_decl(Lang, IsLocal, ForeignDeclString),
add_string(":- pragma foreign_decl(", !U),
mercury_format_foreign_language_string(Lang, !U),
add_string(", ", !U),
@@ -3450,7 +3373,8 @@
mercury_format_foreign_language_string(Lang, !U) :-
add_string("""" ++ foreign_language_string(Lang) ++ """", !U).
-mercury_output_pragma_foreign_import_module(Lang, ModuleName, !IO) :-
+mercury_output_pragma_foreign_import_module(FIMinfo, !IO) :-
+ FIMinfo = pragma_info_foreign_import_module(Lang, ModuleName),
io.write_string(":- pragma foreign_import_module(", !IO),
mercury_format_foreign_language_string(Lang, !IO),
io.write_string(", ", !IO),
@@ -3520,21 +3444,26 @@
%-----------------------------------------------------------------------------%
- % Output the given pragma source_file declaration
-:- pred mercury_output_pragma_source_file(string::in, io::di, io::uo) is det.
+ % Output the given pragma source_file declaration.
+ %
+:- pred mercury_output_pragma_source_file(pragma_info_source_file::in,
+ io::di, io::uo) is det.
-mercury_output_pragma_source_file(SourceFileString, !IO) :-
+mercury_output_pragma_source_file(SourceFileInfo, !IO) :-
+ SourceFileInfo = pragma_info_source_file(SourceFileName),
io.write_string(":- pragma source_file(", !IO),
- term_io.quote_string(SourceFileString, !IO),
+ term_io.quote_string(SourceFileName, !IO),
io.write_string(").\n", !IO).
%-----------------------------------------------------------------------------%
- % Output the given foreign_body_code declaration
-:- pred mercury_output_pragma_foreign_body_code(foreign_language::in,
- string::in, io::di, io::uo) is det.
+ % Output the given foreign_body_code declaration.
+ %
+:- pred mercury_output_pragma_foreign_body_code(pragma_info_foreign_code::in,
+ io::di, io::uo) is det.
-mercury_output_pragma_foreign_body_code(Lang, ForeignCodeString, !IO) :-
+mercury_output_pragma_foreign_body_code(FCInfo, !IO) :-
+ FCInfo = pragma_info_foreign_code(Lang, ForeignCodeString),
io.write_string(":- pragma foreign_code(", !IO),
mercury_format_foreign_language_string(Lang, !IO),
io.write_string(", ", !IO),
@@ -3543,36 +3472,20 @@
%-----------------------------------------------------------------------------%
-mercury_output_pragma_foreign_code(Attributes, PredName, PredOrFunc, Vars0,
- ProgVarset, InstVarset, PragmaCode, !IO) :-
- mercury_format_pragma_foreign_code(Attributes, PredName, PredOrFunc,
- Vars0, ProgVarset, InstVarset, PragmaCode, !IO).
-
-mercury_pragma_foreign_code_to_string(Attributes, PredName, PredOrFunc, Vars0,
- ProgVarset, InstVarset, PragmaCode) = String :-
- mercury_format_pragma_foreign_code(Attributes, PredName, PredOrFunc,
- Vars0, ProgVarset, InstVarset, PragmaCode, "", String).
+mercury_output_pragma_foreign_proc(FPInfo, !IO) :-
+ mercury_format_pragma_foreign_proc(FPInfo, !IO).
- % Output the given pragma foreign_code declaration.
+mercury_pragma_foreign_proc_to_string(FPInfo) = String :-
+ mercury_format_pragma_foreign_proc(FPInfo, "", String).
+
+ % Output the given pragma foreign_proc declaration.
%
-:- pred mercury_format_pragma_foreign_code(pragma_foreign_proc_attributes::in,
- sym_name::in, pred_or_func::in, list(pragma_var)::in, prog_varset::in,
- inst_varset::in, pragma_foreign_code_impl::in,
+:- pred mercury_format_pragma_foreign_proc(pragma_info_foreign_proc::in,
U::di, U::uo) is det <= output(U).
-mercury_format_pragma_foreign_code(Attributes, PredName, PredOrFunc, Vars0,
- ProgVarset, InstVarset, PragmaCode, !U) :-
- PragmaCode = fc_impl_ordinary(_, _),
- mercury_format_pragma_foreign_code_2(Attributes, PredName,
- PredOrFunc, Vars0, ProgVarset, InstVarset, PragmaCode, !U).
-
-:- pred mercury_format_pragma_foreign_code_2(
- pragma_foreign_proc_attributes::in, sym_name::in, pred_or_func::in,
- list(pragma_var)::in, prog_varset::in, inst_varset::in,
- pragma_foreign_code_impl::in, U::di, U::uo) is det <= output(U).
-
-mercury_format_pragma_foreign_code_2(Attributes, PredName, PredOrFunc, Vars0,
- ProgVarset, InstVarset, PragmaCode, !U) :-
+mercury_format_pragma_foreign_proc(FPInfo, !U) :-
+ FPInfo = pragma_info_foreign_proc(Attributes, PredName, PredOrFunc, Vars0,
+ ProgVarset, InstVarset, PragmaCode),
add_string(":- pragma foreign_proc(", !U),
Lang = get_foreign_language(Attributes),
mercury_format_foreign_language_string(Lang, !U),
@@ -3646,8 +3559,8 @@
%-----------------------------------------------------------------------------%
-mercury_output_pragma_type_spec(Pragma, AppendVarnums, !IO) :-
- Pragma = pragma_type_spec(PredName, SpecName, Arity,
+mercury_output_pragma_type_spec(AppendVarnums, TypeSpecInfo, !IO) :-
+ TypeSpecInfo = pragma_info_type_spec(PredName, SpecName, Arity,
MaybePredOrFunc, MaybeModes, Subst, VarSet, _),
io.write_string(":- pragma type_spec(", !IO),
(
@@ -3701,8 +3614,10 @@
%-----------------------------------------------------------------------------%
-mercury_output_pragma_unused_args(PredOrFunc, SymName,
- Arity, ModeNum, UnusedArgs, !IO) :-
+mercury_output_pragma_unused_args(UnusedArgsInfo, !IO) :-
+ UnusedArgsInfo = pragma_info_unused_args(PredNameArityPFMn, UnusedArgs),
+ PredNameArityPFMn = pred_name_arity_pf_mn(SymName, Arity, PredOrFunc,
+ ModeNum),
io.write_string(":- pragma unused_args(", !IO),
write_pred_or_func(PredOrFunc, !IO),
io.write_string(", ", !IO),
@@ -3734,8 +3649,10 @@
%-----------------------------------------------------------------------------%
-mercury_output_pragma_exceptions(PredOrFunc, SymName, Arity, ModeNum,
- ThrowStatus, !IO) :-
+mercury_output_pragma_exceptions(ExceptionsInfo, !IO) :-
+ ExceptionsInfo = pragma_info_exceptions(PredNameArityPFMn, ThrowStatus),
+ PredNameArityPFMn = pred_name_arity_pf_mn(SymName, Arity, PredOrFunc,
+ ModeNum),
io.write_string(":- pragma exceptions(", !IO),
write_pred_or_func(PredOrFunc, !IO),
io.write_string(", ", !IO),
@@ -3766,8 +3683,10 @@
%-----------------------------------------------------------------------------%
-mercury_output_pragma_trailing_info(PredOrFunc, SymName, Arity, ModeNum,
- TrailingStatus, !IO) :-
+mercury_output_pragma_trailing_info(TrailingInfo, !IO) :-
+ TrailingInfo = pragma_info_trailing_info(PredNameArityPFMn, TrailingStatus),
+ PredNameArityPFMn = pred_name_arity_pf_mn(SymName, Arity, PredOrFunc,
+ ModeNum),
io.write_string(":- pragma trailing_info(", !IO),
write_pred_or_func(PredOrFunc, !IO),
io.write_string(", ", !IO),
@@ -3791,8 +3710,11 @@
%-----------------------------------------------------------------------------%
-mercury_output_pragma_mm_tabling_info(PredOrFunc, SymName, Arity, ModeNum,
- MM_TablingStatus, !IO) :-
+mercury_output_pragma_mm_tabling_info(TablingInfo, !IO) :-
+ TablingInfo = pragma_info_mm_tabling_info(PredNameArityPFMn,
+ MM_TablingStatus),
+ PredNameArityPFMn = pred_name_arity_pf_mn(SymName, Arity, PredOrFunc,
+ ModeNum),
io.write_string(":- pragma mm_tabling_info(", !IO),
write_pred_or_func(PredOrFunc, !IO),
io.write_string(", ", !IO),
@@ -3855,12 +3777,12 @@
%-----------------------------------------------------------------------------%
-:- pred mercury_format_pragma_foreign_export_enum(foreign_language::in,
- sym_name::in, arity::in, export_enum_attributes::in,
- assoc_list(sym_name, string)::in, U::di, U::uo) is det <= output(U).
+:- pred mercury_format_pragma_foreign_export_enum(
+ pragma_info_foreign_export_enum::in, U::di, U::uo) is det <= output(U).
-mercury_format_pragma_foreign_export_enum(Lang, TypeName, TypeArity,
- Attributes, Overrides, !U) :-
+mercury_format_pragma_foreign_export_enum(FEEInfo, !U) :-
+ FEEInfo = pragma_info_foreign_export_enum(Lang, TypeName, TypeArity,
+ Attributes, Overrides),
add_string(":- pragma foreign_export_enum(", !U),
mercury_format_foreign_language_string(Lang, !U),
add_string(", ", !U),
@@ -3912,12 +3834,11 @@
%-----------------------------------------------------------------------------%
-:- pred mercury_format_pragma_foreign_enum(foreign_language::in,
- sym_name::in, arity::in, assoc_list(sym_name, string)::in,
+:- pred mercury_format_pragma_foreign_enum(pragma_info_foreign_enum::in,
U::di, U::uo) is det <= output(U).
-mercury_format_pragma_foreign_enum(Lang, TypeName, TypeArity,
- Values, !U) :-
+mercury_format_pragma_foreign_enum(FEInfo, !U) :-
+ FEInfo = pragma_info_foreign_enum(Lang, TypeName, TypeArity, Values),
add_string(":- pragma foreign_enum(", !U),
mercury_format_foreign_language_string(Lang, !U),
add_string(", ", !U),
@@ -3930,12 +3851,12 @@
%-----------------------------------------------------------------------------%
-:- pred mercury_format_pragma_foreign_export(foreign_language::in,
- sym_name::in, pred_or_func::in, list(mer_mode)::in, string::in,
+:- pred mercury_format_pragma_foreign_export(pragma_info_foreign_export::in,
U::di, U::uo) is det <= output(U).
-mercury_format_pragma_foreign_export(Lang, Name, PredOrFunc, ModeList,
- ExportName, !U) :-
+mercury_format_pragma_foreign_export(FEInfo, !U) :-
+ FEInfo = pragma_info_foreign_export(Lang, PredNameModesPF, ExportName),
+ PredNameModesPF = pred_name_modes_pf(Name, ModeList, PredOrFunc),
varset.init(Varset), % The varset isn't really used.
InstInfo = simple_inst_info(Varset),
add_string(":- pragma foreign_export(", !U),
@@ -3961,12 +3882,86 @@
%-----------------------------------------------------------------------------%
-:- pred mercury_format_pragma_fact_table(sym_name::in, arity::in, string::in,
+:- pred mercury_output_pragma_tabled(pragma_info_tabled::in,
+ io::di, io::uo) is det.
+
+mercury_output_pragma_tabled(TabledInfo, !IO) :-
+ TabledInfo = pragma_info_tabled(EvalMethod, PredNameArityMPF, _Mode,
+ MaybeAttributes),
+ PredNameArityMPF = pred_name_arity_mpf(PredName, Arity, _MaybePorF),
+ PragmaName = eval_method_to_pragma_name(EvalMethod),
+ (
+ MaybeAttributes = yes(Attributes),
+ Attributes = table_attributes(Strictness, MaybeSizeLimit, Stats,
+ AllowReset),
+ some [!Strs] (
+ !:Strs = [],
+ (
+ Strictness = all_strict
+ ;
+ Strictness = all_fast_loose,
+ !:Strs = ["fast_loose" | !.Strs]
+ ;
+ Strictness = specified(Args, HiddenArgMethod),
+ ArgStrs = list.map(maybe_arg_tabling_method_to_string,
+ Args),
+ ArgsStr = string.join_list(", ", ArgStrs),
+ (
+ HiddenArgMethod = hidden_arg_value,
+ HiddenArgStr = "hidden_arg_value"
+ ;
+ HiddenArgMethod = hidden_arg_addr,
+ HiddenArgStr = "hidden_arg_addr"
+ ),
+ SpecifiedStr = "specified([" ++ ArgsStr ++ "], " ++
+ HiddenArgStr ++ ")",
+ !:Strs = [SpecifiedStr | !.Strs]
+ ),
+ (
+ MaybeSizeLimit = yes(SizeLimit),
+ LimitStr = "limit(" ++ int_to_string(SizeLimit) ++ ")",
+ !:Strs = [LimitStr | !.Strs]
+ ;
+ MaybeSizeLimit = no
+ ),
+ (
+ Stats = table_gather_statistics,
+ !:Strs = ["statistics" | !.Strs]
+ ;
+ Stats = table_dont_gather_statistics
+ ),
+ (
+ AllowReset = table_allow_reset,
+ !:Strs = ["allow_reset" | !.Strs]
+ ;
+ AllowReset = table_dont_allow_reset
+ ),
+ (
+ !.Strs = [],
+ MaybeAfter = no
+ ;
+ !.Strs = [_ | _],
+ MaybeAfter =
+ yes("[" ++ string.join_list(", ", !.Strs) ++ "]")
+ )
+ )
+ ;
+ MaybeAttributes = no,
+ MaybeAfter = no
+ ),
+ mercury_output_pragma_decl(PredName, Arity, pf_predicate, PragmaName,
+ MaybeAfter, !IO).
+
+%-----------------------------------------------------------------------------%
+
+:- pred mercury_format_pragma_fact_table(pragma_info_fact_table::in,
U::di, U::uo) is det <= output(U).
-mercury_format_pragma_fact_table(Pred, Arity, FileName, !U) :-
+mercury_format_pragma_fact_table(FactTableInfo, !U) :-
+ FactTableInfo = pragma_info_fact_table(PredNameArity, FileName),
+ PredNameArity = pred_name_arity(PredName, Arity),
add_string(":- pragma fact_table(", !U),
- mercury_format_bracketed_sym_name_ngt(Pred, next_to_graphic_token, !U),
+ mercury_format_bracketed_sym_name_ngt(PredName, next_to_graphic_token, !U),
add_string("/", !U),
add_int(Arity, !U),
add_string(", ", !U),
@@ -3975,10 +3970,11 @@
%-----------------------------------------------------------------------------%
-:- pred mercury_output_pragma_require_feature_set(set(required_feature)::in,
- U::di, U::uo) is det <= output(U).
+:- pred mercury_output_pragma_require_feature_set(
+ pragma_info_require_feature_set::in, U::di, U::uo) is det <= output(U).
-mercury_output_pragma_require_feature_set(Features0, !U) :-
+mercury_output_pragma_require_feature_set(RFSInfo, !U) :-
+ RFSInfo = pragma_info_require_feature_set(Features0),
Features = set.to_sorted_list(Features0),
add_string(":- pragma require_feature_set(", !U),
add_list(Features, ",", mercury_format_required_feature, !U),
@@ -4964,7 +4960,6 @@
%-----------------------------------------------------------------------------%
-
% Succeed if the sym_name describes a builtin inst.
%
:- pred builtin_inst_name(sym_name::in, list(inst_var)::in) is semidet.
@@ -4982,8 +4977,8 @@
% so that it can parse the resulting pragma termination_info
% declarations.
-write_pragma_termination_info(PredOrFunc, SymName, ModeList, Context,
- MaybeArgSize, MaybeTermination, !IO) :-
+write_pragma_termination_info_components(PredOrFunc, SymName, ModeList,
+ MaybeArgSize, MaybeTermination, Context, !IO) :-
io.write_string(":- pragma termination_info(", !IO),
varset.init(InitVarSet),
(
@@ -5080,15 +5075,13 @@
% Code to output termination2_info pragmas.
%
-:- pred write_pragma_termination2_info(pred_or_func::in, sym_name::in,
- list(mer_mode)::in, maybe(pragma_constr_arg_size_info)::in,
- maybe(pragma_constr_arg_size_info)::in,
- maybe(pragma_termination_info)::in, prog_context::in,
- io::di, io::uo) is det.
+:- pred write_pragma_termination2_info(pragma_info_termination2_info::in,
+ prog_context::in, io::di, io::uo) is det.
-write_pragma_termination2_info(PredOrFunc, PredName, ModeList,
- MaybeSuccess, MaybeFailure, MaybeTermination, Context,
- !IO) :-
+write_pragma_termination2_info(Term2Info, Context, !IO) :-
+ Term2Info = pragma_info_termination2_info(PredModesPF,
+ MaybeSuccess, MaybeFailure, MaybeTermination),
+ PredModesPF = pred_name_modes_pf(PredName, ModeList, PredOrFunc),
io.write_string(":- pragma termination2_info(", !IO),
(
PredOrFunc = pf_predicate,
@@ -5163,9 +5156,11 @@
%-----------------------------------------------------------------------------%
-write_pragma_structure_sharing_info(PredOrFunc, SymName, Modes, Context,
- HeadVars, MaybeVarSet, HeadVarTypes, MaybeTypeVarSet,
- MaybeSharingAs, !IO) :-
+write_pragma_structure_sharing_info(SharingInfo, MaybeVarSet, MaybeTypeVarSet,
+ Context, !IO) :-
+ SharingInfo = pragma_info_structure_sharing(PredNameModesPF,
+ HeadVars, HeadVarTypes, MaybeSharingAs),
+ PredNameModesPF = pred_name_modes_pf(SymName, Modes, PredOrFunc),
io.write_string(":- pragma structure_sharing(", !IO),
varset.init(InitVarSet),
(
@@ -5200,9 +5195,11 @@
MaybeSharingAs, !IO),
io.write_string(").\n", !IO).
-write_pragma_structure_reuse_info(PredOrFunc, SymName, Modes, Context,
- HeadVars, MaybeVarSet, HeadVarTypes, MaybeTypeVarSet,
- MaybeStructureReuseDomain, !IO) :-
+write_pragma_structure_reuse_info(ReuseInfo, MaybeVarSet, MaybeTypeVarSet,
+ Context, !IO) :-
+ ReuseInfo = pragma_info_structure_reuse(PredNameModesPF,
+ HeadVars, HeadVarTypes, MaybeStructureReuseDomain),
+ PredNameModesPF = pred_name_modes_pf(SymName, Modes, PredOrFunc),
io.write_string(":- pragma structure_reuse(", !IO),
varset.init(InitVarSet),
(
Index: compiler/module_imports.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/module_imports.m,v
retrieving revision 1.13
diff -u -b -r1.13 module_imports.m
--- compiler/module_imports.m 19 Jul 2012 11:44:12 -0000 1.13
+++ compiler/module_imports.m 5 Sep 2012 04:59:59 -0000
@@ -585,7 +585,8 @@
(
Item = item_pragma(ItemPragma),
ItemPragma = item_pragma_info(_, Pragma, _, _),
- Pragma = pragma_tabled(_, _, _, _, _, MaybeAttributes)
+ Pragma = pragma_tabled(TableInfo),
+ TableInfo = pragma_info_tabled(_, _, _, MaybeAttributes)
->
!:ItemsNeedTabling = yes,
(
@@ -783,7 +784,8 @@
(
Item = item_pragma(ItemPragma),
ItemPragma = item_pragma_info(_, Pragma, _, _),
- Pragma = pragma_fact_table(_SymName, _Arity, FileName)
+ Pragma = pragma_fact_table(FTInfo),
+ FTInfo = pragma_info_fact_table(_PredNameArity, FileName)
->
!:Deps = [FileName | !.Deps]
;
Index: compiler/module_qual.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/module_qual.m,v
retrieving revision 1.193
diff -u -b -r1.193 module_qual.m
--- compiler/module_qual.m 11 Jun 2012 03:13:21 -0000 1.193
+++ compiler/module_qual.m 5 Sep 2012 04:59:59 -0000
@@ -1387,52 +1387,61 @@
qualify_pragma(Pragma0, Pragma, !Info, !Specs) :-
(
( Pragma0 = pragma_source_file(_)
- ; Pragma0 = pragma_foreign_decl(_, _, _)
- ; Pragma0 = pragma_foreign_code(_, _)
- ; Pragma0 = pragma_foreign_import_module(_, _)
- ; Pragma0 = pragma_inline(_, _)
- ; Pragma0 = pragma_no_inline(_, _)
- ; Pragma0 = pragma_obsolete(_, _)
- ; Pragma0 = pragma_no_detism_warning(_, _)
- ; Pragma0 = pragma_unused_args(_, _, _, _, _)
- ; Pragma0 = pragma_exceptions(_, _, _, _, _)
- ; Pragma0 = pragma_trailing_info(_, _, _, _, _)
- ; Pragma0 = pragma_mm_tabling_info(_, _, _, _, _)
- ; Pragma0 = pragma_fact_table(_, _, _)
- ; Pragma0 = pragma_reserve_tag(_, _)
- ; Pragma0 = pragma_promise_pure(_, _)
- ; Pragma0 = pragma_promise_semipure(_, _)
- ; Pragma0 = pragma_promise_equivalent_clauses(_, _)
- ; Pragma0 = pragma_terminates(_, _)
- ; Pragma0 = pragma_does_not_terminate(_, _)
- ; Pragma0 = pragma_check_termination(_, _)
- ; Pragma0 = pragma_mode_check_clauses(_, _)
+ ; Pragma0 = pragma_foreign_decl(_)
+ ; Pragma0 = pragma_foreign_code(_)
+ ; Pragma0 = pragma_foreign_import_module(_)
+ ; Pragma0 = pragma_inline(_)
+ ; Pragma0 = pragma_no_inline(_)
+ ; Pragma0 = pragma_obsolete(_)
+ ; Pragma0 = pragma_no_detism_warning(_)
+ ; Pragma0 = pragma_unused_args(_)
+ ; Pragma0 = pragma_exceptions(_)
+ ; Pragma0 = pragma_trailing_info(_)
+ ; Pragma0 = pragma_mm_tabling_info(_)
+ ; Pragma0 = pragma_fact_table(_)
+ ; Pragma0 = pragma_reserve_tag(_)
+ ; Pragma0 = pragma_promise_pure(_)
+ ; Pragma0 = pragma_promise_semipure(_)
+ ; Pragma0 = pragma_promise_eqv_clauses(_)
+ ; Pragma0 = pragma_terminates(_)
+ ; Pragma0 = pragma_does_not_terminate(_)
+ ; Pragma0 = pragma_check_termination(_)
+ ; Pragma0 = pragma_mode_check_clauses(_)
; Pragma0 = pragma_require_feature_set(_)
),
Pragma = Pragma0
;
- Pragma0 = pragma_foreign_export_enum(Lang, TypeName0, TypeArity0,
+ Pragma0 = pragma_foreign_export_enum(FEEInfo0),
+ FEEInfo0 = pragma_info_foreign_export_enum(Lang, TypeName0, TypeArity0,
Attributes, Overrides),
qualify_type_ctor(type_ctor(TypeName0, TypeArity0),
type_ctor(TypeName, TypeArity), !Info, !Specs),
- Pragma = pragma_foreign_export_enum(Lang, TypeName, TypeArity,
- Attributes, Overrides)
+ FEEInfo = pragma_info_foreign_export_enum(Lang, TypeName, TypeArity,
+ Attributes, Overrides),
+ Pragma = pragma_foreign_export_enum(FEEInfo)
;
- Pragma0 = pragma_foreign_enum(Lang, TypeName0, TypeArity0, Values),
+ Pragma0 = pragma_foreign_enum(FEInfo0),
+ FEInfo0 = pragma_info_foreign_enum(Lang, TypeName0, TypeArity0,
+ Values),
qualify_type_ctor(type_ctor(TypeName0, TypeArity0),
type_ctor(TypeName, TypeArity), !Info, !Specs),
- Pragma = pragma_foreign_enum(Lang, TypeName, TypeArity, Values)
- ;
- Pragma0 = pragma_foreign_proc(Attrs0, Name, PredOrFunc, Vars0, Varset,
- InstVarset, Impl),
+ FEInfo = pragma_info_foreign_enum(Lang, TypeName, TypeArity,
+ Values),
+ Pragma = pragma_foreign_enum(FEInfo)
+ ;
+ Pragma0 = pragma_foreign_proc(FPInfo0),
+ FPInfo0 = pragma_info_foreign_proc(Attrs0, Name, PredOrFunc,
+ Vars0, Varset, InstVarset, Impl),
qualify_pragma_vars(Vars0, Vars, !Info, !Specs),
UserSharing0 = get_user_annotated_sharing(Attrs0),
qualify_user_sharing(UserSharing0, UserSharing, !Info, !Specs),
set_user_annotated_sharing(UserSharing, Attrs0, Attrs),
- Pragma = pragma_foreign_proc(Attrs, Name, PredOrFunc, Vars, Varset,
- InstVarset, Impl)
+ FPInfo = pragma_info_foreign_proc(Attrs, Name, PredOrFunc,
+ Vars, Varset, InstVarset, Impl),
+ Pragma = pragma_foreign_proc(FPInfo)
;
- Pragma0 = pragma_tabled(EvalMethod, Name, Arity, PredOrFunc,
+ Pragma0 = pragma_tabled(TabledInfo0),
+ TabledInfo0 = pragma_info_tabled(EvalMethod, PredNameArityPF,
MModes0, Attrs),
(
MModes0 = yes(Modes0),
@@ -1442,14 +1451,21 @@
MModes0 = no,
MModes = no
),
- Pragma = pragma_tabled(EvalMethod, Name, Arity, PredOrFunc,
- MModes, Attrs)
- ;
- Pragma0 = pragma_foreign_export(Lang, Name, PredOrFunc, Modes0, CFunc),
+ TabledInfo = pragma_info_tabled(EvalMethod, PredNameArityPF,
+ MModes, Attrs),
+ Pragma = pragma_tabled(TabledInfo)
+ ;
+ Pragma0 = pragma_foreign_export(FEInfo0),
+ FEInfo0 = pragma_info_foreign_export(Lang, PredNameModesPF0, CFunc),
+ PredNameModesPF0 = pred_name_modes_pf(Name, Modes0, PredOrFunc),
qualify_mode_list(Modes0, Modes, !Info, !Specs),
- Pragma = pragma_foreign_export(Lang, Name, PredOrFunc, Modes, CFunc)
- ;
- Pragma0 = pragma_type_spec(A, B, C, D, MaybeModes0, Subst0, G, H),
+ PredNameModesPF = pred_name_modes_pf(Name, Modes, PredOrFunc),
+ FEInfo = pragma_info_foreign_export(Lang, PredNameModesPF, CFunc),
+ Pragma = pragma_foreign_export(FEInfo)
+ ;
+ Pragma0 = pragma_type_spec(TypeSpecInfo0),
+ TypeSpecInfo0 = pragma_info_type_spec(A, B, C, D, MaybeModes0,
+ Subst0, G, H),
(
MaybeModes0 = yes(Modes0),
qualify_mode_list(Modes0, Modes, !Info, !Specs),
@@ -1459,31 +1475,47 @@
MaybeModes = no
),
qualify_type_spec_subst(Subst0, Subst, !Info, !Specs),
- Pragma = pragma_type_spec(A, B, C, D, MaybeModes, Subst, G, H)
- ;
- Pragma0 = pragma_termination_info(PredOrFunc, SymName, ModeList0,
- Args, Term),
+ TypeSpecInfo = pragma_info_type_spec(A, B, C, D, MaybeModes,
+ Subst, G, H),
+ Pragma = pragma_type_spec(TypeSpecInfo)
+ ;
+ Pragma0 = pragma_termination_info(TermInfo0),
+ TermInfo0 = pragma_info_termination_info(PredNameModesPF0, Args, Term),
+ PredNameModesPF0 = pred_name_modes_pf(SymName, ModeList0, PredOrFunc),
qualify_mode_list(ModeList0, ModeList, !Info, !Specs),
- Pragma = pragma_termination_info(PredOrFunc, SymName, ModeList,
- Args, Term)
+ PredNameModesPF = pred_name_modes_pf(SymName, ModeList, PredOrFunc),
+ TermInfo = pragma_info_termination_info(PredNameModesPF, Args, Term),
+ Pragma = pragma_termination_info(TermInfo)
;
- Pragma0 = pragma_structure_sharing(PredOrFunc, SymName, ModeList0,
+ Pragma0 = pragma_structure_sharing(SharingInfo0),
+ SharingInfo0 = pragma_info_structure_sharing(PredNameModesPF0,
Vars, Types, Sharing),
+ PredNameModesPF0 = pred_name_modes_pf(SymName, ModeList0, PredOrFunc),
qualify_mode_list(ModeList0, ModeList, !Info, !Specs),
- Pragma = pragma_structure_sharing(PredOrFunc, SymName, ModeList,
- Vars, Types, Sharing)
+ PredNameModesPF = pred_name_modes_pf(SymName, ModeList, PredOrFunc),
+ SharingInfo = pragma_info_structure_sharing(PredNameModesPF,
+ Vars, Types, Sharing),
+ Pragma = pragma_structure_sharing(SharingInfo)
;
- Pragma0 = pragma_structure_reuse(PredOrFunc, SymName, ModeList0,
+ Pragma0 = pragma_structure_reuse(ReuseInfo0),
+ ReuseInfo0 = pragma_info_structure_reuse(PredNameModesPF0,
Vars, Types, ReuseTuples),
+ PredNameModesPF0 = pred_name_modes_pf(SymName, ModeList0, PredOrFunc),
qualify_mode_list(ModeList0, ModeList, !Info, !Specs),
- Pragma = pragma_structure_reuse(PredOrFunc, SymName, ModeList,
- Vars, Types, ReuseTuples)
+ PredNameModesPF = pred_name_modes_pf(SymName, ModeList, PredOrFunc),
+ ReuseInfo = pragma_info_structure_reuse(PredNameModesPF,
+ Vars, Types, ReuseTuples),
+ Pragma = pragma_structure_reuse(ReuseInfo)
;
- Pragma0 = pragma_termination2_info(PredOrFunc, SymName, ModeList0,
+ Pragma0 = pragma_termination2_info(Term2Info0),
+ Term2Info0 = pragma_info_termination2_info(PredNameModesPF0,
SuccessArgs, FailureArgs, Term),
+ PredNameModesPF0 = pred_name_modes_pf(SymName, ModeList0, PredOrFunc),
qualify_mode_list(ModeList0, ModeList, !Info, !Specs),
- Pragma = pragma_termination2_info(PredOrFunc, SymName, ModeList,
- SuccessArgs, FailureArgs, Term)
+ PredNameModesPF = pred_name_modes_pf(SymName, ModeList, PredOrFunc),
+ Term2Info = pragma_info_termination2_info(PredNameModesPF,
+ SuccessArgs, FailureArgs, Term),
+ Pragma = pragma_termination2_info(Term2Info)
).
:- pred qualify_pragma_vars(list(pragma_var)::in, list(pragma_var)::out,
@@ -1491,9 +1523,11 @@
list(error_spec)::in, list(error_spec)::out) is det.
qualify_pragma_vars([], [], !Info, !Specs).
-qualify_pragma_vars([pragma_var(Var, Name, Mode0, Box) | PragmaVars0],
- [pragma_var(Var, Name, Mode, Box) | PragmaVars], !Info, !Specs) :-
+qualify_pragma_vars([PragmaVar0 | PragmaVars0], [PragmaVar | PragmaVars],
+ !Info, !Specs) :-
+ PragmaVar0 = pragma_var(Var, Name, Mode0, Box),
qualify_mode(Mode0, Mode, !Info, !Specs),
+ PragmaVar = pragma_var(Var, Name, Mode, Box),
qualify_pragma_vars(PragmaVars0, PragmaVars, !Info, !Specs).
:- pred qualify_type_spec_subst(assoc_list(tvar, mer_type)::in,
@@ -1555,9 +1589,9 @@
mq_info::in, mq_info::out,
list(error_spec)::in, list(error_spec)::out) is det.
+qualify_class_method(Method0, Method, !Info, !Specs) :-
% There is no need to qualify the method name, since that is
% done when the item is parsed.
-qualify_class_method(Method0, Method, !Info, !Specs) :-
(
Method0 = method_pred_or_func(TypeVarset, InstVarset, ExistQVars,
PredOrFunc, Name, TypesAndModes0, WithType0, WithInst0, MaybeDet,
@@ -1578,8 +1612,8 @@
WithInst, MaybeDet, Cond, Context)
).
-:- pred qualify_instance_body(sym_name::in, instance_body::in,
- instance_body::out) is det.
+:- pred qualify_instance_body(sym_name::in,
+ instance_body::in, instance_body::out) is det.
qualify_instance_body(ClassName, InstanceBody0, InstanceBody) :-
(
Index: compiler/modules.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/modules.m,v
retrieving revision 1.471
diff -u -b -r1.471 modules.m
--- compiler/modules.m 22 Nov 2011 23:04:52 -0000 1.471
+++ compiler/modules.m 5 Sep 2012 04:59:59 -0000
@@ -378,6 +378,7 @@
:- import_module parse_tree.prog_out.
:- import_module parse_tree.prog_type.
:- import_module parse_tree.write_deps_file.
+:- import_module recompilation.
:- import_module recompilation.version.
:- import_module char.
@@ -1479,7 +1480,8 @@
(
Item = item_pragma(ItemPragma),
ItemPragma = item_pragma_info(_, Pragma, _, _),
- Pragma = pragma_foreign_enum(_Lang, TypeName, TypeArity, _Values)
+ Pragma = pragma_foreign_enum(FEInfo),
+ FEInfo = pragma_info_foreign_enum(_Lang, TypeName, TypeArity, _Values)
->
% We only add a pragma foreign_enum pragma to the interface file
% if it corresponds to a type _definition_ in the interface of the
@@ -1662,23 +1664,23 @@
% only, and should go in the implementation.
(
- ( Pragma = pragma_foreign_code(_, _)
- ; Pragma = pragma_foreign_decl(_, _, _)
- ; Pragma = pragma_foreign_export(_, _, _, _, _)
- ; Pragma = pragma_foreign_export_enum(_, _, _, _, _)
- ; Pragma = pragma_foreign_proc(_, _, _, _, _, _, _)
- ; Pragma = pragma_inline(_, _)
- ; Pragma = pragma_no_detism_warning(_, _)
- ; Pragma = pragma_no_inline(_, _)
- ; Pragma = pragma_fact_table(_, _, _)
- ; Pragma = pragma_tabled(_, _, _, _, _, _)
- ; Pragma = pragma_promise_pure(_, _)
- ; Pragma = pragma_promise_semipure(_, _)
- ; Pragma = pragma_promise_equivalent_clauses(_, _)
- ; Pragma = pragma_unused_args(_, _, _, _, _)
- ; Pragma = pragma_exceptions(_, _, _, _, _)
- ; Pragma = pragma_trailing_info(_, _, _, _, _)
- ; Pragma = pragma_mm_tabling_info(_, _, _, _, _)
+ ( Pragma = pragma_foreign_code(_)
+ ; Pragma = pragma_foreign_decl(_)
+ ; Pragma = pragma_foreign_export(_)
+ ; Pragma = pragma_foreign_export_enum(_)
+ ; Pragma = pragma_foreign_proc(_)
+ ; Pragma = pragma_inline(_)
+ ; Pragma = pragma_no_detism_warning(_)
+ ; Pragma = pragma_no_inline(_)
+ ; Pragma = pragma_fact_table(_)
+ ; Pragma = pragma_tabled(_)
+ ; Pragma = pragma_promise_pure(_)
+ ; Pragma = pragma_promise_semipure(_)
+ ; Pragma = pragma_promise_eqv_clauses(_)
+ ; Pragma = pragma_unused_args(_)
+ ; Pragma = pragma_exceptions(_)
+ ; Pragma = pragma_trailing_info(_)
+ ; Pragma = pragma_mm_tabling_info(_)
; Pragma = pragma_require_feature_set(_)
),
Allowed = no
@@ -1687,20 +1689,20 @@
% and that `reserve_tag' and `direct_arg' must be in the interface iff
% the corresponding type definition is in the interface. This is
% checked in make_hlds.
- ( Pragma = pragma_foreign_enum(_, _, _, _)
- ; Pragma = pragma_foreign_import_module(_, _)
- ; Pragma = pragma_obsolete(_, _)
+ ( Pragma = pragma_foreign_enum(_)
+ ; Pragma = pragma_foreign_import_module(_)
+ ; Pragma = pragma_obsolete(_)
; Pragma = pragma_source_file(_)
- ; Pragma = pragma_reserve_tag(_, _)
- ; Pragma = pragma_type_spec(_, _, _, _, _, _, _, _)
- ; Pragma = pragma_termination_info(_, _, _, _, _)
- ; Pragma = pragma_termination2_info(_,_, _, _, _, _)
- ; Pragma = pragma_terminates(_, _)
- ; Pragma = pragma_does_not_terminate(_, _)
- ; Pragma = pragma_check_termination(_, _)
- ; Pragma = pragma_structure_sharing(_, _, _, _, _, _)
- ; Pragma = pragma_structure_reuse(_, _, _, _, _, _)
- ; Pragma = pragma_mode_check_clauses(_, _)
+ ; Pragma = pragma_reserve_tag(_)
+ ; Pragma = pragma_type_spec(_)
+ ; Pragma = pragma_termination_info(_)
+ ; Pragma = pragma_termination2_info(_)
+ ; Pragma = pragma_terminates(_)
+ ; Pragma = pragma_does_not_terminate(_)
+ ; Pragma = pragma_check_termination(_)
+ ; Pragma = pragma_structure_sharing(_)
+ ; Pragma = pragma_structure_reuse(_)
+ ; Pragma = pragma_mode_check_clauses(_)
),
Allowed = yes
).
@@ -3628,7 +3630,8 @@
make_foreign_import(ModuleName, Lang) = Item :-
Origin = compiler(foreign_imports),
- Pragma = pragma_foreign_import_module(Lang, ModuleName),
+ Info = pragma_info_foreign_import_module(Lang, ModuleName),
+ Pragma = pragma_foreign_import_module(Info),
ItemPragma = item_pragma_info(Origin, Pragma, term.context_init, -1),
Item = item_pragma(ItemPragma).
@@ -3780,7 +3783,7 @@
% XXX This if-then-else should be a switch, or (even better)
% we should take pragma_foreign_import_modules out of the pragma items
% and given them their own item type.
- ( Pragma = pragma_foreign_import_module(_, _) ->
+ ( Pragma = pragma_foreign_import_module(_) ->
Include = yes
;
Include = no
@@ -3856,42 +3859,51 @@
Item = item_pragma(ItemPragma),
ItemPragma = item_pragma_info(_, Pragma, _, _),
(
- ( Pragma = pragma_foreign_decl(Lang, _, _)
- ; Pragma = pragma_foreign_code(Lang, _)
- ; Pragma = pragma_foreign_enum(Lang, _, _, _)
- ; Pragma = pragma_foreign_export(Lang, _, _, _, _)
+ (
+ Pragma = pragma_foreign_decl(FDInfo),
+ FDInfo = pragma_info_foreign_decl(Lang, _, _)
+ ;
+ Pragma = pragma_foreign_code(FCInfo),
+ FCInfo = pragma_info_foreign_code(Lang, _)
+ ;
+ Pragma = pragma_foreign_enum(FEInfo),
+ FEInfo = pragma_info_foreign_enum(Lang, _, _, _)
+ ;
+ Pragma = pragma_foreign_export(FEInfo),
+ FEInfo = pragma_info_foreign_export(Lang, _, _)
),
Langs = [Lang]
;
- Pragma = pragma_foreign_proc(Attrs, _, _, _, _, _, _),
+ Pragma = pragma_foreign_proc(FPInfo),
+ FPInfo = pragma_info_foreign_proc(Attrs, _, _, _, _, _, _),
Langs = [get_foreign_language(Attrs)]
;
- ( Pragma = pragma_foreign_import_module(_, _)
- ; Pragma = pragma_foreign_export_enum(_, _, _, _, _)
- ; Pragma = pragma_type_spec(_, _, _, _, _, _, _, _)
- ; Pragma = pragma_inline(_, _)
- ; Pragma = pragma_no_inline(_, _)
- ; Pragma = pragma_unused_args(_, _, _, _, _)
- ; Pragma = pragma_exceptions(_, _, _, _, _)
- ; Pragma = pragma_trailing_info(_, _, _, _, _)
- ; Pragma = pragma_mm_tabling_info(_, _, _, _, _)
- ; Pragma = pragma_obsolete(_, _)
- ; Pragma = pragma_no_detism_warning(_, _)
+ ( Pragma = pragma_foreign_import_module(_)
+ ; Pragma = pragma_foreign_export_enum(_)
+ ; Pragma = pragma_type_spec(_)
+ ; Pragma = pragma_inline(_)
+ ; Pragma = pragma_no_inline(_)
+ ; Pragma = pragma_unused_args(_)
+ ; Pragma = pragma_exceptions(_)
+ ; Pragma = pragma_trailing_info(_)
+ ; Pragma = pragma_mm_tabling_info(_)
+ ; Pragma = pragma_obsolete(_)
+ ; Pragma = pragma_no_detism_warning(_)
; Pragma = pragma_source_file(_)
- ; Pragma = pragma_tabled(_, _, _, _, _, _)
- ; Pragma = pragma_fact_table(_, _, _)
- ; Pragma = pragma_reserve_tag(_, _)
- ; Pragma = pragma_promise_equivalent_clauses(_, _)
- ; Pragma = pragma_promise_pure(_, _)
- ; Pragma = pragma_promise_semipure(_, _)
- ; Pragma = pragma_termination_info(_, _, _, _, _)
- ; Pragma = pragma_termination2_info(_, _, _, _, _, _)
- ; Pragma = pragma_terminates(_, _)
- ; Pragma = pragma_does_not_terminate(_, _)
- ; Pragma = pragma_check_termination(_, _)
- ; Pragma = pragma_mode_check_clauses(_, _)
- ; Pragma = pragma_structure_sharing(_, _, _, _, _, _)
- ; Pragma = pragma_structure_reuse(_, _, _, _, _, _)
+ ; Pragma = pragma_tabled(_)
+ ; Pragma = pragma_fact_table(_)
+ ; Pragma = pragma_reserve_tag(_)
+ ; Pragma = pragma_promise_eqv_clauses(_)
+ ; Pragma = pragma_promise_pure(_)
+ ; Pragma = pragma_promise_semipure(_)
+ ; Pragma = pragma_termination_info(_)
+ ; Pragma = pragma_termination2_info(_)
+ ; Pragma = pragma_terminates(_)
+ ; Pragma = pragma_does_not_terminate(_)
+ ; Pragma = pragma_check_termination(_)
+ ; Pragma = pragma_mode_check_clauses(_)
+ ; Pragma = pragma_structure_sharing(_)
+ ; Pragma = pragma_structure_reuse(_)
; Pragma = pragma_require_feature_set(_)
),
Langs = []
@@ -3954,42 +3966,42 @@
Item = item_pragma(ItemPragma),
ItemPragma = item_pragma_info(_, Pragma, _, _),
(
- ( Pragma = pragma_foreign_import_module(_, _)
- ; Pragma = pragma_foreign_enum(_, _, _, _)
+ ( Pragma = pragma_foreign_import_module(_)
+ ; Pragma = pragma_foreign_enum(_)
),
Include = yes
;
% XXX I am not sure about the proper value of Include
% for some of these. -zs
- ( Pragma = pragma_foreign_decl(_, _, _)
- ; Pragma = pragma_foreign_code(_, _)
- ; Pragma = pragma_foreign_proc(_, _, _, _, _, _, _)
- ; Pragma = pragma_foreign_export(_, _, _, _, _)
- ; Pragma = pragma_foreign_export_enum(_, _, _, _, _)
- ; Pragma = pragma_type_spec(_, _, _, _, _, _, _, _)
- ; Pragma = pragma_inline(_, _)
- ; Pragma = pragma_no_inline(_, _)
- ; Pragma = pragma_unused_args(_, _, _, _, _)
- ; Pragma = pragma_exceptions(_, _, _, _, _)
- ; Pragma = pragma_trailing_info(_, _, _, _, _)
- ; Pragma = pragma_mm_tabling_info(_, _, _, _, _)
- ; Pragma = pragma_obsolete(_, _)
- ; Pragma = pragma_no_detism_warning(_, _)
+ ( Pragma = pragma_foreign_decl(_)
+ ; Pragma = pragma_foreign_code(_)
+ ; Pragma = pragma_foreign_proc(_)
+ ; Pragma = pragma_foreign_export(_)
+ ; Pragma = pragma_foreign_export_enum(_)
+ ; Pragma = pragma_type_spec(_)
+ ; Pragma = pragma_inline(_)
+ ; Pragma = pragma_no_inline(_)
+ ; Pragma = pragma_unused_args(_)
+ ; Pragma = pragma_exceptions(_)
+ ; Pragma = pragma_trailing_info(_)
+ ; Pragma = pragma_mm_tabling_info(_)
+ ; Pragma = pragma_obsolete(_)
+ ; Pragma = pragma_no_detism_warning(_)
; Pragma = pragma_source_file(_)
- ; Pragma = pragma_tabled(_, _, _, _, _, _)
- ; Pragma = pragma_fact_table(_, _, _)
- ; Pragma = pragma_reserve_tag(_, _)
- ; Pragma = pragma_promise_equivalent_clauses(_, _)
- ; Pragma = pragma_promise_pure(_, _)
- ; Pragma = pragma_promise_semipure(_, _)
- ; Pragma = pragma_termination_info(_, _, _, _, _)
- ; Pragma = pragma_termination2_info(_, _, _, _, _, _)
- ; Pragma = pragma_terminates(_, _)
- ; Pragma = pragma_does_not_terminate(_, _)
- ; Pragma = pragma_check_termination(_, _)
- ; Pragma = pragma_mode_check_clauses(_, _)
- ; Pragma = pragma_structure_sharing(_, _, _, _, _, _)
- ; Pragma = pragma_structure_reuse(_, _, _, _, _, _)
+ ; Pragma = pragma_tabled(_)
+ ; Pragma = pragma_fact_table(_)
+ ; Pragma = pragma_reserve_tag(_)
+ ; Pragma = pragma_promise_eqv_clauses(_)
+ ; Pragma = pragma_promise_pure(_)
+ ; Pragma = pragma_promise_semipure(_)
+ ; Pragma = pragma_termination_info(_)
+ ; Pragma = pragma_termination2_info(_)
+ ; Pragma = pragma_terminates(_)
+ ; Pragma = pragma_does_not_terminate(_)
+ ; Pragma = pragma_check_termination(_)
+ ; Pragma = pragma_mode_check_clauses(_)
+ ; Pragma = pragma_structure_sharing(_)
+ ; Pragma = pragma_structure_reuse(_)
; Pragma = pragma_require_feature_set(_)
),
Include = no
@@ -4154,7 +4166,7 @@
\+ (
ThisItem = item_pragma(ThisItemPragma),
ThisItemPragma = item_pragma_info(_, Pragma, _, _),
- Pragma = pragma_foreign_import_module(_, _)
+ Pragma = pragma_foreign_import_module(_)
)
),
list.filter(NotPragmaForeignImport, !Items)
@@ -4386,41 +4398,41 @@
reorderable_pragma_type(Pragma) = Reorderable :-
(
- ( Pragma = pragma_check_termination(_, _)
- ; Pragma = pragma_does_not_terminate(_, _)
- ; Pragma = pragma_exceptions(_, _, _, _, _)
- ; Pragma = pragma_trailing_info(_, _, _, _, _)
- ; Pragma = pragma_mm_tabling_info(_, _, _, _, _)
- ; Pragma = pragma_foreign_export(_, _, _, _, _)
- ; Pragma = pragma_foreign_export_enum(_, _, _, _, _)
- ; Pragma = pragma_foreign_enum(_, _, _, _)
- ; Pragma = pragma_inline(_, _)
- ; Pragma = pragma_mode_check_clauses(_, _)
- ; Pragma = pragma_no_inline(_, _)
- ; Pragma = pragma_obsolete(_, _)
- ; Pragma = pragma_no_detism_warning(_, _)
- ; Pragma = pragma_promise_pure(_, _)
- ; Pragma = pragma_promise_semipure(_, _)
- ; Pragma = pragma_promise_equivalent_clauses(_, _)
- ; Pragma = pragma_reserve_tag(_, _)
- ; Pragma = pragma_tabled(_, _, _, _, _, _)
- ; Pragma = pragma_terminates(_, _)
- ; Pragma = pragma_termination_info(_, _, _, _, _)
- ; Pragma = pragma_structure_sharing(_, _, _, _, _, _)
- ; Pragma = pragma_structure_reuse(_, _, _, _, _, _)
- ; Pragma = pragma_type_spec(_, _, _, _, _, _, _, _)
- ; Pragma = pragma_unused_args(_, _, _, _, _)
+ ( Pragma = pragma_check_termination( _)
+ ; Pragma = pragma_does_not_terminate( _)
+ ; Pragma = pragma_exceptions(_)
+ ; Pragma = pragma_trailing_info(_)
+ ; Pragma = pragma_mm_tabling_info(_)
+ ; Pragma = pragma_foreign_export(_)
+ ; Pragma = pragma_foreign_export_enum(_)
+ ; Pragma = pragma_foreign_enum(_)
+ ; Pragma = pragma_inline(_)
+ ; Pragma = pragma_mode_check_clauses(_)
+ ; Pragma = pragma_no_inline(_)
+ ; Pragma = pragma_obsolete(_)
+ ; Pragma = pragma_no_detism_warning(_)
+ ; Pragma = pragma_promise_pure(_)
+ ; Pragma = pragma_promise_semipure(_)
+ ; Pragma = pragma_promise_eqv_clauses(_)
+ ; Pragma = pragma_reserve_tag(_)
+ ; Pragma = pragma_tabled(_)
+ ; Pragma = pragma_terminates(_)
+ ; Pragma = pragma_termination_info(_)
+ ; Pragma = pragma_structure_sharing(_)
+ ; Pragma = pragma_structure_reuse(_)
+ ; Pragma = pragma_type_spec(_)
+ ; Pragma = pragma_unused_args(_)
; Pragma = pragma_require_feature_set(_)
),
Reorderable = yes
;
- ( Pragma = pragma_foreign_code(_, _)
- ; Pragma = pragma_foreign_decl(_, _, _)
- ; Pragma = pragma_foreign_import_module(_, _)
- ; Pragma = pragma_foreign_proc(_, _, _, _, _, _, _)
+ ( Pragma = pragma_foreign_code(_)
+ ; Pragma = pragma_foreign_decl(_)
+ ; Pragma = pragma_foreign_import_module(_)
+ ; Pragma = pragma_foreign_proc(_)
; Pragma = pragma_source_file(_)
- ; Pragma = pragma_termination2_info(_, _, _, _, _, _)
- ; Pragma = pragma_fact_table(_, _, _)
+ ; Pragma = pragma_termination2_info(_)
+ ; Pragma = pragma_fact_table(_)
),
Reorderable = no
).
@@ -4501,41 +4513,41 @@
chunkable_pragma_type(Pragma) = Reorderable :-
(
- ( Pragma = pragma_check_termination(_, _)
- ; Pragma = pragma_does_not_terminate(_, _)
- ; Pragma = pragma_foreign_export(_, _, _, _, _)
- ; Pragma = pragma_foreign_export_enum(_, _, _, _, _)
- ; Pragma = pragma_foreign_enum(_, _, _, _)
- ; Pragma = pragma_inline(_, _)
- ; Pragma = pragma_mode_check_clauses(_, _)
- ; Pragma = pragma_no_inline(_, _)
- ; Pragma = pragma_obsolete(_, _)
- ; Pragma = pragma_no_detism_warning(_, _)
- ; Pragma = pragma_promise_pure(_, _)
- ; Pragma = pragma_promise_semipure(_, _)
- ; Pragma = pragma_promise_equivalent_clauses(_, _)
- ; Pragma = pragma_reserve_tag(_, _)
- ; Pragma = pragma_tabled(_, _, _, _, _, _)
- ; Pragma = pragma_terminates(_, _)
- ; Pragma = pragma_termination_info(_, _, _, _, _)
- ; Pragma = pragma_structure_sharing(_, _, _, _, _, _)
- ; Pragma = pragma_structure_reuse(_, _, _, _, _, _)
- ; Pragma = pragma_trailing_info(_, _, _, _, _)
- ; Pragma = pragma_mm_tabling_info(_, _, _, _, _)
- ; Pragma = pragma_type_spec(_, _, _, _, _, _, _, _)
- ; Pragma = pragma_unused_args(_, _, _, _, _)
+ ( Pragma = pragma_check_termination(_)
+ ; Pragma = pragma_does_not_terminate(_)
+ ; Pragma = pragma_foreign_export(_)
+ ; Pragma = pragma_foreign_export_enum(_)
+ ; Pragma = pragma_foreign_enum(_)
+ ; Pragma = pragma_inline(_)
+ ; Pragma = pragma_mode_check_clauses(_)
+ ; Pragma = pragma_no_inline(_)
+ ; Pragma = pragma_obsolete(_)
+ ; Pragma = pragma_no_detism_warning(_)
+ ; Pragma = pragma_promise_pure(_)
+ ; Pragma = pragma_promise_semipure(_)
+ ; Pragma = pragma_promise_eqv_clauses(_)
+ ; Pragma = pragma_reserve_tag(_)
+ ; Pragma = pragma_tabled(_)
+ ; Pragma = pragma_terminates(_)
+ ; Pragma = pragma_termination_info(_)
+ ; Pragma = pragma_structure_sharing(_)
+ ; Pragma = pragma_structure_reuse(_)
+ ; Pragma = pragma_trailing_info(_)
+ ; Pragma = pragma_mm_tabling_info(_)
+ ; Pragma = pragma_type_spec(_)
+ ; Pragma = pragma_unused_args(_)
; Pragma = pragma_require_feature_set(_)
),
Reorderable = yes
;
- ( Pragma = pragma_exceptions(_, _, _, _, _)
- ; Pragma = pragma_fact_table(_, _, _)
- ; Pragma = pragma_foreign_code(_, _)
- ; Pragma = pragma_foreign_decl(_, _, _)
- ; Pragma = pragma_foreign_import_module(_, _)
- ; Pragma = pragma_foreign_proc(_, _, _, _, _, _, _)
+ ( Pragma = pragma_exceptions(_)
+ ; Pragma = pragma_fact_table(_)
+ ; Pragma = pragma_foreign_code(_)
+ ; Pragma = pragma_foreign_decl(_)
+ ; Pragma = pragma_foreign_import_module(_)
+ ; Pragma = pragma_foreign_proc(_)
; Pragma = pragma_source_file(_)
- ; Pragma = pragma_termination2_info( _, _, _, _, _, _)
+ ; Pragma = pragma_termination2_info(_)
),
Reorderable = no
).
Index: compiler/prog_io.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/prog_io.m,v
retrieving revision 1.308
diff -u -b -r1.308 prog_io.m
--- compiler/prog_io.m 23 Apr 2012 03:34:48 -0000 1.308
+++ compiler/prog_io.m 5 Sep 2012 04:59:59 -0000
@@ -658,8 +658,9 @@
MaybeFirstItem = read_item_ok(FirstItem),
FirstItem = item_pragma(FirstItemPragma),
FirstItemPragma = item_pragma_info(_, Pragma, _, _),
- Pragma = pragma_source_file(!:SourceFileName)
+ Pragma = pragma_source_file(SFNInfo)
->
+ SFNInfo = pragma_info_source_file(!:SourceFileName),
read_first_item(DefaultModuleName, !SourceFileName, ModuleName,
ModuleDeclItem, MaybeSecondTerm, Specs, Error, !SeqNumCounter, !IO)
;
@@ -828,8 +829,8 @@
;
Item = item_pragma(ItemPragma),
ItemPragma = item_pragma_info(_, Pragma, _, _),
- ( Pragma = pragma_source_file(NewSourceFileName) ->
- !:SourceFileName = NewSourceFileName
+ ( Pragma = pragma_source_file(SFNInfo) ->
+ SFNInfo = pragma_info_source_file(!:SourceFileName)
;
!:Items = [Item | !.Items]
)
Index: compiler/prog_io_pragma.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/prog_io_pragma.m,v
retrieving revision 1.150
diff -u -b -r1.150 prog_io_pragma.m
--- compiler/prog_io_pragma.m 16 Jun 2011 07:54:25 -0000 1.150
+++ compiler/prog_io_pragma.m 5 Sep 2012 04:59:59 -0000
@@ -179,56 +179,82 @@
(
PragmaName = "inline",
MakePragma = (pred(Name::in, Arity::in, Pragma::out) is det :-
- Pragma = pragma_inline(Name, Arity))
+ PredNameArity = pred_name_arity(Name, Arity),
+ Pragma = pragma_inline(PredNameArity)
+ )
;
PragmaName = "no_inline",
MakePragma = (pred(Name::in, Arity::in, Pragma::out) is det :-
- Pragma = pragma_no_inline(Name, Arity))
+ PredNameArity = pred_name_arity(Name, Arity),
+ Pragma = pragma_no_inline(PredNameArity)
+ )
;
PragmaName = "obsolete",
MakePragma = (pred(Name::in, Arity::in, Pragma::out) is det :-
- Pragma = pragma_obsolete(Name, Arity))
+ PredNameArity = pred_name_arity(Name, Arity),
+ Pragma = pragma_obsolete(PredNameArity)
+ )
;
PragmaName = "no_determinism_warning",
MakePragma = (pred(Name::in, Arity::in, Pragma::out) is det :-
- Pragma = pragma_no_detism_warning(Name, Arity))
+ PredNameArity = pred_name_arity(Name, Arity),
+ Pragma = pragma_no_detism_warning(PredNameArity)
+ )
;
PragmaName = "promise_equivalent_clauses",
MakePragma = (pred(Name::in, Arity::in, Pragma::out) is det :-
- Pragma = pragma_promise_equivalent_clauses(Name, Arity))
+ PredNameArity = pred_name_arity(Name, Arity),
+ Pragma = pragma_promise_eqv_clauses(PredNameArity)
+ )
;
PragmaName = "promise_pure",
MakePragma = (pred(Name::in, Arity::in, Pragma::out) is det :-
- Pragma = pragma_promise_pure(Name, Arity))
+ PredNameArity = pred_name_arity(Name, Arity),
+ Pragma = pragma_promise_pure(PredNameArity)
+ )
;
PragmaName = "promise_semipure",
MakePragma = (pred(Name::in, Arity::in, Pragma::out) is det :-
- Pragma = pragma_promise_semipure(Name, Arity))
+ PredNameArity = pred_name_arity(Name, Arity),
+ Pragma = pragma_promise_semipure(PredNameArity)
+ )
;
PragmaName = "terminates",
MakePragma = (pred(Name::in, Arity::in, Pragma::out) is det :-
- Pragma = pragma_terminates(Name, Arity))
+ PredNameArity = pred_name_arity(Name, Arity),
+ Pragma = pragma_terminates(PredNameArity)
+ )
;
PragmaName = "does_not_terminate",
MakePragma = (pred(Name::in, Arity::in, Pragma::out) is det :-
- Pragma = pragma_does_not_terminate(Name, Arity))
+ PredNameArity = pred_name_arity(Name, Arity),
+ Pragma = pragma_does_not_terminate(PredNameArity)
+ )
;
PragmaName = "check_termination",
MakePragma = (pred(Name::in, Arity::in, Pragma::out) is det :-
- Pragma = pragma_check_termination(Name, Arity))
+ PredNameArity = pred_name_arity(Name, Arity),
+ Pragma = pragma_check_termination(PredNameArity)
+ )
;
PragmaName = "mode_check_clauses",
MakePragma = (pred(Name::in, Arity::in, Pragma::out) is det :-
- Pragma = pragma_mode_check_clauses(Name, Arity))
+ PredNameArity = pred_name_arity(Name, Arity),
+ Pragma = pragma_mode_check_clauses(PredNameArity)
+ )
),
- parse_simple_pragma(ModuleName, PragmaName, MakePragma,
- PragmaTerms, ErrorTerm, VarSet, Context, SeqNum, MaybeItem)
+ parse_name_arity_pragma(ModuleName, PragmaName,
+ "predicate or function", MakePragma, PragmaTerms, ErrorTerm,
+ VarSet, Context, SeqNum, MaybeItem)
;
PragmaName = "reserve_tag",
MakePragma = (pred(Name::in, Arity::in, Pragma::out) is det :-
- Pragma = pragma_reserve_tag(Name, Arity)),
- parse_simple_type_pragma(ModuleName, PragmaName, MakePragma,
- PragmaTerms, ErrorTerm, VarSet, Context, SeqNum, MaybeItem)
+ TypeCtor = type_ctor(Name, Arity),
+ Pragma = pragma_reserve_tag(TypeCtor)
+ ),
+ parse_name_arity_pragma(ModuleName, PragmaName,
+ "type", MakePragma, PragmaTerms, ErrorTerm,
+ VarSet, Context, SeqNum, MaybeItem)
;
(
PragmaName = "memo",
@@ -305,7 +331,8 @@
parse_pragma_source_file(PragmaTerms, ErrorTerm, Context, SeqNum, MaybeItem) :-
( PragmaTerms = [SourceFileTerm] ->
( SourceFileTerm = term.functor(term.string(SourceFile), [], _) ->
- Pragma = pragma_source_file(SourceFile),
+ PSFInfo = pragma_info_source_file(SourceFile),
+ Pragma = pragma_source_file(PSFInfo),
ItemPragma = item_pragma_info(user, Pragma, Context, SeqNum),
Item = item_pragma(ItemPragma),
MaybeItem = ok1(Item)
@@ -443,11 +470,12 @@
MaybeOverridesTerm, MaybeOverrides),
(
MaybeOverrides = ok1(Overrides),
- PragmaExportEnum = pragma_foreign_export_enum(
+ FEEInfo = pragma_info_foreign_export_enum(
ForeignLanguage, Name, Arity, Attributes,
Overrides
),
- ItemPragma = item_pragma_info(user, PragmaExportEnum,
+ Pragma = pragma_foreign_export_enum(FEEInfo),
+ ItemPragma = item_pragma_info(user, Pragma,
Context, SeqNum),
Item = item_pragma(ItemPragma),
MaybeItem = ok1(Item)
@@ -655,10 +683,11 @@
UnrecognizedPieces, MaybeValues),
(
MaybeValues = ok1(Values),
- PragmaForeignImportEnum = pragma_foreign_enum(
- ForeignLanguage, TypeName, TypeArity, Values),
- ItemPragma = item_pragma_info(user,
- PragmaForeignImportEnum, Context, SeqNum),
+ FEInfo = pragma_info_foreign_enum(ForeignLanguage,
+ TypeName, TypeArity, Values),
+ Pragma = pragma_foreign_enum(FEInfo),
+ ItemPragma = item_pragma_info(user, Pragma, Context,
+ SeqNum),
Item = item_pragma(ItemPragma),
MaybeItem = ok1(Item)
;
@@ -705,8 +734,11 @@
(
MaybePredAndModes = ok2(PredName - PredOrFunc, Modes),
( parse_foreign_language(LangTerm, ForeignLanguage) ->
- Pragma = pragma_foreign_export(ForeignLanguage, PredName,
- PredOrFunc, Modes, Function),
+ PredNameModesPF = pred_name_modes_pf(PredName, Modes,
+ PredOrFunc),
+ FEInfo = pragma_info_foreign_export(ForeignLanguage,
+ PredNameModesPF, Function),
+ Pragma = pragma_foreign_export(FEInfo),
ItemPragma = item_pragma_info(user, Pragma, Context,
SeqNum),
Item = item_pragma(ItemPragma),
@@ -755,7 +787,8 @@
try_parse_sym_name_and_no_args(ImportTerm, Import)
->
( parse_foreign_language(LangTerm, Language) ->
- Pragma = pragma_foreign_import_module(Language, Import),
+ FIMInfo = pragma_info_foreign_import_module(Language, Import),
+ Pragma = pragma_foreign_import_module(FIMInfo),
ItemPragma = item_pragma_info(user, Pragma, Context, SeqNum),
Item = item_pragma(ItemPragma),
MaybeItem = ok1(Item)
@@ -795,8 +828,11 @@
convert_int_list(VarSet, UnusedArgsTerm, MaybeUnusedArgs),
MaybeUnusedArgs = ok1(UnusedArgs)
->
- Pragma = pragma_unused_args(PredOrFunc, PredName, Arity, ModeNum,
+ PredNameArityPFMn = pred_name_arity_pf_mn(PredName, Arity, PredOrFunc,
+ ModeNum),
+ UnusedArgsInfo = pragma_info_unused_args(PredNameArityPFMn,
UnusedArgs),
+ Pragma = pragma_unused_args(UnusedArgsInfo),
ItemPragma = item_pragma_info(user, Pragma, Context, SeqNum),
Item = item_pragma(ItemPragma),
MaybeItem = ok1(Item)
@@ -854,8 +890,10 @@
UnqualName, newpred_type_subst(TVarSet, TypeSubn),
SpecializedName)
),
- Pragma = pragma_type_spec(PredName, SpecializedName, Arity,
- MaybePredOrFunc, MaybeModes, TypeSubn, TVarSet, set.init),
+ TypeSpecInfo = pragma_info_type_spec(PredName, SpecializedName,
+ Arity, MaybePredOrFunc, MaybeModes, TypeSubn, TVarSet,
+ set.init),
+ Pragma = pragma_type_spec(TypeSpecInfo),
ItemPragma = item_pragma_info(user, Pragma, Context, SeqNum),
Item = item_pragma(ItemPragma),
MaybeItem = ok1(Item)
@@ -890,7 +928,10 @@
(
MaybeNameAndArity = ok2(PredName, Arity),
( FileNameTerm = term.functor(term.string(FileName), [], _) ->
- Pragma = pragma_fact_table(PredName, Arity, FileName),
+ PredNameArity = pred_name_arity(PredName, Arity),
+ FactTableInfo = pragma_info_fact_table(PredNameArity,
+ FileName),
+ Pragma = pragma_fact_table(FactTableInfo),
ItemPragma = item_pragma_info(user, Pragma, Context, SeqNum),
Item = item_pragma(ItemPragma),
MaybeItem = ok1(Item)
@@ -955,8 +996,10 @@
MaybeTerminationInfo = yes(cannot_loop(unit))
)
->
- Pragma = pragma_termination_info(PredOrFunc, PredName, ModeList,
+ PredNameModesPF = pred_name_modes_pf(PredName, ModeList, PredOrFunc),
+ TermInfo = pragma_info_termination_info(PredNameModesPF,
MaybeArgSizeInfo, MaybeTerminationInfo),
+ Pragma = pragma_termination_info(TermInfo),
ItemPragma = item_pragma_info(user, Pragma, Context, SeqNum),
Item = item_pragma(ItemPragma),
MaybeItem = ok1(Item)
@@ -997,8 +1040,10 @@
MaybeTerminationInfo = yes(cannot_loop(unit))
)
->
- Pragma = pragma_termination2_info(PredOrFunc, PredName, ModeList,
+ PredNameModesPF = pred_name_modes_pf(PredName, ModeList, PredOrFunc),
+ Term2Info = pragma_info_termination2_info(PredNameModesPF,
SuccessArgSizeInfo, FailureArgSizeInfo, MaybeTerminationInfo),
+ Pragma = pragma_termination2_info(Term2Info),
ItemPragma = item_pragma_info(user, Pragma, Context, SeqNum),
Item = item_pragma(ItemPragma),
MaybeItem = ok1(Item)
@@ -1047,8 +1092,10 @@
MaybeSharingAs = yes(parse_structure_sharing_domain(SharingAsTerm))
)
->
- Pragma = pragma_structure_sharing(PredOrFunc, PredName, ModeList,
+ PredNameModesPF = pred_name_modes_pf(PredName, ModeList, PredOrFunc),
+ SharingInfo = pragma_info_structure_sharing(PredNameModesPF,
HeadVars, Types, MaybeSharingAs),
+ Pragma = pragma_structure_sharing(SharingInfo),
ItemPragma = item_pragma_info(user, Pragma, Context, SeqNum),
Item = item_pragma(ItemPragma),
MaybeItem = ok1(Item)
@@ -1097,8 +1144,10 @@
MaybeStructureReuse = yes(StructureReuse)
)
->
- Pragma = pragma_structure_reuse(PredOrFunc, PredName, ModeList,
+ PredNameModesPF = pred_name_modes_pf(PredName, ModeList, PredOrFunc),
+ ReuseInfo = pragma_info_structure_reuse(PredNameModesPF,
HeadVars, Types, MaybeStructureReuse),
+ Pragma = pragma_structure_reuse(ReuseInfo),
ItemPragma = item_pragma_info(user, Pragma, Context, SeqNum),
Item = item_pragma(ItemPragma),
MaybeItem = ok1(Item)
@@ -1148,8 +1197,11 @@
ThrowStatus = throw_conditional
)
->
- Pragma = pragma_exceptions(PredOrFunc, PredName, Arity, ModeNum,
+ PredNameArityPFMn = pred_name_arity_pf_mn(PredName, Arity, PredOrFunc,
+ ModeNum),
+ ExceptionsInfo = pragma_info_exceptions(PredNameArityPFMn,
ThrowStatus),
+ Pragma = pragma_exceptions(ExceptionsInfo),
ItemPragma = item_pragma_info(user, Pragma, Context, SeqNum),
Item = item_pragma(ItemPragma),
MaybeItem = ok1(Item)
@@ -1187,8 +1239,11 @@
TrailingStatus = trail_conditional
)
->
- Pragma = pragma_trailing_info(PredOrFunc, PredName, Arity, ModeNum,
+ PredNameArityPFMn = pred_name_arity_pf_mn(PredName, Arity, PredOrFunc,
+ ModeNum),
+ TrailingInfo = pragma_info_trailing_info(PredNameArityPFMn,
TrailingStatus),
+ Pragma = pragma_trailing_info(TrailingInfo),
ItemPragma = item_pragma_info(user, Pragma, Context, SeqNum),
Item = item_pragma(ItemPragma),
MaybeItem = ok1(Item)
@@ -1226,8 +1281,11 @@
MM_TablingStatus = mm_tabled_conditional
)
->
- Pragma = pragma_mm_tabling_info(PredOrFunc, PredName, Arity, ModeNum,
+ PredNameArityPFMn = pred_name_arity_pf_mn(PredName, Arity, PredOrFunc,
+ ModeNum),
+ TablingInfo = pragma_info_mm_tabling_info(PredNameArityPFMn,
MM_TablingStatus),
+ Pragma = pragma_mm_tabling_info(TablingInfo),
ItemPragma = item_pragma_info(user, Pragma, Context, SeqNum),
Item = item_pragma(ItemPragma),
MaybeItem = ok1(Item)
@@ -1274,7 +1332,8 @@
;
FeatureList = [_ | _],
FeatureSet = set.from_list(FeatureList),
- Pragma = pragma_require_feature_set(FeatureSet),
+ RFSInfo = pragma_info_require_feature_set(FeatureSet),
+ Pragma = pragma_require_feature_set(RFSInfo),
ItemPragma = item_pragma_info(user, Pragma, Context,
SeqNum),
Item = item_pragma(ItemPragma)
@@ -1520,8 +1579,9 @@
->
( parse_foreign_language(LangTerm, ForeignLanguage) ->
( HeaderTerm = term.functor(term.string(HeaderCode), [], _) ->
- Pragma = pragma_foreign_decl(ForeignLanguage, IsLocal,
+ FDInfo = pragma_info_foreign_decl(ForeignLanguage, IsLocal,
HeaderCode),
+ Pragma = pragma_foreign_decl(FDInfo),
ItemPragma = item_pragma_info(user, Pragma, Context, SeqNum),
Item = item_pragma(ItemPragma),
MaybeItem = ok1(Item)
@@ -1591,7 +1651,8 @@
Specs = LangSpecs ++ CodeSpecs,
(
Specs = [],
- Pragma = pragma_foreign_code(ForeignLanguage, Code),
+ FCInfo = pragma_info_foreign_code(ForeignLanguage, Code),
+ Pragma = pragma_foreign_code(FCInfo),
ItemPragma = item_pragma_info(user, Pragma, Context, SeqNum),
Item = item_pragma(ItemPragma),
MaybeItem = ok1(Item)
@@ -1732,39 +1793,14 @@
MaybeItem = error1(Specs)
).
- % This parses a pragma that refers to a predicate or function.
- %
-:- pred parse_simple_pragma(module_name::in, string::in,
- pred(sym_name, int, pragma_type)::(pred(in, in, out) is det),
- list(term)::in, term::in, varset::in, prog_context::in, int::in,
- maybe1(item)::out) is det.
-
-parse_simple_pragma(ModuleName, PragmaName, MakePragma, PragmaTerms, ErrorTerm,
- VarSet, Context, SeqNum, MaybeItem) :-
- parse_simple_pragma_base(ModuleName, PragmaName, "predicate or function",
- MakePragma, PragmaTerms, ErrorTerm, VarSet, Context, SeqNum,
- MaybeItem).
-
- % This parses a pragma that refers to type.
- %
-:- pred parse_simple_type_pragma(module_name::in, string::in,
- pred(sym_name, int, pragma_type)::(pred(in, in, out) is det),
- list(term)::in, term::in, varset::in, prog_context::in, int::in,
- maybe1(item)::out) is det.
-
-parse_simple_type_pragma(ModuleName, PragmaName, MakePragma,
- PragmaTerms, ErrorTerm, VarSet, Context, SeqNum, MaybeItem) :-
- parse_simple_pragma_base(ModuleName, PragmaName, "type", MakePragma,
- PragmaTerms, ErrorTerm, VarSet, Context, SeqNum, MaybeItem).
-
% This parses a pragma that refers to symbol name / arity.
%
-:- pred parse_simple_pragma_base(module_name::in, string::in, string::in,
+:- pred parse_name_arity_pragma(module_name::in, string::in, string::in,
pred(sym_name, int, pragma_type)::(pred(in, in, out) is det),
list(term)::in, term::in, varset::in, prog_context::in, int::in,
maybe1(item)::out) is det.
-parse_simple_pragma_base(ModuleName, PragmaName, NameKind, MakePragma,
+parse_name_arity_pragma(ModuleName, PragmaName, NameKind, MakePragma,
PragmaTerms, ErrorTerm, VarSet, Context, SeqNum, MaybeItem) :-
( PragmaTerms = [PredAndArityTerm] ->
parse_simple_name_and_arity(ModuleName, PragmaName, NameKind,
@@ -2254,8 +2290,9 @@
MaybePragmaVars = ok1(PragmaVars),
varset.coerce(VarSet, ProgVarSet),
varset.coerce(VarSet, InstVarSet),
- Pragma = pragma_foreign_proc(Flags, PredName, PredOrFunc,
+ FPInfo = pragma_info_foreign_proc(Flags, PredName, PredOrFunc,
PragmaVars, ProgVarSet, InstVarSet, PragmaImpl),
+ Pragma = pragma_foreign_proc(FPInfo),
ItemPragma = item_pragma_info(user, Pragma, Context, SeqNum),
Item = item_pragma(ItemPragma),
MaybeItem = ok1(Item)
@@ -2326,7 +2363,7 @@
list(term)::in, term::in, varset::in, prog_context::in, int::in,
maybe1(item)::out) is det.
-parse_tabling_pragma(ModuleName, PragmaName, TablingType, PragmaTerms,
+parse_tabling_pragma(ModuleName, PragmaName, EvalMethod, PragmaTerms,
ErrorTerm, VarSet, Context, SeqNum, MaybeItem) :-
(
(
@@ -2347,8 +2384,11 @@
MaybeModes),
(
MaybeAttrs = no,
- Pragma = pragma_tabled(TablingType, PredName, Arity,
- MaybePredOrFunc, MaybeModes, no),
+ PredNameArityMPF = pred_name_arity_mpf(PredName,
+ Arity, MaybePredOrFunc),
+ TabledInfo = pragma_info_tabled(EvalMethod,
+ PredNameArityMPF, MaybeModes, no),
+ Pragma = pragma_tabled(TabledInfo),
ItemPragma = item_pragma_info(user, Pragma, Context, SeqNum),
Item = item_pragma(ItemPragma),
MaybeItem = ok1(Item)
@@ -2358,7 +2398,7 @@
[words("Error: expected tabling attribute."), nl],
convert_maybe_list("tabling attributes", yes(VarSet),
AttrsListTerm,
- parse_tabling_attribute(VarSet, TablingType),
+ parse_tabling_attribute(VarSet, EvalMethod),
UnrecognizedPieces, MaybeAttributeList),
(
MaybeAttributeList = ok1(AttributeList),
@@ -2366,9 +2406,11 @@
default_memo_table_attributes, MaybeAttributes),
(
MaybeAttributes = ok1(Attributes),
- Pragma = pragma_tabled(TablingType, PredName,
- Arity, MaybePredOrFunc, MaybeModes,
- yes(Attributes)),
+ PredNameArityMPF = pred_name_arity_mpf(PredName,
+ Arity, MaybePredOrFunc),
+ TabledInfo = pragma_info_tabled(EvalMethod,
+ PredNameArityMPF, MaybeModes, yes(Attributes)),
+ Pragma = pragma_tabled(TabledInfo),
ItemPragma = item_pragma_info(user, Pragma, Context,
SeqNum),
Item = item_pragma(ItemPragma),
Index: compiler/prog_item.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/prog_item.m,v
retrieving revision 1.46
diff -u -b -r1.46 prog_item.m
--- compiler/prog_item.m 5 Jun 2012 15:14:27 -0000 1.46
+++ compiler/prog_item.m 5 Sep 2012 04:59:59 -0000
@@ -13,9 +13,9 @@
% representing Mercury programs.
%
% This data structure specifies basically the same information as is
-% contained in the source code, but in a parse tree rather than a flat
-% file. This module defines the parts of the parse tree that are *not*
-% needed by the various compiler backends; parts of the parse tree that
+% contained in the source code, but in a parse tree rather than a flat file.
+% This module defines the parts of the parse tree that are *not* needed
+% by the various compiler backends; parts of the parse tree that
% are needed by the backends are contained in prog_data.m.
%
%-----------------------------------------------------------------------------%
@@ -451,20 +451,61 @@
:- type pragma_type
% Foreign language interfacing pragmas.
+ ---> pragma_foreign_decl(pragma_info_foreign_decl)
+ ; pragma_foreign_code(pragma_info_foreign_code)
+ ; pragma_foreign_proc(pragma_info_foreign_proc)
+ ; pragma_foreign_import_module(pragma_info_foreign_import_module)
+ ; pragma_foreign_export(pragma_info_foreign_export)
+ ; pragma_foreign_export_enum(pragma_info_foreign_export_enum)
+ ; pragma_foreign_enum(pragma_info_foreign_enum)
+ ; pragma_type_spec(pragma_info_type_spec)
+ ; pragma_inline(pred_name_arity)
+ ; pragma_no_inline(pred_name_arity)
+ ; pragma_unused_args(pragma_info_unused_args)
+ ; pragma_exceptions(pragma_info_exceptions)
+ ; pragma_trailing_info(pragma_info_trailing_info)
+ ; pragma_mm_tabling_info(pragma_info_mm_tabling_info)
+ ; pragma_obsolete(pred_name_arity)
+ ; pragma_no_detism_warning(pred_name_arity)
+ ; pragma_source_file(pragma_info_source_file)
+ ; pragma_tabled(pragma_info_tabled)
+ ; pragma_fact_table(pragma_info_fact_table)
+ ; pragma_reserve_tag(type_ctor)
+ ; pragma_promise_eqv_clauses(pred_name_arity)
+ ; pragma_promise_pure(pred_name_arity)
+ ; pragma_promise_semipure(pred_name_arity)
+ ; pragma_termination_info(pragma_info_termination_info)
+ ; pragma_termination2_info(pragma_info_termination2_info)
+ ; pragma_terminates(pred_name_arity)
+ ; pragma_does_not_terminate(pred_name_arity)
+ ; pragma_check_termination(pred_name_arity)
+ ; pragma_mode_check_clauses(pred_name_arity)
+ ; pragma_structure_sharing(pragma_info_structure_sharing)
+ ; pragma_structure_reuse(pragma_info_structure_reuse)
+ ; pragma_require_feature_set(pragma_info_require_feature_set).
+:- type pragma_info_foreign_decl
+ ---> pragma_info_foreign_decl(
% A foreign language declaration, such as C header code.
- ---> pragma_foreign_decl(
decl_lang :: foreign_language,
decl_is_local :: foreign_decl_is_local,
decl_decl :: string
- )
+ ).
- ; pragma_foreign_code(
+:- type pragma_info_foreign_code
+ ---> pragma_info_foreign_code(
code_lang :: foreign_language,
code_code :: string
- )
+ ).
- ; pragma_foreign_proc(
+:- type pragma_info_foreign_proc
+ ---> pragma_info_foreign_proc(
+ % Set of foreign proc attributes, such as:
+ % what language this code is in
+ % whether or not the code may call Mercury,
+ % whether or not the code is thread-safe
+ % PredName, Predicate or Function, Vars/Mode,
+ % VarNames, Foreign Code Implementation Info
proc_attrs :: pragma_foreign_proc_attributes,
proc_name :: sym_name,
proc_p_or_f :: pred_or_func,
@@ -472,51 +513,51 @@
proc_varset :: prog_varset,
proc_instvarset :: inst_varset,
proc_impl :: pragma_foreign_code_impl
- % Set of foreign proc attributes, eg.:
- % what language this code is in
- % whether or not the code may call Mercury,
- % whether or not the code is thread-safe
- % PredName, Predicate or Function, Vars/Mode,
- % VarNames, Foreign Code Implementation Info
- )
+ ).
- ; pragma_foreign_import_module(
- imp_lang :: foreign_language,
- imp_module :: module_name
+:- type pragma_info_foreign_import_module
+ ---> pragma_info_foreign_import_module(
% Equivalent to
% `:- pragma foreign_decl(Lang, "#include <module>.h").'
% except that the name of the header file is not
% hard-coded, and mmake can use the dependency information.
- )
+ imp_lang :: foreign_language,
+ imp_module :: module_name
+ ).
- ; pragma_foreign_export(
+:- type pragma_info_foreign_export
+ ---> pragma_info_foreign_export(
+ % Predname, Predicate/function, Modes, foreign function name.
exp_language :: foreign_language,
- exp_predname :: sym_name,
- exp_p_or_f :: pred_or_func,
- exp_modes :: list(mer_mode),
+ exp_pred_id :: pred_name_modes_pf,
exp_foreign_name :: string
- % Predname, Predicate/function, Modes, foreign function name.
- )
+ ).
- ;
- pragma_foreign_export_enum(
+:- type pragma_info_foreign_export_enum
+ ---> pragma_info_foreign_export_enum(
export_enum_language :: foreign_language,
export_enum_type_name :: sym_name,
export_enum_type_arity :: arity,
export_enum_attributes :: export_enum_attributes,
export_enum_overrides :: assoc_list(sym_name, string)
- )
- ;
- pragma_foreign_enum(
+ ).
+
+:- type pragma_info_foreign_enum
+ ---> pragma_info_foreign_enum(
foreign_enum_language :: foreign_language,
foreign_enum_type_name :: sym_name,
foreign_enum_type_arity :: arity,
foreign_enum_values :: assoc_list(sym_name, string)
- )
+ ).
% Optimization pragmas.
- ; pragma_type_spec(
+:- type pragma_info_type_spec
+ ---> pragma_info_type_spec(
+ % PredName, SpecializedPredName, Arity, PredOrFunc,
+ % Modes if a specific procedure was specified, type
+ % substitution (using the variable names from the pred
+ % declaration), TVarSet, Equivalence types used
tspec_pred_name :: sym_name,
tspec_new_name :: sym_name,
tspec_arity :: arity,
@@ -525,136 +566,73 @@
tspec_tsubst :: type_subst,
tspec_tvarset :: tvarset,
tspec_items :: set(item_id)
- % PredName, SpecializedPredName, Arity, PredOrFunc,
- % Modes if a specific procedure was specified, type
- % substitution (using the variable names from the pred
- % declaration), TVarSet, Equivalence types used
- )
-
- ; pragma_inline(
- inline_name :: sym_name,
- inline_arity :: arity
- % Predname, Arity
- )
-
- ; pragma_no_inline(
- noinline_name :: sym_name,
- noinline_arity :: arity
- % Predname, Arity
- )
+ ).
- ; pragma_unused_args(
- unused_p_or_f :: pred_or_func,
- unused_name :: sym_name,
- unused_arity :: arity,
- unused_mode :: mode_num,
- unused_args :: list(int)
+:- type pragma_info_unused_args
+ ---> pragma_info_unused_args(
% PredName, Arity, Mode number, Removed arguments.
- % Used for intermodule unused argument removal, should only
+ % Used for intermodule unused argument removal. Should only
% appear in .opt files.
- )
+ unused_proc_id :: pred_name_arity_pf_mn,
+ unused_args :: list(int)
+ ).
- ; pragma_exceptions(
- exceptions_p_or_f :: pred_or_func,
- exceptions_name :: sym_name,
- exceptions_arity :: arity,
- exceptions_mode :: mode_num,
- exceptions_status :: exception_status
+:- type pragma_info_exceptions
+ ---> pragma_info_exceptions(
% PredName, Arity, Mode number, Exception status.
% Should only appear in `.opt' or `.trans_opt' files.
- )
+ exceptions_proc_id :: pred_name_arity_pf_mn,
+ exceptions_status :: exception_status
+ ).
- ; pragma_trailing_info(
+:- type pragma_info_trailing_info
+ ---> pragma_info_trailing_info(
% PredName, Arity, Mode number, Trailing status.
% Should on appear in `.opt' or `.trans_opt' files.
- trailing_info_p_or_f :: pred_or_func,
- trailing_info_name :: sym_name,
- trailing_info_arity :: arity,
- trailing_info_mode :: mode_num,
+ trailing_info_proc_id :: pred_name_arity_pf_mn,
trailing_info_status :: trailing_status
- )
+ ).
- ; pragma_mm_tabling_info(
+:- type pragma_info_mm_tabling_info
+ ---> pragma_info_mm_tabling_info(
% PredName, Arity, Mode number, MM Tabling status.
% Should on appear in `.opt' or `.trans_opt' files.
- mm_tabling_info_p_or_f :: pred_or_func,
- mm_tabling_info_name :: sym_name,
- mm_tabling_info_arity :: arity,
- mm_tabling_info_mode :: mode_num,
+ mm_tabling_info_proc_id :: pred_name_arity_pf_mn,
mm_tabling_info_status :: mm_tabling_status
- )
+ ).
% Diagnostics pragmas (pragmas related to compiler warnings/errors).
- ; pragma_obsolete(
- obsolete_name :: sym_name,
- obsolete_arity :: arity
- % Predname, Arity
- )
-
- ; pragma_no_detism_warning(
- ndw_name :: sym_name,
- ndw_arity :: arity
- )
-
- ; pragma_source_file(
+:- type pragma_info_source_file
+ ---> pragma_info_source_file(
% Source file name.
pragma_source_file :: string
- )
+ ).
% Evaluation method pragmas.
- ; pragma_tabled(
+:- type pragma_info_tabled
+ ---> pragma_info_tabled(
+ % Tabling type, Predname, Arity, PredOrFunc?, Mode?
tabled_method :: eval_method,
- tabled_name :: sym_name,
- tabled_arity :: int,
- tabled_p_or_f :: maybe(pred_or_func),
+ tabled_name :: pred_name_arity_mpf,
tabled_mode :: maybe(list(mer_mode)),
tabled_attributes :: maybe(table_attributes)
- % Tabling type, Predname, Arity, PredOrFunc?, Mode?
- )
-
- ; pragma_fact_table(
- fact_table_name :: sym_name,
- fact_table_arity :: arity,
- fact_table_file :: string
- % Predname, Arity, Fact file name.
- )
+ ).
- ; pragma_reserve_tag(
- restag_type :: sym_name,
- restag_arity :: arity
- % Typename, Arity
- )
+:- type pragma_info_fact_table
+ ---> pragma_info_fact_table(
+ % Predname and Arity, Fact file name.
+ fact_table_pred :: pred_name_arity,
+ fact_table_filename :: string
+ ).
% Purity pragmas.
- ; pragma_promise_equivalent_clauses(
- eqv_clauses_name :: sym_name,
- eqv_clauses_arity :: arity
- % Predname, Arity
- )
-
- ; pragma_promise_pure(
- pure_name :: sym_name,
- pure_arity :: arity
- % Predname, Arity
- )
-
- ; pragma_promise_semipure(
- semipure_name :: sym_name,
- semipure_arity :: arity
- % Predname, Arity
- )
-
% Termination analysis pragmas.
- ; pragma_termination_info(
- terminfo_p_or_f :: pred_or_func,
- terminfo_name :: sym_name,
- terminfo_mode :: list(mer_mode),
- terminfo_args :: maybe(pragma_arg_size_info),
- terminfo_term :: maybe(pragma_termination_info)
+:- type pragma_info_termination_info
+ ---> pragma_info_termination_info(
% The list(mer_mode) is the declared argmodes of the
% procedure, unless there are no declared argmodes, in which
% case the inferred argmodes are used. This pragma is used to
@@ -664,82 +642,92 @@
% predicate. This includes c_code, and imported predicates.
% termination_info pragmas are used in opt and trans_opt
% files.
- )
+ terminfo_pred_id :: pred_name_modes_pf,
+ terminfo_args :: maybe(pragma_arg_size_info),
+ terminfo_term :: maybe(pragma_termination_info)
+ ).
- ; pragma_termination2_info(
- terminfo2_p_or_f :: pred_or_func,
- terminfo2_name :: sym_name,
- terminfo2_mode :: list(mer_mode),
+:- type pragma_info_termination2_info
+ ---> pragma_info_termination2_info(
+ terminfo2_pred_id :: pred_name_modes_pf,
terminfo2_args :: maybe(pragma_constr_arg_size_info),
terminfo2_args2 :: maybe(pragma_constr_arg_size_info),
terminfo2_term :: maybe(pragma_termination_info)
- )
-
- ; pragma_terminates(
- term_name :: sym_name,
- term_arity :: arity
- % Predname, Arity
- )
-
- ; pragma_does_not_terminate(
- noterm_name :: sym_name,
- noterm_arity :: arity
- % Predname, Arity
- )
-
- ; pragma_check_termination(
- checkterm_name :: sym_name,
- checkterm_arity :: arity
- % Predname, Arity
- )
-
- ; pragma_mode_check_clauses(
- mode_check_clause_name :: sym_name,
- mode_check_clause_arity :: arity
- )
+ ).
% CTGC pragmas: structure sharing / structure reuse analysis.
- ; pragma_structure_sharing(
- sharing_p_or_f :: pred_or_func,
- sharing_name :: sym_name,
- sharing_mode :: list(mer_mode),
- sharing_headvars :: list(prog_var),
- sharing_headvartypes :: list(mer_type),
- sharing_description :: maybe(structure_sharing_domain)
- )
+:- type pragma_info_structure_sharing
+ ---> pragma_info_structure_sharing(
% After structure sharing analysis, the compiler generates
% structure sharing pragmas to be stored in and read from
% optimization interface files.
%
- % The list of modes consists of the declared argmodes (or inferred
- % argmodes if there are no declared ones).
+ % The list of modes consists of the declared argmodes
+ % (or inferred argmodes if there are no declared ones).
+ sharing_pred_id :: pred_name_modes_pf,
+ sharing_headvars :: list(prog_var),
+ sharing_headvartypes :: list(mer_type),
+ sharing_description :: maybe(structure_sharing_domain)
+ ).
- ; pragma_structure_reuse(
- reuse_p_or_f :: pred_or_func,
- reuse_name :: sym_name,
- reuse_mode :: list(mer_mode),
- reuse_headvars :: list(prog_var),
- reuse_headvartypes :: list(mer_type),
- reuse_description :: maybe(structure_reuse_domain)
- )
+:- type pragma_info_structure_reuse
+ ---> pragma_info_structure_reuse(
% After reuse analysis, the compiler generates structure reuse
% pragmas to be stored in and read from optimization interface
% files.
%
- % The list of modes consists of the declared argmodes (or inferred
- % argmodes if there are no declared ones).
- % The last sym_name (reuse_optimised_name) stores the name of the
- % optimised version of the exported predicate.
+ % The list of modes consists of the declared argmodes
+ % (or inferred argmodes if there are no declared ones).
+ % The last sym_name (reuse_optimised_name) stores the name
+ % of the optimised version of the exported predicate.
+ reuse_pred_id :: pred_name_modes_pf,
+ reuse_headvars :: list(prog_var),
+ reuse_headvartypes :: list(mer_type),
+ reuse_description :: maybe(structure_reuse_domain)
+ ).
% Misc pragmas.
- ; pragma_require_feature_set(
+:- type pragma_info_require_feature_set
+ ---> pragma_info_require_feature_set(
rfs_feature_set :: set(required_feature)
).
-:- inst pragma_type_spec == bound(pragma_type_spec(ground, ground, ground,
- ground, ground, ground, ground, ground)).
+:- type pred_name_arity
+ ---> pred_name_arity(
+ pna_pred_name :: sym_name,
+ pna_arity :: arity
+ ).
+
+:- type pred_name_arity_pf
+ ---> pred_name_arity_pf(
+ pnap_pred_name :: sym_name,
+ pnap_arity :: arity,
+ pnap_pf :: pred_or_func
+ ).
+
+:- type pred_name_arity_pf_mn
+ ---> pred_name_arity_pf_mn(
+ pnapm_pred_name :: sym_name,
+ pnapm_arity :: arity,
+ pnapm_pf :: pred_or_func,
+ pnapm_mode_num :: mode_num
+ ).
+
+:- type pred_name_modes_pf
+ ---> pred_name_modes_pf(
+ pnmp_pred_name :: sym_name,
+ pnmp_arity :: list(mer_mode),
+ pnmp_pf :: pred_or_func
+ ).
+
+:- type pred_name_arity_mpf
+ ---> pred_name_arity_mpf(
+ pnam_pred_name :: sym_name,
+ pnam_arity :: arity,
+ pnam_maybe_pf :: maybe(pred_or_func)
+ ).
%-----------------------------------------------------------------------------%
%
@@ -1112,42 +1100,44 @@
prog_context::in, module_foreign_info::in, module_foreign_info::out)
is det.
-do_get_item_foreign_code(Globals, Pragma, Context, Info0, Info) :-
+do_get_item_foreign_code(Globals, Pragma, Context, !Info) :-
globals.get_backend_foreign_languages(Globals, BackendLangs),
globals.get_target(Globals, Target),
% The code here should match the way that mlds_to_gcc.m decides whether
- % or not to call mlds_to_c.m. XXX Note that we do NOT count foreign_decls
- % here. We only link in a foreign object file if mlds_to_gcc called
- % mlds_to_c.m to generate it, which it will only do if there is some
- % foreign_code, not just foreign_decls. Counting foreign_decls here
- % causes problems with intermodule optimization.
+ % or not to call mlds_to_c.m.
(
- Pragma = pragma_foreign_code(Lang, _),
- list.member(Lang, BackendLangs)
- ->
- Info = Info0 ^ used_foreign_languages :=
- set.insert(Info0 ^ used_foreign_languages, Lang)
+ Pragma = pragma_foreign_code(FCInfo),
+ FCInfo = pragma_info_foreign_code(Lang, _),
+ ( list.member(Lang, BackendLangs) ->
+ !Info ^ used_foreign_languages :=
+ set.insert(!.Info ^ used_foreign_languages, Lang)
;
- Pragma = pragma_foreign_proc(Attrs, Name, _, _, _, _, _)
- ->
+ true
+ )
+ ;
+ Pragma = pragma_foreign_proc(FPInfo),
+ FPInfo = pragma_info_foreign_proc(Attrs, Name, _, _, _, _, _),
NewLang = get_foreign_language(Attrs),
- ( OldLang = Info0 ^ foreign_proc_languages ^ elem(Name) ->
+ FPLangs0 = !.Info ^ foreign_proc_languages,
+ ( map.search(FPLangs0, Name, OldLang) ->
% is it better than an existing one?
+ PreferNew = prefer_foreign_language(Globals, Target,
+ OldLang, NewLang),
(
- yes = prefer_foreign_language(Globals, Target,
- OldLang, NewLang)
- ->
- Info = Info0 ^ foreign_proc_languages ^ elem(Name) := NewLang
+ PreferNew = yes,
+ map.det_update(Name, NewLang, FPLangs0, FPLangs),
+ !Info ^ foreign_proc_languages := FPLangs
;
- Info = Info0
+ PreferNew = no
)
;
% is it one of the languages we support?
( list.member(NewLang, BackendLangs) ->
- Info = Info0 ^ foreign_proc_languages ^ elem(Name) := NewLang
+ map.det_insert(Name, NewLang, FPLangs0, FPLangs),
+ !Info ^ foreign_proc_languages := FPLangs
;
- Info = Info0
+ true
)
)
;
@@ -1156,32 +1146,79 @@
% punts it on to mlds_to_c.m, thus generating C code for it,
% rather than assembler code. So we need to treat `pragma export'
% like the other pragmas for foreign code.
- Pragma = pragma_foreign_export(Lang, _, _, _, _),
- list.member(Lang, BackendLangs)
- ->
- Info1 = Info0 ^ used_foreign_languages :=
- set.insert(Info0 ^ used_foreign_languages, Lang),
- Info = Info1 ^ module_has_foreign_export :=
+ Pragma = pragma_foreign_export(FEInfo),
+ FEInfo = pragma_info_foreign_export(Lang, _, _),
+ ( list.member(Lang, BackendLangs) ->
+ !Info ^ used_foreign_languages :=
+ set.insert(!.Info ^ used_foreign_languages, Lang),
+ !Info ^ module_has_foreign_export :=
contains_foreign_export
;
- Pragma = pragma_foreign_import_module(Lang, Import),
- list.member(Lang, BackendLangs)
- ->
- Info = Info0 ^ all_foreign_import_modules :=
+ true
+ )
+ ;
+ Pragma = pragma_foreign_import_module(FIMInfo),
+ FIMInfo = pragma_info_foreign_import_module(Lang, Import),
+ ( list.member(Lang, BackendLangs) ->
+ !Info ^ all_foreign_import_modules :=
[foreign_import_module_info(Lang, Import, Context) |
- Info0 ^ all_foreign_import_modules]
+ !.Info ^ all_foreign_import_modules]
;
- % We generate some C code for fact tables, so we need to treat modules
- % containing fact tables as if they contain foreign code.
+ true
+ )
+ ;
+ Pragma = pragma_fact_table(_),
+ (
+ % We generate some C code for fact tables, so we need to treat
+ % modules containing fact tables as if they contain foreign code.
( Target = target_asm
; Target = target_c
- ),
- Pragma = pragma_fact_table(_, _, _)
+ )
->
- Info = Info0 ^ used_foreign_languages :=
- set.insert(Info0 ^ used_foreign_languages, lang_c)
+ !Info ^ used_foreign_languages :=
+ set.insert(!.Info ^ used_foreign_languages, lang_c)
;
- Info = Info0
+ true
+ )
+ ;
+ % We do NOT count foreign_decls here. We only link in a foreign object
+ % file if mlds_to_gcc called mlds_to_c.m to generate it, which it
+ % will only do if there is some foreign_code, not just foreign_decls.
+ % Counting foreign_decls here causes problems with intermodule
+ % optimization.
+ Pragma = pragma_foreign_decl(_)
+ ;
+ ( Pragma = pragma_foreign_enum(_)
+ ; Pragma = pragma_foreign_export_enum(_)
+ )
+ % XXX Should we count these?
+ ;
+ ( Pragma = pragma_check_termination(_)
+ ; Pragma = pragma_does_not_terminate(_)
+ ; Pragma = pragma_exceptions(_)
+ ; Pragma = pragma_inline(_)
+ ; Pragma = pragma_mm_tabling_info(_)
+ ; Pragma = pragma_mode_check_clauses(_)
+ ; Pragma = pragma_no_detism_warning(_)
+ ; Pragma = pragma_no_inline(_)
+ ; Pragma = pragma_obsolete(_)
+ ; Pragma = pragma_promise_eqv_clauses(_)
+ ; Pragma = pragma_promise_pure(_)
+ ; Pragma = pragma_promise_semipure(_)
+ ; Pragma = pragma_require_feature_set(_)
+ ; Pragma = pragma_reserve_tag(_)
+ ; Pragma = pragma_source_file(_)
+ ; Pragma = pragma_structure_reuse(_)
+ ; Pragma = pragma_structure_sharing(_)
+ ; Pragma = pragma_tabled(_)
+ ; Pragma = pragma_terminates(_)
+ ; Pragma = pragma_termination2_info(_)
+ ; Pragma = pragma_termination_info(_)
+ ; Pragma = pragma_trailing_info(_)
+ ; Pragma = pragma_type_spec(_)
+ ; Pragma = pragma_unused_args(_)
+ )
+ % Do nothing.
).
%-----------------------------------------------------------------------------%
Index: compiler/recompilation.usage.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/recompilation.usage.m,v
retrieving revision 1.65
diff -u -b -r1.65 recompilation.usage.m
--- compiler/recompilation.usage.m 5 Jun 2012 15:14:27 -0000 1.65
+++ compiler/recompilation.usage.m 5 Sep 2012 04:59:59 -0000
@@ -1196,11 +1196,11 @@
proc_info_get_argmodes(ProcInfo, ArgModes),
find_items_used_by_modes(ArgModes, !Info).
-:- pred find_items_used_by_type_spec(pragma_type::in,
+:- pred find_items_used_by_type_spec(pragma_info_type_spec::in,
recompilation_usage_info::in, recompilation_usage_info::out) is det.
-find_items_used_by_type_spec(Pragma, !Info) :-
- ( Pragma = pragma_type_spec(_, _, _, _, MaybeModes, Subst, _, _) ->
+find_items_used_by_type_spec(TypeSpecInfo, !Info) :-
+ TypeSpecInfo = pragma_info_type_spec(_, _, _, _, MaybeModes, Subst, _, _),
(
MaybeModes = yes(Modes),
find_items_used_by_modes(Modes, !Info)
@@ -1208,10 +1208,7 @@
MaybeModes = no
),
assoc_list.values(Subst, SubstTypes),
- find_items_used_by_types(SubstTypes, !Info)
- ;
- unexpected($module, $pred, "unexpected pragma type")
- ).
+ find_items_used_by_types(SubstTypes, !Info).
:- pred find_items_used_by_functors(functor_set::in,
recompilation_usage_info::in, recompilation_usage_info::out) is det.
Index: compiler/recompilation.version.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/recompilation.version.m,v
retrieving revision 1.82
diff -u -b -r1.82 recompilation.version.m
--- compiler/recompilation.version.m 5 Jun 2012 15:14:27 -0000 1.82
+++ compiler/recompilation.version.m 5 Sep 2012 04:59:59 -0000
@@ -609,56 +609,87 @@
is_pred_pragma(PragmaType, MaybePredOrFuncId) :-
(
- ( PragmaType = pragma_foreign_decl(_, _, _)
- ; PragmaType = pragma_foreign_import_module(_, _)
- ; PragmaType = pragma_foreign_code(_, _)
- ; PragmaType = pragma_foreign_export_enum(_, _, _, _, _)
- ; PragmaType = pragma_foreign_enum(_, _, _, _)
+ ( PragmaType = pragma_foreign_decl(_)
+ ; PragmaType = pragma_foreign_import_module(_)
+ ; PragmaType = pragma_foreign_code(_)
+ ; PragmaType = pragma_foreign_export_enum(_)
+ ; PragmaType = pragma_foreign_enum(_)
; PragmaType = pragma_source_file(_)
- ; PragmaType = pragma_reserve_tag(_, _)
+ ; PragmaType = pragma_reserve_tag(_)
; PragmaType = pragma_require_feature_set(_)
),
MaybePredOrFuncId = no
;
- ( PragmaType = pragma_inline(Name, Arity)
- ; PragmaType = pragma_no_inline(Name, Arity)
- ; PragmaType = pragma_obsolete(Name, Arity)
- ; PragmaType = pragma_no_detism_warning(Name, Arity)
- ; PragmaType = pragma_promise_semipure(Name, Arity)
- ; PragmaType = pragma_promise_equivalent_clauses(Name, Arity)
- ; PragmaType = pragma_fact_table(Name, Arity, _)
- ; PragmaType = pragma_promise_pure(Name, Arity)
- ; PragmaType = pragma_terminates(Name, Arity)
- ; PragmaType = pragma_does_not_terminate(Name, Arity)
- ; PragmaType = pragma_check_termination(Name, Arity)
- ; PragmaType = pragma_mode_check_clauses(Name, Arity)
+ ( PragmaType = pragma_inline(PredNameArity)
+ ; PragmaType = pragma_no_inline(PredNameArity)
+ ; PragmaType = pragma_obsolete(PredNameArity)
+ ; PragmaType = pragma_no_detism_warning(PredNameArity)
+ ; PragmaType = pragma_promise_pure(PredNameArity)
+ ; PragmaType = pragma_promise_semipure(PredNameArity)
+ ; PragmaType = pragma_promise_eqv_clauses(PredNameArity)
+ ; PragmaType = pragma_terminates(PredNameArity)
+ ; PragmaType = pragma_does_not_terminate(PredNameArity)
+ ; PragmaType = pragma_check_termination(PredNameArity)
+ ; PragmaType = pragma_mode_check_clauses(PredNameArity)
),
+ PredNameArity = pred_name_arity(Name, Arity),
MaybePredOrFuncId = yes(no - Name / Arity)
;
- ( PragmaType = pragma_type_spec(Name, _, Arity, MaybePredOrFunc,
- _, _, _, _)
- ; PragmaType = pragma_tabled(_, Name, Arity, MaybePredOrFunc,
- _, _Attrs)
- ),
+ PragmaType = pragma_fact_table(FTInfo),
+ FTInfo = pragma_info_fact_table(PredNameArity, _),
+ PredNameArity = pred_name_arity(Name, Arity),
+ MaybePredOrFuncId = yes(no - Name / Arity)
+ ;
+ PragmaType = pragma_type_spec(TypeSpecInfo),
+ TypeSpecInfo = pragma_info_type_spec(Name, _, Arity, MaybePredOrFunc,
+ _, _, _, _),
+ MaybePredOrFuncId = yes(MaybePredOrFunc - Name / Arity)
+ ;
+ PragmaType = pragma_tabled(TabledInfo),
+ TabledInfo = pragma_info_tabled(_, PredNameArityMPF, _, _),
+ PredNameArityMPF = pred_name_arity_mpf(Name, Arity, MaybePredOrFunc),
MaybePredOrFuncId = yes(MaybePredOrFunc - Name / Arity)
;
- ( PragmaType = pragma_unused_args(PredOrFunc, Name, Arity, _, _)
- ; PragmaType = pragma_exceptions(PredOrFunc, Name, Arity, _, _)
- ; PragmaType = pragma_trailing_info(PredOrFunc, Name, Arity, _, _)
- ; PragmaType = pragma_mm_tabling_info(PredOrFunc, Name, Arity, _, _)
+ (
+ PragmaType = pragma_unused_args(UnusedArgsInfo),
+ UnusedArgsInfo = pragma_info_unused_args(PredNameArityPFMn, _)
+ ;
+ PragmaType = pragma_exceptions(ExceptionsInfo),
+ ExceptionsInfo = pragma_info_exceptions(PredNameArityPFMn, _)
+ ;
+ PragmaType = pragma_trailing_info(TrailingInfo),
+ TrailingInfo = pragma_info_trailing_info(PredNameArityPFMn, _)
+ ;
+ PragmaType = pragma_mm_tabling_info(MMTablingOnfo),
+ MMTablingOnfo = pragma_info_mm_tabling_info(PredNameArityPFMn, _)
),
+ PredNameArityPFMn = pred_name_arity_pf_mn(Name, Arity, PredOrFunc, _),
MaybePredOrFuncId = yes(yes(PredOrFunc) - Name / Arity)
;
- PragmaType = pragma_foreign_proc(_, Name, PredOrFunc, Args, _, _, _),
+ PragmaType = pragma_foreign_proc(FPInfo),
+ FPInfo = pragma_info_foreign_proc(_, Name, PredOrFunc, Args, _, _, _),
adjust_func_arity(PredOrFunc, Arity, list.length(Args)),
MaybePredOrFuncId = yes(yes(PredOrFunc) - Name / Arity)
;
- ( PragmaType = pragma_termination_info(PredOrFunc, Name, Modes, _, _)
- ; PragmaType = pragma_foreign_export(_, Name, PredOrFunc, Modes, _)
- ; PragmaType = pragma_structure_sharing(PredOrFunc, Name, Modes, _,_,_)
- ; PragmaType = pragma_structure_reuse(PredOrFunc, Name, Modes, _, _, _)
- ; PragmaType = pragma_termination2_info(PredOrFunc, Name, Modes, _,_,_)
+ (
+ PragmaType = pragma_foreign_export(FEInfo),
+ FEInfo = pragma_info_foreign_export(_, PredNameModesPF, _)
+ ;
+ PragmaType = pragma_termination_info(TermInfo),
+ TermInfo = pragma_info_termination_info(PredNameModesPF, _, _)
+ ;
+ PragmaType = pragma_termination2_info(Term2Info),
+ Term2Info = pragma_info_termination2_info(PredNameModesPF, _, _, _)
+ ;
+ PragmaType = pragma_structure_sharing(SharingInfo),
+ SharingInfo = pragma_info_structure_sharing(PredNameModesPF,
+ _, _, _)
+ ;
+ PragmaType = pragma_structure_reuse(ReuseInfo),
+ ReuseInfo = pragma_info_structure_reuse(PredNameModesPF,
+ _, _, _)
),
+ PredNameModesPF = pred_name_modes_pf(Name, Modes, PredOrFunc),
adjust_func_arity(PredOrFunc, Arity, list.length(Modes)),
MaybePredOrFuncId = yes(yes(PredOrFunc) - Name / Arity)
).
@@ -851,9 +882,11 @@
ItemPragma2 = item_pragma_info(_, PragmaType2, _, _)
->
(
- PragmaType1 = pragma_type_spec(Name, SpecName, Arity,
+ PragmaType1 = pragma_type_spec(TypeSpecInfo1),
+ PragmaType2 = pragma_type_spec(TypeSpecInfo2),
+ TypeSpecInfo1 = pragma_info_type_spec(Name, SpecName, Arity,
MaybePredOrFunc, MaybeModes, TypeSubst1, TVarSet1, _),
- PragmaType2 = pragma_type_spec(Name, SpecName, Arity,
+ TypeSpecInfo2 = pragma_info_type_spec(Name, SpecName, Arity,
MaybePredOrFunc, MaybeModes, TypeSubst2, TVarSet2, _)
->
assoc_list.keys_and_values(TypeSubst1, TVars1, Types1),
Index: compiler/structure_reuse.analysis.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/structure_reuse.analysis.m,v
retrieving revision 1.32
diff -u -b -r1.32 structure_reuse.analysis.m
--- compiler/structure_reuse.analysis.m 2 Jul 2012 01:16:37 -0000 1.32
+++ compiler/structure_reuse.analysis.m 5 Sep 2012 04:59:59 -0000
@@ -111,6 +111,7 @@
:- import_module parse_tree.mercury_to_mercury.
:- import_module parse_tree.prog_ctgc.
:- import_module parse_tree.prog_data.
+:- import_module parse_tree.prog_item.
:- import_module parse_tree.prog_type.
:- import_module parse_tree.set_of_var.
:- import_module transform_hlds.ctgc.selector.
@@ -833,9 +834,11 @@
proc_info_get_vartypes(ProcInfo, VarTypes),
lookup_var_types(VarTypes, HeadVars, HeadVarTypes),
MaybeReuse = yes(Reuse),
- write_pragma_structure_reuse_info(PredOrFunc, SymName, Modes,
- Context, HeadVars, yes(VarSet), HeadVarTypes, yes(TypeVarSet),
- MaybeReuse, !IO)
+ PredNameModesPF = pred_name_modes_pf(SymName, Modes, PredOrFunc),
+ ReuseInfo = pragma_info_structure_reuse(PredNameModesPF,
+ HeadVars, HeadVarTypes, MaybeReuse),
+ write_pragma_structure_reuse_info(ReuseInfo,
+ yes(VarSet), yes(TypeVarSet), Context, !IO)
;
MaybeStructureReuseDomain = no
)
Index: compiler/structure_sharing.analysis.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/structure_sharing.analysis.m,v
retrieving revision 1.54
diff -u -b -r1.54 structure_sharing.analysis.m
--- compiler/structure_sharing.analysis.m 2 Jul 2012 01:16:37 -0000 1.54
+++ compiler/structure_sharing.analysis.m 5 Sep 2012 04:59:59 -0000
@@ -80,6 +80,7 @@
:- import_module parse_tree.mercury_to_mercury.
:- import_module parse_tree.prog_ctgc.
:- import_module parse_tree.prog_data.
+:- import_module parse_tree.prog_item.
:- import_module parse_tree.prog_out.
:- import_module parse_tree.prog_type.
:- import_module transform_hlds.ctgc.selector.
@@ -985,9 +986,11 @@
(
MaybeSharingStatus = yes(
structure_sharing_domain_and_status(Sharing, _Status)),
- write_pragma_structure_sharing_info(PredOrFunc, SymName, Modes,
- Context, HeadVars, yes(VarSet), HeadVarTypes, yes(TypeVarSet),
- yes(Sharing), !IO)
+ PredNameModesPF = pred_name_modes_pf(SymName, Modes, PredOrFunc),
+ SharingInfo = pragma_info_structure_sharing(PredNameModesPF,
+ HeadVars, HeadVarTypes, yes(Sharing)),
+ write_pragma_structure_sharing_info(SharingInfo,
+ yes(VarSet), yes(TypeVarSet), Context, !IO)
;
MaybeSharingStatus = no
)
Index: compiler/tabling_analysis.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/tabling_analysis.m,v
retrieving revision 1.26
diff -u -b -r1.26 tabling_analysis.m
--- compiler/tabling_analysis.m 13 Feb 2012 00:11:49 -0000 1.26
+++ compiler/tabling_analysis.m 5 Sep 2012 04:59:59 -0000
@@ -97,6 +97,7 @@
:- import_module parse_tree.mercury_to_mercury.
:- import_module parse_tree.file_names.
:- import_module parse_tree.prog_data.
+:- import_module parse_tree.prog_item.
:- import_module transform_hlds.dependency_graph.
:- import_module transform_hlds.mmc_analysis.
@@ -855,8 +856,12 @@
map.search(TablingInfo, proc(PredId, ProcId), ProcTablingInfo),
ProcTablingInfo = proc_mm_tabling_info(Status, _)
->
- mercury_output_pragma_mm_tabling_info(PredOrFunc,
- qualified(ModuleName, Name), Arity, ModeNum, Status, !IO)
+ PredSymName = qualified(ModuleName, Name),
+ PredNameArityPFMn = pred_name_arity_pf_mn(PredSymName, Arity,
+ PredOrFunc, ModeNum),
+ MMTablingInfo = pragma_info_mm_tabling_info(PredNameArityPFMn,
+ Status),
+ mercury_output_pragma_mm_tabling_info(MMTablingInfo, !IO)
;
true
)
Index: compiler/term_util.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/term_util.m,v
retrieving revision 1.65
diff -u -b -r1.65 term_util.m
--- compiler/term_util.m 2 Jul 2012 01:16:38 -0000 1.65
+++ compiler/term_util.m 5 Sep 2012 04:59:59 -0000
@@ -35,7 +35,7 @@
%-----------------------------------------------------------------------------%
%
-% The `arg_size_info' and `termination_info' structures
+% The `arg_size_info' and `termination_info' structures.
%
% The types `arg_size_info' and `termination_info' hold information about
Index: compiler/termination.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/termination.m,v
retrieving revision 1.87
diff -u -b -r1.87 termination.m
--- compiler/termination.m 23 May 2011 05:08:14 -0000 1.87
+++ compiler/termination.m 5 Sep 2012 04:59:59 -0000
@@ -951,8 +951,8 @@
proc_info_get_maybe_arg_size_info(ProcInfo, ArgSize),
proc_info_get_maybe_termination_info(ProcInfo, Termination),
proc_info_declared_argmodes(ProcInfo, ModeList),
- write_pragma_termination_info(PredOrFunc, SymName, ModeList, Context,
- ArgSize, Termination, !IO),
+ write_pragma_termination_info_components(PredOrFunc, SymName, ModeList,
+ ArgSize, Termination, Context, !IO),
write_proc_termination_info(PredId, ProcIds, ProcTable, PredOrFunc,
SymName, Context, !IO).
Index: compiler/trailing_analysis.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/trailing_analysis.m,v
retrieving revision 1.46
diff -u -b -r1.46 trailing_analysis.m
--- compiler/trailing_analysis.m 2 Jul 2012 01:16:38 -0000 1.46
+++ compiler/trailing_analysis.m 5 Sep 2012 04:59:59 -0000
@@ -97,6 +97,7 @@
:- import_module parse_tree.file_names.
:- import_module parse_tree.mercury_to_mercury.
:- import_module parse_tree.prog_data.
+:- import_module parse_tree.prog_item.
:- import_module parse_tree.prog_type.
:- import_module transform_hlds.dependency_graph.
:- import_module transform_hlds.mmc_analysis.
@@ -1075,7 +1076,7 @@
:- pred write_pragma_trailing_info_2(module_info::in, trailing_info::in,
pred_id::in, pred_info::in, proc_id::in, io::di, io::uo) is det.
-write_pragma_trailing_info_2(ModuleInfo, TrailingInfo, PredId, PredInfo,
+write_pragma_trailing_info_2(ModuleInfo, TrailingMap, PredId, PredInfo,
ProcId, !IO) :-
should_write_trailing_info(ModuleInfo, PredId, ProcId, PredInfo,
for_pragma, ShouldWrite),
@@ -1087,11 +1088,15 @@
PredOrFunc = pred_info_is_pred_or_func(PredInfo),
proc_id_to_int(ProcId, ModeNum),
(
- map.search(TrailingInfo, proc(PredId, ProcId), ProcTrailInfo),
+ map.search(TrailingMap, proc(PredId, ProcId), ProcTrailInfo),
ProcTrailInfo = proc_trailing_info(Status, _)
->
- mercury_output_pragma_trailing_info(PredOrFunc,
- qualified(ModuleName, Name), Arity, ModeNum, Status, !IO)
+ PredSymName = qualified(ModuleName, Name),
+ PredNameArityPFMn = pred_name_arity_pf_mn(PredSymName, Arity,
+ PredOrFunc, ModeNum),
+ TrailingInfo = pragma_info_trailing_info(PredNameArityPFMn,
+ Status),
+ mercury_output_pragma_trailing_info(TrailingInfo, !IO)
;
true
)
Index: compiler/unused_args.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/unused_args.m,v
retrieving revision 1.176
diff -u -b -r1.176 unused_args.m
--- compiler/unused_args.m 25 Jul 2012 01:25:16 -0000 1.176
+++ compiler/unused_args.m 5 Sep 2012 04:59:59 -0000
@@ -103,6 +103,7 @@
:- import_module parse_tree.file_names.
:- import_module parse_tree.mercury_to_mercury.
:- import_module parse_tree.prog_data.
+:- import_module parse_tree.prog_item.
:- import_module parse_tree.prog_out.
:- import_module parse_tree.prog_type.
:- import_module parse_tree.prog_util.
@@ -1792,8 +1793,12 @@
PredOrFunc = pred_info_is_pred_or_func(PredInfo),
io.set_output_stream(OptStream, OldOutput, !IO),
proc_id_to_int(ProcId, ModeNum),
- mercury_output_pragma_unused_args(PredOrFunc, qualified(Module, Name),
- Arity, ModeNum, UnusedArgs, !IO),
+ PredSymName = qualified(Module, Name),
+ PredNameArityPFMn = pred_name_arity_pf_mn(PredSymName, Arity,
+ PredOrFunc, ModeNum),
+ UnusedArgsInfo = pragma_info_unused_args(PredNameArityPFMn,
+ UnusedArgs),
+ mercury_output_pragma_unused_args(UnusedArgsInfo, !IO),
io.set_output_stream(OldOutput, _, !IO)
;
true
cvs diff: Diffing compiler/notes
cvs diff: Diffing deep_profiler
cvs diff: Diffing deep_profiler/notes
cvs diff: Diffing doc
cvs diff: Diffing extras
cvs diff: Diffing extras/base64
cvs diff: Diffing extras/cgi
cvs diff: Diffing extras/complex_numbers
cvs diff: Diffing extras/complex_numbers/samples
cvs diff: Diffing extras/complex_numbers/tests
cvs diff: Diffing extras/curs
cvs diff: Diffing extras/curs/samples
cvs diff: Diffing extras/curses
cvs diff: Diffing extras/curses/sample
cvs diff: Diffing extras/dynamic_linking
cvs diff: Diffing extras/error
cvs diff: Diffing extras/fixed
cvs diff: Diffing extras/gator
cvs diff: Diffing extras/gator/generations
cvs diff: Diffing extras/gator/generations/1
cvs diff: Diffing extras/graphics
cvs diff: Diffing extras/graphics/easyx
cvs diff: Diffing extras/graphics/easyx/samples
cvs diff: Diffing extras/graphics/mercury_allegro
cvs diff: Diffing extras/graphics/mercury_allegro/examples
cvs diff: Diffing extras/graphics/mercury_allegro/samples
cvs diff: Diffing extras/graphics/mercury_allegro/samples/demo
cvs diff: Diffing extras/graphics/mercury_allegro/samples/mandel
cvs diff: Diffing extras/graphics/mercury_allegro/samples/pendulum2
cvs diff: Diffing extras/graphics/mercury_allegro/samples/speed
cvs diff: Diffing extras/graphics/mercury_cairo
cvs diff: Diffing extras/graphics/mercury_cairo/samples
cvs diff: Diffing extras/graphics/mercury_cairo/samples/data
cvs diff: Diffing extras/graphics/mercury_cairo/tutorial
cvs diff: Diffing extras/graphics/mercury_glfw
cvs diff: Diffing extras/graphics/mercury_glfw/samples
cvs diff: Diffing extras/graphics/mercury_glut
cvs diff: Diffing extras/graphics/mercury_opengl
cvs diff: Diffing extras/graphics/mercury_tcltk
cvs diff: Diffing extras/graphics/samples
cvs diff: Diffing extras/graphics/samples/calc
cvs diff: Diffing extras/graphics/samples/gears
cvs diff: Diffing extras/graphics/samples/maze
cvs diff: Diffing extras/graphics/samples/pent
cvs diff: Diffing extras/lazy_evaluation
cvs diff: Diffing extras/lex
cvs diff: Diffing extras/lex/samples
cvs diff: Diffing extras/lex/tests
cvs diff: Diffing extras/log4m
cvs diff: Diffing extras/logged_output
cvs diff: Diffing extras/monte
cvs diff: Diffing extras/moose
cvs diff: Diffing extras/moose/samples
cvs diff: Diffing extras/moose/tests
cvs diff: Diffing extras/mopenssl
cvs diff: Diffing extras/morphine
cvs diff: Diffing extras/morphine/non-regression-tests
cvs diff: Diffing extras/morphine/scripts
cvs diff: Diffing extras/morphine/source
cvs diff: Diffing extras/net
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/posix
cvs diff: Diffing extras/posix/samples
cvs diff: Diffing extras/quickcheck
cvs diff: Diffing extras/quickcheck/tutes
cvs diff: Diffing extras/references
cvs diff: Diffing extras/references/samples
cvs diff: Diffing extras/references/tests
cvs diff: Diffing extras/solver_types
cvs diff: Diffing extras/solver_types/library
cvs diff: Diffing extras/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing extras/windows_installer_generator
cvs diff: Diffing extras/windows_installer_generator/sample
cvs diff: Diffing extras/windows_installer_generator/sample/images
cvs diff: Diffing extras/xml
cvs diff: Diffing extras/xml/samples
cvs diff: Diffing extras/xml_stylesheets
cvs diff: Diffing java
cvs diff: Diffing java/runtime
cvs diff: Diffing library
cvs diff: Diffing m4
cvs diff: Diffing mdbcomp
cvs diff: Diffing profiler
cvs diff: Diffing robdd
cvs diff: Diffing runtime
cvs diff: Diffing runtime/GETOPT
cvs diff: Diffing runtime/machdeps
cvs diff: Diffing runtime/notes
cvs diff: Diffing samples
cvs diff: Diffing samples/appengine
cvs diff: Diffing samples/appengine/war
cvs diff: Diffing samples/appengine/war/WEB-INF
cvs diff: Diffing samples/c_interface
cvs diff: Diffing samples/c_interface/c_calls_mercury
cvs diff: Diffing samples/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/c_interface/mercury_calls_c
cvs diff: Diffing samples/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/c_interface/standalone_c
cvs diff: Diffing samples/concurrency
cvs diff: Diffing samples/concurrency/dining_philosophers
cvs diff: Diffing samples/concurrency/midimon
cvs diff: Diffing samples/diff
cvs diff: Diffing samples/java_interface
cvs diff: Diffing samples/java_interface/java_calls_mercury
cvs diff: Diffing samples/java_interface/mercury_calls_java
cvs diff: Diffing samples/lazy_list
cvs diff: Diffing samples/muz
cvs diff: Diffing samples/rot13
cvs diff: Diffing samples/solutions
cvs diff: Diffing samples/solver_types
cvs diff: Diffing samples/tests
cvs diff: Diffing samples/tests/c_interface
cvs diff: Diffing samples/tests/c_interface/c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/tests/c_interface/mercury_calls_c
cvs diff: Diffing samples/tests/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/tests/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/tests/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/tests/diff
cvs diff: Diffing samples/tests/muz
cvs diff: Diffing samples/tests/rot13
cvs diff: Diffing samples/tests/solutions
cvs diff: Diffing samples/tests/toplevel
cvs diff: Diffing scripts
cvs diff: Diffing slice
cvs diff: Diffing ssdb
cvs diff: Diffing tests
cvs diff: Diffing tests/analysis
cvs diff: Diffing tests/analysis/ctgc
cvs diff: Diffing tests/analysis/excp
cvs diff: Diffing tests/analysis/ext
cvs diff: Diffing tests/analysis/sharing
cvs diff: Diffing tests/analysis/table
cvs diff: Diffing tests/analysis/trail
cvs diff: Diffing tests/analysis/unused_args
cvs diff: Diffing tests/benchmarks
cvs diff: Diffing tests/debugger
cvs diff: Diffing tests/debugger/declarative
cvs diff: Diffing tests/dppd
cvs diff: Diffing tests/feedback
cvs diff: Diffing tests/feedback/mandelbrot
cvs diff: Diffing tests/feedback/mmc
cvs diff: Diffing tests/general
cvs diff: Diffing tests/general/accumulator
cvs diff: Diffing tests/general/string_format
cvs diff: Diffing tests/general/structure_reuse
cvs diff: Diffing tests/grade_subdirs
cvs diff: Diffing tests/hard_coded
cvs diff: Diffing tests/hard_coded/exceptions
cvs diff: Diffing tests/hard_coded/purity
cvs diff: Diffing tests/hard_coded/sub-modules
cvs diff: Diffing tests/hard_coded/typeclasses
cvs diff: Diffing tests/invalid
cvs diff: Diffing tests/invalid/purity
cvs diff: Diffing tests/misc_tests
cvs diff: Diffing tests/mmc_make
cvs diff: Diffing tests/mmc_make/lib
cvs diff: Diffing tests/par_conj
cvs diff: Diffing tests/recompilation
cvs diff: Diffing tests/stm
cvs diff: Diffing tests/stm/orig
cvs diff: Diffing tests/stm/orig/stm-compiler
cvs diff: Diffing tests/stm/orig/stm-compiler/test1
cvs diff: Diffing tests/stm/orig/stm-compiler/test10
cvs diff: Diffing tests/stm/orig/stm-compiler/test2
cvs diff: Diffing tests/stm/orig/stm-compiler/test3
cvs diff: Diffing tests/stm/orig/stm-compiler/test4
cvs diff: Diffing tests/stm/orig/stm-compiler/test5
cvs diff: Diffing tests/stm/orig/stm-compiler/test6
cvs diff: Diffing tests/stm/orig/stm-compiler/test7
cvs diff: Diffing tests/stm/orig/stm-compiler/test8
cvs diff: Diffing tests/stm/orig/stm-compiler/test9
cvs diff: Diffing tests/stm/orig/stm-compiler-par
cvs diff: Diffing tests/stm/orig/stm-compiler-par/bm1
cvs diff: Diffing tests/stm/orig/stm-compiler-par/bm2
cvs diff: Diffing tests/stm/orig/stm-compiler-par/stmqueue
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test1
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test10
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test11
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test2
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test3
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test4
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test5
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test6
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test7
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test8
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test9
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test1
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test2
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test3
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test4
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test5
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test6
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test7
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test8
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test9
cvs diff: Diffing tests/tabling
cvs diff: Diffing tests/term
cvs diff: Diffing tests/trailing
cvs diff: Diffing tests/valid
cvs diff: Diffing tests/warnings
cvs diff: Diffing tools
cvs diff: Diffing trace
cvs diff: Diffing util
cvs diff: Diffing vim
cvs diff: Diffing vim/after
cvs diff: Diffing vim/ftplugin
cvs diff: Diffing vim/syntax
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to: mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions: mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the reviews
mailing list