[m-dev.] for review: cleanup of type_ctor_infos, part 0

Zoltan Somogyi zs at cs.mu.OZ.AU
Fri Feb 25 16:09:53 AEDT 2000


cvs diff: Diffing .
cvs diff: Diffing bindist
cvs diff: Diffing boehm_gc
cvs diff: Diffing boehm_gc/Mac_files
cvs diff: Diffing boehm_gc/cord
cvs diff: Diffing boehm_gc/cord/private
cvs diff: Diffing boehm_gc/include
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
Index: compiler/dead_proc_elim.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/dead_proc_elim.m,v
retrieving revision 1.52
diff -u -b -r1.52 dead_proc_elim.m
--- compiler/dead_proc_elim.m	1999/12/03 12:54:55	1.52
+++ compiler/dead_proc_elim.m	2000/02/21 09:32:01
@@ -114,8 +114,8 @@
 	module_info_get_pragma_exported_procs(ModuleInfo, PragmaExports),
 	dead_proc_elim__initialize_pragma_exports(PragmaExports,
 		Queue1, Queue2, Needed1, Needed2),
-	module_info_base_gen_infos(ModuleInfo, BaseGenInfos),
-	dead_proc_elim__initialize_base_gen_infos(BaseGenInfos,
+	module_info_type_ctor_gen_infos(ModuleInfo, TypeCtorGenInfos),
+	dead_proc_elim__initialize_base_gen_infos(TypeCtorGenInfos,
 		Queue2, Queue3, Needed2, Needed3),
 	module_info_classes(ModuleInfo, Classes),
 	module_info_instances(ModuleInfo, Instances),
@@ -169,15 +169,16 @@
 	dead_proc_elim__initialize_pragma_exports(PragmaProcs,
 		Queue1, Queue, Needed1, Needed).
 
-:- pred dead_proc_elim__initialize_base_gen_infos(list(base_gen_info),
+:- pred dead_proc_elim__initialize_base_gen_infos(list(type_ctor_gen_info),
 	entity_queue, entity_queue, needed_map, needed_map).
 :- mode dead_proc_elim__initialize_base_gen_infos(in, in, out, in, out) is det.
 
 dead_proc_elim__initialize_base_gen_infos([], Queue, Queue, Needed, Needed).
-dead_proc_elim__initialize_base_gen_infos([BaseGenInfo | BaseGenInfos],
+dead_proc_elim__initialize_base_gen_infos([TypeCtorGenInfo | TypeCtorGenInfos],
 		Queue0, Queue, Needed0, Needed) :-
-	BaseGenInfo = base_gen_info(_TypeId, ModuleName, TypeName,
-		Arity, _Status, _Elim, _Procs, _HldsDefn),
+	TypeCtorGenInfo = type_ctor_gen_info(_TypeId, ModuleName, TypeName,
+		Arity, _Status, _HldsDefn, _Unify, _Compare, _Index,
+		_Solver, _Init, _Pretty),
 	(
 		% XXX: We'd like to do this, but there are problems.
 		% status_is_exported(Status, yes)
@@ -204,7 +205,7 @@
 		Queue1 = Queue0,
 		Needed1 = Needed0
 	),
-	dead_proc_elim__initialize_base_gen_infos(BaseGenInfos,
+	dead_proc_elim__initialize_base_gen_infos(TypeCtorGenInfos,
 		Queue1, Queue, Needed1, Needed).
 
 :- pred dead_proc_elim__initialize_class_methods(class_table, instance_table, 
@@ -311,10 +312,10 @@
 
 dead_proc_elim__examine_base_gen_info(ModuleName, TypeName, Arity, ModuleInfo,
 		Queue0, Queue, Needed0, Needed) :-
-	module_info_base_gen_infos(ModuleInfo, BaseGenInfos),
+	module_info_type_ctor_gen_infos(ModuleInfo, TypeCtorGenInfos),
 	(
 		dead_proc_elim__find_base_gen_info(ModuleName, TypeName,
-			Arity, BaseGenInfos, Refs)
+			Arity, TypeCtorGenInfos, Refs)
 	->
 		dead_proc_elim__examine_refs(Refs, Queue0, Queue,
 			Needed0, Needed)
@@ -324,21 +325,37 @@
 	).
 
 :- pred dead_proc_elim__find_base_gen_info(module_name, string, arity,
-	list(base_gen_info), list(pred_proc_id)).
+	list(type_ctor_gen_info), list(pred_proc_id)).
 :- mode dead_proc_elim__find_base_gen_info(in, in, in, in, out) is semidet.
 
 dead_proc_elim__find_base_gen_info(ModuleName, TypeName, TypeArity,
-		[BaseGenInfo | BaseGenInfos], Refs) :-
+		[TypeCtorGenInfo | TypeCtorGenInfos], Refs) :-
 	(
-		BaseGenInfo = base_gen_info(_TypeId, ModuleName, TypeName,
-			TypeArity, _Status, _Elim, Refs0, _HldsDefn)
+		TypeCtorGenInfo = type_ctor_gen_info(_TypeId, ModuleName,
+			TypeName, TypeArity, _Status, _HldsDefn,
+			MaybeUnify, MaybeIndex, MaybeCompare,
+			MaybeSolver, MaybeInit, MaybePretty)
 	->
-		Refs = Refs0
+		Refs0 = [],
+		dead_proc_elim__maybe_add_ref(MaybeUnify,   Refs0, Refs1),
+		dead_proc_elim__maybe_add_ref(MaybeIndex,   Refs1, Refs2),
+		dead_proc_elim__maybe_add_ref(MaybeCompare, Refs2, Refs3),
+		dead_proc_elim__maybe_add_ref(MaybeSolver,  Refs3, Refs4),
+		dead_proc_elim__maybe_add_ref(MaybeInit,    Refs4, Refs5),
+		dead_proc_elim__maybe_add_ref(MaybePretty,  Refs5, Refs6),
+		Refs = Refs6
 	;
 		dead_proc_elim__find_base_gen_info(ModuleName, TypeName,
-			TypeArity, BaseGenInfos, Refs)
+			TypeArity, TypeCtorGenInfos, Refs)
 	).
 
+:- pred dead_proc_elim__maybe_add_ref(maybe(pred_proc_id),
+	list(pred_proc_id), list(pred_proc_id)).
+:- mode dead_proc_elim__maybe_add_ref(in, in, out) is det.
+
+dead_proc_elim__maybe_add_ref(no, Refs, Refs).
+dead_proc_elim__maybe_add_ref(yes(Ref), Refs, [Ref | Refs]).
+
 :- pred dead_proc_elim__examine_refs(list(pred_proc_id),
 	entity_queue, entity_queue, needed_map, needed_map).
 :- mode dead_proc_elim__examine_refs(in, in, out, in, out) is det.
@@ -522,12 +539,12 @@
 	ElimInfo = elimination_info(Needed, ModuleInfo1, PredTable),
 
 	module_info_set_preds(ModuleInfo1, PredTable, ModuleInfo2),
-	module_info_base_gen_infos(ModuleInfo2, BaseGenInfos0),
-	dead_proc_elim__eliminate_base_gen_infos(BaseGenInfos0, Needed,
-		BaseGenInfos),
-	module_info_set_base_gen_infos(ModuleInfo2, BaseGenInfos, ModuleInfo).
+	module_info_type_ctor_gen_infos(ModuleInfo2, TypeCtorGenInfos0),
+	dead_proc_elim__eliminate_base_gen_infos(TypeCtorGenInfos0, Needed,
+		TypeCtorGenInfos),
+	module_info_set_type_ctor_gen_infos(ModuleInfo2, TypeCtorGenInfos,
+		ModuleInfo).
 
-
 		% eliminate any unused procedures for this pred
 
 :- pred dead_proc_elim__eliminate_pred(pred_id, elim_info, elim_info,
@@ -627,38 +644,30 @@
 		{ map__delete(ProcTable0, ProcId, ProcTable) }
 	).
 
-:- pred dead_proc_elim__eliminate_base_gen_infos(list(base_gen_info),
-	needed_map, list(base_gen_info)).
+:- pred dead_proc_elim__eliminate_base_gen_infos(list(type_ctor_gen_info),
+	needed_map, list(type_ctor_gen_info)).
 :- mode dead_proc_elim__eliminate_base_gen_infos(in, in, out) is det.
 
 dead_proc_elim__eliminate_base_gen_infos([], _Needed, []).
-dead_proc_elim__eliminate_base_gen_infos([BaseGenInfo0 | BaseGenInfos0], Needed,
-		BaseGenInfos) :-
-	dead_proc_elim__eliminate_base_gen_infos(BaseGenInfos0, Needed,	
-		BaseGenInfos1),
-	BaseGenInfo0 = base_gen_info(TypeId, ModuleName, TypeName,
-		Arity, Status, Elim0, Procs, HldsDefn),
+dead_proc_elim__eliminate_base_gen_infos([TypeCtorGenInfo0 | TypeCtorGenInfos0],
+		Needed, TypeCtorGenInfos) :-
+	dead_proc_elim__eliminate_base_gen_infos(TypeCtorGenInfos0, Needed,	
+		TypeCtorGenInfos1),
+	TypeCtorGenInfo0 = type_ctor_gen_info(TypeId, ModuleName,
+		TypeName, Arity, Status, HldsDefn,
+		_MaybeUnify, _MaybeIndex, _MaybeCompare,
+		MaybeSolver, MaybeInit, MaybePretty),
 	(
 		Entity = base_gen_info(ModuleName, TypeName, Arity),
 		map__search(Needed, Entity, _)
-	->
-		BaseGenInfos = [BaseGenInfo0 | BaseGenInfos1]
-	;
-		list__length(Procs, ProcsLength),
-
-			% Procs may have been eliminated elsewhere, if so
-			% we sum the eliminated procs together.
-		(
-			Elim0 = yes(NumProcs0)
 		->
-			NumProcs is ProcsLength + NumProcs0
+		TypeCtorGenInfos = [TypeCtorGenInfo0 | TypeCtorGenInfos1]
 		;
-			NumProcs = ProcsLength
-		),
-		NeuteredBaseGenInfo = base_gen_info(TypeId, ModuleName, 
-			TypeName, Arity, Status, yes(NumProcs), [],
-			HldsDefn),
-		BaseGenInfos = [NeuteredBaseGenInfo | BaseGenInfos1]
+		NeuteredTypeCtorGenInfo = type_ctor_gen_info(TypeId,
+			ModuleName, TypeName, Arity, Status, HldsDefn,
+			no, no, no, MaybeSolver, MaybeInit, MaybePretty),
+		TypeCtorGenInfos = [NeuteredTypeCtorGenInfo |
+			TypeCtorGenInfos1]
 	).
 
 %-----------------------------------------------------------------------------%
Index: compiler/hlds_data.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/hlds_data.m,v
retrieving revision 1.44
diff -u -b -r1.44 hlds_data.m
--- compiler/hlds_data.m	2000/01/31 03:59:00	1.44
+++ compiler/hlds_data.m	2000/02/21 09:32:01
@@ -132,6 +132,18 @@
 :- pred make_cons_id(sym_name, list(constructor_arg), type_id, cons_id).
 :- mode make_cons_id(in, in, in, out) is det.
 
+	% Another way of making a cons_id from a functor.
+	% Given the name, argument types, and type_id of a functor,
+	% create a cons_id for that functor.
+	%
+	% Differs from make_cons_id in that (a) it requires the sym_name
+	% to be already module qualified, which means that it does not
+	% need the module qualification of the type, (b) it can compute the
+	% arity from any list of the right length.
+
+:- pred make_cons_id_from_qualified_sym_name(sym_name, list(_), cons_id).
+:- mode make_cons_id_from_qualified_sym_name(in, in, out) is det.
+
 %-----------------------------------------------------------------------------%
 
 :- implementation.
@@ -190,6 +202,9 @@
 			SymName = qualified(TypeModule, ConsName)
 		)
 	),
+	list__length(Args, Arity).
+
+make_cons_id_from_qualified_sym_name(SymName, Args, cons(SymName, Arity)) :-
 	list__length(Args, Arity).
 
 %-----------------------------------------------------------------------------%
