[m-rev.] for review: automatically generate all type_ctor_infos on non C backends
Peter Ross
pro at missioncriticalit.com
Thu Nov 20 22:23:05 AEDT 2003
On Thu, Nov 20, 2003 at 01:40:44PM +1100, Fergus Henderson wrote:
>
> That seems to be the second occurrence of that list of names
> (the other was in special_pred.m, above).
> It should be abstracted out into a separate predicate.
>
Forgot this
diff -u compiler/make_hlds.m compiler/make_hlds.m
--- compiler/make_hlds.m
+++ compiler/make_hlds.m
@@ -3800,16 +3800,8 @@
adjust_types_with_special_preds_in_private_builtin(Type) = NormalizedType :-
( type_to_ctor_and_args(Type, TypeCtor, []) ->
- Builtin = mercury_public_builtin_module,
- (
- TypeCtor = qualified(Builtin, Name) - 0,
- ( Name = "int"
- ; Name = "string"
- ; Name = "character"
- ; Name = "float"
- ; Name = "pred"
- )
- ->
+ ( is_builtin_types_special_preds_defined_in_mercury(TypeCtor,
+ Name) ->
construct_type(unqualified(Name) - 0, [], NormalizedType)
;
NormalizedType = Type
diff -u compiler/special_pred.m compiler/special_pred.m
--- compiler/special_pred.m
+++ compiler/special_pred.m
@@ -108,6 +108,10 @@
hlds_type_body).
:- mode can_generate_special_pred_clauses_for_type(in, in, in) is semidet.
+ % Are the special predicates for a builtin type defined in Mercury?
+:- pred is_builtin_types_special_preds_defined_in_mercury(
+ type_ctor::in, string::out) is semidet.
+
% Does the compiler generate the RTTI for the builtin types, or is
% it hand-coded?
:- pred compiler_generated_rtti_for_the_builtins(module_info::in) is semidet.
@@ -234,22 +238,24 @@
(
Body \= abstract_type(_)
;
- % Only the types which have a unification defined in
- % private_builtin.m
+ % Only the types which have its unification and comparison
+ % predicates defined in private_builtin.m
compiler_generated_rtti_for_the_builtins(ModuleInfo),
- Builtin = mercury_public_builtin_module,
- ( TypeCtor = qualified(Builtin, "int") - 0
- ; TypeCtor = qualified(Builtin, "string") - 0
- ; TypeCtor = qualified(Builtin, "character") - 0
- ; TypeCtor = qualified(Builtin, "float") - 0
- ; TypeCtor = qualified(Builtin, "pred") - 0
- )
+ is_builtin_types_special_preds_defined_in_mercury(TypeCtor, _)
),
\+ type_ctor_has_hand_defined_rtti(TypeCtor, Body),
\+ type_body_has_user_defined_equality_pred(ModuleInfo, Body,
abstract_noncanonical_type).
-
+is_builtin_types_special_preds_defined_in_mercury(TypeCtor, TypeName) :-
+ Builtin = mercury_public_builtin_module,
+ ( TypeCtor = qualified(Builtin, "int") - 0
+ ; TypeCtor = qualified(Builtin, "string") - 0
+ ; TypeCtor = qualified(Builtin, "character") - 0
+ ; TypeCtor = qualified(Builtin, "float") - 0
+ ; TypeCtor = qualified(Builtin, "pred") - 0
+ ),
+ TypeCtor = qualified(_Module, TypeName) - _Arity.
%-----------------------------------------------------------------------------%
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list