mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-14 13:23:53 +00:00
Instead of being relied on all over the place, centralize the compiler's
Estimated hours taken: 16 Branches: main Instead of being relied on all over the place, centralize the compiler's knowledge of the names of unify, compare and index predicates in one place, special_pred.m. This should make it easy to change the naming scheme once we switch over to compiler-generated type_ctor_infos for builtin types, which will eliminate the runtime system's knowledge of the naming scheme. compiler/hlds_pred.m: Add a field to pred_infos that says whether the predicate is a unify, compare or index predicate, and if so, for which type constructor. Code that used to test the predicate's name for __Unify__ etc now tests this field instead. Similarly the code that used to employ devious tricks to find out the type the unify/compare/index predicate is for. compiler/rtti.m: Include this field in rtti_proc_labels as well as pred_infos. compiler/make_hlds.m: Fill in this field as appropriate. compiler/proc_label.m: Replace the predicate name with special_pred_id in the proc_labels of unify, index and compare preds. compiler/special_pred.m: Narrow the interface to prevent reliance on the naming scheme for compiler-generated unify, compare and index predicates, except when absolutely necessary, i.e. when creating names for them. Narrow the mechanism required to reverse-engineer the type constructor a unify/compare/index predicate is for from the types to the functionality required by higher_order.m. compiler/code_gen.m: compiler/det_report.m: compiler/higher_order.m: compiler/intermod.m: compiler/layout_out.m: compiler/magic_util.m: compiler/ml_code_util.m: compiler/name_mangle.m: compiler/opt_debug.m: compiler/opt_util.m: compiler/optimize.m: compiler/polymorphism.m: compiler/post_typecheck.m: compiler/proc_label.m: compiler/rl_exprn.m: compiler/rl_key.m: compiler/simplify.m: compiler/termination.m: compiler/typecheck.m: compiler/unify_proc.m: compiler/unused_args.m: Update code and comments to conform to the changes above. compiler/hlds_out.m: Don't refer to the 'type' that a unify, compare or index predicate is for; refer to the type *constructor*. compiler/mlds_to_java.m: Delete an unused predicate. tests/invalid/purity/purity.err_exp: Update this expected output for the change in hlds_out.m.
This commit is contained in:
@@ -125,22 +125,6 @@ qualified_name_is_stdlib(qualified(Module, Name)) :-
|
||||
qualified_name_is_stdlib(Module)
|
||||
).
|
||||
|
||||
% Succeeds iff this definition is a function definition which
|
||||
% defines the `unify' or `compare' special predicate.
|
||||
%
|
||||
:- pred defn_is_unify_or_compare(mlds__defn).
|
||||
:- mode defn_is_unify_or_compare(in) is semidet.
|
||||
|
||||
defn_is_unify_or_compare(Defn) :-
|
||||
Defn = mlds__defn(Name, _Context, _Flags, _Body),
|
||||
Name = function(Label, _ProcID, _MaybeSeqNum, _PredID),
|
||||
Label = special_pred(PredName, _, _, _),
|
||||
(
|
||||
PredName = "__Compare__"
|
||||
;
|
||||
PredName = "__Unify__"
|
||||
).
|
||||
|
||||
% Succeeds iff this definition is a data definition which
|
||||
% defines RTTI.
|
||||
%
|
||||
|
||||
Reference in New Issue
Block a user