When deciding on the representation of a type, record whether the

Estimated hours taken: 2
Branches: main

When deciding on the representation of a type, record whether the
representation uses reserved addresses. We already do this for reserved tags,
so not doing it for reserved addresses is an asymmetry.

compiler/hlds_data.m:
	Add the required slot to the hlds_du_type function symbol.

	Rename is_enum as is_mercury_enum, since now we have is_foreign_enum
	as well, and is_enum is misleading.

	Replace some bools with purpose-specific types.

compiler/prog_data.m:
	Define those purpose-specific types. They are defined here since we
	also use them in the parse tree.

compiler/add_type.m:
compiler/make_tags.m:
	Record in the slot whether a type representation uses reserved
	addresses.

compiler/switch_gen.m:
	Use the new slot, instead of going through the tags of the cons_ids
	in all the switch arms.

	Convert most of an if-then-else chain to a switch.

compiler/type_util.m:
	Factor out some common code, and replace some map.searches (that could
	fail only if previous code screwed up) with map.lookup.

compiler/*.m:
	Conform to the changes above.
This commit is contained in:
Zoltan Somogyi
2007-09-25 04:56:44 +00:00
parent 5311e514a7
commit 7712f35c12
27 changed files with 252 additions and 216 deletions

View File

@@ -367,7 +367,7 @@ type_documentation(C, type_ctor(TypeName, TypeArity), TypeDefn, !Xmls) :-
:- func type_xml_tag(hlds_type_body) = string.
type_xml_tag(hlds_du_type(_, _, _, _, _, _)) = "du_type".
type_xml_tag(hlds_du_type(_, _, _, _, _, _, _)) = "du_type".
type_xml_tag(hlds_eqv_type(_)) = "eqv_type".
type_xml_tag(hlds_foreign_type(_)) = "foreign_type".
type_xml_tag(hlds_solver_type(_, _)) = "solver_type".
@@ -381,7 +381,7 @@ type_param(TVarset, TVar) = Xml :-
:- func type_body(comments, tvarset, hlds_type_body) = list(xml).
type_body(C, TVarset, hlds_du_type(Ctors, _, _, _, _, _)) =
type_body(C, TVarset, hlds_du_type(Ctors, _, _, _, _, _, _)) =
[xml_list("constructors", constructor(C, TVarset), Ctors)].
type_body(_, TVarset, hlds_eqv_type(Type)) =
[elem("equivalent_type", [], [mer_type(TVarset, Type)])].