[m-dev.] for review: make unboxed enums and no-tag types optional

Tyson Dowd trd at cs.mu.OZ.AU
Wed Aug 9 13:19:56 AEST 2000


Hi,

Another Project 7 diff.

===================================================================


Estimated hours taken: 1

Add options for 
	unboxed_enums	- turns on unboxed enums (default is yes)
	no_tag_types	- turns on no_tag_types (default is yes)

Currently every grade uses these representations.

We will set these to `no' on the IL backend (and probably the Java
backend) if using a simple implementation of the the Array of Object
representation for Mercury data structures.

compiler/make_tags.m:
	Check for these options when creating representations.

compiler/options.m:
	Add the new options.


Index: compiler/make_tags.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/make_tags.m,v
retrieving revision 1.30
diff -u -r1.30 make_tags.m
--- compiler/make_tags.m	2000/03/10 13:37:46	1.30
+++ compiler/make_tags.m	2000/08/08 06:48:27
@@ -69,6 +69,9 @@
 		% now assign them
 	map__init(CtorTags0),
 	(
+			% All the constructors must be constant, and we
+			% must be allowed to make unboxed enums.
+		globals__lookup_bool_option(Globals, unboxed_enums, yes),
 		ctors_are_all_constants(Ctors)
 	->
 		IsEnum = yes,
@@ -78,6 +81,7 @@
 		(
 			% assign single functor of arity one a `no_tag' tag
 			% (unless it is type_info/1)
+			globals__lookup_bool_option(Globals, no_tag_types, yes),
 			type_is_no_tag_type(Ctors, SingleFunc, SingleArg)
 		->
 			make_cons_id_from_qualified_sym_name(SingleFunc,
Index: compiler/options.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/options.m,v
retrieving revision 1.285
diff -u -r1.285 options.m
--- compiler/options.m	2000/07/25 09:27:24	1.285
+++ compiler/options.m	2000/08/08 06:45:31
@@ -166,6 +166,8 @@
 		;	highlevel_data
 		;	gcc_nested_functions
 		;	unboxed_float
+		;       unboxed_enums
+		;       no_tag_types
 		;	sync_term_size % in words
 		;	type_layout
 	% Options for internal use only
@@ -561,7 +563,9 @@
 	highlevel_code		-	bool(no),
 	highlevel_data		-	bool(no),
 	gcc_nested_functions	-	bool(no),
-	unboxed_float		-	bool(no)
+	unboxed_float           -       bool(no),
+	unboxed_enums           -       bool(yes),
+	no_tag_types            -       bool(yes)
 ]).
 option_defaults_2(code_gen_option, [
 		% Code Generation Options
@@ -935,7 +939,10 @@
 long_option("high-level-data",		highlevel_data).
 long_option("gcc-nested-functions",	gcc_nested_functions).
 long_option("unboxed-float",		unboxed_float).
+long_option("unboxed-enums",           unboxed_enums).
+long_option("no-tag-types",            no_tag_types).
 
+
 % code generation options
 long_option("low-level-debug",		low_level_debug).
 long_option("polymorphism",		polymorphism).
@@ -1931,7 +1938,16 @@
 		"\tThe C code needs to be compiled with `-UBOXED_FLOAT'.",
 		"\tIt may also need to be compiled with",
 		"\t`-DUSE_SINGLE_PREC_FLOAT', if double precision",
-		"\tfloats don't fit into a word."
+		"\tfloats don't fit into a word.",
+
+		"--unboxed-enums",
+		"(This option is not for general use.)",
+		"\tDon't box enumerations.  This option is set by default.",
+
+		"--no-tag-types",
+		"(This option is not for general use.)",
+		"\tDon't allow unboxed no-tag types.",
+		"\tThis option is set by default."
 	]).
 
 :- pred options_help_code_generation(io__state::di, io__state::uo) is det.


-- 
       Tyson Dowd           # 
                            #  Surreal humour isn't everyone's cup of fur.
     trd at cs.mu.oz.au        # 
http://www.cs.mu.oz.au/~trd #
--------------------------------------------------------------------------
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