mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-16 06:14:59 +00:00
Estimated hours taken: 2 Branches: main Remove support for the Aditi backend. It is a pain to have to update it every time a data structure changes when we don't see any benefit from it, and its presence makes compilation of the compiler directory take about 10% longer (since the Aditi backend modules are roughly 10% of the code in the compiler directory). Deleting the Aditi-specific data structures from the HLDS should also speed up compilation a little bit. I have spoken to Rao and he is fine with this step. Aditi users, if there are any, can continue to use the Aditi support in release 0.12.*. I also tagged the last version on the trunk to support aditi with the name "last_aditi". The need for modifications in this Aditi support is likely to be very rare to nonexistent, if the recent past is any guide: the Aditi backend hasn't seen a nontrivial modification in a year or more. This diff removes a net 31492 lines. compiler/add_aditi.m: compiler/aditi_backend.pp: compiler/aditi_builtin_ops.m: compiler/context.m: compiler/dnf.m: compiler/magic.m: compiler/magic_util.m: compiler/rl.m: compiler/rl_analyse.m: compiler/rl_block.m: compiler/rl_block_opt.m: compiler/rl_code.m: compiler/rl_dump.m: compiler/rl_exprn.m: compiler/rl_file.pp: compiler/rl_gen.m: compiler/rl_info.m: compiler/rl_key.m: compiler/rl_liveness.m: compiler/rl_loop.m: compiler/rl_opt.m: compiler/rl_out.pp: compiler/rl_relops.m: compiler/rl_sort.m: compiler/rl_stream.m: Remove these compiler modules, since they existed only to support the Aditi backend. compiler/hlds_goal.m: Delete the Aditi-specific components of goals (e.g. the aditi-builtin kind of generic calls and Aditi-evaluated lambdas). compiler/hlds_pred.m: Delete the Aditi-specific components of pred_infos. compiler/prog_data.m: Delete the Aditi-specific items. compiler/passes_aux.m: Don't worry about processing all procedures or just all non-Aditi procedures. compiler/add_clause.m: Add a predicate from a deleted module that is now used only here. compiler/*.m: Conform to the data structure changes above. compiler/notes/*.html: Remove references to the Aditi backend. tests/invalid/aditi.m: tests/invalid/aditi_errors.err_exp: tests/invalid/aditi_errors.m: tests/invalid/aditi_private_builtin.m: tests/invalid/aditi_state_errors.err_exp: tests/invalid/aditi_state_errors.m: tests/invalid/aditi_update_derived_relation.err_exp: tests/invalid/aditi_update_derived_relation.m: tests/invalid/aditi_update_errors.err_exp: tests/invalid/aditi_update_errors.m: tests/invalid/aditi_update_mode_errors.err_exp: tests/invalid/aditi_update_mode_errors.m: tests/valid/aditi.m: tests/valid/aditi_calls_mercury.m: tests/valid/aditi_error_bug.m: tests/valid/aditi_error_bug2.m: tests/valid/aditi_error_bug3.m: tests/valid/aditi_private_builtin.m: tests/valid/aditi_query.m: tests/valid/aditi_update.m: tests/valid/base_relation.m: tests/valid/base_relation2.m: tests/valid/ite_to_disj.m: Remove these Aditi-specific tests. tests/*/Mmakefile: Remove the references to these Aditi-specific tests.
162 lines
6.6 KiB
Mathematica
162 lines
6.6 KiB
Mathematica
%-----------------------------------------------------------------------------%
|
|
% vim: ft=mercury ts=4 sw=4 et
|
|
%-----------------------------------------------------------------------------%
|
|
% Copyright (C) 1993-2006 The University of Melbourne.
|
|
% This file may only be copied under the terms of the GNU General
|
|
% Public License - see the file COPYING in the Mercury distribution.
|
|
%-----------------------------------------------------------------------------%
|
|
|
|
% File: make_hlds.m.
|
|
% Main author: fjh.
|
|
|
|
% This module converts from the parse tree structure which is read in by
|
|
% prog_io.m, into the simplified high level data structure defined in
|
|
% hlds.m. In the parse tree, the program is represented as a list of
|
|
% items; we insert each item into the appropriate symbol table, and report
|
|
% any duplicate definition errors. We also transform clause bodies from
|
|
% (A,B,C) into conj([A,B,C]) form, convert all unifications into
|
|
% super-homogenous form, and introduce implicit quantification.
|
|
%
|
|
% XXX we should record each error using module_info_incr_errors.
|
|
|
|
% WISHLIST - we should handle explicit module quantification
|
|
|
|
:- module hlds__make_hlds.
|
|
:- interface.
|
|
|
|
:- import_module hlds.hlds_data.
|
|
:- import_module hlds.hlds_module.
|
|
:- import_module hlds.hlds_pred.
|
|
:- import_module mdbcomp.prim_data.
|
|
:- import_module parse_tree.equiv_type.
|
|
:- import_module parse_tree.module_qual.
|
|
:- import_module parse_tree.prog_data.
|
|
:- import_module parse_tree.prog_item.
|
|
|
|
:- import_module bool.
|
|
:- import_module io.
|
|
:- import_module list.
|
|
:- import_module std_util.
|
|
:- import_module term.
|
|
|
|
:- type make_hlds_qual_info.
|
|
|
|
% parse_tree_to_hlds(ParseTree, MQInfo, EqvMap, HLDS, QualInfo,
|
|
% InvalidTypes, InvalidModes):
|
|
%
|
|
% Given MQInfo (returned by module_qual.m) and EqvMap (returned by
|
|
% equiv_type.m), converts ParseTree to HLDS. Any errors found are
|
|
% recorded in the HLDS num_errors field.
|
|
% Returns InvalidTypes = yes if undefined types found.
|
|
% Returns InvalidModes = yes if undefined or cyclic insts or modes
|
|
% found. QualInfo is an abstract type that is then passed back to
|
|
% produce_instance_method_clauses (see below).
|
|
%
|
|
:- pred parse_tree_to_hlds(compilation_unit::in, mq_info::in, eqv_map::in,
|
|
module_info::out, make_hlds_qual_info::out, bool::out, bool::out,
|
|
io::di, io::uo) is det.
|
|
|
|
:- pred add_new_proc(inst_varset::in, arity::in, list(mer_mode)::in,
|
|
maybe(list(mer_mode))::in, maybe(list(is_live))::in,
|
|
maybe(determinism)::in, prog_context::in, is_address_taken::in,
|
|
pred_info::in, pred_info::out, proc_id::out) is det.
|
|
|
|
% add_special_pred_for_real(SpecialPredId, TVarSet, Type, TypeCtor,
|
|
% TypeBody, TypeContext, TypeStatus, !ModuleInfo).
|
|
%
|
|
% Add declarations and clauses for a special predicate.
|
|
% This is used by unify_proc.m to add a unification predicate
|
|
% for an imported type for which special predicates are being
|
|
% generated only when a unification procedure is requested
|
|
% during mode analysis.
|
|
%
|
|
:- pred add_special_pred_for_real(special_pred_id::in, tvarset::in,
|
|
mer_type::in, type_ctor::in, hlds_type_body::in, prog_context::in,
|
|
import_status::in, module_info::in, module_info::out) is det.
|
|
|
|
% add_special_pred_decl_for_real(SpecialPredId, TVarSet,
|
|
% Type, TypeCtor, TypeContext, TypeStatus, !ModuleInfo).
|
|
%
|
|
% Add declarations for a special predicate.
|
|
% This is used by higher_order.m when specializing an in-in
|
|
% unification for an imported type for which unification procedures
|
|
% are generated lazily.
|
|
%
|
|
:- pred add_special_pred_decl_for_real(special_pred_id::in,
|
|
tvarset::in, mer_type::in, type_ctor::in, prog_context::in,
|
|
import_status::in, module_info::in, module_info::out) is det.
|
|
|
|
% Given the definition for a predicate or function from a
|
|
% type class instance declaration, produce the clauses_info
|
|
% for that definition.
|
|
%
|
|
:- pred produce_instance_method_clauses(instance_proc_def::in,
|
|
pred_or_func::in, arity::in, list(mer_type)::in, pred_markers::in,
|
|
term__context::in, import_status::in, clauses_info::out,
|
|
module_info::in, module_info::out,
|
|
make_hlds_qual_info::in, make_hlds_qual_info::out, io::di, io::uo) is det.
|
|
|
|
% Move the recompilation_info from the qual_info to the module_info
|
|
% after make_hlds is finished with it and the qual_info is dead.
|
|
%
|
|
:- pred set_module_recomp_info(make_hlds_qual_info::in,
|
|
module_info::in, module_info::out) is det.
|
|
|
|
:- implementation.
|
|
|
|
:- include_module add_class.
|
|
:- include_module add_clause.
|
|
:- include_module add_mode.
|
|
:- include_module add_pragma.
|
|
:- include_module add_pred.
|
|
:- include_module add_solver.
|
|
:- include_module add_special_pred.
|
|
:- include_module add_type.
|
|
:- include_module field_access.
|
|
:- include_module make_hlds_error.
|
|
:- include_module make_hlds_passes.
|
|
:- include_module make_hlds_warn.
|
|
:- include_module qual_info.
|
|
:- include_module state_var.
|
|
:- include_module superhomogeneous.
|
|
|
|
:- import_module hlds.make_hlds.add_class.
|
|
:- import_module hlds.make_hlds.add_pred.
|
|
:- import_module hlds.make_hlds.add_special_pred.
|
|
:- import_module hlds.make_hlds.make_hlds_passes.
|
|
:- import_module hlds.make_hlds.qual_info.
|
|
|
|
:- type make_hlds_qual_info == hlds__make_hlds__qual_info__qual_info.
|
|
|
|
parse_tree_to_hlds(Module, MQInfo0, EqvMap, ModuleInfo,
|
|
QualInfo, InvalidTypes, InvalidModes, !IO) :-
|
|
do_parse_tree_to_hlds(Module, MQInfo0, EqvMap, ModuleInfo,
|
|
QualInfo, InvalidTypes, InvalidModes, !IO).
|
|
|
|
add_new_proc(InstVarSet, Arity, ArgModes, MaybeDeclaredArgModes,
|
|
MaybeArgLives, MaybeDet, Context, IsAddressTaken, PredInfo0, PredInfo,
|
|
ModeId) :-
|
|
do_add_new_proc(InstVarSet, Arity, ArgModes, MaybeDeclaredArgModes,
|
|
MaybeArgLives, MaybeDet, Context, IsAddressTaken, PredInfo0, PredInfo,
|
|
ModeId).
|
|
|
|
add_special_pred_for_real(SpecialPredId, TVarSet,
|
|
Type0, TypeCtor, TypeBody, Context, Status0, !ModuleInfo) :-
|
|
do_add_special_pred_for_real(SpecialPredId, TVarSet,
|
|
Type0, TypeCtor, TypeBody, Context, Status0, !ModuleInfo).
|
|
|
|
add_special_pred_decl_for_real(SpecialPredId, TVarSet,
|
|
Type, TypeCtor, Context, Status0, !ModuleInfo) :-
|
|
do_add_special_pred_decl_for_real(SpecialPredId, TVarSet,
|
|
Type, TypeCtor, Context, Status0, !ModuleInfo).
|
|
|
|
produce_instance_method_clauses(InstanceProcDefn,
|
|
PredOrFunc, PredArity, ArgTypes, Markers, Context, Status,
|
|
ClausesInfo, !ModuleInfo, !QualInfo, !IO) :-
|
|
do_produce_instance_method_clauses(InstanceProcDefn, PredOrFunc,
|
|
PredArity, ArgTypes, Markers, Context, Status, ClausesInfo,
|
|
!ModuleInfo, !QualInfo, !IO).
|
|
|
|
set_module_recomp_info(QualInfo, !ModuleInfo) :-
|
|
set_module_recompilation_info(QualInfo, !ModuleInfo).
|