mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-16 06:14:59 +00:00
Estimated hours taken: 1.5 Branches: main Remove residual parts of the Aditi backend that weren't deleted the other day. configure.in: Mmake.common.in: Remove support for enabling the Aditi backend. runtime/mercury_aditi.h: Remove this file. runtime/Mmakefile: runtime/mercury.h: runtime/mercury_imp.h: runtime/mercury_ho_call.[ch]: runtime/mercury_wrapper.[ch]: Delete support for Aditi in the runtime. scripts/Mmake.rules: scripts/Mmake.vars.in: scripts/c2init.in: scripts/parse_ml_options.sh-subr.in: Remove mmake support for building .rlo files, etc. util/mkinit.c: Remove Aditi specific code. compiler/bytecode_data.m: compiler/closure_analysis.m: compiler/code_model.m: compiler/compile_target_code.m: compiler/det_analysis.m: compiler/handle_options.m: compiler/hlds_goal.m: compiler/hlds_module.m: compiler/make.dependencies.m: compiler/make.m: compiler/make.module_target.m: compiler/make.program_target.m: compiler/make.util.m: compiler/make_hlds_error.m: compiler/make_hlds_passes.m: compiler/mercury_to_mercury.m: compiler/mlds_to_gcc.m: compiler/modecheck_call.m: compiler/modules.m: compiler/opt_debug.m: compiler/options.m: compiler/prog_data.m: compiler/prog_foreign.m: compiler/prog_mode.m: compiler/prog_type.m: compiler/rtti.m: compiler/rtti_out.m: compiler/rtti_to_mlds.m: compiler/term_errors.m: compiler/unify_proc.m: mdbcomp/prim_data.m: Remove residual support for Aditi. library/ops.m: Remove the 'aditi_bottom_up' and 'aditi_top_down' operators from the ops table. doc/reference_manual.texi: doc/user_guide.texi: Delete the sections on the Aditi interface. extras/aditi/*: Delete this.
88 lines
3.7 KiB
Mathematica
88 lines
3.7 KiB
Mathematica
%-----------------------------------------------------------------------------%
|
|
% vim: ft=mercury ts=4 sw=4 et
|
|
%-----------------------------------------------------------------------------%
|
|
% Copyright (C) 2000, 2003-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.
|
|
%-----------------------------------------------------------------------------%
|
|
%
|
|
% This module defines the `code_model' data type, and associated procedures.
|
|
% The `code_model' type is a simplified version of the `determinism' type
|
|
% that is defined in prog_data.m. It ignores most of the distinctions in
|
|
% the determinism type and keeps only the distinctions that are important
|
|
% for code generation.
|
|
%
|
|
% We define this in a different module than the `determinism' type because
|
|
% it is only used by some of the different back-ends, not all of them.
|
|
% It is used by the MLDS, LLDS, and bytecode back-ends.
|
|
%
|
|
%-----------------------------------------------------------------------------%
|
|
|
|
:- module hlds__code_model.
|
|
|
|
:- interface.
|
|
|
|
:- import_module hlds.hlds_goal.
|
|
:- import_module hlds.hlds_pred.
|
|
:- import_module parse_tree.prog_data.
|
|
|
|
:- type code_model
|
|
---> model_det % functional & total
|
|
; model_semi % just functional
|
|
; model_non. % not functional
|
|
|
|
:- pred determinism_to_code_model(determinism, code_model).
|
|
:- mode determinism_to_code_model(in, out) is det.
|
|
:- mode determinism_to_code_model(out, in) is multi.
|
|
|
|
:- pred proc_info_interface_code_model(proc_info::in, code_model::out) is det.
|
|
|
|
:- pred goal_info_get_code_model(hlds_goal_info::in, code_model::out) is det.
|
|
|
|
% Construct a representation of the interface determinism of a procedure.
|
|
% The code we have chosen is not sequential; instead it encodes the various
|
|
% properties of each determinism. This must match the encoding of
|
|
% MR_Determinism in mercury_stack_layout.h.
|
|
%
|
|
% The 8 bit is set iff the context is first_solution.
|
|
% The 4 bit is set iff the min number of solutions is more than zero.
|
|
% The 2 bit is set iff the max number of solutions is more than zero.
|
|
% The 1 bit is set iff the max number of solutions is more than one.
|
|
%
|
|
:- func represent_determinism(determinism) = int.
|
|
|
|
%-----------------------------------------------------------------------------%
|
|
|
|
:- implementation.
|
|
|
|
:- import_module mdbcomp.program_representation.
|
|
:- import_module int.
|
|
|
|
determinism_to_code_model(det, model_det).
|
|
determinism_to_code_model(semidet, model_semi).
|
|
determinism_to_code_model(nondet, model_non).
|
|
determinism_to_code_model(multidet, model_non).
|
|
determinism_to_code_model(cc_nondet, model_semi).
|
|
determinism_to_code_model(cc_multidet, model_det).
|
|
determinism_to_code_model(erroneous, model_det).
|
|
determinism_to_code_model(failure, model_semi).
|
|
|
|
proc_info_interface_code_model(ProcInfo, CodeModel) :-
|
|
proc_info_interface_determinism(ProcInfo, Determinism),
|
|
determinism_to_code_model(Determinism, CodeModel).
|
|
|
|
goal_info_get_code_model(GoalInfo, CodeModel) :-
|
|
goal_info_get_determinism(GoalInfo, Determinism),
|
|
determinism_to_code_model(Determinism, CodeModel).
|
|
|
|
represent_determinism(det) = detism_rep(det_rep).
|
|
represent_determinism(semidet) = detism_rep(semidet_rep).
|
|
represent_determinism(nondet) = detism_rep(nondet_rep).
|
|
represent_determinism(multidet) = detism_rep(multidet_rep).
|
|
represent_determinism(erroneous) = detism_rep(erroneous_rep).
|
|
represent_determinism(failure) = detism_rep(failure_rep).
|
|
represent_determinism(cc_nondet) = detism_rep(cc_nondet_rep).
|
|
represent_determinism(cc_multidet) = detism_rep(cc_multidet_rep).
|
|
|
|
%-----------------------------------------------------------------------------%
|