mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-21 12:23:44 +00:00
compiler/elds.m:
compiler/elds_to_erlang.m:
compiler/erl_backend.m:
compiler/erl_call_gen.m:
compiler/erl_code_gen.m:
compiler/erl_code_util.m:
compiler/erl_rtti.m:
compiler/erl_unify_gen.m:
compiler/erlang_rtti.m:
compiler/mercury_compile_erl_back_end.m:
Delete these modules, which together constitute the Erlang backend.
compiler/notes/compiler_design.html:
Delete references to the deleted modules.
compiler/parse_tree_out_type_repn.m:
Update the format we use to represent the sets of foreign_type and
foreign_enum declarations for a type as part of its item_type_repn_info,
now that Erlang is no longer a target language.
compiler/parse_type_repn.m:
Accept both the updated version of the item_type_repn_info and the
immediately previous version, since the installed compiler will
initially generate that previous version. However, stop accepting
an even older version that we stopped generating several months ago.
compiler/parse_pragma_foreign.m:
When the compiler finds a reference to Erlang as a foreign language,
add a message about support for Erlang being discontinued to the error
message.
Make the code parsing foreign_decls handle the term containing
the foreign language the same way as the codes parsing foreign
codes, procs, types and enums.
Add a mechanism to help parse_mutable.m to do the same.
compiler/parse_mutable.m:
When the compiler finds a reference to Erlang as a foreign language,
print an error message about support for Erlang being discontinued.
compiler/compute_grade.m:
When the compiler finds a reference to Erlang as a grade component,
print an informational message about support for Erlang being discontinued.
compiler/pickle.m:
compiler/make.build.m:
Delete Erlang foreign procs and types.
compiler/add_foreign_enum.m:
compiler/add_mutable_aux_preds.m:
compiler/add_pred.m:
compiler/add_solver.m:
compiler/add_type.m:
compiler/check_libgrades.m:
compiler/check_parse_tree_type_defns.m:
compiler/code_gen.m:
compiler/compile_target_code.m:
compiler/compute_grade.m:
compiler/const_struct.m:
compiler/convert_parse_tree.m:
compiler/dead_proc_elim.m:
compiler/decide_type_repn.m:
compiler/deps_map.m:
compiler/du_type_layout.m:
compiler/export.m:
compiler/foreign.m:
compiler/globals.m:
compiler/granularity.m:
compiler/handle_options.m:
compiler/hlds_code_util.m:
compiler/hlds_data.m:
compiler/hlds_module.m:
compiler/inlining.m:
compiler/int_emu.m:
compiler/intermod.m:
compiler/item_util.m:
compiler/lambda.m:
compiler/lco.m:
compiler/llds_out_file.m:
compiler/make.dependencies.m:
compiler/make.m:
compiler/make.module_dep_file.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/make.util.m:
compiler/make_hlds_separate_items.m:
compiler/make_hlds_warn.m:
compiler/mercury_compile_llds_back_end.m:
compiler/mercury_compile_main.m:
compiler/mercury_compile_middle_passes.m:
compiler/mercury_compile_mlds_back_end.m:
compiler/ml_code_util.m:
compiler/ml_foreign_proc_gen.m:
compiler/ml_target_util.m:
compiler/ml_top_gen.m:
compiler/mlds.m:
compiler/mlds_dump.m:
compiler/mlds_to_c_export.m:
compiler/mlds_to_c_file.m:
compiler/mlds_to_cs_data.m:
compiler/mlds_to_cs_export.m:
compiler/mlds_to_cs_file.m:
compiler/mlds_to_cs_type.m:
compiler/mlds_to_java_export.m:
compiler/mlds_to_java_file.m:
compiler/mlds_to_java_type.m:
compiler/module_imports.m:
compiler/parse_pragma_foreign.m:
compiler/parse_tree_out.m:
compiler/polymorphism.m:
compiler/pragma_c_gen.m:
compiler/prog_data.m:
compiler/prog_data_foreign.m:
compiler/prog_foreign.m:
compiler/prog_item.m:
compiler/simplify_goal_scope.m:
compiler/special_pred.m:
compiler/string_encoding.m:
compiler/top_level.m:
compiler/uint_emu.m:
compiler/write_deps_file.m:
Remove references to Erlang as a backend or as a target language.
tests/invalid/bad_foreign_code.{m,err_exp}:
tests/invalid/bad_foreign_decl.{m,err_exp}:
tests/invalid/bad_foreign_enum.{m,err_exp}:
tests/invalid/bad_foreign_export.{m,err_exp}:
tests/invalid/bad_foreign_export_enum.{m,err_exp}:
tests/invalid/bad_foreign_import_module.{m,err_exp}:
tests/invalid/bad_foreign_proc.{m,err_exp}:
tests/invalid/bad_foreign_type.{m,err_exp}:
Add a test for Erlang as an invalid foreign language. Expect both the
new error message for this new error, and the updated list of now-valid
foreign languages on all errors.
138 lines
5.4 KiB
Mathematica
138 lines
5.4 KiB
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ft=mercury ts=4 sw=4 et
|
|
%---------------------------------------------------------------------------%
|
|
% Copyright (C) 2011 The University of Melbourne.
|
|
% Copyright (C) 2013-2015, 2017-2018 The Mercury team.
|
|
% This file may only be copied under the terms of the GNU General
|
|
% Public License - see the file COPYING in the Mercury distribution.
|
|
%---------------------------------------------------------------------------%
|
|
%
|
|
% File: ml_target_util.m.
|
|
% Author: zs.
|
|
%
|
|
% This module contains utility predicates dealing with target languages.
|
|
%
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- module ml_backend.ml_target_util.
|
|
:- interface.
|
|
|
|
:- import_module libs.
|
|
:- import_module libs.globals.
|
|
:- import_module parse_tree.
|
|
:- import_module parse_tree.prog_data.
|
|
|
|
:- import_module bool.
|
|
|
|
%---------------------------------------------------------------------------%
|
|
|
|
% Return `yes' iff the target language supports the specified construct.
|
|
%
|
|
% Note that for int switches one of our target languages (Java) does not
|
|
% support switching on 64-bit values, so we treat that case separately.
|
|
%
|
|
:- func globals_target_supports_int_switch(globals) = bool.
|
|
:- func globals_target_supports_int64_switch(globals) = bool.
|
|
:- func globals_target_supports_int_type_switch(globals, int_type) = bool.
|
|
:- func globals_target_supports_string_switch(globals) = bool.
|
|
:- func globals_target_supports_goto(globals) = bool.
|
|
:- func globals_target_supports_computed_goto(globals) = bool.
|
|
:- func globals_target_supports_break_and_continue(globals) = bool.
|
|
|
|
:- func target_supports_int_switch(compilation_target) = bool.
|
|
:- func target_supports_int64_switch(compilation_target) = bool.
|
|
:- func target_supports_string_switch(compilation_target) = bool.
|
|
:- func target_supports_goto(compilation_target) = bool.
|
|
:- func target_supports_computed_goto(compilation_target) = bool.
|
|
:- func target_supports_break_and_continue(compilation_target) = bool.
|
|
|
|
% This should return `yes' iff downcasts are not needed.
|
|
%
|
|
:- func target_supports_inheritence(compilation_target) = bool.
|
|
|
|
%---------------------------------------------------------------------------%
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- implementation.
|
|
|
|
globals_target_supports_int_switch(Globals) = SupportsIntSwitch :-
|
|
globals.get_target(Globals, Target),
|
|
SupportsIntSwitch = target_supports_int_switch(Target).
|
|
|
|
globals_target_supports_int64_switch(Globals) = SupportsInt64Switch :-
|
|
globals.get_target(Globals, Target),
|
|
SupportsInt64Switch = target_supports_int64_switch(Target).
|
|
|
|
globals_target_supports_int_type_switch(Globals, IntType)
|
|
= SupportsIntTypeSwitch :-
|
|
(
|
|
( IntType = int_type_int
|
|
; IntType = int_type_uint
|
|
; IntType = int_type_int8
|
|
; IntType = int_type_uint8
|
|
; IntType = int_type_int16
|
|
; IntType = int_type_uint16
|
|
; IntType = int_type_int32
|
|
; IntType = int_type_uint32
|
|
),
|
|
SupportsIntTypeSwitch = globals_target_supports_int_switch(Globals)
|
|
;
|
|
( IntType = int_type_int64
|
|
; IntType = int_type_uint64
|
|
),
|
|
SupportsIntTypeSwitch = globals_target_supports_int64_switch(Globals)
|
|
).
|
|
|
|
globals_target_supports_string_switch(Globals) = SupportsStringSwitch :-
|
|
globals.get_target(Globals, Target),
|
|
SupportsStringSwitch = target_supports_string_switch(Target).
|
|
|
|
globals_target_supports_goto(Globals) = SupportsGoto :-
|
|
globals.get_target(Globals, Target),
|
|
SupportsGoto = target_supports_goto(Target).
|
|
|
|
globals_target_supports_computed_goto(Globals) = SupportsComputedGoto :-
|
|
globals.get_target(Globals, Target),
|
|
SupportsComputedGoto = target_supports_computed_goto(Target).
|
|
|
|
globals_target_supports_break_and_continue(Globals) = SupportsBreakContinue :-
|
|
globals.get_target(Globals, Target),
|
|
SupportsBreakContinue = target_supports_break_and_continue(Target).
|
|
|
|
%---------------------------------------------------------------------------%
|
|
|
|
target_supports_int_switch(target_c) = yes.
|
|
target_supports_int_switch(target_csharp) = yes.
|
|
target_supports_int_switch(target_java) = yes.
|
|
|
|
target_supports_int64_switch(target_c) = yes.
|
|
target_supports_int64_switch(target_csharp) = yes.
|
|
target_supports_int64_switch(target_java) = no.
|
|
|
|
target_supports_string_switch(target_c) = no.
|
|
target_supports_string_switch(target_csharp) = yes.
|
|
target_supports_string_switch(target_java) = yes.
|
|
% String switches were added in Java 7, and we now require 8.
|
|
|
|
target_supports_goto(target_c) = yes.
|
|
% XXX C# *does* support gotos but mlds_to_cs_stmt.m currently aborts
|
|
% if it encounters them.
|
|
target_supports_goto(target_csharp) = no.
|
|
target_supports_goto(target_java) = no.
|
|
|
|
target_supports_computed_goto(target_c) = yes.
|
|
target_supports_computed_goto(target_csharp) = no.
|
|
target_supports_computed_goto(target_java) = no.
|
|
|
|
target_supports_break_and_continue(target_c) = yes.
|
|
target_supports_break_and_continue(target_csharp) = yes.
|
|
target_supports_break_and_continue(target_java) = yes.
|
|
|
|
target_supports_inheritence(target_c) = no.
|
|
target_supports_inheritence(target_csharp) = yes.
|
|
target_supports_inheritence(target_java) = yes.
|
|
|
|
%---------------------------------------------------------------------------%
|
|
:- end_module ml_backend.ml_target_util.
|
|
%---------------------------------------------------------------------------%
|