Index: compiler/hlds_module.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/hlds_module.m,v
retrieving revision 1.50
diff -u -b -r1.50 hlds_module.m
--- compiler/hlds_module.m	2000/01/13 06:15:41	1.50
+++ compiler/hlds_module.m	2000/02/22 05:55:24
@@ -54,35 +54,22 @@
 	% This structure contains the information we need to generate
 	% a type_ctor_info structure for a type defined in this module.
 
-:- type base_gen_info
-	--->	base_gen_info(
+:- type type_ctor_gen_info
+	--->	type_ctor_gen_info(
 			type_id,
 			module_name,	% module name
 			string,		% type name
 			int,		% type arity
 			import_status,	% of the type
-			maybe(int),	% eliminated procs?
-					% and how many if so
-			list(pred_proc_id),
-					% the ids of the procs
-					% referred to from the
-					% type_ctor_info
-			hlds_type_defn	% defn of type
+			hlds_type_defn,	% defn of type
+			maybe(pred_proc_id),	% unif, if not eliminated
+			maybe(pred_proc_id),	% inde, if not eliminated
+			maybe(pred_proc_id),	% compare, if not eliminated
+			maybe(pred_proc_id),	% solver, if relevant
+			maybe(pred_proc_id),	% init, if relevant
+			maybe(pred_proc_id)	% prettyprinter, if relevant
 		).
 
-	% This structure contains the information we need to generate
-	% a type_ctor_layout structure for a type defined in this module.
-	
-:- type base_gen_layout
-	--->	base_gen_layout(
-			type_id,
-			module_name,	% module name
-			string,		% type name
-			int,		% type arity
-			import_status,	% of the type
-			hlds_type_defn	% defn of type
-		).
-
 	% map from proc to a list of unused argument numbers.
 :- type unused_arg_info == map(pred_proc_id, list(int)).
 
@@ -282,19 +269,12 @@
 	list(pragma_exported_proc), module_info).
 :- mode module_info_set_pragma_exported_procs(in, in, out) is det.
 
-:- pred module_info_base_gen_infos(module_info, list(base_gen_info)).
-:- mode module_info_base_gen_infos(in, out) is det.
+:- pred module_info_type_ctor_gen_infos(module_info, list(type_ctor_gen_info)).
+:- mode module_info_type_ctor_gen_infos(in, out) is det.
 
-:- pred module_info_set_base_gen_infos(module_info, list(base_gen_info),
-	module_info).
-:- mode module_info_set_base_gen_infos(in, in, out) is det.
-
-:- pred module_info_base_gen_layouts(module_info, list(base_gen_layout)).
-:- mode module_info_base_gen_layouts(in, out) is det.
-
-:- pred module_info_set_base_gen_layouts(module_info, list(base_gen_layout),
-	module_info).
-:- mode module_info_set_base_gen_layouts(in, in, out) is det.
+:- pred module_info_set_type_ctor_gen_infos(module_info,
+	list(type_ctor_gen_info), module_info).
+:- mode module_info_set_type_ctor_gen_infos(in, in, out) is det.
 
 :- pred module_info_stratified_preds(module_info, set(pred_id)).
 :- mode module_info_stratified_preds(in, out) is det.
@@ -478,12 +458,10 @@
 	list(pragma_exported_proc)).
 :- mode module_sub_get_pragma_exported_procs(in, out) is det.
 
-:- pred module_sub_get_base_gen_infos(module_sub_info, list(base_gen_info)).
-:- mode module_sub_get_base_gen_infos(in, out) is det.
+:- pred module_sub_get_type_ctor_gen_infos(module_sub_info,
+	list(type_ctor_gen_info)).
+:- mode module_sub_get_type_ctor_gen_infos(in, out) is det.
 
-:- pred module_sub_get_base_gen_layouts(module_sub_info, list(base_gen_layout)).
-:- mode module_sub_get_base_gen_layouts(in, out) is det.
-
 :- pred module_sub_get_stratified_preds(module_sub_info, set(pred_id)).
 :- mode module_sub_get_stratified_preds(in, out) is det.
 
@@ -526,14 +504,10 @@
 	list(pragma_exported_proc), module_sub_info).
 :- mode module_sub_set_pragma_exported_procs(in, in, out) is det.
 
-:- pred module_sub_set_base_gen_infos(module_sub_info, list(base_gen_info),
-	module_sub_info).
-:- mode module_sub_set_base_gen_infos(in, in, out) is det.
+:- pred module_sub_set_type_ctor_gen_infos(module_sub_info,
+	list(type_ctor_gen_info), module_sub_info).
+:- mode module_sub_set_type_ctor_gen_infos(in, in, out) is det.
 
-:- pred module_sub_set_base_gen_layouts(module_sub_info, list(base_gen_layout),
-	module_sub_info).
-:- mode module_sub_set_base_gen_layouts(in, in, out) is det.
-
 :- pred module_sub_set_stratified_preds(module_sub_info, set(pred_id),
 	module_sub_info).
 :- mode module_sub_set_stratified_preds(in, in, out) is det.
