Add EXTRA_MLFLAGS variable, so that you can set

compiler/Mmake:
	Add EXTRA_MLFLAGS variable, so that you can set
	EXTRA_MLFLAGS=--no-strip if you want to preserve
	the debugging info.

code_util.m, polymorphism.m, hlds.m, special_pred.m:
	Move the stuff dealing with special_preds from hlds.m into
	a new module special_pred.  Add a new predicate special_pred_get_type
	to that module, and use it in code_util.m and polymorphism.m
	(replacing some fairly non-maintainable hacks).

make_hlds.m, unify_proc.m:
	Import special_pred.m.
This commit is contained in:
Fergus Henderson
1995-09-21 04:48:16 +00:00
parent 8bdeb60cb6
commit 139675dec7
7 changed files with 137 additions and 136 deletions

View File

@@ -74,7 +74,7 @@
%---------------------------------------------------------------------------%
:- implementation.
:- import_module type_util, list, map, require, std_util.
:- import_module type_util, special_pred, list, map, require, std_util.
%---------------------------------------------------------------------------%
@@ -110,32 +110,8 @@ code_util__make_proc_label(ModuleInfo, PredId, ProcId, ProcLabel) :-
module_info_preds(ModuleInfo, Preds),
map__lookup(Preds, PredId, PredInfo),
pred_info_arg_types(PredInfo, _TypeVarSet, ArgTypes),
% XXX This is a kludge!
% For compiler-generated type-specific predicates,
% we should really store the type as a separate
% field in pred_info.
% Instead we use some nasty hacks:
% for __Index__(...TypeInfos..., T, int)
% and __Type_To_Term__(...TypeInfos..., T, term)
% we use the type of the second last argument,
% and for __Compare__(...TypeInfos..., comparison_result, T, T)
% __Unify__(...TypeInfos..., T, T), and
% __Term_To_Type__(...TypeInfos..., term, T) we use the
% type of the last argument.
(
( PredName = "__Index__"
; PredName = "__Type_To_Term__"
),
list__reverse(ArgTypes, [_, Type | _]),
type_to_type_id(Type, TypeId0, _)
->
TypeId = TypeId0
;
( PredName = "__Unify__"
; PredName = "__Compare__"
; PredName = "__Term_To_Type__"
),
list__reverse(ArgTypes, [Type | _]),
special_pred_get_type(PredName, ArgTypes, Type),
type_to_type_id(Type, TypeId0, _)
->
TypeId = TypeId0