[m-rev.] for review: disable equiv_type special pred and type_ctor_info generation for il backend
Peter Ross
pro at missioncriticalit.com
Sun Nov 10 01:36:32 AEDT 2002
Hi,
===================================================================
Estimated hours taken: 0.5
Branches: main
The java and il backends don't have a typedef mechanism so all types
must have all the equivalence types in them expanded fully, thus the
type_ctor_info and special preds for equivalence types are not needed.
compiler/make_hlds.m:
Don't output the special predicates for types defined as
equivalence types on the il and java backends.
compiler/type_ctor_info.m:
Don't output the type_ctor_infos for types defined as equivalence
types on the il and java backends.
Index: compiler/make_hlds.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/make_hlds.m,v
retrieving revision 1.425
diff -u -r1.425 make_hlds.m
--- compiler/make_hlds.m 24 Oct 2002 04:36:45 -0000 1.425
+++ compiler/make_hlds.m 9 Nov 2002 14:30:50 -0000
@@ -2102,9 +2102,17 @@
;
{ Module3 = Module0 }
),
- { construct_type(TypeCtor, Args, Type) },
- { add_special_preds(Module3, TVarSet, Type, TypeCtor,
- Body, Context, Status, Module) }.
+ globals__io_get_target(Target),
+
+ % Equivalence types are fully expanded on the IL and Java
+ % backends, so the special predicates aren't required.
+ { ( Target = il ; Target = java), Body = eqv_type(_) ->
+ Module = Module3
+ ;
+ construct_type(TypeCtor, Args, Type),
+ add_special_preds(Module3, TVarSet, Type, TypeCtor,
+ Body, Context, Status, Module)
+ }.
% check_foreign_type ensures that if we are generating code for
% a specific backend that the foreign type has a representation
Index: compiler/type_ctor_info.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/type_ctor_info.m,v
retrieving revision 1.30
diff -u -r1.30 type_ctor_info.m
--- compiler/type_ctor_info.m 1 Aug 2002 11:52:22 -0000 1.30
+++ compiler/type_ctor_info.m 9 Nov 2002 14:30:53 -0000
@@ -73,8 +73,10 @@
type_ctor_info__generate_hlds(ModuleInfo0, ModuleInfo) :-
module_info_name(ModuleInfo0, ModuleName),
module_info_types(ModuleInfo0, TypeTable),
+ module_info_globals(ModuleInfo0, Globals),
+ globals__get_target(Globals, Target),
map__keys(TypeTable, TypeCtors),
- type_ctor_info__gen_type_ctor_gen_infos(TypeCtors, TypeTable,
+ type_ctor_info__gen_type_ctor_gen_infos(TypeCtors, Target, TypeTable,
ModuleName, ModuleInfo0, TypeCtorGenInfos),
module_info_set_type_ctor_gen_infos(ModuleInfo0, TypeCtorGenInfos,
ModuleInfo).
@@ -84,13 +86,13 @@
% for each.
:- pred type_ctor_info__gen_type_ctor_gen_infos(list(type_ctor)::in,
- type_table::in, module_name::in, module_info::in,
- list(type_ctor_gen_info)::out) is det.
+ compilation_target::in, type_table::in, module_name::in,
+ module_info::in, list(type_ctor_gen_info)::out) is det.
-type_ctor_info__gen_type_ctor_gen_infos([], _, _, _, []).
-type_ctor_info__gen_type_ctor_gen_infos([TypeCtor | TypeCtors], TypeTable,
- ModuleName, ModuleInfo, TypeCtorGenInfos) :-
- type_ctor_info__gen_type_ctor_gen_infos(TypeCtors, TypeTable,
+type_ctor_info__gen_type_ctor_gen_infos([], _, _, _, _, []).
+type_ctor_info__gen_type_ctor_gen_infos([TypeCtor | TypeCtors], Target,
+ TypeTable, ModuleName, ModuleInfo, TypeCtorGenInfos) :-
+ type_ctor_info__gen_type_ctor_gen_infos(TypeCtors, Target, TypeTable,
ModuleName, ModuleInfo, TypeCtorGenInfos1),
TypeCtor = SymName - TypeArity,
(
@@ -100,7 +102,9 @@
map__lookup(TypeTable, TypeCtor, TypeDefn),
hlds_data__get_type_defn_body(TypeDefn, TypeBody),
TypeBody \= abstract_type,
- \+ type_ctor_has_hand_defined_rtti(TypeCtor)
+ \+ type_ctor_has_hand_defined_rtti(TypeCtor),
+ ( (Target = il ; Target = java) =>
+ TypeBody \= eqv_type(_) )
->
type_ctor_info__gen_type_ctor_gen_info(TypeCtor,
TypeName, TypeArity, TypeDefn,
--------------------------------------------------------------------------
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