@@ -559,21 +533,22 @@
 
 :- type module_info
 	--->	module(
-			module_sub_info,
-			predicate_table,
-			proc_requests,
-			special_pred_map,
-			partial_qualifier_info,
-			type_table,
-			inst_table,
-			mode_table,
-			cons_table,
-			class_table,
-			instance_table,
-			superclass_table,
-			assertion_table,
-			ctor_field_table,
-			int		% cell count, passed into code_info
+			module_sub_info :: module_sub_info,
+			pred_table :: predicate_table,
+			proc_requests :: proc_requests,
+			special_pred_map :: special_pred_map,
+			partial_qualifier_info :: partial_qualifier_info,
+			type_table :: type_table,
+			inst_table :: inst_table,
+			mode_table :: mode_table,
+			cons_table :: cons_table,
+			class_table :: class_table,
+			instance_table :: instance_table,
+			superclass_table :: superclass_table,
+			assertion_table :: assertion_table,
+			ctor_field_table :: ctor_field_table,
+			cell_count :: int
+					% cell count, passed into code_info
 					% and used to generate unique label
 					% numbers for constant terms in the
 					% generated C code
@@ -581,36 +556,35 @@
 
 :- type module_sub_info
 	--->	module_sub(
-			module_name,	% module name
-			globals, 	% global options
-			c_header_info,
-			c_body_info,
-			maybe(dependency_info),
-			int,		% number of errors
-			int,		% lambda predicate counter
-			list(pragma_exported_proc),
+			module_name:: module_name,
+			globals:: globals,
+			c_header_info :: c_header_info,
+			c_body_info :: c_body_info,
+			maybe_dependency_info :: maybe(dependency_info),
+			errors :: int,
+			last_lambda_number :: int,
+			pragma_exported_procs :: list(pragma_exported_proc),
 					% list of the procs for which
 					% there is a pragma export(...)
 					% declaration
-			list(base_gen_info),
-			list(base_gen_layout),
+			type_ctor_gen_infos :: list(type_ctor_gen_info),
 					% info about the types defined here
-			set(pred_id),
-					% preds which must be stratified
-			unused_arg_info,
+			must_be_stratified_preds :: set(pred_id),
+			unused_arg_info :: unused_arg_info,
 					% unused argument info about
 					% predicates in the current
 					% module which has been exported
 					% in .opt files.
-			int,		% number of the structure types defined
+			model_non_pragma_types_so_far :: int,
+					% number of the structure types defined
 					% so far for model_non pragma C codes
-			set(module_specifier),
+			imported_module_specifiers :: set(module_specifier),
 					% All the imported module specifiers
 					% (used during type checking).
-			do_aditi_compilation,
+			do_aditi_compilation :: do_aditi_compilation,
 					% are there any local Aditi predicates
 					% for which Aditi-RL must be produced.
-			type_spec_info
+			type_spec_info :: type_spec_info
 					% data used for user-guided type
 					% specialization.
 		).
@@ -648,7 +622,7 @@
 	map__init(FieldNameTable),
 
 	ModuleSubInfo = module_sub(Name, Globals, [], [], no, 0, 0, [], 
-		[], [], StratPreds, UnusedArgInfo, 0, ImportedModules,
+		[], StratPreds, UnusedArgInfo, 0, ImportedModules,
 		no_aditi_compilation, TypeSpecInfo),
 	ModuleInfo = module(ModuleSubInfo, PredicateTable, Requests,
 		UnifyPredMap, QualifierInfo, Types, Insts, Modes, Ctors,
@@ -657,293 +631,86 @@
 
 %-----------------------------------------------------------------------------%
 
-% :- type module_sub_info
-%	--->	module_sub(
-% A			module_name,	% module name
-% B			globals, 	% global options
-% C			c_header_info,
-% D			c_body_info,
-% E			maybe(dependency_info),
-% F			int,		% number of errors
-% G			int,		% lambda predicate counter
-% H			list(pragma_exported_proc),
-%					% list of the procs for which
-%					% there is a pragma export(...)
-%					% declaration
-% I			list(base_gen_info),
-% J			list(base_gen_layout)
-%					% info about the types defined here
-% K			set(pred_id),
-%					% preds which must be stratified
-% L			unused_arg_info,
-%					% unused argument info about
-%					% predicates in the current
-%					% module which has been exported
-%					% in .opt files.
-% M			int,		% number of the structure types defined
-%					% so far for model_non pragma C codes
-% N			set(module_name),
-%					% All the imported module names
-%					% (used during type checking).
-% O			do_aditi_compilation
-%					% are there any local Aditi predicates
-%					% for which Aditi-RL must be produced.
-% P			type_spec_info
-%		).
-
-%-----------------------------------------------------------------------------%
-
 	% Various predicates which access the module_sub_info data structure.
-
-module_sub_get_name(MI0, A) :-
-	MI0 = module_sub(A, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _).
-
-module_sub_get_globals(MI0, B) :-
-	MI0 = module_sub(_, B, _, _, _, _, _, _, _, _, _, _, _, _, _, _).
-
-module_sub_get_c_header_info(MI0, C) :-
-	MI0 = module_sub(_, _, C, _, _, _, _, _, _, _, _, _, _, _, _, _).
-
-module_sub_get_c_body_info(MI0, D) :-
-	MI0 = module_sub(_, _, _, D, _, _, _, _, _, _, _, _, _, _, _, _).
-
-module_sub_get_maybe_dependency_info(MI0, E) :-
-	MI0 = module_sub(_, _, _, _, E, _, _, _, _, _, _, _, _, _, _, _).
-
-module_sub_get_num_errors(MI0, F) :-
-	MI0 = module_sub(_, _, _, _, _, F, _, _, _, _, _, _, _, _, _, _).
-
-module_sub_get_lambda_count(MI0, G) :-
-	MI0 = module_sub(_, _, _, _, _, _, G, _, _, _, _, _, _, _, _, _).
-
-module_sub_get_pragma_exported_procs(MI0, H) :-
-	MI0 = module_sub(_, _, _, _, _, _, _, H, _, _, _, _, _, _, _, _).
-
-module_sub_get_base_gen_infos(MI0, I) :-
-	MI0 = module_sub(_, _, _, _, _, _, _, _, I, _, _, _, _, _, _, _).
 
-module_sub_get_base_gen_layouts(MI0, J) :-
-	MI0 = module_sub(_, _, _, _, _, _, _, _, _, J, _, _, _, _, _, _).
+module_sub_get_name(MI, MI^module_name).
+module_sub_get_globals(MI, MI^globals).
+module_sub_get_c_header_info(MI, MI^c_header_info).
+module_sub_get_c_body_info(MI, MI^c_body_info).
+module_sub_get_maybe_dependency_info(MI, MI^maybe_dependency_info).
+module_sub_get_num_errors(MI, MI^errors).
+module_sub_get_lambda_count(MI, MI^last_lambda_number).
+module_sub_get_pragma_exported_procs(MI, MI^pragma_exported_procs).
+module_sub_get_type_ctor_gen_infos(MI, MI^type_ctor_gen_infos).
+module_sub_get_stratified_preds(MI, MI^must_be_stratified_preds).
+module_sub_get_unused_arg_info(MI, MI^unused_arg_info).
+module_sub_get_model_non_pragma_count(MI, MI^model_non_pragma_types_so_far).
+module_sub_get_imported_module_specifiers(MI, MI^imported_module_specifiers).
+module_sub_get_do_aditi_compilation(MI, MI^do_aditi_compilation).
+module_sub_get_type_spec_info(MI, MI^type_spec_info).
 
-module_sub_get_stratified_preds(MI0, K) :-
-	MI0 = module_sub(_, _, _, _, _, _, _, _, _, _, K, _, _, _, _, _).
-
-module_sub_get_unused_arg_info(MI0, L) :-
-	MI0 = module_sub(_, _, _, _, _, _, _, _, _, _, _, L, _, _, _, _).
-
-module_sub_get_model_non_pragma_count(MI0, M) :-
-	MI0 = module_sub(_, _, _, _, _, _, _, _, _, _, _, _, M, _, _, _).
-
-module_sub_get_imported_module_specifiers(MI0, N) :-
-	MI0 = module_sub(_, _, _, _, _, _, _, _, _, _, _, _, _, N, _, _).
-
-module_sub_get_do_aditi_compilation(MI0, O) :-
-	MI0 = module_sub(_, _, _, _, _, _, _, _, _, _, _, _, _, _, O, _).
-
-module_sub_get_type_spec_info(MI0, P) :-
-	MI0 = module_sub(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, P).
-
 %-----------------------------------------------------------------------------%
 
 	% Various predicates which modify the module_sub_info data structure.
-
-module_sub_set_globals(MI0, B, MI) :-
-	MI0 = module_sub(A, _, C, D, E, F, G, H, I, J, K, L, M, N, O, P),
-	MI  = module_sub(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P).
-
-module_sub_set_c_header_info(MI0, C, MI) :-
-	MI0 = module_sub(A, B, _, D, E, F, G, H, I, J, K, L, M, N, O, P),
-	MI  = module_sub(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P).
-
-module_sub_set_c_body_info(MI0, D, MI) :-
-	MI0 = module_sub(A, B, C, _, E, F, G, H, I, J, K, L, M, N, O, P),
-	MI  = module_sub(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P).
-
-module_sub_set_maybe_dependency_info(MI0, E, MI) :-
-	MI0 = module_sub(A, B, C, D, _, F, G, H, I, J, K, L, M, N, O, P),
-	MI  = module_sub(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P).
-
-module_sub_set_num_errors(MI0, F, MI) :-
-	MI0 = module_sub(A, B, C, D, E, _, G, H, I, J, K, L, M, N, O, P),
-	MI  = module_sub(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P).
-
-module_sub_set_lambda_count(MI0, G, MI) :-
-	MI0 = module_sub(A, B, C, D, E, F, _, H, I, J, K, L, M, N, O, P),
-	MI  = module_sub(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P).
-
-module_sub_set_pragma_exported_procs(MI0, H, MI) :-
-	MI0 = module_sub(A, B, C, D, E, F, G, _, I, J, K, L, M, N, O, P),
-	MI  = module_sub(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P).
-
-module_sub_set_base_gen_infos(MI0, I, MI) :-
-	MI0 = module_sub(A, B, C, D, E, F, G, H, _, J, K, L, M, N, O, P),
-	MI  = module_sub(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P).
-
-module_sub_set_base_gen_layouts(MI0, J, MI) :-
-	MI0 = module_sub(A, B, C, D, E, F, G, H, I, _, K, L, M, N, O, P),
-	MI  = module_sub(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P).
-
-module_sub_set_stratified_preds(MI0, K, MI) :-
-	MI0 = module_sub(A, B, C, D, E, F, G, H, I, J, _, L, M, N, O, P),
-	MI  = module_sub(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P).
-
-module_sub_set_unused_arg_info(MI0, L, MI) :-
-	MI0 = module_sub(A, B, C, D, E, F, G, H, I, J, K, _, M, N, O, P),
-	MI  = module_sub(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P).
-
-module_sub_set_model_non_pragma_count(MI0, M, MI) :-
-	MI0 = module_sub(A, B, C, D, E, F, G, H, I, J, K, L, _, N, O, P),
-	MI  = module_sub(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P).
-
-module_sub_set_imported_module_specifiers(MI0, N, MI) :-
-	MI0 = module_sub(A, B, C, D, E, F, G, H, I, J, K, L, M, _, O, P),
-	MI  = module_sub(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P).
-
-module_sub_set_do_aditi_compilation(MI0, MI) :-
-	MI0 = module_sub(A, B, C, D, E, F, G, H, I, J, K, L, M, N, _, P),
-	MI  = module_sub(A, B, C, D, E, F, G, H, I, J, K, L, M, N,
-		do_aditi_compilation, P).
-
-module_sub_set_type_spec_info(MI0, P, MI) :-
-	MI0 = module_sub(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, _),
-	MI  = module_sub(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P).
 
-%-----------------------------------------------------------------------------%
-
-% :- type module_info
-%	--->	module(
-% A			module_sub_info,
-% B			predicate_table,
-% C			proc_requests,
-% D			special_pred_map,
-% E			partial_qualifier_info,
-% F			type_table,
-% G			inst_table,
-% H			mode_table,
-% I			cons_table,
-% J			class_table,
-% K			instance_table,
-% L			superclass_table,
-% M			assertion_table
-% N			ctor_field_table,
-% O			int		% cell count, passed into code_info
-%					% and used to generate unique label
-%					% numbers for constant terms in the
-%					% generated C code
-%		).
+module_sub_set_globals(MI, G, MI^globals := G).
+module_sub_set_c_header_info(MI, CH, MI^c_header_info := CH).
+module_sub_set_c_body_info(MI, CB, MI^c_body_info := CB).
+module_sub_set_maybe_dependency_info(MI, MD, MI^maybe_dependency_info := MD).
+module_sub_set_num_errors(MI, E, MI^errors := E).
+module_sub_set_lambda_count(MI, LLC, MI^last_lambda_number := LLC).
+module_sub_set_pragma_exported_procs(MI, PE, MI^pragma_exported_procs := PE).
+module_sub_set_type_ctor_gen_infos(MI, TCG, MI^type_ctor_gen_infos := TCG).
+module_sub_set_stratified_preds(MI, MSP, MI^must_be_stratified_preds := MSP).
+module_sub_set_unused_arg_info(MI, UA, MI^unused_arg_info := UA).
+module_sub_set_model_non_pragma_count(MI, MNP,
+	MI^model_non_pragma_types_so_far := MNP).
+module_sub_set_imported_module_specifiers(MI, IMS,
+	MI^imported_module_specifiers := IMS).
+module_sub_set_do_aditi_compilation(MI,
+	MI^do_aditi_compilation := do_aditi_compilation).
+module_sub_set_type_spec_info(MI, TS, MI^type_spec_info := TS).
 
 %-----------------------------------------------------------------------------%
 
 	% Various predicates which access the module_info data structure.
-
-module_info_get_sub_info(MI0, A) :-
-	MI0 = module(A, _, _, _, _, _, _, _, _, _, _, _, _, _, _).
-
-module_info_get_predicate_table(MI0, B) :-
-	MI0 = module(_, B, _, _, _, _, _, _, _, _, _, _, _, _, _).
-
-module_info_get_proc_requests(MI0, C) :-
-	MI0 = module(_, _, C, _, _, _, _, _, _, _, _, _, _, _, _).
-
-module_info_get_special_pred_map(MI0, D) :-
-	MI0 = module(_, _, _, D, _, _, _, _, _, _, _, _, _, _, _).
-
-module_info_get_partial_qualifier_info(MI0, E) :-
-	MI0 = module(_, _, _, _, E, _, _, _, _, _, _, _, _, _, _).
 
-module_info_types(MI0, F) :-
-	MI0 = module(_, _, _, _, _, F, _, _, _, _, _, _, _, _, _).
+module_info_get_sub_info(MI, MI^module_sub_info).
+module_info_get_predicate_table(MI, MI^pred_table).
+module_info_get_proc_requests(MI, MI^proc_requests).
+module_info_get_special_pred_map(MI, MI^special_pred_map).
+module_info_get_partial_qualifier_info(MI, MI^partial_qualifier_info).
+module_info_types(MI, MI^type_table).
+module_info_insts(MI, MI^inst_table).
+module_info_modes(MI, MI^mode_table).
+module_info_ctors(MI, MI^cons_table).
+module_info_classes(MI, MI^class_table).
+module_info_instances(MI, MI^instance_table).
+module_info_superclasses(MI, MI^superclass_table).
+module_info_assertion_table(MI, MI^assertion_table).
+module_info_ctor_field_table(MI, MI^ctor_field_table).
+module_info_get_cell_count(MI, MI^cell_count).
 
-module_info_insts(MI0, G) :-
-	MI0 = module(_, _, _, _, _, _, G, _, _, _, _, _, _, _, _).
-
-module_info_modes(MI0, H) :-
-	MI0 = module(_, _, _, _, _, _, _, H, _, _, _, _, _, _, _).
-
-module_info_ctors(MI0, I) :-
-	MI0 = module(_, _, _, _, _, _, _, _, I, _, _, _, _, _, _).
-
-module_info_classes(MI0, J) :-
-	MI0 = module(_, _, _, _, _, _, _, _, _, J, _, _, _, _, _).
-
-module_info_instances(MI0, K) :-
-	MI0 = module(_, _, _, _, _, _, _, _, _, _, K, _, _, _, _).
-
-module_info_superclasses(MI0, L) :-
-	MI0 = module(_, _, _, _, _, _, _, _, _, _, _, L, _, _, _).
-
-module_info_assertion_table(MI0, M) :-
-	MI0 = module(_, _, _, _, _, _, _, _, _, _, _, _, M, _, _).
-
-module_info_ctor_field_table(MI0, N) :-
-	MI0 = module(_, _, _, _, _, _, _, _, _, _, _, _, _, N, _).
-
-module_info_get_cell_count(MI0, O) :-
-	MI0 = module(_, _, _, _, _, _, _, _, _, _, _, _, _, _, O).
-
 %-----------------------------------------------------------------------------%
 
 	% Various predicates which modify the module_info data structure.
 
-module_info_set_sub_info(MI0, A, MI) :-
-	MI0 = module(_, B, C, D, E, F, G, H, I, J, K, L, M, N, O),
-	MI  = module(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O).
-
-module_info_set_predicate_table(MI0, B, MI) :-
-	MI0 = module(A, _, C, D, E, F, G, H, I, J, K, L, M, N, O),
-	MI  = module(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O).
-
-module_info_set_proc_requests(MI0, C, MI) :-
-	MI0 = module(A, B, _, D, E, F, G, H, I, J, K, L, M, N, O),
-	MI  = module(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O).
-
-module_info_set_special_pred_map(MI0, D, MI) :-
-	MI0 = module(A, B, C, _, E, F, G, H, I, J, K, L, M, N, O),
-	MI  = module(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O).
-
-module_info_set_partial_qualifier_info(MI0, E, MI) :-
-	MI0 = module(A, B, C, D, _, F, G, H, I, J, K, L, M, N, O),
-	MI  = module(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O).
-
-module_info_set_types(MI0, F, MI) :-
-	MI0 = module(A, B, C, D, E, _, G, H, I, J, K, L, M, N, O),
-	MI  = module(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O).
-
-module_info_set_insts(MI0, G, MI) :-
-	MI0 = module(A, B, C, D, E, F, _, H, I, J, K, L, M, N, O),
-	MI  = module(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O).
-
-module_info_set_modes(MI0, H, MI) :-
-	MI0 = module(A, B, C, D, E, F, G, _, I, J, K, L, M, N, O),
-	MI  = module(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O).
-
-module_info_set_ctors(MI0, I, MI) :-
-	MI0 = module(A, B, C, D, E, F, G, H, _, J, K, L, M, N, O),
-	MI  = module(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O).
-
-module_info_set_classes(MI0, J, MI) :-
-	MI0 = module(A, B, C, D, E, F, G, H, I, _, K, L, M, N, O),
-	MI  = module(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O).
-
-module_info_set_instances(MI0, K, MI) :-
-	MI0 = module(A, B, C, D, E, F, G, H, I, J, _, L, M, N, O),
-	MI  = module(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O).
-
-module_info_set_superclasses(MI0, L, MI) :-
-	MI0 = module(A, B, C, D, E, F, G, H, I, J, K, _, M, N, O),
-	MI  = module(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O).
-
-module_info_set_assertion_table(MI0, M, MI) :-
-	MI0 = module(A, B, C, D, E, F, G, H, I, J, K, L, _, N, O),
-	MI  = module(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O).
-
-module_info_set_ctor_field_table(MI0, N, MI) :-
-	MI0 = module(A, B, C, D, E, F, G, H, I, J, K, L, M, _, O),
-	MI  = module(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O).
-
-module_info_set_cell_count(MI0, O, MI) :-
-	MI0 = module(A, B, C, D, E, F, G, H, I, J, K, L, M, N, _),
-	MI  = module(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O).
+module_info_set_sub_info(MI, SMI, MI^module_sub_info := SMI).
+module_info_set_predicate_table(MI, PT, MI^pred_table := PT).
+module_info_set_proc_requests(MI, PR, MI^proc_requests := PR).
+module_info_set_special_pred_map(MI, SPM, MI^special_pred_map := SPM).
+module_info_set_partial_qualifier_info(MI, PQ,
+	MI^partial_qualifier_info := PQ).
+module_info_set_types(MI, T, MI^type_table := T).
+module_info_set_insts(MI, I, MI^inst_table := I).
+module_info_set_modes(MI, M, MI^mode_table := M).
+module_info_set_ctors(MI, C, MI^cons_table := C).
+module_info_set_classes(MI, C, MI^class_table := C).
+module_info_set_instances(MI, I, MI^instance_table := I).
+module_info_set_superclasses(MI, S, MI^superclass_table := S).
+module_info_set_assertion_table(MI, A, MI^assertion_table := A).
+module_info_set_ctor_field_table(MI, CF, MI^ctor_field_table := CF).
+module_info_set_cell_count(MI, CC, MI^cell_count := CC).
 
 %-----------------------------------------------------------------------------%
 
@@ -981,14 +748,10 @@
 module_info_get_pragma_exported_procs(MI0, H) :-
 	module_info_get_sub_info(MI0, MS0),
 	module_sub_get_pragma_exported_procs(MS0, H).
-
-module_info_base_gen_infos(MI0, I) :-
-	module_info_get_sub_info(MI0, MS0),
-	module_sub_get_base_gen_infos(MS0, I).
 
-module_info_base_gen_layouts(MI0, J) :-
+module_info_type_ctor_gen_infos(MI0, I) :-
 	module_info_get_sub_info(MI0, MS0),
-	module_sub_get_base_gen_layouts(MS0, J).
+	module_sub_get_type_ctor_gen_infos(MS0, I).
 
 module_info_stratified_preds(MI0, K) :-
 	module_info_get_sub_info(MI0, MS0),
@@ -1053,15 +816,10 @@
 	module_info_get_sub_info(MI0, MS0),
 	module_sub_set_pragma_exported_procs(MS0, H, MS),
 	module_info_set_sub_info(MI0, MS, MI).
-
-module_info_set_base_gen_infos(MI0, I, MI) :-
-	module_info_get_sub_info(MI0, MS0),
-	module_sub_set_base_gen_infos(MS0, I, MS),
-	module_info_set_sub_info(MI0, MS, MI).
 
-module_info_set_base_gen_layouts(MI0, J, MI) :-
+module_info_set_type_ctor_gen_infos(MI0, I, MI) :-
 	module_info_get_sub_info(MI0, MS0),
-	module_sub_set_base_gen_layouts(MS0, J, MS),
+	module_sub_set_type_ctor_gen_infos(MS0, I, MS),
 	module_info_set_sub_info(MI0, MS, MI).
 
 module_info_set_stratified_preds(MI0, K, MI) :-
Index: compiler/llds.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/llds.m,v
retrieving revision 1.257
diff -u -b -r1.257 llds.m
--- compiler/llds.m	2000/02/10 04:37:30	1.257
+++ compiler/llds.m	2000/02/24 03:57:31
@@ -17,7 +17,7 @@
 :- interface.
 
 :- import_module hlds_pred, hlds_data, tree, prog_data, (inst).
-:- import_module builtin_ops.
+:- import_module rtti, builtin_ops.
 
 :- import_module bool, assoc_list, list, map, set, std_util.
 
@@ -150,6 +150,9 @@
 						% arguments of the create.
 			list(pred_proc_id)	% The procedures referenced.
 						% Used by dead_proc_elim.
+		)
+	;	rtti_data(
+			rtti_data
 		).
 
 :- type comp_gen_c_module
@@ -843,13 +846,13 @@
 			% the address of the label (uses ENTRY macro).
 
 :- type data_addr
-	--->	data_addr(module_name, data_name).
+	--->	data_addr(module_name, data_name)
 			% module name; which var
+	;	rtti_addr(rtti_type_id, rtti_name).
+			% type id; which var
 
 :- type data_name
 	--->	common(int)
-	;	type_ctor(base_data, string, arity)
-			% base_data, type name, type arity
 	;	base_typeclass_info(class_id, string)
 			% class name & class arity, names and arities of the
 			% types
@@ -865,14 +868,6 @@
 			% the table used to implement memoization, loopcheck
 			% or minimal model semantics for the given procedure.
 
-:- type base_data
-	--->	info
-			% basic information, including special preds
-	;	layout
-			% layout information
-	;	functors.
-			% information on functors
-
 :- type reg_type	
 	--->	r		% general-purpose (integer) regs
 	;	f.		% floating point regs
@@ -1001,6 +996,8 @@
 				% signed or unsigned
 				% (used for registers, stack slots, etc).
 
+:- pred llds__wrap_rtti_data(rtti_data::in, comp_gen_c_data::out) is det.
+
 	% given a non-var rval, figure out its type
 :- pred llds__rval_type(rval::in, llds_type::out) is det.
 
@@ -1030,7 +1027,10 @@
 :- pred llds__type_is_word_size_as_arg(llds_type::in, bool::out) is det.
 
 :- implementation.
+
 :- import_module require.
+
+llds__wrap_rtti_data(RttiData, rtti_data(RttiData)).
 
 llds__lval_type(reg(RegType, _), Type) :-
 	llds__register_type(RegType, Type).
Index: compiler/llds_common.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/llds_common.m,v
retrieving revision 1.28
diff -u -b -r1.28 llds_common.m
--- compiler/llds_common.m	2000/02/10 04:37:38	1.28
+++ compiler/llds_common.m	2000/02/22 03:18:28
@@ -30,7 +30,7 @@
 
 :- implementation.
 
-:- import_module llds_out.
+:- import_module rtti, llds_out.
 :- import_module bool, int, assoc_list, map, std_util, require.
 
 :- type cell_info
@@ -123,7 +123,91 @@
 		comp_gen_c_data(Name, DataName, Export, Args, ArgTypes, Refs),
 		Info0, Info) :-
 	llds_common__process_maybe_rvals(Args0, Args, Info0, Info).
+llds_common__process_data(rtti_data(RttiData0), rtti_data(RttiData),
+		Info0, Info) :-
+	llds_common__process_rtti_data(RttiData0, RttiData, Info0, Info).
+
+:- pred llds_common__process_rtti_data(rtti_data::in, rtti_data::out,
+	common_info::in, common_info::out) is det.
+
+llds_common__process_rtti_data(
+		exist_locns(RttiTypeId, Ordinal, Locns),
+		exist_locns(RttiTypeId, Ordinal, Locns),
+		Info, Info).
+llds_common__process_rtti_data(
+		exist_info(RttiTypeId, Ordinal, Plain, InTci, Tci, Locns),
+		exist_info(RttiTypeId, Ordinal, Plain, InTci, Tci, Locns),
+		Info, Info).
+llds_common__process_rtti_data(
+		field_names(RttiTypeId, Ordinal, Names),
+		field_names(RttiTypeId, Ordinal, Names),
+		Info, Info).
+llds_common__process_rtti_data(
+		enum_functor_desc(RttiTypeId, FunctorName, Ordinal),
+		enum_functor_desc(RttiTypeId, FunctorName, Ordinal),
+		Info, Info).
+llds_common__process_rtti_data(
+		notag_functor_desc(RttiTypeId, FunctorName, ArgType0),
+		notag_functor_desc(RttiTypeId, FunctorName, ArgType),
+		Info0, Info) :-
+	llds_common__process_rval(ArgType0, ArgType, Info0, Info).
+llds_common__process_rtti_data(
+		du_functor_desc(RttiTypeId, FunctorName, Ptag, Stag, Locn,
+			Ordinal, Arity, Args0, Names, Exist),
+		du_functor_desc(RttiTypeId, FunctorName, Ptag, Stag, Locn,
+			Ordinal, Arity, Args, Names, Exist),
+		Info0, Info) :-
+	llds_common__process_rval(Args0, Args, Info0, Info).
+llds_common__process_rtti_data(
+		enum_name_ordered_table(RttiTypeId, Functors),
+		enum_name_ordered_table(RttiTypeId, Functors),
+		Info, Info).
+llds_common__process_rtti_data(
+		enum_value_ordered_table(RttiTypeId, Functors),
+		enum_value_ordered_table(RttiTypeId, Functors),
+		Info, Info).
+llds_common__process_rtti_data(
+		du_name_ordered_table(RttiTypeId, Functors),
+		du_name_ordered_table(RttiTypeId, Functors),
+		Info, Info).
+llds_common__process_rtti_data(
+		du_stag_ordered_table(RttiTypeId, Ptag, Functors),
+		du_stag_ordered_table(RttiTypeId, Ptag, Functors),
+		Info, Info).
+llds_common__process_rtti_data(
+		du_ptag_ordered_table(RttiTypeId, Functors),
+		du_ptag_ordered_table(RttiTypeId, Functors),
+		Info, Info).
+llds_common__process_rtti_data(
+		du_ptag_layout(RttiTypeId, Ptag, NumSharers, Locn, Table),
+		du_ptag_layout(RttiTypeId, Ptag, NumSharers, Locn, Table),
+		Info, Info).
+llds_common__process_rtti_data(
+		type_ctor_info(RttiTypeId, Unify, Index, Compare, Rep, Solver,
+			Init, Version, NumFunctors, Functors, Layout0,
+			HashCons, PrettyPrint),
+		type_ctor_info(RttiTypeId, Unify, Index, Compare, Rep, Solver,
+			Init, Version, NumFunctors, Functors, Layout,
+			HashCons, PrettyPrint),
+		Info0, Info) :-
+	llds_common__process_layout_info(Layout0, Layout, Info0, Info).
 
+:- pred llds_common__process_layout_info(type_ctor_layout_info::in,
+	type_ctor_layout_info::out, common_info::in, common_info::out) is det.
+
+llds_common__process_layout_info(no_layout, no_layout, Info, Info).
+llds_common__process_layout_info(enum_layout(Layout), enum_layout(Layout),
+		Info, Info).
+llds_common__process_layout_info(notag_layout(Layout), notag_layout(Layout),
+		Info, Info).
+llds_common__process_layout_info(du_layout(Layout), du_layout(Layout),
+		Info, Info).
+llds_common__process_layout_info(
+		equiv_layout(PseudoTypeInfo0), equiv_layout(PseudoTypeInfo),
+		Info0, Info) :-
+	llds_common__process_rval(PseudoTypeInfo0, PseudoTypeInfo,
+		Info0, Info).
+
 :- pred llds_common__process_procs(list(c_procedure)::in,
 	list(c_procedure)::out, common_info::in, common_info::out) is det.
 
@@ -329,19 +413,25 @@
 	llds_common__process_rval(Rval0, Rval, Info0, Info1),
 	llds_common__process_rvals(Rvals0, Rvals, Info1, Info).
 
-:- pred llds_common__process_maybe_rvals(list(maybe(rval))::in,
-	list(maybe(rval))::out,	common_info::in, common_info::out) is det.
+:- pred llds_common__process_maybe_rval(maybe(rval)::in,
+	maybe(rval)::out, common_info::in, common_info::out) is det.
 
-llds_common__process_maybe_rvals([], [], Info, Info).
-llds_common__process_maybe_rvals([MaybeRval0 | MaybeRvals0],
-		[MaybeRval | MaybeRvals], Info0, Info) :-
+llds_common__process_maybe_rval(MaybeRval0, MaybeRval, Info0, Info) :-
 	(
 		MaybeRval0 = yes(Rval0),
-		llds_common__process_rval(Rval0, Rval, Info0, Info1),
+		llds_common__process_rval(Rval0, Rval, Info0, Info),
 		MaybeRval = yes(Rval)
 	;
 		MaybeRval0 = no,
 		MaybeRval = no,
-		Info1 = Info0
-	),
+		Info = Info0
+	).
+
+:- pred llds_common__process_maybe_rvals(list(maybe(rval))::in,
+	list(maybe(rval))::out, common_info::in, common_info::out) is det.
+
+llds_common__process_maybe_rvals([], [], Info, Info).
+llds_common__process_maybe_rvals([MaybeRval0 | MaybeRvals0],
+		[MaybeRval | MaybeRvals], Info0, Info) :-
+	llds_common__process_maybe_rval(MaybeRval0, MaybeRval, Info0, Info1),
 	llds_common__process_maybe_rvals(MaybeRvals0, MaybeRvals, Info1, Info).
Index: compiler/llds_out.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/llds_out.m,v
retrieving revision 1.135
diff -u -b -r1.135 llds_out.m
--- compiler/llds_out.m	2000/02/10 04:37:32	1.135
+++ compiler/llds_out.m	2000/02/24 03:57:24
@@ -18,6 +18,7 @@
 :- interface.
 
 :- import_module llds, builtin_ops, prog_data, hlds_data, rl_file.
+:- import_module llds_util, globals.
 :- import_module set_bbbtree, bool, io, std_util.
 
 	% Given a 'c_file' structure, output the LLDS code inside it
@@ -30,6 +31,48 @@
 		io__state, io__state).
 :- mode output_llds(in, in, in, di, uo) is det.
 
+:- pred output_rval_decls(rval, string, string, int, int, decl_set, decl_set,
+	io__state, io__state).
+:- mode output_rval_decls(in, in, in, in, out, in, out, di, uo) is det.
+
+	% output an rval (not converted to any particular type,
+	% but instead output as its "natural" type)
+	%
+:- pred output_rval(rval, io__state, io__state).
+:- mode output_rval(in, di, uo) is det.
+
+% output_code_addr_decls(CodeAddr, ...) outputs the declarations of any
+% extern symbols, etc. that need to be declared before
+% output_code_addr(CodeAddr) is called.
+
+:- pred output_code_addr_decls(code_addr, string, string, int, int,
+	decl_set, decl_set, io__state, io__state).
+:- mode output_code_addr_decls(in, in, in, in, out, in, out, di, uo) is det.
+
+:- pred output_code_addr(code_addr, io__state, io__state).
+:- mode output_code_addr(in, di, uo) is det.
+
+:- pred output_data_addr(data_addr::in, io__state::di, io__state::uo) is det.
+
+	% All the C data structures we generate which are either fully static
+	% or static after initialization should have this prefix.
+:- func mercury_data_prefix = string.
+
+:- pred output_data_addr_decls(data_addr::in, string::in, string::in,
+	int::in, int::out, decl_set::in, decl_set::out,
+	io__state::di, io__state::uo) is det.
+
+	% Given the default linkage of a data item, and a bool sayinng whether
+	% it is being defined, return a C string that gives its storage class.
+
+:- pred c_data_linkage_string(globals::in, linkage::in, bool::in, string::out)
+	is det.
+
+	% Given a boolean that states whether a data item includes code
+	% addresses or not, return a C string that gives its "const-ness".
+
+:- pred c_data_const_string(globals::in, bool::in, string::out) is det.
+
 	% Convert an lval to a string description of that lval.
 
 :- pred llds_out__lval_to_string(lval, string).
@@ -113,11 +156,6 @@
 :- pred output_c_quoted_multi_string(int, string, io__state, io__state).
 :- mode output_c_quoted_multi_string(in, in, di, uo) is det.
 
-	% Create a name for type_ctor_*
-
-:- pred llds_out__make_type_ctor_name(base_data, string, arity, string).
-:- mode llds_out__make_type_ctor_name(in, in, in, out) is det.
-
 	% Create a name for base_typeclass_info
 
 :- pred llds_out__make_base_typeclass_info_name(class_id, string, string).
@@ -147,51 +185,20 @@
 :- pred llds_out__trace_port_to_num(trace_port, int).
 :- mode llds_out__trace_port_to_num(in, out) is det.
 
-%-----------------------------------------------------------------------------%
-
 :- implementation.
 
-:- import_module globals, options.
+:- import_module rtti, rtti_out, options.
 :- import_module exprn_aux, prog_util, prog_out, hlds_pred.
 :- import_module export, mercury_to_mercury, modules.
 :- import_module c_util.
 
-:- import_module int, list, char, string, map, std_util.
-:- import_module set, bintree_set, assoc_list, require.
+:- import_module int, list, char, string, std_util.
+:- import_module map, set, bintree_set, assoc_list, require.
 :- import_module varset, term.
 :- import_module library.	% for the version number.
 
 %-----------------------------------------------------------------------------%
 
-% Every time we emit a declaration for a symbol, we insert it into the
-% set of symbols we've already declared.  That way, we avoid generating
-% the same symbol twice, which would cause an error in the C code.
-
-:- type decl_id --->	create_label(int)
-		;	float_label(string)
-		;	code_addr(code_addr)
-		;	data_addr(data_addr)
-		;	pragma_c_struct(string).
-
-:- type decl_set ==	map(decl_id, unit).
-
-:- pred decl_set_init(decl_set::out) is det.
-
-decl_set_init(DeclSet) :-
-	map__init(DeclSet).
-
-:- pred decl_set_insert(decl_set::in, decl_id::in, decl_set::out) is det.
-
-decl_set_insert(DeclSet0, DeclId, DeclSet) :-
-	map__set(DeclSet0, DeclId, unit, DeclSet).
-
-:- pred decl_set_is_member(decl_id::in, decl_set::in) is semidet.
-
-decl_set_is_member(DeclId, DeclSet) :-
-	map__search(DeclSet, DeclId, _).
-
-%-----------------------------------------------------------------------------%
-
 output_llds(C_File, StackLayoutLabels, MaybeRLFile) -->
 	globals__io_lookup_bool_option(split_c_files, SplitFiles),
 	( { SplitFiles = yes } ->
@@ -397,7 +404,7 @@
 		output_c_label_decl_list(Labels, StackLayoutLabels,
 			DeclSet0, DeclSet1),
 		output_comp_gen_c_var_list(Vars, DeclSet1, DeclSet2),
-		output_c_data_def_list(Datas, DeclSet2, DeclSet3),
+		output_c_data_type_def_list(Datas, DeclSet2, DeclSet3),
 		output_comp_gen_c_data_list(Datas, DeclSet3, DeclSet4),
 		output_comp_gen_c_module_list(Modules, StackLayoutLabels,
 			DeclSet4, _DeclSet),
@@ -573,28 +580,12 @@
 output_c_data_init_list([]) --> [].
 output_c_data_init_list([Data | Datas]) -->
 	(
-		{ Data = comp_gen_c_data(ModuleName, DataName, _, _, _, _) },
-		{ DataName = type_ctor(info, TypeName, Arity) }
+		{ Data = rtti_data(RttiData) }
 	->
-		io__write_string("\t\tMR_INIT_TYPE_CTOR_INFO(\n\t\t"),
-		output_data_addr(ModuleName, DataName),
-		io__write_string(",\n\t\t\t"),
-		{ llds_out__sym_name_mangle(ModuleName, ModuleNameString) },
-		{ string__append(ModuleNameString, "__", UnderscoresModule) },
-		( 
-			{ string__append(UnderscoresModule, _, TypeName) } 
-		->
-			[]
+		rtti_out__init_rtti_data_if_nec(RttiData)
 		;
-			io__write_string(UnderscoresModule)
-		),
-		{ llds_out__name_mangle(TypeName, MangledTypeName) },
-		io__write_string(MangledTypeName),
-		io__write_string("_"),
-		io__write_int(Arity),
-		io__write_string("_0);\n")
-	;
-		{ Data = comp_gen_c_data(ModuleName, DataName, _, ArgRvals, _, _) },
+		{ Data = comp_gen_c_data(ModuleName, DataName, _, ArgRvals,
+			_, _) },
 		{ DataName = base_typeclass_info(_ClassName, _ClassArity) }
 	->
 		io__write_string("#ifndef MR_STATIC_CODE_ADDRESSES\n"),
@@ -683,30 +674,28 @@
 	io__write_int(Number).
 
 	%
-	% output_c_data_def_list outputs all the type definitions of
+	% output_c_data_type_def_list outputs all the type definitions of
 	% the module.  This is needed because some compilers need the
 	% data definition to appear before any use of the type in
 	% forward declarations of static constants.
 	%
-:- pred output_c_data_def_list(list(comp_gen_c_data), decl_set, decl_set, 
+:- pred output_c_data_type_def_list(list(comp_gen_c_data), decl_set, decl_set,
 	io__state, io__state).
-:- mode output_c_data_def_list(in, in, out, di, uo) is det.
+:- mode output_c_data_type_def_list(in, in, out, di, uo) is det.
 
-output_c_data_def_list([], DeclSet, DeclSet) --> [].
-output_c_data_def_list([M | Ms], DeclSet0, DeclSet) -->
-	output_c_data_def(M, DeclSet0, DeclSet1),
-	output_c_data_def_list(Ms, DeclSet1, DeclSet).
+output_c_data_type_def_list([], DeclSet, DeclSet) --> [].
+output_c_data_type_def_list([M | Ms], DeclSet0, DeclSet) -->
+	output_c_data_type_def(M, DeclSet0, DeclSet1),
+	output_c_data_type_def_list(Ms, DeclSet1, DeclSet).
 
-:- pred output_c_data_def(comp_gen_c_data, decl_set, decl_set,
+:- pred output_c_data_type_def(comp_gen_c_data, decl_set, decl_set,
 	io__state, io__state).
-:- mode output_c_data_def(in, in, out, di, uo) is det.
+:- mode output_c_data_type_def(in, in, out, di, uo) is det.
 
-output_c_data_def(comp_gen_c_data(ModuleName, VarName, ExportedFromModule,
+output_c_data_type_def(comp_gen_c_data(ModuleName, VarName, ExportedFromModule,
 		ArgVals, ArgTypes, _Refs), DeclSet0, DeclSet) -->
 	io__write_string("\n"),
-	{ DataAddr = data_addr(data_addr(ModuleName, VarName)) },
-
-	{ linkage(VarName, Linkage) },
+	{ data_name_linkage(VarName, Linkage) },
 	{
 		( Linkage = extern, ExportedFromModule = yes
 		; Linkage = static, ExportedFromModule = no
@@ -729,9 +718,12 @@
 		{ ExportedFromFile = SplitFiles }
 	),
 
-	output_const_term_decl(ArgVals, ArgTypes, DataAddr, ExportedFromFile, 
+	{ DeclId = data_addr(data_addr(ModuleName, VarName)) },
+	output_const_term_decl(ArgVals, ArgTypes, DeclId, ExportedFromFile,
 			yes, yes, no, "", "", 0, _),
-	{ decl_set_insert(DeclSet0, DataAddr, DeclSet) }.
+	{ decl_set_insert(DeclSet0, DeclId, DeclSet) }.
+output_c_data_type_def(rtti_data(RttiData), DeclSet0, DeclSet) -->
+	output_rtti_data_decl(RttiData, DeclSet0, DeclSet).
 
 :- pred output_comp_gen_c_module_list(list(comp_gen_c_module)::in,
 	set_bbbtree(label)::in, decl_set::in, decl_set::out,
@@ -798,7 +790,6 @@
 output_comp_gen_c_data(comp_gen_c_data(ModuleName, VarName, ExportedFromModule,
 		ArgVals, ArgTypes, _Refs), DeclSet0, DeclSet) -->
 	io__write_string("\n"),
-	{ DataAddr = data_addr(data_addr(ModuleName, VarName)) },
 	output_cons_arg_decls(ArgVals, "", "", 0, _, DeclSet0, DeclSet1),
 
 	%
@@ -807,7 +798,7 @@
 	% computed by linkage/2 from the dataname, which we use for any
 	% prior declarations.
 	%
-	{ linkage(VarName, Linkage) },
+	{ data_name_linkage(VarName, Linkage) },
 	{
 		( Linkage = extern, ExportedFromModule = yes
 		; Linkage = static, ExportedFromModule = no
@@ -829,9 +820,12 @@
 		globals__io_lookup_bool_option(split_c_files, SplitFiles),
 		{ ExportedFromFile = SplitFiles }
 	),
-	output_const_term_decl(ArgVals, ArgTypes, DataAddr, ExportedFromFile,
+	{ DeclId = data_addr(data_addr(ModuleName, VarName)) },
+	output_const_term_decl(ArgVals, ArgTypes, DeclId, ExportedFromFile,
 		no, yes, yes, "", "", 0, _),
-	{ decl_set_insert(DeclSet1, DataAddr, DeclSet) }.
+	{ decl_set_insert(DeclSet1, DeclId, DeclSet) }.
+output_comp_gen_c_data(rtti_data(RttiData), DeclSet0, DeclSet) -->
+	output_rtti_data_defn(RttiData, DeclSet0, DeclSet).
 
 llds_out__trace_port_to_string(call, "MR_PORT_CALL").
 llds_out__trace_port_to_string(exit, "MR_PORT_EXIT").
@@ -1999,10 +1993,6 @@
 % set of symbols we've already declared. That way, we avoid generating
 % the same symbol twice, which would cause an error in the C code.
 
-:- pred output_rval_decls(rval, string, string, int, int, decl_set, decl_set,
-	io__state, io__state).
-:- mode output_rval_decls(in, in, in, in, out, in, out, di, uo) is det.
-
 output_rval_decls(lval(Lval), FirstIndent, LaterIndent, N0, N,
 		DeclSet0, DeclSet) -->
 	output_lval_decls(Lval, FirstIndent, LaterIndent, N0, N,
@@ -2270,8 +2260,8 @@
 				% code addresses but we don't have static code
 				% addresses.
 			{ StaticCode = no },
-			{ DeclId = data_addr(data_addr(_, DataName)) },
-			{ data_name_would_include_code_address(DataName, yes) }
+			{ DeclId = data_addr(DataAddr) },
+			{ data_addr_would_include_code_address(DataAddr, yes) }
 		->
 			[]
 		;
@@ -2282,13 +2272,6 @@
 	),
 	io__write_string("struct "),
 
-	% If it's a type_ctor_info struct, use the MR_TypeCtorInfo_struct
-	% type, and don't emit a definition.
-	(
-		{ decl_id_is_type_ctor_info(DeclId) }
-	->
-		io__write_string("MR_TypeCtorInfo_struct")
-	;
 		output_decl_id(DeclId),
 		io__write_string("_struct"),
 		(
@@ -2299,7 +2282,6 @@
 			io__write_string("} ")
 		;
 			[]
-		)
 	),
 	(
 		{ Decl = yes }
@@ -2320,13 +2302,6 @@
 		io__write_string(";\n")
 	).
 
-	% Succeed if the decl_id is for a type constructor info structure.
-
-:- pred decl_id_is_type_ctor_info(decl_id).
-:- mode decl_id_is_type_ctor_info(in) is semidet.
-
-decl_id_is_type_ctor_info(data_addr(data_addr(_, type_ctor(info, _, _)))).
-
 	% Return true if a data structure of the given type will eventually
 	% include code addresses. Note that we can't just test the data
 	% structure itself, since in the absence of code addresses the earlier
@@ -2334,13 +2309,18 @@
 	% that will have to be overridden with the real code address at
 	% initialization time.
 
+:- pred data_addr_would_include_code_address(data_addr, bool).
+:- mode data_addr_would_include_code_address(in, out) is det.
+
+data_addr_would_include_code_address(data_addr(_, DataName), CodeAddr) :-
+	data_name_would_include_code_address(DataName, CodeAddr).
+data_addr_would_include_code_address(rtti_addr(_, RttiName), CodeAddr) :-
+	rtti__name_would_include_code_address(RttiName, CodeAddr).
+
 :- pred data_name_would_include_code_address(data_name, bool).
 :- mode data_name_would_include_code_address(in, out) is det.
 
 data_name_would_include_code_address(common(_), no).
-data_name_would_include_code_address(type_ctor(info, _, _), yes).
-data_name_would_include_code_address(type_ctor(layout, _, _), no).
-data_name_would_include_code_address(type_ctor(functors, _, _), no).
 data_name_would_include_code_address(base_typeclass_info(_, _), yes).
 data_name_would_include_code_address(module_layout, no).
 data_name_would_include_code_address(proc_layout(_), yes).
@@ -2353,8 +2333,8 @@
 output_decl_id(create_label(N)) -->
 	io__write_string("mercury_const_"),
 	io__write_int(N).
-output_decl_id(data_addr(data_addr(ModuleName, VarName))) -->
-	output_data_addr(ModuleName, VarName).
+output_decl_id(data_addr(DataAddr)) -->
+	output_data_addr(DataAddr).
 output_decl_id(code_addr(_CodeAddress)) -->
 	{ error("output_decl_id: code_addr unexpected") }.
 output_decl_id(float_label(_Label)) -->
@@ -2647,14 +2627,6 @@
 	output_rval_decls(Rval, FirstIndent, LaterIndent, N0, N,
 		DeclSet0, DeclSet).
 
-% output_code_addr_decls(CodeAddr, ...) outputs the declarations of any
-% extern symbols, etc. that need to be declared before
-% output_code_addr(CodeAddr) is called.
-
-:- pred output_code_addr_decls(code_addr, string, string, int, int,
-	decl_set, decl_set, io__state, io__state).
-:- mode output_code_addr_decls(in, in, in, in, out, in, out, di, uo) is det.
-
 output_code_addr_decls(CodeAddress, FirstIndent, LaterIndent, N0, N,
 		DeclSet0, DeclSet) -->
 	( { decl_set_is_member(code_addr(CodeAddress), DeclSet0) } ->
@@ -2801,31 +2773,48 @@
 output_label_as_code_addr_decls(c_local(_)) --> [].
 output_label_as_code_addr_decls(local(_, _)) --> [].
 
-:- pred output_data_addr_decls(data_addr, string, string, int, int,
-		decl_set, decl_set, io__state, io__state).
-:- mode output_data_addr_decls(in, in, in, in, out, in, out, di, uo) is det.
-
 output_data_addr_decls(DataAddr, FirstIndent, LaterIndent, N0, N,
 		DeclSet0, DeclSet) -->
 	( { decl_set_is_member(data_addr(DataAddr), DeclSet0) } ->
 		{ N = N0 },
 		{ DeclSet = DeclSet0 }
 	;
-		{ decl_set_insert(DeclSet0, data_addr(DataAddr),
-			DeclSet) },
+		{ decl_set_insert(DeclSet0, data_addr(DataAddr), DeclSet) },
 		output_data_addr_decls_2(DataAddr,
 			FirstIndent, LaterIndent, N0, N)
 	).
 
-:- pred output_data_addr_decls_2(data_addr, string, string, int, int,
-	io__state, io__state).
-:- mode output_data_addr_decls_2(in, in, in, in, out, di, uo) is det.
+:- pred output_data_addr_decls_2(data_addr::in, string::in, string::in,
+	int::in, int::out, io__state::di, io__state::uo) is det.
 
-output_data_addr_decls_2(data_addr(ModuleName, VarName),
-		FirstIndent, LaterIndent, N0, N) -->
+output_data_addr_decls_2(DataAddr, FirstIndent, LaterIndent, N0, N) -->
 	output_indent(FirstIndent, LaterIndent, N0),
 	{ N is N0 + 1 },
+	(
+		{ DataAddr = data_addr(ModuleName, DataVarName) },
+		output_data_addr_scope_type_name(ModuleName, DataVarName, no,
+			LaterIndent)
+	;
+		{ DataAddr = rtti_addr(RttiTypeId, RttiVarName) },
+		output_rtti_addr_scope_type_name(RttiTypeId, RttiVarName, no)
+	),
+	io__write_string(";\n").
 
+c_data_linkage_string(Globals, DefaultLinkage, BeingDefined, LinkageStr) :-
+	globals__lookup_bool_option(Globals, split_c_files, SplitFiles),
+	(
+		( DefaultLinkage = extern
+		; SplitFiles = yes
+		)
+	->
+		(
+			BeingDefined = yes,
+			LinkageStr = ""
+		;
+			BeingDefined = no,
+			LinkageStr = "extern "
+		)
+	;
 	%
 	% Previously we used to always write `extern' here, but
 	% declaring something `extern' and then later defining it as
@@ -2833,71 +2822,49 @@
 	% works, but on some systems such as RS/6000s running AIX
 	% it results in link errors.
 	%
-	{ linkage(VarName, Linkage) },
-	globals__io_lookup_bool_option(split_c_files, SplitFiles),
+		LinkageStr = "static "
+	).
+
+c_data_const_string(Globals, InclCodeAddr, ConstStr) :-
 	(
-		( { Linkage = extern }
-		; { SplitFiles = yes }
-		)
+		InclCodeAddr = yes,
+		globals__have_static_code_addresses(Globals, no)
 	->
-		io__write_string("extern ")
+		ConstStr = ""
 	;
-		io__write_string("static ")
-	),
+		ConstStr = "const "
+	).
 
+:- pred output_data_addr_scope_type_name(module_name::in, data_name::in,
+	bool::in, string::in, io__state::di, io__state::uo) is det.
+
+output_data_addr_scope_type_name(ModuleName, DataVarName, BeingDefined,
+		LaterIndent) -->
+	{ data_name_linkage(DataVarName, Linkage) },
 	globals__io_get_globals(Globals),
+	{ c_data_linkage_string(Globals, Linkage, BeingDefined, LinkageStr) },
+	io__write_string(LinkageStr),
 
-		% Don't make decls of type_ctor_infos etc.
-		% `const' if we don't have static code addresses.
-	(
-		{ data_name_would_include_code_address(VarName, yes) },
-		{ globals__have_static_code_addresses(Globals, no) }
-	->
-		[]
-	;
-		io__write_string("const ")
-	),
-	io__write_string("struct "),
+	{ data_name_would_include_code_address(DataVarName, InclCodeAddr) },
+	{ c_data_const_string(Globals, InclCodeAddr, ConstStr) },
+	io__write_string(ConstStr),
 
-	% If it's a type_ctor_info struct, use the
-	% MR_TypeCtorInfo_struct type.
-	(
-		{ VarName = type_ctor(info, _, _) }
-	->
-		io__write_string("MR_TypeCtorInfo_struct\n")
-	;
-		output_data_addr(ModuleName, VarName), 
-		io__write_string("_struct\n")
-	),
+	io__write_string("struct "),
+	output_data_addr(ModuleName, DataVarName),
+	io__write_string("_struct\n"),
 	io__write_string(LaterIndent),
 	io__write_string("\t"),
-	output_data_addr(ModuleName, VarName), 
-	io__write_string(";\n").
+	output_data_addr(ModuleName, DataVarName).
 
-%
-% Note that we need to know the linkage not just at the definition,
-% but also at every use, because if the use is prior to the definition,
-% then we need to declare the name first, and the linkage used in that
-% declaration must be consistent with the linkage in the definition.
-% For this reason, the field in c_data (which holds the information about
-% the definition) which says whether or not a data name is exported
-% is not useful.  Instead, we need to determine whether or not something
-% is exported from its `data_name'.
-%
+:- pred data_name_linkage(data_name::in, linkage::out) is det.
 
-:- type linkage ---> extern ; static.
+data_name_linkage(common(_),                 static).
+data_name_linkage(base_typeclass_info(_, _), extern).
+data_name_linkage(module_layout,             static).
+data_name_linkage(proc_layout(_),            static).
+data_name_linkage(internal_layout(_),        static).
+data_name_linkage(tabling_pointer(_),        static).
 
-:- pred linkage(data_name::in, linkage::out) is det.
-linkage(common(_),                 static).
-linkage(type_ctor(info, _, _),     extern).
-linkage(type_ctor(layout, _, _),   static).
-linkage(type_ctor(functors, _, _), static).
-linkage(base_typeclass_info(_, _), extern).
-linkage(module_layout,             static).
-linkage(proc_layout(_),            static).
-linkage(internal_layout(_),        static).
-linkage(tabling_pointer(_),        static).
-
 %-----------------------------------------------------------------------------%
 
 :- pred output_indent(string, string, int, io__state, io__state).
@@ -3083,9 +3050,6 @@
 	output_label_as_code_addr(CallerLabel),
 	io__write_string(");\n").
 
-:- pred output_code_addr(code_addr, io__state, io__state).
-:- mode output_code_addr(in, di, uo) is det.
-
 output_code_addr(label(Label)) -->
 	output_label_as_code_addr(Label).
 output_code_addr(imported(ProcLabel)) -->
@@ -3141,30 +3105,70 @@
 		LabelName
 	], Name).
 
+	% Output a list of maybe data addresses, with a `no' meaning NULL.
+
+:- pred output_maybe_data_addrs(list(maybe(data_addr))::in,
+	io__state::di, io__state::uo) is det.
+
+output_maybe_data_addrs([]) --> [].
+output_maybe_data_addrs([MaybeDataAddr | DataAddrs]) -->
+	io__write_string("\t"),
+	(
+		{ MaybeDataAddr = yes(DataAddr) },
+		output_data_addr(DataAddr)
+	;
+		{ MaybeDataAddr = no },
+		io__write_string("NULL")
+	),
+	(
+		{ DataAddrs = [] },
+		io__write_string("\n")
+	;
+		{ DataAddrs = [_|_] },
+		io__write_string(",\n"),
+		output_maybe_data_addrs(DataAddrs)
+	).
+
+	% Output a list of data addresses.
+
+:- pred output_data_addrs(list(data_addr)::in, io__state::di, io__state::uo)
+	is det.
+
+output_data_addrs([]) --> [].
+output_data_addrs([DataAddr | DataAddrs]) -->
+	io__write_string("\t"),
+	output_data_addr(DataAddr),
+	(
+		{ DataAddrs = [] },
+		io__write_string("\n")
+	;
+		{ DataAddrs = [_|_] },
+		io__write_string(",\n"),
+		output_data_addrs(DataAddrs)
+	).
+
 	% Output a data address. 
+
+output_data_addr(data_addr(ModuleName, DataName)) -->
+	output_data_addr(ModuleName, DataName).
+output_data_addr(rtti_addr(RttiTypeId, RttiName)) -->
+	output_rtti_addr(RttiTypeId, RttiName).
 
-:- pred output_data_addr(module_name, data_name, io__state, io__state).
-:- mode output_data_addr(in, in, di, uo) is det.
+mercury_data_prefix = "mercury_data_".
+
+:- pred output_data_addr(module_name::in, data_name::in,
+	io__state::di, io__state::uo) is det.
 
 output_data_addr(ModuleName, VarName) -->
 	(
 		{ VarName = common(N) },
 		{ llds_out__sym_name_mangle(ModuleName, MangledModuleName) },
-		io__write_string("mercury_data_"),
+		io__write_string(mercury_data_prefix),
 		io__write_string(MangledModuleName),
 		io__write_string("__common_"),
 		{ string__int_to_string(N, NStr) },
 		io__write_string(NStr)
 	;
-		{ VarName = type_ctor(BaseData, TypeName0, TypeArity) },
-		{ llds_out__sym_name_mangle(ModuleName, MangledModuleName) },
-		io__write_string("mercury_data_"),
-		io__write_string(MangledModuleName),
-		{ llds_out__make_type_ctor_name(BaseData, TypeName0, TypeArity,
-			Str) },
-		io__write_string("__"),
-		io__write_string(Str)
-	;
 			% We don't want to include the module name as part
 			% of the name if it is a base_typeclass_info, since
 			% we _want_ to cause a link error for overlapping
@@ -3173,22 +3177,26 @@
 		{ VarName = base_typeclass_info(ClassId, TypeNames) },
 		{ llds_out__make_base_typeclass_info_name(ClassId, TypeNames, 
 			Str) },
-		io__write_string("mercury_data___"),
+		io__write_string(mercury_data_prefix),
+		io__write_string("__"),
 		io__write_string(Str)
 	;
 		{ VarName = module_layout },
-		io__write_string("mercury_data__module_layout_"),
+		io__write_string(mercury_data_prefix),
+		io__write_string("_module_layout_"),
 		{ llds_out__sym_name_mangle(ModuleName, MangledModuleName) },
 		io__write_string(MangledModuleName)
 	;
 		% Keep this code in sync with make_stack_layout_name/3.
 		{ VarName = proc_layout(Label) },
-		io__write_string("mercury_data__layout__"),
+		io__write_string(mercury_data_prefix),
+		io__write_string("_layout__"),
 		output_label(Label)
 	;
 		% Keep this code in sync with make_stack_layout_name/3.
 		{ VarName = internal_layout(Label) },
-		io__write_string("mercury_data__layout__"),
+		io__write_string(mercury_data_prefix),
+		io__write_string("_layout__"),
 		output_label(Label)
 	;
 		{ VarName = tabling_pointer(ProcLabel) },
@@ -3558,12 +3566,6 @@
 		io__write_string(")")
 	).
 
-	% output an rval (not converted to any particular type,
-	% but instead output as its "natural" type)
-	%
-:- pred output_rval(rval, io__state, io__state).
-:- mode output_rval(in, di, uo) is det.
-
 output_rval(const(Const)) -->
 	output_rval_const(Const).
 output_rval(unop(UnaryOp, Exprn)) -->
@@ -3755,11 +3757,11 @@
 	io__write_string("FALSE").
 output_rval_const(code_addr_const(CodeAddress)) -->
 	output_code_addr(CodeAddress).
-output_rval_const(data_addr_const(data_addr(ModuleName, VarName))) -->
+output_rval_const(data_addr_const(DataAddr)) -->
 	% data addresses are all assumed to be of type `Word *';
 	% we need to cast them here to avoid type errors
 	io__write_string("(Word *) &"),
-	output_data_addr(ModuleName, VarName).
+	output_data_addr(DataAddr).
 output_rval_const(label_entry(Label)) -->
 	io__write_string("ENTRY("),
 	output_label(Label),
@@ -3829,9 +3831,9 @@
 	io__write_string("FALSE").
 output_rval_static_const(code_addr_const(CodeAddress)) -->
 	output_code_addr(CodeAddress).
-output_rval_static_const(data_addr_const(data_addr(ModuleName, VarName))) -->
+output_rval_static_const(data_addr_const(DataAddr)) -->
 	io__write_string("(Word *) &"),
-	output_data_addr(ModuleName, VarName).
+	output_data_addr(DataAddr).
 output_rval_static_const(label_entry(Label)) -->
 	io__write_string("ENTRY("),
 	output_label(Label),
@@ -4131,25 +4133,6 @@
 
 %-----------------------------------------------------------------------------%
 
-llds_out__make_type_ctor_name(BaseData, TypeName0, TypeArity, Str) :-
-	(
-		BaseData = info,
-		BaseString = "info"
-	;
-		BaseData = layout,
-		BaseString = "layout"
-	;
-		BaseData = functors,
-		BaseString = "functors"
-	),
-	llds_out__name_mangle(TypeName0, TypeName),
-	string__int_to_string(TypeArity, A_str),
-        string__append_list(["type_ctor_", BaseString, "_", TypeName, "_", 
-		A_str], Str).
-
-
-%-----------------------------------------------------------------------------%
-
 llds_out__make_base_typeclass_info_name(class_id(ClassSym, ClassArity),
 		TypeNames, Str) :-
 	llds_out__sym_name_mangle(ClassSym, MangledClassString),
Index: compiler/make_tags.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/make_tags.m,v
retrieving revision 1.29
diff -u -b -r1.29 make_tags.m
--- compiler/make_tags.m	1999/04/22 01:04:10	1.29
+++ compiler/make_tags.m	2000/02/21 09:32:01
@@ -80,7 +80,8 @@
 			% (unless it is type_info/1)
 			type_is_no_tag_type(Ctors, SingleFunc, SingleArg)
 		->
-			create_cons_id(SingleFunc, [SingleArg], SingleConsId),
+			make_cons_id_from_qualified_sym_name(SingleFunc,
+				[SingleArg], SingleConsId),
 			map__set(CtorTags0, SingleConsId, no_tag, CtorTags)
 		;
 			NumTagBits = 0
@@ -110,7 +111,7 @@
 assign_enum_constants([], _, CtorTags, CtorTags).
 assign_enum_constants([Ctor | Rest], Val, CtorTags0, CtorTags) :-
 	Ctor = ctor(_ExistQVars, _Constraints, Name, Args),
-	create_cons_id(Name, Args, ConsId),
+	make_cons_id_from_qualified_sym_name(Name, Args, ConsId),
 	Tag = int_constant(Val),
 	map__set(CtorTags0, ConsId, Tag, CtorTags1),
 	Val1 is Val + 1,
@@ -147,7 +148,7 @@
 assign_unshared_tags([], _, _, CtorTags, CtorTags).
 assign_unshared_tags([Ctor | Rest], Val, MaxTag, CtorTags0, CtorTags) :-
 	Ctor = ctor(_ExistQVars, _Constraints, Name, Args),
-	create_cons_id(Name, Args, ConsId),
+	make_cons_id_from_qualified_sym_name(Name, Args, ConsId),
 		% if we're about to run out of unshared tags, start assigning
 		% shared remote tags instead
 	( Val = MaxTag, Rest \= [] ->
@@ -168,7 +169,7 @@
 assign_shared_remote_tags([Ctor | Rest], PrimaryVal, SecondaryVal,
 		CtorTags0, CtorTags) :-
 	Ctor = ctor(_ExistQVars, _Constraints, Name, Args),
-	create_cons_id(Name, Args, ConsId),
+	make_cons_id_from_qualified_sym_name(Name, Args, ConsId),
 	Tag = shared_remote_tag(PrimaryVal, SecondaryVal),
 	map__set(CtorTags0, ConsId, Tag, CtorTags1),
 	SecondaryVal1 is SecondaryVal + 1,
@@ -183,7 +184,7 @@
 assign_shared_local_tags([Ctor | Rest], PrimaryVal, SecondaryVal,
 			CtorTags0, CtorTags) :-
 	Ctor = ctor(_ExistQVars, _Constraints, Name, Args),
-	create_cons_id(Name, Args, ConsId),
+	make_cons_id_from_qualified_sym_name(Name, Args, ConsId),
 	Tag = shared_local_tag(PrimaryVal, SecondaryVal),
 	map__set(CtorTags0, ConsId, Tag, CtorTags1),
 	SecondaryVal1 is SecondaryVal + 1,
@@ -226,14 +227,6 @@
 		Functors = [Ctor | Functors0]
 	),
 	split_constructors(Ctors, Constants0, Functors0).
-
-%-----------------------------------------------------------------------------%
-
-:- pred create_cons_id(sym_name, list(_), cons_id).
-:- mode create_cons_id(in, in, out) is det.
-
-create_cons_id(SymName, Args, cons(SymName, Arity)) :-
-	list__length(Args, Arity).
 
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
Index: compiler/mercury_compile.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mercury_compile.m,v
retrieving revision 1.148
diff -u -b -r1.148 mercury_compile.m
--- compiler/mercury_compile.m	2000/02/10 04:37:38	1.148
+++ compiler/mercury_compile.m	2000/02/22 02:45:53
@@ -40,7 +40,8 @@
 :- import_module deforest, dnf, magic, dead_proc_elim.
 :- import_module unused_args, lco, saved_vars, liveness.
 :- import_module follow_code, live_vars, arg_info, store_alloc, goal_path.
-:- import_module code_gen, optimize, export, base_type_info, base_type_layout.
+:- import_module code_gen, optimize, export.
+:- import_module base_type_info, base_typeclass_info.
 :- import_module rl_gen, rl_opt, rl_out.
 :- import_module llds_common, transform_llds, llds_out.
 :- import_module continuation_info, stack_layout.
@@ -993,14 +994,10 @@
 	mercury_compile__maybe_termination(HLDS27, Verbose, Stats, HLDS28),
 	mercury_compile__maybe_dump_hlds(HLDS28, "28", "termination"), !,
 
-	mercury_compile__maybe_type_ctor_infos(HLDS28, Verbose, Stats, HLDS29),
+	mercury_compile__maybe_type_ctor_infos(HLDS28, Verbose, Stats, HLDS30),
 	!,
-	mercury_compile__maybe_dump_hlds(HLDS29, "29", "type_ctor_infos"), !,
+	mercury_compile__maybe_dump_hlds(HLDS30, "30", "type_ctor_infos"), !,
 
-	mercury_compile__maybe_type_ctor_layouts(HLDS29, Verbose, Stats,HLDS30),
-	!,
-	mercury_compile__maybe_dump_hlds(HLDS30, "30", "type_ctor_layouts"), !,
-
 	mercury_compile__maybe_bytecodes(HLDS30, ModuleName, Verbose, Stats),
 	!,
 
@@ -1620,29 +1617,6 @@
 		{ HLDS0 = HLDS }
 	).
 
-	% We only add type_ctor_layouts if shared-one-or-two-cell
-	% type_infos are being used (the layouts refer to the
-	% type_ctor_infos, so will fail to link without them).
-
-:- pred mercury_compile__maybe_type_ctor_layouts(module_info, bool, bool,
-	module_info, io__state, io__state).
-:- mode mercury_compile__maybe_type_ctor_layouts(in, in, in, out, di, uo) is det.
-
-mercury_compile__maybe_type_ctor_layouts(HLDS0, Verbose, Stats, HLDS) -->
-	globals__io_lookup_bool_option(type_layout, TypeLayoutOption),
-	( 
-		{ TypeLayoutOption = yes } 
-	->
-		maybe_write_string(Verbose,
-			"% Generating type_ctor_layout structures..."),
-		maybe_flush_output(Verbose),
-		{ base_type_layout__generate_hlds(HLDS0, HLDS) },
-		maybe_write_string(Verbose, " done.\n"),
-		maybe_report_stats(Stats)
-	;
-		{ HLDS = HLDS0 }
-	).
-
 :- pred mercury_compile__maybe_bytecodes(module_info, module_name, bool, bool,
 	io__state, io__state).
 :- mode mercury_compile__maybe_bytecodes(in, in, in, in, di, uo) is det.
@@ -2061,25 +2035,24 @@
 	globals__io_lookup_bool_option(verbose, Verbose),
 	globals__io_lookup_bool_option(statistics, Stats),
 	globals__io_lookup_bool_option(common_data, CommonData),
-	{ base_type_info__generate_llds(HLDS0, TypeCtorInfos) },
-	{ base_type_layout__generate_llds(HLDS0, HLDS1, TypeCtorLayouts) },
+	{ base_type_info__generate_llds(HLDS0, HLDS1, TypeCtorTables) },
+	{ base_typeclass_info__generate_llds(HLDS1, TypeClassInfos) },
 	{ stack_layout__generate_llds(HLDS1, HLDS, GlobalData,
 		PossiblyDynamicLayouts, StaticLayouts, LayoutLabels) },
 	{ get_c_interface_info(HLDS, C_InterfaceInfo) },
 	{ global_data_get_all_proc_vars(GlobalData, GlobalVars) },
 	{ global_data_get_all_non_common_static_data(GlobalData,
 		NonCommonStaticData) },
-	{ list__append(StaticLayouts, TypeCtorLayouts, StaticData0) },
+	{ list__append(StaticLayouts, TypeCtorTables, CommonableData0) },
 	(  { CommonData = yes } ->
-		{ llds_common(Procs0, StaticData0, ModuleName, Procs1,
-			StaticData1) }
+		{ llds_common(Procs0, CommonableData0, ModuleName, Procs1,
+			CommonableData) }
 	;
-		{ StaticData1 = StaticData0 },
+		{ CommonableData = CommonableData0 },
 		{ Procs1 = Procs0 }
 	),
-	{ list__append(StaticData1, NonCommonStaticData, StaticData) },
-	{ list__condense([TypeCtorInfos, PossiblyDynamicLayouts, StaticData],
-		AllData) },
+	{ list__condense([CommonableData, NonCommonStaticData,
+		TypeClassInfos, PossiblyDynamicLayouts], AllData) },
 	mercury_compile__construct_c_file(C_InterfaceInfo, Procs1, GlobalVars,
 		AllData, CFile, NumChunks),
 	mercury_compile__output_llds(ModuleName, CFile, LayoutLabels,
Index: compiler/ml_base_type_info.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ml_base_type_info.m,v
retrieving revision 1.4
diff -u -b -r1.4 ml_base_type_info.m
--- compiler/ml_base_type_info.m	1999/12/30 18:04:54	1.4
+++ compiler/ml_base_type_info.m	2000/02/21 09:32:01
@@ -1,5 +1,5 @@
 %---------------------------------------------------------------------------%
-% Copyright (C) 1999 The University of Melbourne.
+% Copyright (C) 1999-2000 The University of Melbourne.
 % This file may only be copied under the terms of the GNU General
 % Public License - see the file COPYING in the Mercury distribution.
 %---------------------------------------------------------------------------%
@@ -56,9 +56,9 @@
 type_ctor_info_rtti_version = 3.
 
 ml_base_type_info__generate_mlds(ModuleInfo, Defns) :-
-	module_info_base_gen_infos(ModuleInfo, BaseGenInfos),
-	ml_base_type_info__construct_type_ctor_infos(BaseGenInfos, ModuleInfo,
-		Defns).
+	module_info_type_ctor_gen_infos(ModuleInfo, TypeCtorGenInfos),
+	ml_base_type_info__construct_type_ctor_infos(TypeCtorGenInfos,
+		ModuleInfo, Defns).
 	/***
 	% XXX type classes are not yet implemented in the MLDS back-end
 	ml_base_typeclass_info__generate_mlds(ModuleInfo, Defns2),
@@ -66,77 +66,82 @@
 	list__append(Defns1, Defns2, Defns).
 	***/
 
-:- pred ml_base_type_info__construct_type_ctor_infos(list(base_gen_info),
+:- pred ml_base_type_info__construct_type_ctor_infos(list(type_ctor_gen_info),
 	module_info, mlds__defns).
 :- mode ml_base_type_info__construct_type_ctor_infos(in, in, out) is det.
 
-ml_base_type_info__construct_type_ctor_infos([], _, []).
-ml_base_type_info__construct_type_ctor_infos([BaseGenInfo | BaseGenInfos],
-		ModuleInfo, [Defn | Defns]) :-
-	BaseGenInfo = base_gen_info(_TypeId, ModuleName, TypeName, TypeArity,
-		Status, Elim, Procs, HLDS_TypeDefn),
-
-	status_is_exported(Status, Exported),
-	Flags = ml_gen_base_type_info_decl_flags(Exported),
-
-	ml_base_type_info__construct_pred_addrs(Procs, Elim, ModuleInfo, 
-		PredAddrArgs),
-	ArityArg = const(int_const(TypeArity)),
-
-	module_info_globals(ModuleInfo, Globals),
-	globals__lookup_bool_option(Globals, type_layout, TypeLayoutOption),
-	(
-		TypeLayoutOption = yes
-	->
-		ml_base_type_info__construct_type_ctor_representation(HLDS_TypeDefn,
-			TypeCtorArg),
-		/*****
-		% XXX generation of the base_type_layout and base_type_functors
-		% is not yet implemented for the MLDS back-end
-		ml_base_type_info__construct_layout(ModuleInfo, TypeName,
-			TypeArity, LayoutArg),
-		ml_base_type_info__construct_functors(ModuleInfo, TypeName,
-			TypeArity, FunctorsArg),
-		******/
-		LayoutArg = const(int_const(0)),
-		FunctorsArg = const(int_const(0)),
-		prog_out__sym_name_to_string(ModuleName, ModuleNameString),
-		ModuleArg = const(string_const(ModuleNameString)),
-		NameArg = const(string_const(TypeName)),
-		VersionArg = const(int_const(type_ctor_info_rtti_version)),
-		list__append(PredAddrArgs, [TypeCtorArg, FunctorsArg, LayoutArg,
-			ModuleArg, NameArg, VersionArg], FinalArgs)
-	;
-		FinalArgs = PredAddrArgs
-	),
-
-	DataName = type_ctor(info, TypeName, TypeArity),
-	hlds_data__get_type_defn_context(HLDS_TypeDefn, Context),
-	MLDS_Context = mlds__make_context(Context),
-	Initializer = [ArityArg | FinalArgs],
-	MLDS_Type = mlds__base_type_info_type,
-	DefnBody = mlds__data(MLDS_Type, yes(Initializer)),
-	Defn = mlds__defn(data(DataName), MLDS_Context, Flags, DefnBody),
+ml_base_type_info__construct_type_ctor_infos(_, _, []).
 
-	ml_base_type_info__construct_type_ctor_infos(BaseGenInfos, ModuleInfo,
-		Defns).
-
-	% Return the declaration flags appropriate for a base_type_info.
-	%
-:- func ml_gen_base_type_info_decl_flags(bool) = mlds__decl_flags.
-ml_gen_base_type_info_decl_flags(Exported) = MLDS_DeclFlags :-
-	( Exported = yes ->
-		Access = public
-	;
-		Access = private
-	),
-	PerInstance = per_instance,
-	Virtuality = non_virtual,
-	Finality = overridable,
-	Constness = const,
-	Abstractness = concrete,
-	MLDS_DeclFlags = init_decl_flags(Access, PerInstance,
-		Virtuality, Finality, Constness, Abstractness).
+% ml_base_type_info__construct_type_ctor_infos([], _, []).
+% ml_base_type_info__construct_type_ctor_infos(
+% 		[TypeCtorGenInfo | TypeCtorGenInfos], ModuleInfo,
+% 		[Defn | Defns]) :-
+% 	TypeCtorGenInfo = type_ctor_gen_info(_TypeId,
+% 		ModuleName, TypeName, TypeArity, Status, HLDS_TypeDefn,
+% 		MaybeUnify, MaybeIndex, MaybeCompare,
+% 		MaybeSolver, MaybeInit, MaybePretty),
+% 
+% 	status_is_exported(Status, Exported),
+% 	Flags = ml_gen_base_type_info_decl_flags(Exported),
+% 
+% 	ml_base_type_info__construct_pred_addrs(Procs, Elim, ModuleInfo, 
+% 		PredAddrArgs),
+% 	ArityArg = const(int_const(TypeArity)),
+% 
+% 	module_info_globals(ModuleInfo, Globals),
+% 	globals__lookup_bool_option(Globals, type_layout, TypeLayoutOption),
+% 	(
+% 		TypeLayoutOption = yes
+% 	->
+% 		ml_base_type_info__construct_type_ctor_representation(HLDS_TypeDefn,
+% 			TypeCtorArg),
+% 		/*****
+% 		% XXX generation of the base_type_layout and base_type_functors
+% 		% is not yet implemented for the MLDS back-end
+% 		ml_base_type_info__construct_layout(ModuleInfo, TypeName,
+% 			TypeArity, LayoutArg),
+% 		ml_base_type_info__construct_functors(ModuleInfo, TypeName,
+% 			TypeArity, FunctorsArg),
+% 		******/
+% 		LayoutArg = const(int_const(0)),
+% 		FunctorsArg = const(int_const(0)),
+% 		prog_out__sym_name_to_string(ModuleName, ModuleNameString),
+% 		ModuleArg = const(string_const(ModuleNameString)),
+% 		NameArg = const(string_const(TypeName)),
+% 		VersionArg = const(int_const(type_ctor_info_rtti_version)),
+% 		list__append(PredAddrArgs, [TypeCtorArg, FunctorsArg, LayoutArg,
+% 			ModuleArg, NameArg, VersionArg], FinalArgs)
+% 	;
+% 		FinalArgs = PredAddrArgs
+% 	),
+% 
+% 	DataName = type_ctor(info, TypeName, TypeArity),
+% 	hlds_data__get_type_defn_context(HLDS_TypeDefn, Context),
+% 	MLDS_Context = mlds__make_context(Context),
+% 	Initializer = [ArityArg | FinalArgs],
+% 	MLDS_Type = mlds__base_type_info_type,
+% 	DefnBody = mlds__data(MLDS_Type, yes(Initializer)),
+% 	Defn = mlds__defn(data(DataName), MLDS_Context, Flags, DefnBody),
+% 
+% 	ml_base_type_info__construct_type_ctor_infos(TypeCtorGenInfos, ModuleInfo,
+% 		Defns).
+% 
+% 	% Return the declaration flags appropriate for a base_type_info.
+% 	%
+% :- func ml_gen_base_type_info_decl_flags(bool) = mlds__decl_flags.
+% ml_gen_base_type_info_decl_flags(Exported) = MLDS_DeclFlags :-
+% 	( Exported = yes ->
+% 		Access = public
+% 	;
+% 		Access = private
+% 	),
+% 	PerInstance = per_instance,
+% 	Virtuality = non_virtual,
+% 	Finality = overridable,
+% 	Constness = const,
+% 	Abstractness = concrete,
+% 	MLDS_DeclFlags = init_decl_flags(Access, PerInstance,
+% 		Virtuality, Finality, Constness, Abstractness).
 
 :- pred	ml_base_type_info__construct_layout(module_info, string, int,
 		mlds__rval).
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list