[m-rev.] trivial diff: cleanups for il backend

Julien Fischer juliensf at cs.mu.OZ.AU
Wed Mar 15 01:26:24 AEDT 2006


Estimated hours taken: 2
Branches: main

Cleanups for the IL backend.  Aside from changing some if-then-elses into
switches there are no changes to any algorithms.

compiler/ilasm.m:
compiler/ilds.m:
compiler/mlds_to_il.m:
compiler/mlds_to_ilasm.m
compiler/mlds_to_managed.m:
	Convert these modules to use 4-space indentation where that has not
	already been done.

	Rename the type ilds.type as ilds.il_type in order to avoid having
	to parenthesize it.

	Replace __ with . as the module qualifier.

	Use state variable notation in a few spots.

	Replace some if-then-elses with switches.

	Conform more closely to our current coding standard.

Julien.

Index: ilasm.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ilasm.m,v
retrieving revision 1.44
diff -u -b -r1.44 ilasm.m
--- ilasm.m	28 Nov 2005 04:11:42 -0000	1.44
+++ ilasm.m	14 Mar 2006 12:29:31 -0000
@@ -1,4 +1,6 @@
 %-----------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et
+%-----------------------------------------------------------------------------%
 % Copyright (C) 1999-2005 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.
@@ -23,8 +25,7 @@

 %-----------------------------------------------------------------------------%

-:- module ml_backend__ilasm.
-
+:- module ml_backend.ilasm.
 :- interface.

 :- import_module ml_backend.ilds.
@@ -38,7 +39,7 @@

 %-----------------------------------------------------------------------------%

-:- pred ilasm__output(list(decl)::in, io::di, io::uo) is det.
+:- pred ilasm.output(list(decl)::in, io::di, io::uo) is det.

 :- type int64 ---> int64(integer).
 :- type int32 ---> int32(int).
@@ -48,24 +49,26 @@
 :- type float64 ---> float64(float).
 :- type float32 ---> float32(float).

-% A top level declaration in IL assembler.
+    % A top level declaration in IL assembler.
+    %
 :- type decl
 		% .class declaration
 	--->	class(
-			list(classattr),	% attributes for the class
-			ilds__id,		% name of the class
-			extends,		% what is the parent class
-			implements, 		% what interfaces are
-						% implemented
-			list(class_member)		% methods and fields
+                list(classattr),    % Attributes for the class.
+                ilds.id,            % Name of the class.
+                extends,            % What is the parent class?
+                implements,         % What interfaces are implemented?
+                list(class_member)  % Methods and fields.
 		)
+
 		% .namespace declaration
 	;	namespace(
-			namespace_qual_name,	% namespace name
-			list(decl)		% contents
+                namespace_qual_name,    % Namespace name.
+                list(decl)              % Contents.
 		)
+
 		% .method  (a global function)
-		% there are lots of restriction on global functions so
+            % There are lots of restrictions on global functions so
 		% don't get too excited about using them for anything.
 		% In particular, you can't reference a namespace
 		% qualified global function from outside the module.
@@ -73,184 +76,245 @@
 			methodhead,
 			method_defn
 		)
+
 		% .data  (module local data)
 	;	data(
-			bool, 		 % is data in thread local storage?
-			maybe(ilds__id), % id to name this data
-			data_body 	 % body of data
+                bool,            % Is data in thread local storage?
+                maybe(ilds.id),  % id to name this data.
+                data_body        % Body of data.
 		)

 		% .file
-		% Declares a file associated with the current assembly
-	;	file(ilds__id)
+            % Declares a file associated with the current assembly.
+    ;       file(ilds.id)

 		% .module extern
-		% declares a module name.
-	;	extern_module(ilds__id)
+            % Declares a module name.
+    ;       extern_module(ilds.id)

 		% .assembly extern
-		% declares an assembly name, and possibly its strong
+            % Declares an assembly name, and possibly its strong
 		% name/version number.
-	;	extern_assembly(ilds__id, list(assembly_decl))
+    ;       extern_assembly(ilds.id, list(assembly_decl))

 		% .assembly
-		% defines an assembly
-	;	assembly(ilds__id)
+            % Defines an assembly.
+    ;       assembly(ilds.id)

 		% .custom
-		% a custom attribute
+            % A custom attribute.
 	;	custom(custom_decl)

-		% comments
+    %
+    % Comments
+    %
+
 	;	comment_term(term)
-			% print almost anything using pprint__to_doc
+
+            % Print almost anything using pprint.to_doc
 			% (see library/pprint.m for limitations).
 	;	some [T] comment_thing(T)
 	;	comment(string).

 :- type assembly_decl
-	--->	version(int, int, int, int)	% version number
-	;	hash(list(int8))		% hash
-	;	public_key_token(list(int8))	% public key token
-	;	custom(custom_decl).		% a custom attribute
+    --->    version(int, int, int, int)     % Version number.
+    ;       hash(list(int8))                % Hash.
+    ;       public_key_token(list(int8))    % Public key token.
+    ;       custom(custom_decl).            % A custom attribute.

-	% a method definition is just a list of body decls.
+    % A method definition is just a list of body decls.
+    %
 :- type method_defn == list(method_body_decl).

 :- type methodhead
 	--->	methodhead(
-			list(methattr),		% method attributes
-			member_name,		% method name
-			signature,		% method signature
-			list(implattr)		% implementation attributes
+                list(methattr),     % Method attributes.
+                member_name,        % Method name.
+                signature,          % Method signature.
+                list(implattr)      % Implementation attributes.
 	).

 :- type class_member
 		% .method (a class method)
 	--->	method(
-			methodhead,		% name, signature, attributes
-			method_defn		% definition of method
+                methodhead,     % Name, signature, attributes.
+                method_defn     % Definition of method.
 		)
+
 		% .field (a class field)
 	;	field(
-			list(fieldattr),	% attributes
-			ilds__type,		% field type
-			ilds__id,		% field name
-			maybe(int32),		% offset for explicit layout
-			field_initializer	% initializer
+                list(fieldattr),    % Attributes.
+                il_type,            % Field type.
+                ilds.id,            % Field name.
+                maybe(int32),       % Offset for explicit layout.
+                field_initializer   % Initializer.
 		)
+
 		% .property (a class property)
 	;	property(
-			ilds__type,		% property type
-			ilds__id,		% property name
-			maybe(methodhead),	% get property
-			maybe(methodhead)	% set property
+                il_type,            % Property type.
+                ilds.id,            % Property name.
+                maybe(methodhead),  % Get property.
+                maybe(methodhead)   % Set property.
 		)
+
 		% .class (a nested class)
 	;	nested_class(
-			list(classattr),	% attributes for the class
-			ilds__id,		% name of the class
-			extends,		% what is the parent class
-			implements, 		% what interfaces are
-						% implemented
-			list(class_member)	% methods and fields
+                list(classattr),    % Attributes for the class.
+                ilds.id,           % Name of the class.
+                extends,            % What is the parent class?
+                implements,         % What interfaces are implemented?
+                list(class_member)  % Methods and fields.
 		)
+
 	;	custom(custom_decl)		% custom attribute
-		% comments
+
+    %
+    % Comments
+    %
+
 	;	comment_term(term)
 	;	comment(string)
-			% print almost anything using pprint__to_doc
+
+            % print almost anything using pprint.to_doc
 			% (see library/pprint.m for limitations).
 	;	some [T] comment_thing(T).

 :- type field_initializer
-	--->	none		% no initializer
-	;	at(ilds__id)	% initialize with .data at given location
-	;	equals(field_init).	% initialize with constant
+    --->    none                % No initializer.
+    ;       at(ilds.id)         % Initialize with .data at given location.
+    ;       equals(field_init). % Initialize with constant.

-	% note that for some reason the syntax for field_init is almost,
+    % Note that for some reason the syntax for field_init is almost,
 	% but not quite the same as data items.
+    %
 :- type field_init
-	--->	data_item(data_item)		% most data_items are valid
+    --->    data_item(data_item)        % Most data_items are valid.
 			% XXX unicode is not yet implemented, don't use
 			% wchar_ptr unless you intend to implement it
-	;	wchar_ptr(string)		% a string to convert to unicode
-	;	binary_float32(int32)		% binary rep. of float
-	;	binary_float64(int64).		% binary rep. of double
+    ;       wchar_ptr(string)           % A string to convert to unicode.
+    ;       binary_float32(int32)       % Binary rep. of float.
+    ;       binary_float64(int64).      % Binary rep. of double.

-	% a parent class to extend
+    % A parent class to extend.
+    %
 :- type extends
-	--->	extends(ilds__class_name)
+    --->    extends(ilds.class_name)
 	;	extends_nothing.

-	% a list of interfaces that we implement
+    % A list of interfaces that we implement.
+    %
 :- type implements
-	--->	implements(list(ilds__class_name)).
+    --->    implements(list(ilds.class_name)).

-	% declarations that can form the body of a method.
+    % Declarations that can form the body of a method.
+    %
 :- type method_body_decl
-	--->	emitbyte(int32)		% raw byte output (danger! danger!)
-		        % "emits an int32 to the code section of the method"
-			% according to the IL Assembly Language
-			% Programmers' Reference.
-			% This probably means it can output IL
-			% bytecodes.
-	;	maxstack(int32)		% maximum stack size
-		        % "Defines the maximum size of the stack,
-			% specified by the int32"
-			% But does it measure in bits, nibbles, bytes,
-			% words or something else?
-	;	entrypoint		% is this "main"?
-	;	zeroinit		% initialize locals to zero.
-	;	custom(custom_decl)	% custom attribute
-	;	instrs(list(instr))	% instructions
-	;	label(string).		% a label
+    --->    emitbyte(int32)
+            % raw byte output (danger! danger!)
+            % "emits an int32 to the code section of the method" according
+            % to the IL Assembly Language Programmers' Reference.
+            % This probably means it can output IL bytecodes.
+
+    ;       maxstack(int32)
+            % "Defines the maximum size of the stack, specified by the int32"
+            % But does it measure in bits, nibbles, bytes, words or
+            % something else?
+
+    ;       entrypoint          % Is this "main"?
+    ;       zeroinit            % Initialize locals to zero.
+    ;       custom(custom_decl) % Custom attribute.
+    ;       instrs(list(instr)) % Instructions.
+    ;       label(string).      % A label.

-	% attributes that a class can have.
-	% see SDK documentation for what they all mean.
+    % Attributes that a class can have.
+    % See SDK documentation for what they all mean.
+    %
 :-  type classattr
-	--->	abstract		; ansi
-	;	auto			; autochar
-	;	beforefieldinit		; explicit
-	;	interface		; nestedassembly
-	;	nestedfamandassem	; nestedfamily
-	;	nestedfamorassem	; nestedprivate
-	;	nestedpublic		; private
-	;	public 			; rtspecialname
-	;	sealed			; sequential
-	;	serializable		; specialname
+    --->    abstract
+    ;       ansi
+    ;       auto
+    ;       autochar
+    ;       beforefieldinit
+    ;       explicit
+    ;       interface
+    ;       nestedassembly
+    ;       nestedfamandassem
+    ;       nestedfamily
+    ;       nestedfamorassem
+    ;       nestedprivate
+    ;       nestedpublic
+    ;       private
+    ;       public
+    ;       rtspecialname
+    ;       sealed
+    ;       sequential
+    ;       serializable
+    ;       specialname
 	;	unicode.

-	% attributes that a method can have.
-	% see SDK documentation for what they all mean.
+    % Attributes that a method can have.
+    % See SDK documentation for what they all mean.
+    %
 :- type methattr
-	--->  abstract      ;  assembly     ;   famandassem  ;    family
-	;     famorassem    ;  final        ;   hidebysig    ;    newslot
-	;     private       ;  privatescope ;   public
-	;     rtspecialname ;  specialname  ;   static
-	;     synchronized  ;  virtual      ;   pinvokeimpl.
+    --->    abstract
+    ;       assembly
+    ;       famandassem
+    ;       family
+    ;       famorassem
+    ;       final
+    ;       hidebysig
+    ;       newslot
+    ;       private
+    ;       privatescope
+    ;       public
+    ;       rtspecialname
+    ;       specialname
+    ;       static
+    ;       synchronized
+    ;       virtual
+    ;       pinvokeimpl.

-	% attributes that a field can have.
-	% see SDK documentation for what they all mean.
+    % Attributes that a field can have.
+    % See SDK documentation for what they all mean.
+    %
 :- type fieldattr
-	--->  assembly      ;  famandassem  ;  family        ;  famorassem
-	;     initonly      ;  literal      ;  notserialized ;  pinvokeimpl
-	;     private       ;  privatescope ;  public        ;  static
+    --->    assembly
+    ;       famandassem
+    ;       family
+    ;       famorassem
+    ;       initonly
+    ;       literal
+    ;       notserialized
+    ;       pinvokeimpl
+    ;       private
+    ;       privatescope
+    ;       public
+    ;       static
 	;     volatile.

-	% attributes that a method implementation can have.
-	% see SDK documentation for what they all mean.
+    % Attributes that a method implementation can have.
+    % See SDK documentation for what they all mean.
+    %
 :- type implattr
-	--->  il            ;  implemented  ;  internalcall  ;  managed
-	;     native        ;  ole          ;  optil         ;  runtime
+    --->    il
+    ;       implemented
+    ;       internalcall
+    ;       managed
+    ;       native
+    ;       ole
+    ;       optil
+    ;       runtime
         ;     unmanaged.

-	% the body of a .data declaration
+    % The body of a .data declaration
+    %
 :- type data_body
 	--->	itemlist(list(data_item))
 	;	item(data_item).

-	% various constants that can be used in .data declarations
+    % Various constants that can be used in .data declarations.
+    %
 :- type data_item
 	---> 	float32(float32)
 	;	float64(float64)
@@ -259,12 +323,11 @@
 	;	int16(int16)
 	;	int8(int8)
 	;	char_ptr(string)
-	;	'&'(ilds__id)
-	;	bytearray(list(byte)).	% output as two digit hex, e.g.
-					% 01 F7 0A
+    ;       '&'(ilds.id)
+    ;       bytearray(list(byte)).  % Output as two digit hex, e.g. 01 F7 0A.

-:- type custom_decl --->
-	custom_decl(
+:- type custom_decl
+    --->    custom_decl(
 		custom_type,
 		maybe(custom_type),
 		qstring_or_bytes
@@ -276,8 +339,8 @@
 	; 	no_initalizer.

 :- type custom_type
-	--->	type(ilds__type)
-	;	methodref(ilds__methodref).
+    --->    type(il_type)
+    ;       methodref(ilds.methodref).

 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
@@ -289,7 +352,6 @@
 :- import_module libs.globals.
 :- import_module libs.options.

-:- import_module bool.
 :- import_module char.
 :- import_module getopt_io.
 :- import_module int.
@@ -315,57 +377,56 @@
 	% performance hit if you use assembly references to a symbol that is
 	% in the local assembly.

-:- type ilasm_info --->
-		ilasm_info(
-			current_assembly :: ilds__id
+:- type ilasm_info
+    --->    ilasm_info(
+                current_assembly :: ilds.id
 		).

-:- pred ilasm__write_list(list(T)::in, string::in,
+:- pred ilasm.write_list(list(T)::in, string::in,
 	pred(T, ilasm_info, ilasm_info, io, io)
 		::in(pred(in, in, out, di, uo) is det),
 	ilasm_info::in, ilasm_info::out, io::di, io::uo) is det.

-ilasm__write_list([], _Separator, _OutputPred, !Info, !IO).
-ilasm__write_list([E | Es], Separator, OutputPred, !Info, !IO) :-
-	call(OutputPred, E, !Info, !IO),
+ilasm.write_list([], _Separator, _OutputPred, !Info, !IO).
+ilasm.write_list([E | Es], Separator, OutputPred, !Info, !IO) :-
+    OutputPred(E, !Info, !IO),
 	(
 		Es = []
 	;
 		Es = [_ | _],
-		io__write_string(Separator, !IO)
+        io.write_string(Separator, !IO)
 	),
-	ilasm__write_list(Es, Separator, OutputPred, !Info, !IO).
+    ilasm.write_list(Es, Separator, OutputPred, !Info, !IO).

-ilasm__output(Blocks, !IO) :-
+ilasm.output(Blocks, !IO) :-
 	Info0 = ilasm_info(""),
-	ilasm__output(Blocks, Info0, _Info, !IO).
+    ilasm.output(Blocks, Info0, _Info, !IO).

-:- pred ilasm__output(list(decl)::in, ilasm_info::in, ilasm_info::out,
+:- pred ilasm.output(list(decl)::in, ilasm_info::in, ilasm_info::out,
 	io::di, io::uo) is det.

-ilasm__output(Blocks, !Info, !IO) :-
-	ilasm__write_list(Blocks, "\n\n", output_decl, !Info, !IO),
-	io__write_string("\n\n", !IO).
+ilasm.output(Blocks, !Info, !IO) :-
+    ilasm.write_list(Blocks, "\n\n", output_decl, !Info, !IO),
+    io.write_string("\n\n", !IO).

-:- pred ilasm__output_decl(decl::in, ilasm_info::in, ilasm_info::out,
+:- pred output_decl(decl::in, ilasm_info::in, ilasm_info::out,
 	io::di, io::uo) is det.

-ilasm__output_decl(custom(CustomDecl), !Info, !IO) :-
+output_decl(custom(CustomDecl), !Info, !IO) :-
 	output_custom_decl(CustomDecl, !Info, !IO).
-ilasm__output_decl(class(Attrs, Id, Extends, Implements, Contents), !Info,
-		!IO) :-
-	io__write_string(".class ", !IO),
-	io__write_list(Attrs, " ", output_classattr, !IO),
+output_decl(class(Attrs, Id, Extends, Implements, Contents), !Info, !IO) :-
+    io.write_string(".class ", !IO),
+    io.write_list(Attrs, " ", output_classattr, !IO),
 	(
 		Attrs = [_ | _],
-		io__write_string(" ", !IO)
+        io.write_string(" ", !IO)
 	;
 		Attrs = []
 	),
 	output_id(Id, !IO),
 	(
 		Extends = extends(ExtendsModule),
-		io__write_string(" extends ", !IO),
+        io.write_string(" extends ", !IO),
 		output_class_name(ExtendsModule, !Info, !IO)
 	;
 		Extends = extends_nothing
@@ -373,143 +434,143 @@
 	Implements = implements(ImplementsList),
 	(
 		ImplementsList = [_ | _],
-		io__write_string(" implements ", !IO),
-		ilasm__write_list(ImplementsList, ", ", output_class_name,
-			!Info, !IO)
+        io.write_string(" implements ", !IO),
+        ilasm.write_list(ImplementsList, ", ", output_class_name, !Info, !IO)
 	;
 		ImplementsList = []
 	),
-	io__write_string(" {\n", !IO),
-	ilasm__write_list(Contents, "\n", output_class_member, !Info, !IO),
-	io__write_string("\n}", !IO).
-ilasm__output_decl(namespace(DottedName, Contents), !Info, !IO) :-
+    io.write_string(" {\n", !IO),
+    ilasm.write_list(Contents, "\n", output_class_member, !Info, !IO),
+    io.write_string("\n}", !IO).
+output_decl(namespace(DottedName, Contents), !Info, !IO) :-
 	(
 		DottedName = [_ | _],
-		io__write_string(".namespace ", !IO),
+        io.write_string(".namespace ", !IO),
 		output_dotted_name(DottedName, !IO),
-		io__write_string(" {\n", !IO),
+        io.write_string(" {\n", !IO),
 		output(Contents, !Info, !IO),
-		io__write_string("}\n", !IO)
+        io.write_string("}\n", !IO)
 	;
 		DottedName = [],
 		output(Contents, !Info, !IO)
 	).
-ilasm__output_decl(method(MethodHead, MethodDecls), !Info, !IO) :-
-	io__write_string(".method ", !IO),
+output_decl(method(MethodHead, MethodDecls), !Info, !IO) :-
+    io.write_string(".method ", !IO),
 	output_methodhead(MethodHead, !Info, !IO),
-	io__write_string("\n{\n", !IO),
-	ilasm__write_list(MethodDecls, "\n", output_method_body_decl, !Info,
-		!IO),
-	io__write_string("}\n", !IO).
-ilasm__output_decl(data(TLS, MaybeId, Body), !Info, !IO) :-
-	io__write_string(".data ", !IO),
-	( TLS = yes ->
-		io__write_string("tls ", !IO)
+    io.write_string("\n{\n", !IO),
+    ilasm.write_list(MethodDecls, "\n", output_method_body_decl, !Info, !IO),
+    io.write_string("}\n", !IO).
+output_decl(data(TLS, MaybeId, Body), !Info, !IO) :-
+    io.write_string(".data ", !IO),
+    (
+        TLS = yes,
+        io.write_string("tls ", !IO)
 	;
-		true
+        TLS = no
 	),
-	( MaybeId = yes(Id) ->
+    (
+        MaybeId = yes(Id),
 		output_id(Id, !IO),
-		io__write_string(" = ", !IO)
+        io.write_string(" = ", !IO)
 	;
-		true
+        MaybeId = no
 	),
 	output_data_body(Body, !IO).
-ilasm__output_decl(comment_term(CommentTerm), !Info, !IO) :-
-	globals__io_lookup_bool_option(auto_comments, PrintComments, !IO),
-	( PrintComments = yes ->
-		io__write_string("// ", !IO),
-		varset__init(VarSet),
-		term_io__write_term(VarSet, CommentTerm, !IO),
-		io__write_string("\n", !IO)
+output_decl(comment_term(CommentTerm), !Info, !IO) :-
+    globals.io_lookup_bool_option(auto_comments, PrintComments, !IO),
+    (
+        PrintComments = yes,
+        io.write_string("// ", !IO),
+        varset.init(VarSet),
+        term_io.write_term(VarSet, CommentTerm, !IO),
+        io.nl(!IO)
 	;
-		true
+        PrintComments = no
 	).
-ilasm__output_decl(comment_thing(Thing), !Info, !IO) :-
-	globals__io_lookup_bool_option(auto_comments, PrintComments, !IO),
-	( PrintComments = yes ->
+output_decl(comment_thing(Thing), !Info, !IO) :-
+    globals.io_lookup_bool_option(auto_comments, PrintComments, !IO),
+    (
+        PrintComments = yes,
 		Doc = label("// ", to_doc(Thing)),
 		write(70, Doc, !IO),
-		io__nl(!IO)
+        io.nl(!IO)
 	;
-		true
+        PrintComments = no
 	).
-ilasm__output_decl(comment(CommentStr), !Info, !IO) :-
-	globals__io_lookup_bool_option(auto_comments, PrintComments, !IO),
+output_decl(comment(CommentStr), !Info, !IO) :-
+    globals.io_lookup_bool_option(auto_comments, PrintComments, !IO),
 	(
 		PrintComments = yes,
 		output_comment_string(CommentStr, !IO)
 	;
 		PrintComments = no
 	).
-ilasm__output_decl(extern_assembly(AsmName, AssemblyDecls), !Info, !IO) :-
-	io__write_string(".assembly extern ", !IO),
+output_decl(extern_assembly(AsmName, AssemblyDecls), !Info, !IO) :-
+    io.write_string(".assembly extern ", !IO),
 	output_id(AsmName, !IO),
-	io__write_string("{\n", !IO),
-	list__foldl2((pred(A::in, I0::in, I::out, IO0::di, IO::uo) is det :-
+    io.write_string("{\n", !IO),
+    list.foldl2((pred(A::in, I0::in, I::out, IO0::di, IO::uo) is det :-
 			output_assembly_decl(A, I0, I, IO0, IO1),
-			io__write_string("\n\t", IO1, IO)
+            io.write_string("\n\t", IO1, IO)
 		), AssemblyDecls, !Info, !IO),
-	io__write_string("\n}\n", !IO).
-ilasm__output_decl(assembly(AsmName), !Info, !IO) :-
-	io__write_string(".assembly ", !IO),
+    io.write_string("\n}\n", !IO).
+output_decl(assembly(AsmName), !Info, !IO) :-
+    io.write_string(".assembly ", !IO),
 	output_id(AsmName, !IO),
 	!:Info = !.Info ^ current_assembly := AsmName,
-	io__write_string(" { }", !IO).
-ilasm__output_decl(file(FileName), !Info, !IO) :-
-	io__write_string(".file ", !IO),
+    io.write_string(" { }", !IO).
+output_decl(file(FileName), !Info, !IO) :-
+    io.write_string(".file ", !IO),
 	output_id(FileName, !IO).
-ilasm__output_decl(extern_module(ModName), !Info, !IO) :-
-	io__write_string(".module extern ", !IO),
+output_decl(extern_module(ModName), !Info, !IO) :-
+    io.write_string(".module extern ", !IO),
 	output_id(ModName, !IO).

-:- pred ilasm__output_class_member(class_member::in, ilasm_info::in,
+:- pred output_class_member(class_member::in, ilasm_info::in,
 	ilasm_info::out, io::di, io::uo) is det.

-ilasm__output_class_member(method(MethodHead, MethodDecls), !Info, !IO) :-
+output_class_member(method(MethodHead, MethodDecls), !Info, !IO) :-
 		% Don't do debug output on class constructors, since
 		% they are automatically generated and take forever to
 		% run.
-	globals__io_lookup_option(debug_il_asm, DebugIlAsm, !IO),
+    globals.io_lookup_option(debug_il_asm, DebugIlAsm, !IO),
 	( MethodHead = methodhead(_, cctor, _, _) ->
-		globals__io_set_option(debug_il_asm, bool(no), !IO),
-		ilasm__output_decl(method(MethodHead, MethodDecls), !Info, !IO),
-		globals__io_set_option(debug_il_asm, DebugIlAsm, !IO)
+        globals.io_set_option(debug_il_asm, bool(no), !IO),
+        output_decl(method(MethodHead, MethodDecls), !Info, !IO),
+        globals.io_set_option(debug_il_asm, DebugIlAsm, !IO)
 	;
-		ilasm__output_decl(method(MethodHead, MethodDecls), !Info, !IO)
+        output_decl(method(MethodHead, MethodDecls), !Info, !IO)
 	).

-ilasm__output_class_member(custom(CustomDecl), !Info, !IO) :-
+output_class_member(custom(CustomDecl), !Info, !IO) :-
 	output_custom_decl(CustomDecl, !Info, !IO).

-ilasm__output_class_member(
-		field(FieldAttrs, Type, IlId, MaybeOffset, Initializer),
+output_class_member(field(FieldAttrs, Type, IlId, MaybeOffset, Initializer),
 		!Info, !IO) :-
-	io__write_string(".field ", !IO),
+    io.write_string(".field ", !IO),
 	(
 		MaybeOffset = yes(Offset),
 		output_int32(Offset, !IO),
-		io__write_string(" ", !IO)
+        io.write_string(" ", !IO)
 	;
 		MaybeOffset = no
 	),
-	io__write_list(FieldAttrs, " ", io__write, !IO),
-	io__write_string("\n\t", !IO),
+    io.write_list(FieldAttrs, " ", io.write, !IO),
+    io.write_string("\n\t", !IO),
 	output_type(Type, !Info, !IO),
-	io__write_string("\n\t", !IO),
+    io.write_string("\n\t", !IO),
 	output_id(IlId, !IO),
 	output_field_initializer(Initializer, !IO).
-ilasm__output_class_member(
-		property(Type, Name, MaybeGet, MaybeSet), !Info, !IO) :-
-	io__write_string(".property instance ", !IO),
+output_class_member(property(Type, Name, MaybeGet, MaybeSet), !Info, !IO) :-
+    io.write_string(".property instance ", !IO),
 	output_type(Type, !Info, !IO),
-	io__write_string(" ", !IO),
+    io.write_string(" ", !IO),
 	output_id(Name, !IO),
-	io__write_string("() {", !IO),
+    io.write_string("() {", !IO),
 	(
 		MaybeGet = yes(methodhead(_, GetMethodName, GetSignature, _)),
-		io__nl(!IO),
-		io__write_string("\t.get instance ", !IO),
+        io.nl(!IO),
+        io.write_string("\t.get instance ", !IO),
 		output_name_signature_and_call_conv(GetSignature,
 			yes(GetMethodName), "\t\t", !Info, !IO)
 	;
@@ -517,91 +578,90 @@
 	),
 	(
 		MaybeSet = yes(methodhead(_, SetMethodName, SetSignature, _)),
-		io__nl(!IO),
-		io__write_string("\t.set instance ", !IO),
+        io.nl(!IO),
+        io.write_string("\t.set instance ", !IO),
 		output_name_signature_and_call_conv(SetSignature,
 			yes(SetMethodName), "\t\t", !Info, !IO)
 	;
 		MaybeSet = no
 	),
-	io__write_string("\n}\n", !IO).
-ilasm__output_class_member(nested_class(Attrs, Id, Extends, Implements,
-		Contents), !Info, !IO) :-
-	ilasm__output_decl(class(Attrs, Id, Extends, Implements, Contents),
-		!Info, !IO).
-ilasm__output_class_member(comment(CommentStr), !Info, !IO) :-
-	globals__io_lookup_bool_option(auto_comments, PrintComments, !IO),
+    io.write_string("\n}\n", !IO).
+output_class_member(nested_class(Attrs, Id, Extends, Implements, Contents),
+        !Info, !IO) :-
+    output_decl(class(Attrs, Id, Extends, Implements, Contents), !Info, !IO).
+output_class_member(comment(CommentStr), !Info, !IO) :-
+    globals.io_lookup_bool_option(auto_comments, PrintComments, !IO),
 	(
 		PrintComments = yes,
 		output_comment_string(CommentStr, !IO)
 	;
 		PrintComments = no
 	).
-ilasm__output_class_member(comment_term(CommentTerm), !Info, !IO) :-
-	globals__io_lookup_bool_option(auto_comments, PrintComments, !IO),
+output_class_member(comment_term(CommentTerm), !Info, !IO) :-
+    globals.io_lookup_bool_option(auto_comments, PrintComments, !IO),
 	(
 		PrintComments = yes,
-		io__write_string("// ", !IO),
-		varset__init(VarSet),
-		term_io__write_term(VarSet, CommentTerm, !IO),
-		io__nl(!IO)
+        io.write_string("// ", !IO),
+        varset.init(VarSet),
+        term_io.write_term(VarSet, CommentTerm, !IO),
+        io.nl(!IO)
 	;
 		PrintComments = no
 	).
-ilasm__output_class_member(comment_thing(Thing), !Info, !IO) :-
-	globals__io_lookup_bool_option(auto_comments, PrintComments, !IO),
+output_class_member(comment_thing(Thing), !Info, !IO) :-
+    globals.io_lookup_bool_option(auto_comments, PrintComments, !IO),
 	(
 		PrintComments = yes,
 		Doc = label("// ", to_doc(Thing)),
 		write(70, Doc, !IO),
-		io__nl(!IO)
+        io.nl(!IO)
 	;
 		PrintComments = no
 	).

-:- pred ilasm__output_methodhead(methodhead::in,
-	ilasm_info::in, ilasm_info::out, io::di, io::uo) is det.
+:- pred output_methodhead(methodhead::in, ilasm_info::in, ilasm_info::out,
+    io::di, io::uo) is det.

-ilasm__output_methodhead(methodhead(Attrs, MethodName, Signature, ImplAttrs),
+output_methodhead(methodhead(Attrs, MethodName, Signature, ImplAttrs),
 		!Info, !IO) :-
-	io__write_list(Attrs, " ", io__write, !IO),
+    io.write_list(Attrs, " ", io.write, !IO),
 	(
 		Attrs = [_ | _],
-		io__write_string(" ", !IO)
+        io.write_string(" ", !IO)
 	;
 		Attrs = []
 	),
 	output_name_signature_and_call_conv(Signature, yes(MethodName), "\t",
 		!Info, !IO),
-	io__write_list(ImplAttrs, " ", io__write, !IO).
+    io.write_list(ImplAttrs, " ", io.write, !IO).

-:- pred ilasm__output_method_body_decl(method_body_decl::in,
+:- pred output_method_body_decl(method_body_decl::in,
 	ilasm_info::in, ilasm_info::out, io::di, io::uo) is det.

-ilasm__output_method_body_decl(emitbyte(Int32), !Info, !IO) :-
-	io__write_string(".emitbyte ", !IO),
+output_method_body_decl(emitbyte(Int32), !Info, !IO) :-
+    io.write_string(".emitbyte ", !IO),
 	output_int32(Int32, !IO).
-ilasm__output_method_body_decl(custom(CustomDecl), !Info, !IO) :-
+output_method_body_decl(custom(CustomDecl), !Info, !IO) :-
 	output_custom_decl(CustomDecl, !Info, !IO).
-ilasm__output_method_body_decl(maxstack(Int32), !Info, !IO) :-
-	io__write_string(".maxstack ", !IO),
+output_method_body_decl(maxstack(Int32), !Info, !IO) :-
+    io.write_string(".maxstack ", !IO),
 	output_int32(Int32, !IO).
-ilasm__output_method_body_decl(entrypoint, !Info, !IO) :-
-	io__write_string(".entrypoint ", !IO).
-ilasm__output_method_body_decl(zeroinit, !Info, !IO) :-
-	io__write_string(".zeroinit ", !IO).
-ilasm__output_method_body_decl(instrs(Instrs), !Info, !IO) :-
+output_method_body_decl(entrypoint, !Info, !IO) :-
+    io.write_string(".entrypoint ", !IO).
+output_method_body_decl(zeroinit, !Info, !IO) :-
+    io.write_string(".zeroinit ", !IO).
+output_method_body_decl(instrs(Instrs), !Info, !IO) :-
 	output_instructions(Instrs, !Info, !IO).
-ilasm__output_method_body_decl(label(Label), !Info, !IO) :-
+output_method_body_decl(label(Label), !Info, !IO) :-
 	output_label(Label, !IO),
-	io__write_string(":", !IO).
+    io.write_string(":", !IO).

 :- pred output_label(label::in, io::di, io::uo) is det.

 output_label(Label, !IO) :-
-	io__write_string(Label, !IO).
+    io.write_string(Label, !IO).

-:- pred output_class_name(ilds__class_name::in,
+:- pred output_class_name(ilds.class_name::in,
 	ilasm_info::in, ilasm_info::out, io::di, io::uo) is det.

 output_class_name(ClassName, !Info, !IO) :-
@@ -612,11 +672,11 @@
 output_call_conv(call_conv(IsInstance, IlCallConv), !IO) :-
 	(
 		IsInstance = yes,
-		io__write_string("instance ", !IO)
+        io.write_string("instance ", !IO)
 	;
 		IsInstance = no,
-		io__write(IlCallConv, !IO),
-		io__write_string(" ", !IO)
+        io.write(IlCallConv, !IO),
+        io.write_string(" ", !IO)
 	).

 :- pred output_name_signature_and_call_conv(signature::in,
@@ -626,27 +686,26 @@
 output_name_signature_and_call_conv(signature(CallConv, ReturnType, ArgTypes),
 		MaybeMethodName, Indent, !Info, !IO) :-
 	output_call_conv(CallConv, !IO),
-	io__write_string("\n", !IO),
-	io__write_string(Indent, !IO),
+    io.write_string("\n", !IO),
+    io.write_string(Indent, !IO),
 	output_ret_type(ReturnType, !Info, !IO),
 	(
 		MaybeMethodName = yes(MethodName),
-		io__write_string("\n", !IO),
-		io__write_string(Indent, !IO),
+        io.write_string("\n", !IO),
+        io.write_string(Indent, !IO),
 		output_member_name(MethodName, !IO)
 	;
 		MaybeMethodName = no,
-		io__write_string(" ", !IO)
+        io.write_string(" ", !IO)
 	),
 	(
 		ArgTypes = [],
-		io__write_string("()", !IO)
+        io.write_string("()", !IO)
 	;
 		ArgTypes = [_ | _],
-		io__write_string("(\n\t\t", !IO),
-		ilasm__write_list(ArgTypes, ",\n\t\t", output_param,
-			!Info, !IO),
-		io__write_string("\n\t)", !IO)
+        io.write_string("(\n\t\t", !IO),
+        ilasm.write_list(ArgTypes, ",\n\t\t", output_param, !Info, !IO),
+        io.write_string("\n\t)", !IO)
 	).

 :- pred output_member_name(member_name::in, io::di, io::uo) is det.
@@ -654,10 +713,10 @@
 output_member_name(MethodName, !IO) :-
 	(
 		MethodName = ctor,
-		io__write_string(".ctor", !IO)
+        io.write_string(".ctor", !IO)
 	;
 		MethodName = cctor,
-		io__write_string(".cctor", !IO)
+        io.write_string(".cctor", !IO)
 	;
 		MethodName = id(IlId),
 		output_id(IlId, !IO)
@@ -667,87 +726,86 @@
 	ilasm_info::in, ilasm_info::out, io::di, io::uo) is det.

 output_ret_type(void, !Info, !IO) :-
-	io__write_string("void", !IO).
+    io.write_string("void", !IO).
 output_ret_type(simple_type(Type), !Info, !IO) :-
 	output_simple_type(Type, !Info, !IO).

-:- pred output_local(pair(ilds__id, ilds__type)::in,
+:- pred output_local(pair(ilds.id, il_type)::in,
 	ilasm_info::in, ilasm_info::out, io::di, io::uo) is det.

 output_local(Id - Type, !Info, !IO) :-
 	output_type(Type, !Info, !IO),
-	io__write_string(" ", !IO),
+    io.write_string(" ", !IO),
 	output_id(Id, !IO).

-:- pred output_param(pair(ilds__type, maybe(ilds__id))::in,
+:- pred output_param(pair(il_type, maybe(ilds.id))::in,
 	ilasm_info::in, ilasm_info::out, io::di, io::uo) is det.

 output_param(Type - no, !Info, !IO) :-
 	output_type(Type, !Info, !IO).
 output_param(Type - yes(Id), !Info, !IO) :-
 	output_type(Type, !Info, !IO),
-	io__write_string(" ", !IO),
+    io.write_string(" ", !IO),
 	output_id(Id, !IO).

-:- pred output_type(ilds__type::in, ilasm_info::in, ilasm_info::out,
+:- pred output_type(il_type::in, ilasm_info::in, ilasm_info::out,
 	io::di, io::uo) is det.

-output_type(ilds__type(Modifiers, SimpleType), !Info, !IO) :-
-	io__write_list(Modifiers, " ", output_modifier, !IO),
+output_type(il_type(Modifiers, SimpleType), !Info, !IO) :-
+    io.write_list(Modifiers, " ", output_modifier, !IO),
 	output_simple_type(SimpleType, !Info, !IO).

 :- pred output_simple_type(simple_type::in,
 	ilasm_info::in, ilasm_info::out, io::di, io::uo) is det.

 output_simple_type(int8, !Info, !IO) :-
-	io__write_string("int8", !IO).
+    io.write_string("int8", !IO).
 output_simple_type(int16, !Info, !IO) :-
-	io__write_string("int16", !IO).
+    io.write_string("int16", !IO).
 output_simple_type(int32, !Info, !IO) :-
-	io__write_string("int32", !IO).
+    io.write_string("int32", !IO).
 output_simple_type(int64, !Info, !IO) :-
-	io__write_string("int64", !IO).
+    io.write_string("int64", !IO).
 output_simple_type(uint8, !Info, !IO) :-
-	io__write_string("unsigned int8", !IO).
+    io.write_string("unsigned int8", !IO).
 output_simple_type(uint16, !Info, !IO) :-
-	io__write_string("unsigned int16", !IO).
+    io.write_string("unsigned int16", !IO).
 output_simple_type(uint32, !Info, !IO) :-
-	io__write_string("unsigned int32", !IO).
+    io.write_string("unsigned int32", !IO).
 output_simple_type(uint64, !Info, !IO) :-
-	io__write_string("unsigned int64", !IO).
+    io.write_string("unsigned int64", !IO).
 output_simple_type(native_int, !Info, !IO) :-
-	io__write_string("native int", !IO).
+    io.write_string("native int", !IO).
 output_simple_type(native_uint, !Info, !IO) :-
-	io__write_string("native unsigned int", !IO).
+    io.write_string("native unsigned int", !IO).
 output_simple_type(float32, !Info, !IO) :-
-	io__write_string("float32", !IO).
+    io.write_string("float32", !IO).
 output_simple_type(float64, !Info, !IO) :-
-	io__write_string("float64", !IO).
+    io.write_string("float64", !IO).
 output_simple_type(native_float, !Info, !IO) :-
-	io__write_string("native float", !IO).
+    io.write_string("native float", !IO).
 output_simple_type(bool, !Info, !IO) :-
-	io__write_string("bool", !IO).
+    io.write_string("bool", !IO).
 output_simple_type(char, !Info, !IO) :-
-	io__write_string("char", !IO).
+    io.write_string("char", !IO).
 output_simple_type(object, !Info, !IO) :-
-	io__write_string("object", !IO).
+    io.write_string("object", !IO).
 output_simple_type(string, !Info, !IO) :-
-	io__write_string("string", !IO).
+    io.write_string("string", !IO).
 output_simple_type(refany, !Info, !IO) :-
-	io__write_string("refany", !IO).
+    io.write_string("refany", !IO).
 output_simple_type(class(Name), !Info, !IO) :-
 	( name_to_simple_type(Name, Type) ->
 		( Type = reference(SimpleType) ->
 			output_simple_type(SimpleType, !Info, !IO)
 		;
-				% If it is a value type then we are
-				% refering to the boxed version of the
-				% value type.
-			io__write_string("class ", !IO),
+            % If it is a value type then we are refering
+            % to the boxed version of the value type.
+            io.write_string("class ", !IO),
 			output_structured_name(Name, !.Info, !IO)
 		)
 	;
-		io__write_string("class ", !IO),
+        io.write_string("class ", !IO),
 		output_structured_name(Name, !.Info, !IO)
 	).
 output_simple_type(valuetype(Name), !Info, !IO) :-
@@ -758,21 +816,21 @@
 			unexpected(this_file, "builtin reference type")
 		)
 	;
-		io__write_string("valuetype ", !IO),
+        io.write_string("valuetype ", !IO),
 		output_structured_name(Name, !.Info, !IO)
 	).
 output_simple_type(interface(Name), !Info, !IO) :-
-	io__write_string("interface ", !IO),
+    io.write_string("interface ", !IO),
 	output_structured_name(Name, !.Info, !IO).
 output_simple_type('[]'(Type, Bounds), !Info, !IO) :-
 	output_type(Type, !Info, !IO),
 	output_bounds(Bounds, !IO).
 output_simple_type('*'(Type), !Info, !IO) :-
 	output_type(Type, !Info, !IO),
-	io__write_string("*", !IO).
+    io.write_string("*", !IO).
 output_simple_type('&'(Type), !Info, !IO) :-
 	output_type(Type, !Info, !IO),
-	io__write_string("&", !IO).
+    io.write_string("&", !IO).

 :- type ref_or_value
 	--->	reference(simple_type)
@@ -781,6 +839,7 @@
 	% If possible converts a class name to a simple type and an
 	% indicator of whether or not that simple type is a reference or
 	% value class.
+    %
 :- pred name_to_simple_type(class_name::in, ref_or_value::out) is semidet.

 name_to_simple_type(Name, Type) :-
@@ -846,89 +905,89 @@
 	).

 	% The names are all different if it is an opcode.
-	% There's probably a very implementation dependent reason for
-	% this.
+    % There's probably a very implementation dependent reason for this.
+    %
 :- pred output_simple_type_opcode(simple_type::in, io::di, io::uo) is det.

-output_simple_type_opcode(int8) --> io__write_string("i1").
-output_simple_type_opcode(int16) --> io__write_string("i2").
-output_simple_type_opcode(int32) --> io__write_string("i4").
-output_simple_type_opcode(int64) --> io__write_string("i8").
-output_simple_type_opcode(uint8) --> io__write_string("u1").
-output_simple_type_opcode(uint16) --> io__write_string("u2").
-output_simple_type_opcode(uint32) --> io__write_string("u4").
-output_simple_type_opcode(uint64) --> io__write_string("u8").
-output_simple_type_opcode(native_int) --> io__write_string("i").
-output_simple_type_opcode(native_uint) --> io__write_string("u").
-output_simple_type_opcode(float32) --> io__write_string("r4").
-output_simple_type_opcode(float64) --> io__write_string("r8").
+output_simple_type_opcode(int8) --> io.write_string("i1").
+output_simple_type_opcode(int16) --> io.write_string("i2").
+output_simple_type_opcode(int32) --> io.write_string("i4").
+output_simple_type_opcode(int64) --> io.write_string("i8").
+output_simple_type_opcode(uint8) --> io.write_string("u1").
+output_simple_type_opcode(uint16) --> io.write_string("u2").
+output_simple_type_opcode(uint32) --> io.write_string("u4").
+output_simple_type_opcode(uint64) --> io.write_string("u8").
+output_simple_type_opcode(native_int) --> io.write_string("i").
+output_simple_type_opcode(native_uint) --> io.write_string("u").
+output_simple_type_opcode(float32) --> io.write_string("r4").
+output_simple_type_opcode(float64) --> io.write_string("r8").
 output_simple_type_opcode(native_float) -->
 	{ unexpected(this_file, "unable to create opcode for native_float") }.
 	% XXX should i4 be used for bool?
-output_simple_type_opcode(bool) --> io__write_string("i4").
-output_simple_type_opcode(char) --> io__write_string("i2").
+output_simple_type_opcode(bool) --> io.write_string("i4").
+output_simple_type_opcode(char) --> io.write_string("i2").

-	% all reference types use "ref" as their opcode.
+    % All reference types use "ref" as their opcode.
 	% XXX is "ref" here correct for value classes?
-output_simple_type_opcode(object) --> io__write_string("ref").
-output_simple_type_opcode(string) --> io__write_string("ref").
-output_simple_type_opcode(refany) --> io__write_string("ref").
-output_simple_type_opcode(class(_Name)) --> io__write_string("ref").
-output_simple_type_opcode(valuetype(_Name)) --> io__write_string("ref").
-output_simple_type_opcode(interface(_Name)) --> io__write_string("ref").
-output_simple_type_opcode('[]'(_Type, _Bounds)) --> io__write_string("ref").
-output_simple_type_opcode('*'(_Type)) --> io__write_string("ref").
-output_simple_type_opcode('&'(_Type)) --> io__write_string("ref").
+output_simple_type_opcode(object) --> io.write_string("ref").
+output_simple_type_opcode(string) --> io.write_string("ref").
+output_simple_type_opcode(refany) --> io.write_string("ref").
+output_simple_type_opcode(class(_Name)) --> io.write_string("ref").
+output_simple_type_opcode(valuetype(_Name)) --> io.write_string("ref").
+output_simple_type_opcode(interface(_Name)) --> io.write_string("ref").
+output_simple_type_opcode('[]'(_Type, _Bounds)) --> io.write_string("ref").
+output_simple_type_opcode('*'(_Type)) --> io.write_string("ref").
+output_simple_type_opcode('&'(_Type)) --> io.write_string("ref").

 :- pred output_bounds(bounds::in, io::di, io::uo) is det.

 output_bounds(Bounds, !IO) :-
-	io__write_string("[", !IO),
-	io__write_list(Bounds, ", ", output_bound, !IO),
-	io__write_string("]", !IO).
+    io.write_string("[", !IO),
+    io.write_list(Bounds, ", ", output_bound, !IO),
+    io.write_string("]", !IO).

 :- pred output_bound(bound::in, io::di, io::uo) is det.

 output_bound(upper(X), !IO) :-
-	io__write_int(X, !IO).
+    io.write_int(X, !IO).
 output_bound(lower(X), !IO) :-
-	io__write_int(X, !IO),
-	io__write_string("...", !IO).
+    io.write_int(X, !IO),
+    io.write_string("...", !IO).
 output_bound(between(X, Y), !IO) :-
-	io__write_int(X, !IO),
-	io__write_string("...", !IO),
-	io__write_int(Y, !IO).
-
-:- pred output_modifier(ilds__type_modifier::in, io::di, io::uo) is det.
-
-output_modifier(const)    --> io__write_string("const").
-output_modifier(volatile) --> io__write_string("volatile").
-output_modifier(readonly) --> io__write_string("readonly").
+    io.write_int(X, !IO),
+    io.write_string("...", !IO),
+    io.write_int(Y, !IO).
+
+:- pred output_modifier(ilds.type_modifier::in, io::di, io::uo) is det.
+
+output_modifier(const)    --> io.write_string("const").
+output_modifier(volatile) --> io.write_string("volatile").
+output_modifier(readonly) --> io.write_string("readonly").

 :- pred output_instructions(list(instr)::in, ilasm_info::in, ilasm_info::out,
 	io::di, io::uo) is det.

 output_instructions(Instructions, !Info, !IO) :-
-	globals__io_lookup_bool_option(auto_comments, PrintComments, !IO),
-	globals__io_lookup_bool_option(debug_il_asm, DebugIlAsm, !IO),
+    globals.io_lookup_bool_option(auto_comments, PrintComments, !IO),
+    globals.io_lookup_bool_option(debug_il_asm, DebugIlAsm, !IO),
 	(
 		DebugIlAsm = yes,
-		list__foldl2(output_debug_instruction, Instructions,
-			!Info, !IO)
+        list.foldl2(output_debug_instruction, Instructions, !Info, !IO)
 	;
 		DebugIlAsm = no,
-		list__foldl2(output_instruction(PrintComments), Instructions,
+        list.foldl2(output_instruction(PrintComments), Instructions,
 			!Info, !IO)
 	).

 	% We write each instruction before we execute it.
 	% This is a nice way of debugging IL as it executes, although as
 	% the IL debugger improves we might not need this any more.
+    %
 :- pred output_debug_instruction(instr::in,
 	ilasm_info::in, ilasm_info::out, io::di, io::uo) is det.

 output_debug_instruction(Instr, !Info, !IO) :-
-
+    %
 		% We can't handle tailcalls easily -- you need to put
 		% it out as
 		% 		trace the tail instruction
@@ -936,6 +995,7 @@
 		%		output the tail instruction
 		% 		output the call instruction
 		% For the moment we'll just ignore tailcalls.
+    %
 	( Instr = tailcall ->
 		true
 	; Instr = context(_, _) ->
@@ -943,76 +1003,75 @@
 		true
 	; Instr = start_block(catch(ClassName), Id) ->
 		output_instr(start_block(catch(ClassName), Id), !Info, !IO),
-		io__write_string("\n", !IO),
-		io__write_string("\t", !IO),
+        io.write_string("\n", !IO),
+        io.write_string("\t", !IO),
 		output_trace_instr(Instr, !Info, !IO),
-		io__write_string("\n", !IO)
+        io.write_string("\n", !IO)
 	; Instr = start_block(scope(Locals), Id) ->
-		string__format("{\t// #%d", [i(Id)], S),
-		io__write_string(S, !IO),
-		io__nl(!IO),
+        string.format("{\t// #%d", [i(Id)], S),
+        io.write_string(S, !IO),
+        io.nl(!IO),
 		output_trace(S, !IO),
 		(
 			Locals = []
 		;
 			Locals = [_ | _],
 			% output the .locals decl
-			io__write_string("\t.locals (\n\t\t", !IO),
-			ilasm__write_list(Locals, ",\n\t\t", output_local,
+            io.write_string("\t.locals (\n\t\t", !IO),
+            ilasm.write_list(Locals, ",\n\t\t", output_local,
 				!Info, !IO),
-			io__write_string("\n\t)", !IO),
-			io__write_string("\n", !IO),
+            io.write_string("\n\t)", !IO),
+            io.write_string("\n", !IO),

 				% trace the .locals decl
-			io__write_string("\t\tldstr """, !IO),
-			io__write_string(".locals (\\n\\t\\t", !IO),
-			ilasm__write_list(Locals, ",\\n\\t\\t", output_local,
-				!Info, !IO),
-			io__write_string(")", !IO),
-			io__write_string("\\n""", !IO),
-			io__write_string("\n", !IO),
-			io__write_string("\t\tcall void " ++
+            io.write_string("\t\tldstr """, !IO),
+            io.write_string(".locals (\\n\\t\\t", !IO),
+            ilasm.write_list(Locals, ",\\n\\t\\t", output_local, !Info, !IO),
+            io.write_string(")", !IO),
+            io.write_string("\\n""", !IO),
+            io.write_string("\n", !IO),
+            io.write_string("\t\tcall void " ++
 				"['mscorlib']System.Console::" ++
 				"Write(class ['mscorlib']System.String)\n",
 				!IO)
 		)
 	;
 		output_trace_instr(Instr, !Info, !IO),
-		io__write_string("\t", !IO),
+        io.write_string("\t", !IO),
 		output_instr(Instr, !Info, !IO),
-		io__write_string("\n", !IO)
+        io.write_string("\n", !IO)
 	).

 :- pred output_trace_instr(instr::in, ilasm_info::in, ilasm_info::out,
 	io::di, io::uo) is det.

 output_trace_instr(Instr, !Info, !IO) :-
-	io__write_string("\t\tldstr """, !IO),
+    io.write_string("\t\tldstr """, !IO),
 		% We have to quote loadstrings.
 	( Instr = ldstr(LoadString) ->
-		io__write_string("ldstr \\""", !IO),
+        io.write_string("ldstr \\""", !IO),
 		output_escaped_string(LoadString, '\"', !IO),
-		io__write_string("\\""", !IO)
+        io.write_string("\\""", !IO)
 			% XXX there could be issues with
 			% comments containing embedded newlines
 	; Instr = comment(Comment) ->
-		io__write_string("comment: ", !IO),
-		io__write_string(Comment, !IO)
+        io.write_string("comment: ", !IO),
+        io.write_string(Comment, !IO)
 	;
 		output_instr(Instr, !Info, !IO)
 	),
-	io__write_string("\\n", !IO),
-	io__write_string("""\n", !IO),
-	io__write_string("\t\tcall void ['mscorlib']System.Console::" ++
+    io.write_string("\\n", !IO),
+    io.write_string("""\n", !IO),
+    io.write_string("\t\tcall void ['mscorlib']System.Console::" ++
 		"Write(class ['mscorlib']System.String)\n", !IO).

 :- pred output_trace(string::in, io::di, io::uo) is det.

 output_trace(S, !IO) :-
-	io__write_string("\t\tldstr """, !IO),
-	io__write_string(S, !IO),
-	io__write_string("\\n""\n", !IO),
-	io__write_string("\t\tcall void " ++
+    io.write_string("\t\tldstr """, !IO),
+    io.write_string(S, !IO),
+    io.write_string("\\n""\n", !IO),
+    io.write_string("\t\tcall void " ++
 		"['mscorlib']System.Console::Write(class System.String)\n",
 		!IO).

@@ -1026,141 +1085,141 @@
 	->
 		true
 	;
-		io__write_string("\t", !IO),
+        io.write_string("\t", !IO),
 		output_instr(Instr, !Info, !IO),
-		io__write_string("\n", !IO)
+        io.write_string("\n", !IO)
 	).

 :- pred output_instr(instr::in, ilasm_info::in, ilasm_info::out,
 	io::di, io::uo) is det.

 output_instr(il_asm_code(Code, _MaxStack), !Info, !IO) :-
-	io__write_string(Code, !IO).
+    io.write_string(Code, !IO).
 output_instr(comment(Comment), !Info, !IO) :-
 	output_comment_string(Comment, !IO).
 output_instr(label(Label), !Info, !IO) :-
 	output_label(Label, !IO),
-	io__write_string(":", !IO).
+    io.write_string(":", !IO).
 output_instr(start_block(scope(Locals), Id), !Info, !IO) :-
-	io__write_string("{", !IO),
-	io__write_string("\t// #", !IO),
-	io__write_int(Id, !IO),
+    io.write_string("{", !IO),
+    io.write_string("\t// #", !IO),
+    io.write_int(Id, !IO),
 	(
 		Locals = []
 	;
 		Locals = [_ | _],
-		io__write_string("\n\t.locals (\n\t\t", !IO),
-		ilasm__write_list(Locals, ",\n\t\t", output_local, !Info, !IO),
-		io__write_string("\n\t)\n", !IO)
+        io.write_string("\n\t.locals (\n\t\t", !IO),
+        ilasm.write_list(Locals, ",\n\t\t", output_local, !Info, !IO),
+        io.write_string("\n\t)\n", !IO)
 	).
 output_instr(start_block(try, Id), !Info, !IO) :-
-	io__write_string(".try {", !IO),
-	io__write_string("\t// #", !IO),
-	io__write_int(Id, !IO).
+    io.write_string(".try {", !IO),
+    io.write_string("\t// #", !IO),
+    io.write_int(Id, !IO).
 output_instr(start_block(catch(ClassName), Id), !Info, !IO) :-
-	io__write_string("catch ", !IO),
+    io.write_string("catch ", !IO),
 	output_class_name(ClassName, !Info, !IO),
-	io__write_string(" {", !IO),
-	io__write_string("\t// #", !IO),
-	io__write_int(Id, !IO).
+    io.write_string(" {", !IO),
+    io.write_string("\t// #", !IO),
+    io.write_int(Id, !IO).
 output_instr(end_block(scope(_), Id), !Info, !IO) :-
-	io__write_string("}", !IO),
-	io__write_string("\t// #", !IO),
-	io__write_int(Id, !IO).
+    io.write_string("}", !IO),
+    io.write_string("\t// #", !IO),
+    io.write_int(Id, !IO).
 output_instr(end_block(catch(_), Id), !Info, !IO) :-
-	io__write_string("}", !IO),
-	io__write_string("\t// #", !IO),
-	io__write_int(Id, !IO),
-	io__write_string(" (catch block)", !IO).
+    io.write_string("}", !IO),
+    io.write_string("\t// #", !IO),
+    io.write_int(Id, !IO),
+    io.write_string(" (catch block)", !IO).
 output_instr(end_block(try, Id), !Info, !IO) :-
-	io__write_string("}", !IO),
-	io__write_string("\t// #", !IO),
-	io__write_int(Id, !IO),
-	io__write_string(" (try block)", !IO).
+    io.write_string("}", !IO),
+    io.write_string("\t// #", !IO),
+    io.write_int(Id, !IO),
+    io.write_string(" (try block)", !IO).
 output_instr(context(File, Line), !Info, !IO) :-
-	io_lookup_bool_option(line_numbers, LineNumbers, !IO),
+    globals.io_lookup_bool_option(line_numbers, LineNumbers, !IO),
 	(
 		LineNumbers = yes,
-		io__write_string("\n\t.line ", !IO),
-		io__write_int(Line, !IO),
-		io__write_string(" '", !IO),
-		io__write_string(File, !IO),
-		io__write_string("'", !IO)
+        io.write_string("\n\t.line ", !IO),
+        io.write_int(Line, !IO),
+        io.write_string(" '", !IO),
+        io.write_string(File, !IO),
+        io.write_string("'", !IO)
 	;
 		LineNumbers = no
 	).
 output_instr(call(MethodRef), !Info, !IO) :-
-	io__write_string("call\t", !IO),
+    io.write_string("call\t", !IO),
 	output_methodref(MethodRef, !Info, !IO).
 output_instr(callvirt(MethodRef), !Info, !IO) :-
-	io__write_string("callvirt\t", !IO),
+    io.write_string("callvirt\t", !IO),
 	output_methodref(MethodRef, !Info, !IO).
 output_instr(calli(Signature), !Info, !IO) :-
-	io__write_string("calli\t", !IO),
+    io.write_string("calli\t", !IO),
 	output_name_signature_and_call_conv(Signature, no, "\t\t", !Info, !IO).
 output_instr(ret, !Info, !IO) :-
-	io__write_string("ret", !IO).
+    io.write_string("ret", !IO).
 output_instr(bitwise_and, !Info, !IO) :-
-	io__write_string("and", !IO).
+    io.write_string("and", !IO).
 output_instr(arglist, !Info, !IO) :-
-	io__write_string("arglist", !IO).
+    io.write_string("arglist", !IO).
 output_instr(break, !Info, !IO) :-
-	io__write_string("break", !IO).
+    io.write_string("break", !IO).
 output_instr(ceq, !Info, !IO) :-
-	io__write_string("ceq", !IO).
+    io.write_string("ceq", !IO).
 output_instr(ckfinite, !Info, !IO) :-
-	io__write_string("ckfinite", !IO).
+    io.write_string("ckfinite", !IO).
 output_instr(cpblk, !Info, !IO) :-
-	io__write_string("cpblk", !IO).
+    io.write_string("cpblk", !IO).
 output_instr(dup, !Info, !IO) :-
-	io__write_string("dup", !IO).
+    io.write_string("dup", !IO).
 output_instr(endfilter, !Info, !IO) :-
-	io__write_string("endfilter", !IO).
+    io.write_string("endfilter", !IO).
 output_instr(endfinally, !Info, !IO) :-
-	io__write_string("endfinally", !IO).
+    io.write_string("endfinally", !IO).
 output_instr(initblk, !Info, !IO) :-
-	io__write_string("initblk", !IO).
+    io.write_string("initblk", !IO).
 output_instr(ldnull, !Info, !IO) :-
-	io__write_string("ldnull", !IO).
+    io.write_string("ldnull", !IO).
 output_instr(localloc, !Info, !IO) :-
-	io__write_string("localloc", !IO).
+    io.write_string("localloc", !IO).
 output_instr(neg, !Info, !IO) :-
-	io__write_string("neg", !IO).
+    io.write_string("neg", !IO).
 output_instr(nop, !Info, !IO) :-
-	io__write_string("nop", !IO).
+    io.write_string("nop", !IO).
 output_instr(bitwise_not, !Info, !IO) :-
-	io__write_string("not", !IO).
+    io.write_string("not", !IO).
 output_instr(bitwise_or, !Info, !IO) :-
-	io__write_string("or", !IO).
+    io.write_string("or", !IO).
 output_instr(pop, !Info, !IO) :-
-	io__write_string("pop", !IO).
+    io.write_string("pop", !IO).
 output_instr(shl, !Info, !IO) :-
-	io__write_string("shl", !IO).
+    io.write_string("shl", !IO).
 output_instr(tailcall, !Info, !IO) :-
-	io__write_string("tail.", !IO).
+    io.write_string("tail.", !IO).
 output_instr(volatile, !Info, !IO) :-
-	io__write_string("volatile", !IO).
+    io.write_string("volatile", !IO).
 output_instr(bitwise_xor, !Info, !IO) :-
-	io__write_string("xor", !IO).
+    io.write_string("xor", !IO).
 output_instr(ldlen, !Info, !IO) :-
-	io__write_string("ldlen", !IO).
+    io.write_string("ldlen", !IO).
 output_instr(throw, !Info, !IO) :-
-	io__write_string("throw", !IO).
+    io.write_string("throw", !IO).
 	% There are short forms of various instructions.
 	% The assembler can't generate them for you.
 output_instr(ldarg(index(Index)), !Info, !IO) :-
 	( Index < 4 ->
-		io__write_string("ldarg.", !IO),
-		io__write_int(Index, !IO)
+        io.write_string("ldarg.", !IO),
+        io.write_int(Index, !IO)
 	; Index < 256 ->
-		io__write_string("ldarg.s\t", !IO),
+        io.write_string("ldarg.s\t", !IO),
 		output_index(Index, !IO)
 	;
-		io__write_string("ldarg\t", !IO),
+        io.write_string("ldarg\t", !IO),
 		output_index(Index, !IO)
 	).
 output_instr(ldarg(name(Id)), !Info, !IO) :-
-	io__write_string("ldarg\t", !IO),
+    io.write_string("ldarg\t", !IO),
 	output_id(Id, !IO).

 	% Lots of short forms for loading integer.
@@ -1168,109 +1227,109 @@
 output_instr(ldc(Type, Const), !Info, !IO) :-
 	( ( Type = int32 ; Type = bool ), Const = i(IntConst)  ->
 		( IntConst < 8, IntConst >= 0 ->
-			io__write_string("ldc.i4.", !IO),
-			io__write_int(IntConst, !IO)
+            io.write_string("ldc.i4.", !IO),
+            io.write_int(IntConst, !IO)
 		; IntConst = -1 ->
-			io__write_string("ldc.i4.m1", !IO)
+            io.write_string("ldc.i4.m1", !IO)
 		; IntConst < 128, IntConst > -128 ->
-			io__write_string("ldc.i4.s\t", !IO),
-			io__write_int(IntConst, !IO)
+            io.write_string("ldc.i4.s\t", !IO),
+            io.write_int(IntConst, !IO)
 		;
-		 	io__write_string("ldc.i4\t", !IO),
-			io__write_int(IntConst, !IO)
+            io.write_string("ldc.i4\t", !IO),
+            io.write_int(IntConst, !IO)
 		)
 	; Type = int64, Const = i(IntConst) ->
-		io__write_string("ldc.i8\t", !IO),
-		io__write_int(IntConst, !IO)
+        io.write_string("ldc.i8\t", !IO),
+        io.write_int(IntConst, !IO)
 	; Type = float32, Const = f(FloatConst) ->
-		io__write_string("ldc.r4\t", !IO),
-		c_util__output_float_literal(FloatConst, !IO)
+        io.write_string("ldc.r4\t", !IO),
+        c_util.output_float_literal(FloatConst, !IO)
 	; Type = float64, Const = f(FloatConst) ->
-		io__write_string("ldc.r8\t", !IO),
-		c_util__output_float_literal(FloatConst, !IO)
+        io.write_string("ldc.r8\t", !IO),
+        c_util.output_float_literal(FloatConst, !IO)
 	;
 	 	unexpected(this_file,
 			"Inconsistent arguments in ldc instruction")
 	).

 output_instr(ldstr(String), !Info, !IO) :-
-	io__write_string("ldstr\t", !IO),
+    io.write_string("ldstr\t", !IO),
 	output_string_constant(String, !IO).

 output_instr(add(Overflow, Signed), !Info, !IO) :-
-	io__write_string("add", !IO),
+    io.write_string("add", !IO),
 	output_overflow(Overflow, !IO),
 	output_signed(Signed, !IO).

 output_instr(beq(Target), !Info, !IO) :-
-	io__write_string("beq ", !IO),
+    io.write_string("beq ", !IO),
 	output_target(Target, !IO).

 output_instr(bge(Signed, Target), !Info, !IO) :-
-	io__write_string("bge", !IO),
+    io.write_string("bge", !IO),
 	output_signed(Signed, !IO),
-	io__write_string("\t", !IO),
+    io.write_string("\t", !IO),
 	output_target(Target, !IO).

 output_instr(bgt(Signed, Target), !Info, !IO) :-
-	io__write_string("bgt", !IO),
+    io.write_string("bgt", !IO),
 	output_signed(Signed, !IO),
-	io__write_string("\t", !IO),
+    io.write_string("\t", !IO),
 	output_target(Target, !IO).

 output_instr(ble(Signed, Target), !Info, !IO) :-
-	io__write_string("ble", !IO),
+    io.write_string("ble", !IO),
 	output_signed(Signed, !IO),
-	io__write_string("\t", !IO),
+    io.write_string("\t", !IO),
 	output_target(Target, !IO).

 output_instr(blt(Signed, Target), !Info, !IO) :-
-	io__write_string("blt", !IO),
+    io.write_string("blt", !IO),
 	output_signed(Signed, !IO),
-	io__write_string("\t", !IO),
+    io.write_string("\t", !IO),
 	output_target(Target, !IO).

 output_instr(bne(Signed, Target), !Info, !IO) :-
-	io__write_string("bne", !IO),
+    io.write_string("bne", !IO),
 	output_signed(Signed, !IO),
-	io__write_string("\t", !IO),
+    io.write_string("\t", !IO),
 	output_target(Target, !IO).

 output_instr(br(Target), !Info, !IO) :-
-	io__write_string("br\t", !IO),
+    io.write_string("br\t", !IO),
 	output_target(Target, !IO).

 output_instr(brfalse(Target), !Info, !IO) :-
-	io__write_string("brfalse\t", !IO),
+    io.write_string("brfalse\t", !IO),
 	output_target(Target, !IO).

 output_instr(brtrue(Target), !Info, !IO) :-
-	io__write_string("brtrue\t", !IO),
+    io.write_string("brtrue\t", !IO),
 	output_target(Target, !IO).

 output_instr(cgt(Signed), !Info, !IO) :-
-	io__write_string("cgt", !IO),
+    io.write_string("cgt", !IO),
 	output_signed(Signed, !IO).

 output_instr(clt(Signed), !Info, !IO) :-
-	io__write_string("clt", !IO),
+    io.write_string("clt", !IO),
 	output_signed(Signed, !IO).

 output_instr(conv(SimpleType), !Info, !IO) :-
-	io__write_string("conv.", !IO),
+    io.write_string("conv.", !IO),
 	output_simple_type_opcode(SimpleType, !IO).

 output_instr(div(Signed), !Info, !IO) :-
-	io__write_string("div", !IO),
+    io.write_string("div", !IO),
 	output_signed(Signed, !IO).

 output_instr(jmp(MethodRef), !Info, !IO) :-
-	io__write_string("jmp\t", !IO),
+    io.write_string("jmp\t", !IO),
 	output_methodref(MethodRef, !Info, !IO).

 	% XXX can use short encoding for indexes
 output_instr(ldarga(Variable), !Info, !IO) :-
-	io__write_string("ldarga\t", !IO),
+    io.write_string("ldarga\t", !IO),
 	(
 		Variable = index(Index),
 		output_index(Index, !IO)
@@ -1280,16 +1339,16 @@
 	).

 output_instr(ldftn(MethodRef), !Info, !IO) :-
-	io__write_string("ldftn\t", !IO),
+    io.write_string("ldftn\t", !IO),
 	output_methodref(MethodRef, !Info, !IO).

 output_instr(ldind(SimpleType), !Info, !IO) :-
-	io__write_string("ldind.", !IO),
+    io.write_string("ldind.", !IO),
 	output_simple_type_opcode(SimpleType, !IO).

 	% XXX can use short encoding for indexes
 output_instr(ldloc(Variable), !Info, !IO) :-
-	io__write_string("ldloc\t", !IO),
+    io.write_string("ldloc\t", !IO),
 	(
 		Variable = index(Index),
 		output_index(Index, !IO)
@@ -1300,7 +1359,7 @@

 	% XXX can use short encoding for indexes
 output_instr(ldloca(Variable), !Info, !IO) :-
-	io__write_string("ldloca\t", !IO),
+    io.write_string("ldloca\t", !IO),
 	(
 		Variable = index(Index),
 		output_index(Index, !IO)
@@ -1310,25 +1369,25 @@
 	).

 output_instr(leave(Target), !Info, !IO) :-
-	io__write_string("leave\t", !IO),
+    io.write_string("leave\t", !IO),
 	output_target(Target, !IO).

 output_instr(mul(Overflow, Signed), !Info, !IO) :-
-	io__write_string("mul", !IO),
+    io.write_string("mul", !IO),
 	output_overflow(Overflow, !IO),
 	output_signed(Signed, !IO).

 output_instr(rem(Signed), !Info, !IO) :-
-	io__write_string("rem", !IO),
+    io.write_string("rem", !IO),
 	output_signed(Signed, !IO).

 output_instr(shr(Signed), !Info, !IO) :-
-	io__write_string("shr", !IO),
+    io.write_string("shr", !IO),
 	output_signed(Signed, !IO).

 	% XXX can use short encoding for indexes
 output_instr(starg(Variable), !Info, !IO) :-
-	io__write_string("starg\t", !IO),
+    io.write_string("starg\t", !IO),
 	(
 		Variable = index(Index),
 		output_index(Index, !IO)
@@ -1339,11 +1398,11 @@

 	% XXX can use short encoding for indexes
 output_instr(stind(SimpleType), !Info, !IO) :-
-	io__write_string("stind.", !IO),
+    io.write_string("stind.", !IO),
 	output_simple_type_opcode(SimpleType, !IO).

 output_instr(stloc(Variable), !Info, !IO) :-
-	io__write_string("stloc\t", !IO),
+    io.write_string("stloc\t", !IO),
 	(
 		Variable = index(Index),
 		output_index(Index, !IO)
@@ -1353,77 +1412,77 @@
 	).

 output_instr(sub(OverFlow, Signed), !Info, !IO) :-
-	io__write_string("sub", !IO),
+    io.write_string("sub", !IO),
 	output_overflow(OverFlow, !IO),
 	output_signed(Signed, !IO).

 output_instr(switch(Targets), !Info, !IO) :-
-	io__write_string("switch (", !IO),
-	io__write_list(Targets, ", ", output_target, !IO),
-	io__write_string(")", !IO).
+    io.write_string("switch (", !IO),
+    io.write_list(Targets, ", ", output_target, !IO),
+    io.write_string(")", !IO).

 output_instr(unaligned(_), !Info, !IO) :-
-	io__write_string("unaligned.", !IO).
+    io.write_string("unaligned.", !IO).

 output_instr(box(Type), !Info, !IO) :-
-	io__write_string("box\t", !IO),
+    io.write_string("box\t", !IO),
 	output_type(Type, !Info, !IO).

 output_instr(castclass(Type), !Info, !IO) :-
 	(
-		Type = type(_, '[]'(ElementType, _)),
-		ElementType = type(_, class(Name)),
+        Type = il_type(_, '[]'(ElementType, _)),
+        ElementType = il_type(_, class(Name)),
 		Name = structured_name(assembly("mscorlib"),
 			["System", "Type"], _)
 	->
 		% XXX There is bug where castclass to System.Type[]
 		% sometimes erroneously fails, so we comment out these
 		% castclass's.
-		io__write_string("// ", !IO)
+        io.write_string("// ", !IO)
 	;
 		true
 	),
-	io__write_string("castclass\t", !IO),
+    io.write_string("castclass\t", !IO),
 	output_type(Type, !Info, !IO).

 output_instr(cpobj(Type), !Info, !IO) :-
-	io__write_string("cpobj\t", !IO),
+    io.write_string("cpobj\t", !IO),
 	output_type(Type, !Info, !IO).

 output_instr(initobj(Type), !Info, !IO) :-
-	io__write_string("initobj\t", !IO),
+    io.write_string("initobj\t", !IO),
 	output_type(Type, !Info, !IO).

 output_instr(isinst(Type), !Info, !IO) :-
-	io__write_string("isinst\t", !IO),
+    io.write_string("isinst\t", !IO),
 	output_type(Type, !Info, !IO).

 output_instr(ldelem(SimpleType), !Info, !IO) :-
-	io__write_string("ldelem.", !IO),
+    io.write_string("ldelem.", !IO),
 	output_simple_type_opcode(SimpleType, !IO).

 output_instr(ldelema(Type), !Info, !IO) :-
-	io__write_string("ldelema\t", !IO),
+    io.write_string("ldelema\t", !IO),
 	output_type(Type, !Info, !IO).

 output_instr(ldfld(FieldRef), !Info, !IO) :-
-	io__write_string("ldfld\t", !IO),
+    io.write_string("ldfld\t", !IO),
 	output_fieldref(FieldRef, !Info, !IO).

 output_instr(ldflda(FieldRef), !Info, !IO) :-
-	io__write_string("ldflda\t", !IO),
+    io.write_string("ldflda\t", !IO),
 	output_fieldref(FieldRef, !Info, !IO).

 output_instr(ldobj(Type), !Info, !IO) :-
-	io__write_string("ldobj\t", !IO),
+    io.write_string("ldobj\t", !IO),
 	output_type(Type, !Info, !IO).

 output_instr(ldsfld(FieldRef), !Info, !IO) :-
-	io__write_string("ldsfld\t", !IO),
+    io.write_string("ldsfld\t", !IO),
 	output_fieldref(FieldRef, !Info, !IO).

 output_instr(ldsflda(FieldRef), !Info, !IO) :-
-	io__write_string("ldsflda\t", !IO),
+    io.write_string("ldsflda\t", !IO),
 	output_fieldref(FieldRef, !Info, !IO).

 	% XXX should be implemented
@@ -1431,53 +1490,53 @@
 	sorry(this_file, "output not implemented").

 output_instr(ldvirtftn(MethodRef), !Info, !IO) :-
-	io__write_string("ldvirtftn\t", !IO),
+    io.write_string("ldvirtftn\t", !IO),
 	output_methodref(MethodRef, !Info, !IO).

 output_instr(mkrefany(Type), !Info, !IO) :-
-	io__write_string("mkrefany\t", !IO),
+    io.write_string("mkrefany\t", !IO),
 	output_type(Type, !Info, !IO).

 output_instr(newarr(Type), !Info, !IO) :-
-	io__write_string("newarr\t", !IO),
+    io.write_string("newarr\t", !IO),
 	output_type(Type, !Info, !IO).

 output_instr(newobj(MethodRef), !Info, !IO) :-
-	io__write_string("newobj\t", !IO),
+    io.write_string("newobj\t", !IO),
 	output_methodref(MethodRef, !Info, !IO).

 output_instr(refanytype, !Info, !IO) :-
-	io__write_string("refanytype", !IO).
+    io.write_string("refanytype", !IO).

 output_instr(refanyval(Type), !Info, !IO) :-
-	io__write_string("refanyval\t", !IO),
+    io.write_string("refanyval\t", !IO),
 	output_type(Type, !Info, !IO).

 output_instr(rethrow, !Info, !IO) :-
-	io__write_string("rethrow", !IO).
+    io.write_string("rethrow", !IO).

 output_instr(stelem(SimpleType), !Info, !IO) :-
-	io__write_string("stelem.", !IO),
+    io.write_string("stelem.", !IO),
 	output_simple_type_opcode(SimpleType, !IO).

 output_instr(stfld(FieldRef), !Info, !IO) :-
-	io__write_string("stfld\t", !IO),
+    io.write_string("stfld\t", !IO),
 	output_fieldref(FieldRef, !Info, !IO).

 output_instr(stobj(Type), !Info, !IO) :-
-	io__write_string("stobj\t", !IO),
+    io.write_string("stobj\t", !IO),
 	output_type(Type, !Info, !IO).

 output_instr(sizeof(Type), !Info, !IO) :-
-	io__write_string("sizeof\t", !IO),
+    io.write_string("sizeof\t", !IO),
 	output_type(Type, !Info, !IO).

 output_instr(stsfld(FieldRef), !Info, !IO) :-
-	io__write_string("stsfld\t", !IO),
+    io.write_string("stsfld\t", !IO),
 	output_fieldref(FieldRef, !Info, !IO).

 output_instr(unbox(Type), !Info, !IO) :-
-	io__write_string("unbox\t", !IO),
+    io.write_string("unbox\t", !IO),
 	output_type(Type, !Info, !IO).

 	% XXX might use this later.
@@ -1490,7 +1549,7 @@
 output_overflow(OverFlow, !IO) :-
 	(
 		OverFlow = checkoverflow,
-		io__write_string(".ovf", !IO)
+        io.write_string(".ovf", !IO)
 	;
 		OverFlow = nocheckoverflow
 	).
@@ -1502,13 +1561,13 @@
 		Signed = signed
 	;
 		Signed = unsigned,
-		io__write_string(".un", !IO)
+        io.write_string(".un", !IO)
 	).

 :- pred output_target(target::in, io::di, io::uo) is det.

 output_target(offset_target(Target), !IO) :-
-	io__write_int(Target, !IO).
+    io.write_int(Target, !IO).
 output_target(label_target(Label), !IO) :-
 	output_label(Label, !IO).

@@ -1517,7 +1576,7 @@

 output_fieldref(fieldref(Type, ClassMemberName), !Info, !IO) :-
 	output_type(Type, !Info, !IO),
-	io__write_string("\n\t\t", !IO),
+    io.write_string("\n\t\t", !IO),
 	output_class_member_name(ClassMemberName, !.Info, !IO).

 :- pred output_methodref(methodref::in, ilasm_info::in, ilasm_info::out,
@@ -1527,107 +1586,105 @@
 		ClassMemberName, ArgTypes), !Info, !IO) :-
 	(
 		IsInstance = yes,
-		io__write_string("instance ", !IO)
+        io.write_string("instance ", !IO)
 	;
 		IsInstance = no
 	),
 	output_ret_type(ReturnType, !Info, !IO),
-	io__write_string("\n\t\t", !IO),
+    io.write_string("\n\t\t", !IO),
 	output_class_member_name(ClassMemberName, !.Info, !IO),
 	(
 		ArgTypes = [],
-		io__write_string("()\n", !IO)
+        io.write_string("()\n", !IO)
 	;
 		ArgTypes = [_ | _],
-		io__write_string("(\n\t\t\t", !IO),
-		ilasm__write_list(ArgTypes, ",\n\t\t\t", output_type,
-			!Info, !IO),
-		io__write_string("\n\t\t)", !IO)
+        io.write_string("(\n\t\t\t", !IO),
+        ilasm.write_list(ArgTypes, ",\n\t\t\t", output_type, !Info, !IO),
+        io.write_string("\n\t\t)", !IO)
 	).
 output_methodref(local_method(call_conv(IsInstance, _), ReturnType,
 		MethodName, ArgTypes), !Info, !IO) :-
 	(
 		IsInstance = yes,
-		io__write_string("instance ", !IO)
+        io.write_string("instance ", !IO)
 	;
 		IsInstance = no
 	),
 	output_ret_type(ReturnType, !Info, !IO),
-	io__write_string("\n\t\t", !IO),
+    io.write_string("\n\t\t", !IO),
 	output_member_name(MethodName, !IO),
 	(
 		ArgTypes = [],
-		io__write_string("()\n", !IO)
+        io.write_string("()\n", !IO)
 	;
 		ArgTypes = [_ | _],
-		io__write_string("(\n\t\t\t", !IO),
-		ilasm__write_list(ArgTypes, ",\n\t\t\t", output_type,
-			!Info, !IO),
-		io__write_string("\n\t\t)", !IO)
+        io.write_string("(\n\t\t\t", !IO),
+        ilasm.write_list(ArgTypes, ",\n\t\t\t", output_type, !Info, !IO),
+        io.write_string("\n\t\t)", !IO)
 	).

 :- pred output_classattr(classattr::in, io::di, io::uo) is det.

-output_classattr(abstract) --> io__write_string("abstract").
-output_classattr(ansi) --> io__write_string("ansi").
-output_classattr(auto) --> io__write_string("auto").
-output_classattr(autochar) --> io__write_string("autochar").
-output_classattr(beforefieldinit) --> io__write_string("beforefieldinit").
-output_classattr(explicit) --> io__write_string("explicit").
-output_classattr(interface) --> io__write_string("interface").
-output_classattr(nestedassembly) --> io__write_string("nested assembly").
-output_classattr(nestedfamandassem) --> io__write_string("nested famandassem").
-output_classattr(nestedfamily) --> io__write_string("nested family").
-output_classattr(nestedfamorassem) --> io__write_string("nested famorassem").
-output_classattr(nestedprivate) --> io__write_string("nested private").
-output_classattr(nestedpublic) --> io__write_string("nested public").
-output_classattr(private) --> io__write_string("private").
-output_classattr(public) --> io__write_string("public").
-output_classattr(rtspecialname) --> io__write_string("rtspecialname").
-output_classattr(sealed) --> io__write_string("sealed").
-output_classattr(sequential) --> io__write_string("sequential").
-output_classattr(serializable) --> io__write_string("serializable").
-output_classattr(specialname) --> io__write_string("specialname").
-output_classattr(unicode) --> io__write_string("unicode").
+output_classattr(abstract) --> io.write_string("abstract").
+output_classattr(ansi) --> io.write_string("ansi").
+output_classattr(auto) --> io.write_string("auto").
+output_classattr(autochar) --> io.write_string("autochar").
+output_classattr(beforefieldinit) --> io.write_string("beforefieldinit").
+output_classattr(explicit) --> io.write_string("explicit").
+output_classattr(interface) --> io.write_string("interface").
+output_classattr(nestedassembly) --> io.write_string("nested assembly").
+output_classattr(nestedfamandassem) --> io.write_string("nested famandassem").
+output_classattr(nestedfamily) --> io.write_string("nested family").
+output_classattr(nestedfamorassem) --> io.write_string("nested famorassem").
+output_classattr(nestedprivate) --> io.write_string("nested private").
+output_classattr(nestedpublic) --> io.write_string("nested public").
+output_classattr(private) --> io.write_string("private").
+output_classattr(public) --> io.write_string("public").
+output_classattr(rtspecialname) --> io.write_string("rtspecialname").
+output_classattr(sealed) --> io.write_string("sealed").
+output_classattr(sequential) --> io.write_string("sequential").
+output_classattr(serializable) --> io.write_string("serializable").
+output_classattr(specialname) --> io.write_string("specialname").
+output_classattr(unicode) --> io.write_string("unicode").

-:- pred ilasm__output_assembly_decl(assembly_decl::in,
+:- pred output_assembly_decl(assembly_decl::in,
 	ilasm_info::in, ilasm_info::out, io::di, io::uo) is det.

-ilasm__output_assembly_decl(version(A, B, C, D), !Info, !IO) :-
-	io__format(".ver %d:%d:%d:%d", [i(A), i(B), i(C), i(D)], !IO).
-ilasm__output_assembly_decl(public_key_token(Token), !Info, !IO) :-
-	io__write_string(".publickeytoken = ( ", !IO),
-	io__write_list(Token, " ", output_hexbyte, !IO),
-	io__write_string(" ) ", !IO).
-ilasm__output_assembly_decl(hash(Hash), !Info, !IO) :-
-	io__write_string(".hash = ( ", !IO),
-	io__write_list(Hash, " ", output_hexbyte, !IO),
-	io__write_string(" ) ", !IO).
-ilasm__output_assembly_decl(custom(CustomDecl), !Info, !IO) :-
+output_assembly_decl(version(A, B, C, D), !Info, !IO) :-
+    io.format(".ver %d:%d:%d:%d", [i(A), i(B), i(C), i(D)], !IO).
+output_assembly_decl(public_key_token(Token), !Info, !IO) :-
+    io.write_string(".publickeytoken = ( ", !IO),
+    io.write_list(Token, " ", output_hexbyte, !IO),
+    io.write_string(" ) ", !IO).
+output_assembly_decl(hash(Hash), !Info, !IO) :-
+    io.write_string(".hash = ( ", !IO),
+    io.write_list(Hash, " ", output_hexbyte, !IO),
+    io.write_string(" ) ", !IO).
+output_assembly_decl(custom(CustomDecl), !Info, !IO) :-
 	output_custom_decl(CustomDecl, !Info, !IO).

 :- pred output_custom_decl(custom_decl::in, ilasm_info::in, ilasm_info::out,
 	io::di, io::uo) is det.

 output_custom_decl(custom_decl(Type, MaybeOwner, StringOrBytes), !Info, !IO) :-
-	io__write_string(".custom ", !IO),
+    io.write_string(".custom ", !IO),
 	(
 		MaybeOwner = yes(Owner),
-		io__write_string(" (", !IO),
+        io.write_string(" (", !IO),
 		output_custom_type(Owner, !Info, !IO),
-		io__write_string(") ", !IO)
+        io.write_string(") ", !IO)
 	;
 		MaybeOwner = no
 	),
 	output_custom_type(Type, !Info, !IO),
 	( StringOrBytes = bytes(Bytes) ->
-		io__write_string(" = (", !IO),
-		io__write_list(Bytes, " ", output_hexbyte, !IO),
-		io__write_string(")", !IO)
+        io.write_string(" = (", !IO),
+        io.write_list(Bytes, " ", output_hexbyte, !IO),
+        io.write_string(")", !IO)
 	;
 		sorry(this_file, "custom_decl of this sort")
 	),
-	io__write_string("\n", !IO).
+    io.write_string("\n", !IO).

 :- pred output_custom_type(custom_type::in, ilasm_info::in, ilasm_info::out,
 	io::di, io::uo) is det.
@@ -1640,14 +1697,14 @@
 :- pred output_index(index::in, io::di, io::uo) is det.

 output_index(Index, !IO) :-
-	io__write_int(Index, !IO).
+    io.write_int(Index, !IO).

 :- pred output_string_constant(string::in, io::di, io::uo) is det.

 output_string_constant(String, !IO) :-
-	io__write_string("""", !IO),
+    io.write_string("""", !IO),
 	output_escaped_string(String, '\"', !IO),
-	io__write_string("""", !IO).
+    io.write_string("""", !IO).

 :- pred output_class_member_name(class_member_name::in, ilasm_info::in,
 	io::di, io::uo) is det.
@@ -1655,7 +1712,7 @@
 output_class_member_name(class_member_name(StructuredName, MemberName), Info,
 		!IO) :-
 	output_structured_name(StructuredName, Info, !IO),
-	io__write_string("::", !IO),
+    io.write_string("::", !IO),
 	output_member_name(MemberName, !IO).

 :- pred output_structured_name(structured_name::in, ilasm_info::in,
@@ -1663,7 +1720,7 @@

 output_structured_name(structured_name(Asm, DottedName, NestedClasses), Info,
 		!IO) :-
-	globals__io_lookup_bool_option(separate_assemblies, SeparateAssemblies,
+    globals.io_lookup_bool_option(separate_assemblies, SeparateAssemblies,
 		!IO),
 	(
 		Asm = assembly(Assembly),
@@ -1677,21 +1734,19 @@
 			SeparateAssemblies = no,
 			(
 				Info ^ current_assembly \= "",
-				string__prefix(Module, Info ^ current_assembly)
+                string.prefix(Module, Info ^ current_assembly)
 			->
 				quote_id(Module ++ ".dll", QuotedModuleName),
-				io__format("[.module %s]",
-					[s(QuotedModuleName)], !IO)
+                io.format("[.module %s]", [s(QuotedModuleName)], !IO)
 			;
-				maybe_output_quoted_assembly_name(Assembly,
-					Info, !IO)
+                maybe_output_quoted_assembly_name(Assembly, Info, !IO)
 			)
 		)
 	),
 	output_dotted_name(DottedName, !IO),
 	output_nested_class_quals(NestedClasses, !IO).

-:- pred maybe_output_quoted_assembly_name(ilds__id::in, ilasm_info::in,
+:- pred maybe_output_quoted_assembly_name(ilds.id::in, ilasm_info::in,
 	io::di, io::uo) is det.

 maybe_output_quoted_assembly_name(Assembly, Info, !IO) :-
@@ -1700,7 +1755,7 @@
 		Assembly \= Info ^ current_assembly
 	->
 		quote_id(Assembly, QuotedAssemblyName),
-		io__format("[%s]", [s(QuotedAssemblyName)], !IO)
+        io.format("[%s]", [s(QuotedAssemblyName)], !IO)
 	;
 		true
 	).
@@ -1708,53 +1763,53 @@
 :- pred output_dotted_name(namespace_qual_name::in, io::di, io::uo) is det.

 output_dotted_name(Name, !IO) :-
-	io__write_list(Name, ".", output_id, !IO).
+    io.write_list(Name, ".", output_id, !IO).

 :- pred output_nested_class_quals(nested_class_name::in,
 	io::di, io::uo) is det.

 output_nested_class_quals(Name, !IO) :-
-	list__foldl(
+    list.foldl(
 		(pred(Id::in, IO0::di, IO::uo) is det :-
-			io__write_char('/', IO0, IO1),
+            io.write_char('/', IO0, IO1),
 			output_id(Id, IO1, IO)
 		),
 		Name, !IO).

-:- pred output_id(ilds__id::in, io::di, io::uo) is det.
+:- pred output_id(ilds.id::in, io::di, io::uo) is det.

 output_id(Id, !IO) :-
 	quote_id(Id, QuotedId),
-	io__write_string(QuotedId, !IO).
+    io.write_string(QuotedId, !IO).

 :- pred output_field_initializer(field_initializer::in, io::di, io::uo) is det.

 output_field_initializer(none, !IO).
 output_field_initializer(at(Id), !IO) :-
-	io__write_string(" at ", !IO),
+    io.write_string(" at ", !IO),
 	output_id(Id, !IO).
 output_field_initializer(equals(FieldInit), !IO) :-
-	io__write_string(" = ", !IO),
+    io.write_string(" = ", !IO),
 	output_field_init(FieldInit, !IO).

 :- pred output_field_init(field_init::in, io::di, io::uo) is det.

 output_field_init(binary_float64(Int64), !IO) :-
-	io__write_string("float64(", !IO),
+    io.write_string("float64(", !IO),
 	output_int64(Int64, !IO),
-	io__write_string(")", !IO).
+    io.write_string(")", !IO).
 output_field_init(binary_float32(Int32), !IO) :-
-	io__write_string("float32(", !IO),
+    io.write_string("float32(", !IO),
 	output_int32(Int32, !IO),
-	io__write_string(")", !IO).
+    io.write_string(")", !IO).
 output_field_init(wchar_ptr(String), !IO) :-
-	io__write_string("wchar *(", !IO),
-	io__write(String, !IO),
-	io__write_string(")", !IO).
+    io.write_string("wchar *(", !IO),
+    io.write(String, !IO),
+    io.write_string(")", !IO).
 		% XXX should check for invalid data_items
 output_field_init(data_item(DataItem), !IO) :-
 	( DataItem = char_ptr(String) ->
-		io__write(String, !IO)
+        io.write(String, !IO)
 	;
 		output_data_item(DataItem, !IO)
 	).
@@ -1762,80 +1817,80 @@
 :- pred output_data_body(data_body::in, io::di, io::uo) is det.

 output_data_body(itemlist(DataItemList), !IO) :-
-	io__write_string("{", !IO),
-	io__write_list(DataItemList, ", ", output_data_item, !IO),
-	io__write_string("}", !IO).
+    io.write_string("{", !IO),
+    io.write_list(DataItemList, ", ", output_data_item, !IO),
+    io.write_string("}", !IO).
 output_data_body(item(DataItem), !IO) :-
 	output_data_item(DataItem, !IO).

 :- pred output_data_item(data_item::in, io::di, io::uo) is det.

 output_data_item(float64(Float), !IO) :-
-	io__write_string("float64(", !IO),
+    io.write_string("float64(", !IO),
 	output_float64(Float, !IO),
-	io__write_string(")", !IO).
+    io.write_string(")", !IO).
 output_data_item(float32(Float32), !IO) :-
-	io__write_string("float32(", !IO),
+    io.write_string("float32(", !IO),
 	output_float32(Float32, !IO),
-	io__write_string(")", !IO).
+    io.write_string(")", !IO).
 output_data_item(int64(Int64), !IO) :-
-	io__write_string("int64(", !IO),
+    io.write_string("int64(", !IO),
 	output_int64(Int64, !IO),
-	io__write_string(")", !IO).
+    io.write_string(")", !IO).
 output_data_item(int32(Int32), !IO) :-
-	io__write_string("int32(", !IO),
+    io.write_string("int32(", !IO),
 	output_int32(Int32, !IO),
-	io__write_string(")", !IO).
+    io.write_string(")", !IO).
 output_data_item(int16(Int16), !IO) :-
-	io__write_string("int16(", !IO),
+    io.write_string("int16(", !IO),
 	output_int16(Int16, !IO),
-	io__write_string(")", !IO).
+    io.write_string(")", !IO).
 output_data_item(int8(Int8), !IO) :-
-	io__write_string("int8(", !IO),
+    io.write_string("int8(", !IO),
 	output_int8(Int8, !IO),
-	io__write_string(")", !IO).
+    io.write_string(")", !IO).
 output_data_item(char_ptr(String), !IO) :-
-	io__write_string("char *(", !IO),
-	io__write(String, !IO),
-	io__write_string(")", !IO).
+    io.write_string("char *(", !IO),
+    io.write(String, !IO),
+    io.write_string(")", !IO).
 output_data_item('&'(Id), !IO) :-
-	io__write_string("&(", !IO),
+    io.write_string("&(", !IO),
 	output_id(Id, !IO),
-	io__write_string(")", !IO).
+    io.write_string(")", !IO).
 output_data_item(bytearray(Bytes), !IO) :-
-	io__write_string("bytearray(", !IO),
-	io__write_list(Bytes, " ", output_hexbyte, !IO),
-	io__write_string(")", !IO).
+    io.write_string("bytearray(", !IO),
+    io.write_list(Bytes, " ", output_hexbyte, !IO),
+    io.write_string(")", !IO).

 :- pred output_float64(float64::in, io::di, io::uo) is det.

 output_float64(float64(Float), !IO) :-
-	io__write_float(Float, !IO).
+    io.write_float(Float, !IO).

 :- pred output_float32(float32::in, io::di, io::uo) is det.

 output_float32(float32(Float), !IO) :-
-	io__write_float(Float, !IO).
+    io.write_float(Float, !IO).

 :- pred output_int64(int64::in, io::di, io::uo) is det.

 output_int64(int64(Integer), !IO) :-
-	io__write_string(integer__to_string(Integer), !IO).
+    io.write_string(integer.to_string(Integer), !IO).

 :- pred output_int32(int32::in, io::di, io::uo) is det.

 output_int32(int32(Int), !IO) :-
-	io__write_int(Int, !IO).
+    io.write_int(Int, !IO).

 :- pred output_int16(int16::in, io::di, io::uo) is det.

 output_int16(int16(Int), !IO) :-
-	io__write_int(Int, !IO).
+    io.write_int(Int, !IO).

 :- pred output_int8(int8::in, io::di, io::uo) is det.

 output_int8(int8(Int), !IO) :-
-	io__write_int(Int, !IO).
+    io.write_int(Int, !IO).

 :- pred output_byte(byte::in, io::di, io::uo) is det.

@@ -1845,43 +1900,44 @@
 :- pred output_hexbyte(byte::in, io::di, io::uo) is det.

 output_hexbyte(int8(Int), !IO) :-
-	string__int_to_base_string(Int, 16, Tmp),
-	io__write_string(Tmp, !IO).
+    string.int_to_base_string(Int, 16, Tmp),
+    io.write_string(Tmp, !IO).

 :- pred output_comment_string(string::in, io::di, io::uo) is det.

 output_comment_string(Comment, !IO) :-
-	io__write_string("// ", !IO),
+    io.write_string("// ", !IO),
 	CommentDoc = separated(text, line,
-		string__words((pred('\n'::in) is semidet :- true), Comment)),
+        string.words((pred('\n'::in) is semidet :- true), Comment)),
 	Doc = label("\t// ", CommentDoc),
 	write(70, Doc, !IO).

 	% We need to quote all the IDs we output to avoid bumping into
 	% keywords that assembler uses (there are a lot of them, and
 	% there is no list available).
-:- pred quote_id(ilds__id::in, string::out) is det.
+:- pred quote_id(ilds.id::in, string::out) is det.

 quote_id(Id, QuotedId) :-
 	escape_string(Id, '\'', EscapedId),
-	string__append_list(["'", EscapedId, "'"], QuotedId).
+    string.append_list(["'", EscapedId, "'"], QuotedId).

 :- pred output_escaped_string(string::in, char::in, io::di, io::uo) is det.

 output_escaped_string(String, EscapeChar, !IO) :-
 	escape_string(String, EscapeChar, EscapedString),
-	io__write_string(EscapedString, !IO).
+    io.write_string(EscapedString, !IO).

 	% Replace all Rep0 with backslash quoted Rep0 in Str0,
 	% giving the escaped string Str.
 	% We also escape embedded newlines and other characters.
 	% We already do some name mangling during code generation that
 	% means we avoid most weird characters here.
+    %
 :- pred escape_string(string::in, char::in, string::out) is det.

 escape_string(Str0, ReplaceChar, Str) :-
-	string__to_char_list(Str0, CharList0),
-	list__foldl(
+    string.to_char_list(Str0, CharList0),
+    list.foldl(
 		(pred(Char::in, E0::in, E::out) is det :-
 			( escape_special_char(Char, QuoteChar) ->
 				E = [QuoteChar, '\\' | E0]
@@ -1891,10 +1947,11 @@
 				E = [Char | E0]
 			)
 		), CharList0, [], CharList),
-	string__from_rev_char_list(CharList, Str).
+    string.from_rev_char_list(CharList, Str).

 	% Characters that should be escaped in strings, and the
 	% character to escape with.
+    %
 :- pred escape_special_char(char::in, char::out) is semidet.

 escape_special_char('\\', '\\').
@@ -1902,8 +1959,12 @@
 escape_special_char('\t', 't').
 escape_special_char('\b', 'b').

+%-----------------------------------------------------------------------------%
+
 :- func this_file = string.

 this_file = "ilasm.m".

+%-----------------------------------------------------------------------------%
 :- end_module ilasm.
+%-----------------------------------------------------------------------------%
Index: ilds.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ilds.m,v
retrieving revision 1.23
diff -u -b -r1.23 ilds.m
--- ilds.m	28 Nov 2005 04:11:42 -0000	1.23
+++ ilds.m	14 Mar 2006 12:52:12 -0000
@@ -22,7 +22,7 @@
 %
 %-----------------------------------------------------------------------------%

-:- module ml_backend__ilds.
+:- module ml_backend.ilds.
 :- interface.

 :- import_module assoc_list.
@@ -34,13 +34,13 @@

     % Returns the maximum stack usage of a list of IL instructions.
     %
-:- func calculate_max_stack(list(ilds__instr)) = int.
+:- func calculate_max_stack(list(ilds.instr)) = int.

     % A method parameter.
     %
 :- type param == pair(
-            ilds__type,     % type of the parameter
-            maybe(ilds__id) % name of the parameter (if any)
+            il_type,       % Type of the parameter.
+            maybe(ilds.id) % Name of the parameter (if any).
         ).

     % A method signature.
@@ -59,25 +59,25 @@
                 call_conv,
                 ret_type,
                 class_member_name,
-                list(ilds__type)
+                list(il_type)
             )
 %   ;       methodref(
 %               call_conv,
 %               ret_type,
 %               class_name,
-%               list(ilds__type)
+%               list(il_type)
 %           )
     ;       local_method(
                 call_conv,
                 ret_type,
                 member_name,
-                list(ilds__type)
+                list(il_type)
             ).

     % A field reference.
     %
 :- type fieldref
-    --->    fieldref(ilds__type, class_member_name).
+    --->    fieldref(il_type, class_member_name).

 %-----------------------------------------------------------------------------%

@@ -108,16 +108,16 @@
     %
 :- type assembly_name
     --->    module(
-                il_module_name              :: ilds__id,
-                containing_assembly_name    :: ilds__id
+                il_module_name              :: ilds.id,
+                containing_assembly_name    :: ilds.id

             )
     ;       assembly(
-                ilds__id
+                ilds.id
             ).

-:- type namespace_qual_name == list(ilds__id).
-:- type nested_class_name == list(ilds__id).
+:- type namespace_qual_name == list(ilds.id).
+:- type nested_class_name == list(ilds.id).

     % An assembly- and namespace-qualified class name is a structured name.
     % E.g. the ILASM name [Foo]Bar1.Bar2.Baz1/Baz2/Quux is
@@ -152,7 +152,7 @@
     ;       cctor           % class constructor (initializes
                             % non-instance fields).

-    ;       id(ilds__id).   % ordinary method or field name
+    ;       id(ilds.id).   % ordinary method or field name

     % Calling conventions.
     %
@@ -180,10 +180,10 @@
     --->    void
     ;       simple_type(simple_type).

-:- type ilds__type
-    --->    ilds__type(list(ilds__type_modifier), simple_type).
+:- type il_type
+    --->    il_type(list(ilds.type_modifier), simple_type).

-:- type ilds__type_modifier
+:- type ilds.type_modifier
     --->    const
     ;       readonly
     ;       volatile.
@@ -210,9 +210,9 @@
     ;       class(class_name)
     ;       valuetype(class_name)
     ;       interface(class_name)
-    ;       '[]'(ilds__type, bounds)    % An array.
-    ;       '&'(ilds__type)             % A managed pointer.
-    ;       '*'(ilds__type).            % A transient pointer (could become
+    ;       '[]'(il_type, bounds)       % An array.
+    ;       '&'(il_type)                % A managed pointer.
+    ;       '*'(il_type).               % A transient pointer (could become
                                          % managed or unmanaged depending on
                                          % usage).

@@ -227,7 +227,7 @@
     % This initial character can be followed by any number of alphabetic
     % characters, decimal digits, ">", "<", or "_".
     %
-:- type ilds__id == string.
+:- type ilds.id == string.

     % XXX Should really limit this, but we don't really support
     % the alignment instruction just yet.
@@ -248,7 +248,7 @@
     % A variable (local or argument) can be referred to by name or index
     %
 :- type variable
-    --->    name(ilds__id)
+    --->    name(ilds.id)
     ;       index(index).

 :- type index == int.
@@ -260,7 +260,7 @@
     % Local variables, they all have names.
     % This should probably be the same as params.
     %
-:- type locals == assoc_list(ilds__id, ilds__type).
+:- type locals == assoc_list(ilds.id, il_type).

     % Blocks can be just scope for locals, can surround a block of
     % handwritten code, or can introduce try or catch code.
@@ -359,36 +359,36 @@

     % OBJECT MODEL INSTRUCTIONS

-    ;       box(ilds__type)         % convert pointer to reference
+    ;       box(il_type)            % convert pointer to reference
     ;       callvirt(methodref)     % call a method associated with obj
-    ;       castclass(ilds__type)   % cast obj to class
-    ;       cpobj(ilds__type)       % copy a value type
-    ;       initobj(ilds__type)     % initialize a value type
-    ;       isinst(ilds__type)      % test if obj is an instance
+    ;       castclass(il_type)        % cast obj to class
+    ;       cpobj(ilds.il_type)       % copy a value type
+    ;       initobj(il_type)          % initialize a value type
+    ;       isinst(il_type)           % test if obj is an instance
     ;       ldelem(simple_type)     % load an element of an array
-    ;       ldelema(ilds__type)     % load address of element of array
+    ;       ldelema(ilds.il_type)     % load address of element of array
     ;       ldfld(fieldref)         % load value of field of obj
     ;       ldflda(fieldref)        % load field address of obj
     ;       ldlen                   % load length of array
-    ;       ldobj(ilds__type)       % copy value type to stack
+    ;       ldobj(ilds.il_type)       % copy value type to stack
     ;       ldsfld(fieldref)        % load static field of a class
     ;       ldsflda(fieldref)       % load static field address
     ;       ldstr(string)           % load a literal string
     ;       ldtoken(signature)      % load runtime rep of metadata token
     ;       ldvirtftn(methodref)    % push a pointer to a virtual method
-    ;       mkrefany(ilds__type)    % push a refany pointer of type class
-    ;       newarr(ilds__type)      % create a zero based 1D array
+    ;       mkrefany(ilds.il_type)    % push a refany pointer of type class
+    ;       newarr(ilds.il_type)      % create a zero based 1D array
     ;       newobj(methodref)       % create new obj and call constructor
     ;       refanytype              % extract type info from refany nth arg
-    ;       refanyval(ilds__type)   % extract type info from refany nth arg
+    ;       refanyval(ilds.il_type)   % extract type info from refany nth arg
     ;       rethrow                 % rethrow an exception
-    ;       sizeof(ilds__type)      % push the sizeof a value type
+    ;       sizeof(ilds.il_type)      % push the sizeof a value type
     ;       stelem(simple_type)     % store an element of an array
     ;       stfld(fieldref)         % store into a field of an object
-    ;       stobj(ilds__type)
+    ;       stobj(ilds.il_type)
     ;       stsfld(fieldref)        % replace the value of field with val
     ;       throw                   % throw an exception
-    ;       unbox(ilds__type).      % convert boxed value type to raw form
+    ;       unbox(ilds.il_type).      % convert boxed value type to raw form

     % Locations marked as dead by ann_dead -- positive numbers are stack slots,
     % negative numbers are locals.
@@ -409,25 +409,25 @@

     % Get the namespace portion of a class name.
     %
-:- func get_class_namespace(ilds__class_name) = ilds__namespace_qual_name.
+:- func get_class_namespace(ilds.class_name) = ilds.namespace_qual_name.

     % Get the non-namespace portion of a class name.
     %
-:- func get_class_suffix(ilds__class_name) = list(ilds__id).
+:- func get_class_suffix(ilds.class_name) = list(ilds.id).

     % Add an extra identifier to the end of an IL namespace name, e.g.
     % append Foo to [mercury]mercury.runtime to make
     % [mercury]mercury.runtime.Foo
     %
-:- func append_toplevel_class_name(ilds__namespace_name, ilds__id) =
-    ilds__class_name.
+:- func append_toplevel_class_name(ilds.namespace_name, ilds.id) =
+    ilds.class_name.

     % Add an extra identifier to the end of an IL class name, e.g.
     % append Bar to [mercury]mercury.runtime.Foo to make
     % [mercury]mercury.runtime.Foo/Bar
     %
-:- func append_nested_class_name(ilds__class_name, ilds__nested_class_name) =
-    ilds__class_name.
+:- func append_nested_class_name(ilds.class_name, ilds.nested_class_name) =
+    ilds.class_name.

 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
@@ -443,7 +443,7 @@
 get_class_suffix(structured_name(_, OuterClassFullName, NestedClass))
         = SuffixName :-
     (
-        list__last(OuterClassFullName, Last)
+        list.last(OuterClassFullName, Last)
     ->
         SuffixName = [Last | NestedClass]
     ;
@@ -453,8 +453,8 @@

 get_class_namespace(structured_name(_, FullName, _)) = NamespaceName :-
     (
-        list__last(FullName, Last),
-        list__remove_suffix(FullName, [Last], NamespaceName0)
+        list.last(FullName, Last),
+        list.remove_suffix(FullName, [Last], NamespaceName0)
     ->
         NamespaceName0 = NamespaceName
     ;
@@ -466,7 +466,7 @@
         Class) = structured_name(Assembly, ClassName, []) :-
     expect(unify(NestedClass, []), this_file,
         "append_toplevel_class_name: namespace name has nested class?"),
-    list__append(Namespace, [Class], ClassName).
+    list.append(Namespace, [Class], ClassName).

 append_nested_class_name(StructuredName0, ExtraNestedClasses)
         = StructuredName :-
@@ -477,7 +477,7 @@
 calculate_max_stack(Instrs) =
     calculate_max_stack_2(Instrs, 0, 0).

-:- func calculate_max_stack_2(list(ilds__instr), int, int) = int.
+:- func calculate_max_stack_2(list(ilds.instr), int, int) = int.

 calculate_max_stack_2([], _, Max) = Max.
 calculate_max_stack_2([I | Instrs], Current, Max) =
@@ -504,7 +504,7 @@
     % Stack height is measured in stack items (each item can be a different
     % size in bits).
     %
-:- func get_stack_difference(ilds__instr) = int.
+:- func get_stack_difference(ilds.instr) = int.

 get_stack_difference(end_block(_, _))           = 0.
 get_stack_difference(comment(_))                = 0.
Index: mlds_to_il.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds_to_il.m,v
retrieving revision 1.157
diff -u -b -r1.157 mlds_to_il.m
--- mlds_to_il.m	27 Jan 2006 05:52:04 -0000	1.157
+++ mlds_to_il.m	14 Mar 2006 13:47:15 -0000
@@ -33,7 +33,7 @@
 %   - type class hierarchies don't work due to unimplemented pragma
 %     foreign code.
 %   - should be implemented as interfaces
-% [ ] RTTI (io__write -- about half the work required for this is done)
+% [ ] RTTI (io.write -- about half the work required for this is done)
 % [ ] High-level RTTI data
 % [ ] Test unused mode (we seem to create a byref for it)
 % [ ] auto dependency generation for IL and assembler
@@ -57,7 +57,7 @@
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%

-:- module ml_backend__mlds_to_il.
+:- module ml_backend.mlds_to_il.
 :- interface.

 :- import_module hlds.hlds_pred. % for `pred_proc_id'.
@@ -78,7 +78,7 @@
     %
     % This is where all the action is for the IL backend.
     %
-:- pred generate_il(mlds::in, list(ilasm__decl)::out,
+:- pred generate_il(mlds::in, list(ilasm.decl)::out,
     set(foreign_language)::out, io::di, io::uo) is det.

 %-----------------------------------------------------------------------------%
@@ -91,52 +91,53 @@
     % XXX we should reduce the dependencies here to a bare minimum.

 :- func params_to_il_signature(il_data_rep, mlds_module_name,
-    mlds__func_params) = signature.
+    mlds.func_params) = signature.

     % Generate an IL identifier for a pred label.
-:- pred predlabel_to_id(mlds__pred_label, proc_id,
-    maybe(mlds__func_sequence_num), ilds__id).
-:- mode predlabel_to_id(in, in, in, out) is det.
+    %
+:- pred predlabel_to_id(mlds.pred_label::in, proc_id::in,
+    maybe(mlds.func_sequence_num)::in, ilds.id::out) is det.

     % Generate an IL identifier for a MLDS var.
-:- pred mangle_mlds_var(mlds__var, ilds__id).
-:- mode mangle_mlds_var(in, out) is det.
+    %
+:- pred mangle_mlds_var(mlds.var::in, ilds.id::out) is det.

     % This type stores information affecting our IL data representation.
+    %
 :- type il_data_rep
     --->    il_data_rep(
-                highlevel_data  :: bool,        % do we use high-level data?
-                il_envptr_type :: ilds__type    % what IL type do we use for
-                                                % mlds__generic_env_ptr_type?
+                highlevel_data  :: bool,        % Do we use high-level data?
+                il_envptr_type  :: il_type      % What IL type do we use for
+                                                % mlds.generic_env_ptr_type?
             ).

-:- pred get_il_data_rep(il_data_rep::out, io__state::di, io__state::uo) is det.
+:- pred get_il_data_rep(il_data_rep::out, io::di, io::uo) is det.

     % Get the corresponding ILDS type for an MLDS type
     % (this depends on which representation you happen to be using).
     %
-:- func mlds_type_to_ilds_type(il_data_rep, mlds_type) = ilds__type.
+:- func mlds_type_to_ilds_type(il_data_rep, mlds_type) = il_type.

     % Get the corresponding ILDS class name for an MLDS type
     % (this depends on which representation you happen to be using).
     %
 :- func mlds_type_to_ilds_class_name(il_data_rep, mlds_type) =
-    ilds__class_name.
+    ilds.class_name.

     % Turn a proc name into an IL class_name and a method name.
     %
-:- pred mangle_mlds_proc_label(mlds__qualified_proc_label,
-    maybe(mlds__func_sequence_num), ilds__class_name, ilds__id).
-:- mode mangle_mlds_proc_label(in, in, out, out) is det.
+:- pred mangle_mlds_proc_label(mlds.qualified_proc_label::in,
+    maybe(mlds.func_sequence_num)::in, ilds.class_name::out, ilds.id::out)
+    is det.

     % class_name(Module, Name) returns a class name representing
     % Name in the module Module.
     %
-:- func class_name(mlds_module_name, string) = ilds__class_name.
+:- func class_name(mlds_module_name, string) = ilds.class_name.

     % Return the class_name for the generic class.
     %
-:- func il_generic_class_name = ilds__class_name.
+:- func il_generic_class_name = ilds.class_name.

 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
@@ -153,7 +154,6 @@
 :- import_module hlds.code_model.
 :- import_module hlds.passes_aux.
 :- import_module libs.compiler_util.
-:- import_module libs.globals.
 :- import_module libs.options.
 :- import_module libs.tree.
 :- import_module mdbcomp.prim_data.
@@ -169,27 +169,28 @@
 :- import_module parse_tree.prog_util.

 :- import_module assoc_list.
-:- import_module bool.
 :- import_module counter.
 :- import_module int.
 :- import_module library.
-:- import_module list.
 :- import_module map.
-:- import_module set.
 :- import_module string.
 :- import_module term.

+%-----------------------------------------------------------------------------%
+
     % We build up lists of instructions using a tree to make
     % insertion easy.
+    %
 :- type instr_tree == tree(list(instr)).

     % The state of the il code generator.
+    %
 :- type il_info
     --->    il_info(
                 % file-wide attributes (all static)
                 module_name         :: mlds_module_name,
-                assembly_name       :: ilds__id,
-                imports             :: mlds__imports,
+                assembly_name       :: ilds.id,
+                imports             :: mlds.imports,
                 file_foreign_langs  :: set(foreign_language),
                                     % file foreign code

@@ -229,9 +230,9 @@
                 signature           :: signature        % current return type
             ).

-:- type locals_map == map(ilds__id, mlds_type).
-:- type arguments_map == assoc_list(ilds__id, mlds_type).
-:- type mlds_vartypes == map(ilds__id, mlds_type).
+:- type locals_map == map(ilds.id, mlds_type).
+:- type arguments_map == assoc_list(ilds.id, mlds_type).
+:- type mlds_vartypes == map(ilds.id, mlds_type).
 :- type field_names_set == set(string).

 %-----------------------------------------------------------------------------%
@@ -245,7 +246,7 @@
     ;
         MaybeVersion = no,
         ILAsm = [],
-        ForeignLangs = set__init
+        ForeignLangs = set.init
     ).

 :- pred maybe_get_dotnet_library_version(maybe(assembly_decl)::out,
@@ -255,11 +256,11 @@
     io_lookup_string_option(dotnet_library_version, VersionStr, !IO),
     IsSep = (pred(('.')::in) is semidet),
     (
-        string__words(IsSep, VersionStr) = [Mj, Mn, Bu, Rv],
-        string__to_int(Mj, Major),
-        string__to_int(Mn, Minor),
-        string__to_int(Bu, Build),
-        string__to_int(Rv, Revision)
+        string.words(IsSep, VersionStr) = [Mj, Mn, Bu, Rv],
+        string.to_int(Mj, Major),
+        string.to_int(Mn, Minor),
+        string.to_int(Bu, Build),
+        string.to_int(Rv, Revision)
     ->
         Version = version(Major, Minor, Build, Revision),
         MaybeVersion = yes(Version)
@@ -270,13 +271,13 @@
             words("`" ++ VersionStr ++ "'"),
             words("passed to `--dotnet-library-version'.")
             ], !IO),
-        io__set_exit_status(1, !IO)
+        io.set_exit_status(1, !IO)
     ).

 %-----------------------------------------------------------------------------%

 :- pred generate_il(mlds::in, assembly_decl::in,
-    list(ilasm__decl)::out, set(foreign_language)::out,
+    list(ilasm.decl)::out, set(foreign_language)::out,
     io::di, io::uo) is det.

 generate_il(MLDS, Version, ILAsm, ForeignLangs, !IO) :-
@@ -285,31 +286,31 @@
         transform_mlds(MLDS),

     ModuleName = mercury_module_name_to_mlds(MercuryModuleName),
-    mdbcomp__prim_data__sym_name_to_string(
-        mlds_module_name_to_sym_name(ModuleName), ".", AssemblyName),
+    prim_data.sym_name_to_string(mlds_module_name_to_sym_name(ModuleName),
+        ".", AssemblyName),
     get_il_data_rep(ILDataRep, !IO),
-    globals__io_lookup_bool_option(debug_il_asm, DebugIlAsm, !IO),
-    globals__io_lookup_bool_option(verifiable_code,
+    globals.io_lookup_bool_option(debug_il_asm, DebugIlAsm, !IO),
+    globals.io_lookup_bool_option(verifiable_code,
             VerifiableCode, !IO),
-    globals__io_lookup_bool_option(il_byref_tailcalls, ByRefTailCalls, !IO),
-    globals__io_lookup_bool_option(sign_assembly, SignAssembly, !IO),
-    globals__io_lookup_bool_option(separate_assemblies, SeparateAssemblies,
+    globals.io_lookup_bool_option(il_byref_tailcalls, ByRefTailCalls, !IO),
+    globals.io_lookup_bool_option(sign_assembly, SignAssembly, !IO),
+    globals.io_lookup_bool_option(separate_assemblies, SeparateAssemblies,
         !IO),
-    globals__io_lookup_bool_option(support_ms_clr, MsCLR, !IO),
-    globals__io_lookup_bool_option(support_rotor_clr, RotorCLR, !IO),
+    globals.io_lookup_bool_option(support_ms_clr, MsCLR, !IO),
+    globals.io_lookup_bool_option(support_rotor_clr, RotorCLR, !IO),

     IlInfo0 = il_info_init(ModuleName, AssemblyName, Imports, ILDataRep,
         DebugIlAsm, VerifiableCode, ByRefTailCalls, MsCLR, RotorCLR),

     % Generate code for all the methods.
-    list__map_foldl(mlds_defn_to_ilasm_decl, Defns, ILDecls,
+    list.map_foldl(mlds_defn_to_ilasm_decl, Defns, ILDecls,
         IlInfo0, IlInfo),

-    list__filter(has_foreign_code_defined(ForeignCode),
+    list.filter(has_foreign_code_defined(ForeignCode),
         [managed_cplusplus, csharp], ForeignCodeLangs),

     ForeignLangs = IlInfo ^ file_foreign_langs `union`
-        set__list_to_set(ForeignCodeLangs),
+        set.list_to_set(ForeignCodeLangs),

     ClassName = mlds_module_name_to_class_name(ModuleName),
     ClassName = structured_name(_, NamespaceName, _),
@@ -341,33 +342,33 @@
         %
         % If not in the library, but we have foreign code, declare the foreign
         % module as an assembly we reference.
-        list__map(
+        list.map(
             (pred(F::in, I::out) is det :-
                 mangle_foreign_code_module(F, ModuleName, N),
                 I = mercury_import(compiler_visible_interface, N)
             ),
-            set__to_sorted_list(ForeignLangs),
+            set.to_sorted_list(ForeignLangs),
             ForeignCodeAssemblerRefs),
-        AssemblerRefs = list__append(ForeignCodeAssemblerRefs, Imports)
+        AssemblerRefs = list.append(ForeignCodeAssemblerRefs, Imports)
     ),
     generate_extern_assembly(AssemblyName, Version, SignAssembly,
         SeparateAssemblies, AssemblerRefs, ExternAssemblies),
     Namespace = [namespace(NamespaceName, ILDecls)],
-    ILAsm = list__condense([ThisAssembly, ExternAssemblies, Namespace]).
+    ILAsm = list.condense([ThisAssembly, ExternAssemblies, Namespace]).

 get_il_data_rep(ILDataRep, !IO) :-
-    globals__io_get_globals(Globals, !IO),
-    globals__lookup_bool_option(Globals, highlevel_data, HighLevelData),
+    globals.io_get_globals(Globals, !IO),
+    globals.lookup_bool_option(Globals, highlevel_data, HighLevelData),
     ILEnvPtrType = choose_il_envptr_type(Globals),
     ILDataRep = il_data_rep(HighLevelData, ILEnvPtrType).

 :- pred has_foreign_code_defined(
-        map(foreign_language, mlds__foreign_code)::in,
+        map(foreign_language, mlds.foreign_code)::in,
         foreign_language::in) is semidet.

 has_foreign_code_defined(ForeignCodeMap, Lang) :-
-    ForeignCode = map__search(ForeignCodeMap, Lang),
-    ForeignCode = mlds__foreign_code(Decls, Imports, Codes, Exports),
+    ForeignCode = map.search(ForeignCodeMap, Lang),
+    ForeignCode = mlds.foreign_code(Decls, Imports, Codes, Exports),
     ( Decls = [_ | _]
     ; Imports = [_ | _]
     ; Codes = [_ | _]
@@ -377,45 +378,45 @@
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%

-    % Move all the top level methods and data definitions into the
-    % wrapper class, and then fix all the references so that
-    % they refer to their new names.
+    % Move all the top level methods and data definitions into the wrapper
+    % class, and then fix all the references so that they refer to their new
+    % names.
     %
 :- func transform_mlds(mlds) = mlds.

 transform_mlds(MLDS0) = MLDS :-
-    AllExports = list__condense(
-        list__map(
-            (func(mlds__foreign_code(_, _, _, Exports)) = Exports),
-            map__values(MLDS0 ^ foreign_code))
+    AllExports = list.condense(
+        list.map(
+            (func(mlds.foreign_code(_, _, _, Exports)) = Exports),
+            map.values(MLDS0 ^ foreign_code))
         ),

     % Generate the exports for this file, they will be placed into
     % class methods inside the wrapper class.
-    list__map(mlds_export_to_mlds_defn, AllExports, ExportDefns),
+    list.map(mlds_export_to_mlds_defn, AllExports, ExportDefns),

-    list__filter((pred(D::in) is semidet :-
-            ( D = mlds__defn(_, _, _, mlds__function(_, _, _, _))
-            ; D = mlds__defn(_, _, _, mlds__data(_, _, _))
+    list.filter((pred(D::in) is semidet :-
+            ( D = mlds.defn(_, _, _, mlds.function(_, _, _, _))
+            ; D = mlds.defn(_, _, _, mlds.data(_, _, _))
             )
         ), MLDS0 ^ defns ++ ExportDefns, MercuryCodeMembers, Others),
     WrapperClass = wrapper_class(
-        list__map(rename_defn, MercuryCodeMembers)),
+        list.map(rename_defn, MercuryCodeMembers)),
     % Note that ILASM requires that the type definitions in Others
     % must precede the references to those types in WrapperClass.
-    MLDS = MLDS0 ^ defns := list__map(rename_defn, Others) ++ [WrapperClass].
+    MLDS = MLDS0 ^ defns := list.map(rename_defn, Others) ++ [WrapperClass].

-:- func wrapper_class(mlds__defns) = mlds__defn.
+:- func wrapper_class(mlds.defns) = mlds.defn.

 wrapper_class(Members) =
-    mlds__defn(
+    mlds.defn(
         export(wrapper_class_name),
-        mlds__make_context(term__context_init),
+        mlds.make_context(term.context_init),
         ml_gen_type_decl_flags,
-        mlds__class(mlds__class_defn(mlds__package, [], [], [], [], Members))
+        mlds.class(mlds.class_defn(mlds.package, [], [], [], [], Members))
     ).

-:- func rename_defn(mlds__defn) = mlds__defn.
+:- func rename_defn(mlds.defn) = mlds.defn.

 rename_defn(defn(Name, Context, Flags, Entity0))
         = defn(Name, Context, Flags, Entity) :-
@@ -440,12 +441,11 @@
         ClassDefn = class_defn(Kind, Imports, Inherits, Implements,
             Ctors, Members),
         Entity = class(class_defn(Kind, Imports, Inherits, Implements,
-            list__map(rename_defn, Ctors),
-            list__map(rename_defn, Members)))
+            list.map(rename_defn, Ctors),
+            list.map(rename_defn, Members)))
     ).

-:- func rename_maybe_statement(maybe(statement))
-    = maybe(statement).
+:- func rename_maybe_statement(maybe(statement)) = maybe(statement).

 rename_maybe_statement(no) = no.
 rename_maybe_statement(yes(Stmt)) = yes(rename_statement(Stmt)).
@@ -453,8 +453,8 @@
 :- func rename_statement(statement) = statement.

 rename_statement(statement(block(Defns, Stmts), Context))
-    = statement(block(list__map(rename_defn, Defns),
-        list__map(rename_statement, Stmts)), Context).
+    = statement(block(list.map(rename_defn, Defns),
+        list.map(rename_statement, Stmts)), Context).
 rename_statement(statement(while(Rval, Loop, IterateOnce), Context))
     = statement(while(rename_rval(Rval),
         rename_statement(Loop), IterateOnce), Context).
@@ -465,7 +465,7 @@
 rename_statement(statement(switch(Type, Rval, Range, Cases, Default0),
         Context))
     = statement(switch(Type, rename_rval(Rval), Range,
-        list__map(rename_switch_case, Cases), Default), Context) :-
+        list.map(rename_switch_case, Cases), Default), Context) :-
     (
         Default0 = default_is_unreachable,
         Default = default_is_unreachable
@@ -487,8 +487,8 @@
         call(Signature, Rval, MaybeThis0, Args, Results, TailCall),
         Context))
     = statement(call(Signature, rename_rval(Rval),
-        MaybeThis, list__map(rename_rval, Args),
-        list__map(rename_lval, Results), TailCall), Context) :-
+        MaybeThis, list.map(rename_rval, Args),
+        list.map(rename_lval, Results), TailCall), Context) :-
     (
         MaybeThis0 = yes(Self),
         MaybeThis = yes(rename_rval(Self))
@@ -510,7 +510,7 @@
 :- func rename_switch_case(switch_case) = switch_case.

 rename_switch_case(Conds - Stmt)
-    = list__map(rename_cond, Conds) - rename_statement(Stmt).
+    = list.map(rename_cond, Conds) - rename_statement(Stmt).

 :- func rename_cond(case_match_cond) = case_match_cond.

@@ -526,7 +526,7 @@
 rename_atomic(new_object(L, Tag, HasSecTag, Type, MaybeSize, Ctxt, Args,
         Types))
     = new_object(rename_lval(L), Tag, HasSecTag, Type, MaybeSize,
-        Ctxt, list__map(rename_rval, Args), Types).
+        Ctxt, list.map(rename_rval, Args), Types).
 rename_atomic(gc_check) = gc_check.
 rename_atomic(mark_hp(L)) = mark_hp(rename_lval(L)).
 rename_atomic(restore_hp(R)) = restore_hp(rename_rval(R)).
@@ -558,7 +558,7 @@
 rename_const(data_addr_const(A)) = data_addr_const(rename_data_addr(A)).
 rename_const(null(T)) = null(T).

-:- func rename_code_addr(mlds__code_addr) = mlds__code_addr.
+:- func rename_code_addr(mlds.code_addr) = mlds.code_addr.

 rename_code_addr(proc(Label, Signature))
     = proc(rename_proc_label(Label), Signature).
@@ -581,13 +581,13 @@
 rename_field_id(offset(Rval)) = offset(rename_rval(Rval)).
 rename_field_id(named_field(Name, Type)) = named_field(Name, Type).

-:- func rename_initializer(mlds__initializer) = mlds__initializer.
+:- func rename_initializer(mlds.initializer) = mlds.initializer.

 rename_initializer(init_obj(Rval)) = init_obj(rename_rval(Rval)).
 rename_initializer(init_struct(Type, Inits))
-    = init_struct(Type, list__map(rename_initializer, Inits)).
+    = init_struct(Type, list.map(rename_initializer, Inits)).
 rename_initializer(init_array(Inits))
-    = init_array(list__map(rename_initializer, Inits)).
+    = init_array(list.map(rename_initializer, Inits)).
 rename_initializer(no_initializer) = no_initializer.

     % We need to append a wrapper class qualifier so that we access
@@ -601,12 +601,12 @@
     % We need to append a wrapper class qualifier so that we refer to the
     % methods of the wrapper class.
     %
-:- func rename_proc_label(mlds__qualified_proc_label)
-    = mlds__qualified_proc_label.
+:- func rename_proc_label(mlds.qualified_proc_label)
+    = mlds.qualified_proc_label.

     % Again append a wrapper class qualifier to the var name.
     %
-:- func rename_var(mlds__var, mlds_type) = mlds__var.
+:- func rename_var(mlds.var, mlds_type) = mlds.var.

 rename_var(qual(ModuleName, _QualKind, Name), _Type)
     = qual(append_wrapper_class(ModuleName), type_qual, Name).
@@ -614,7 +614,7 @@
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%

-:- pred mlds_defn_to_ilasm_decl(mlds__defn::in, ilasm__decl::out,
+:- pred mlds_defn_to_ilasm_decl(mlds.defn::in, ilasm.decl::out,
     il_info::in, il_info::out) is det.

     % IL supports top-level (i.e. "global") function definitions and
@@ -639,8 +639,8 @@
     % executed by the class constructor.
     ( EntityName = wrapper_class_name ->
         Imports = !.Info ^ imports,
-        InitInstrs = list__condense(tree__flatten(!.Info ^ init_instrs)),
-        AllocInstrs = list__condense(tree__flatten(!.Info ^ alloc_instrs)),
+        InitInstrs = list.condense(tree.flatten(!.Info ^ init_instrs)),
+        AllocInstrs = list.condense(tree.flatten(!.Info ^ alloc_instrs)),

         % Generate a field that records whether we have finished
         % RTTI initialization.
@@ -668,8 +668,8 @@
     Decl = class(decl_flags_to_classattrs(Flags), EntityName, Extends,
         Interfaces, MethodDecls).

-:- pred generate_class_body(mlds__entity_name::in, mlds__context::in,
-    mlds__class_defn::in, ilds__class_name::out, ilds__id::out,
+:- pred generate_class_body(mlds.entity_name::in, mlds.context::in,
+    mlds.class_defn::in, ilds.class_name::out, ilds.id::out,
     extends::out, implements::out, list(class_member)::out,
     il_info::in, il_info::out) is det.

@@ -681,12 +681,12 @@
     Parent - Extends = generate_parent_and_extends(!.Info ^ il_data_rep,
         Kind, Inherits),
     Interfaces = implements(
-        list__map(interface_id_to_class_name, Implements)),
+        list.map(interface_id_to_class_name, Implements)),
     ClassName = class_name(!.Info ^ module_name, EntityName),
-    list__map_foldl(generate_method(ClassName, no), Members,
+    list.map_foldl(generate_method(ClassName, no), Members,
         MethodsAndFields, !Info),
     Ctors = maybe_add_empty_ctor(Ctors0, Kind, Context),
-    list__map_foldl(generate_method(ClassName, yes(Parent)), Ctors,
+    list.map_foldl(generate_method(ClassName, yes(Parent)), Ctors,
         IlCtors, !Info),
     ClassMembers = IlCtors ++ MethodsAndFields.

@@ -694,47 +694,47 @@
     % newobj instruction to allocate instances of the class. So if a class
     % doesn't already have one, we add an empty one.
     %
-:- func maybe_add_empty_ctor(mlds__defns, mlds__class_kind, mlds__context) =
-    mlds__defns.
+:- func maybe_add_empty_ctor(mlds.defns, mlds.class_kind, mlds.context) =
+    mlds.defns.

 maybe_add_empty_ctor(Ctors0, Kind, Context) = Ctors :-
     (
-        Kind = mlds__class,
+        Kind = mlds.class,
         Ctors0 = []
     ->
         % Generate an empty block for the body of the constructor.
         Stmt = statement(block([], []), Context),

         Attributes = [],
-        Ctor = mlds__function(no, func_params([], []), defined_here(Stmt),
+        Ctor = mlds.function(no, func_params([], []), defined_here(Stmt),
             Attributes),
         CtorFlags = init_decl_flags(public, per_instance, non_virtual,
             overridable, modifiable, concrete),

-        CtorDefn = mlds__defn(export(".ctor"), Context, CtorFlags, Ctor),
+        CtorDefn = mlds.defn(export(".ctor"), Context, CtorFlags, Ctor),
         Ctors = [CtorDefn]
     ;
         Ctors = Ctors0
     ).

-:- func generate_parent_and_extends(il_data_rep, mlds__class_kind,
-    list(mlds__class_id)) = pair(ilds__class_name, extends).
+:- func generate_parent_and_extends(il_data_rep, mlds.class_kind,
+    list(mlds.class_id)) = pair(ilds.class_name, extends).

 generate_parent_and_extends(DataRep, Kind, Inherits) = Parent - Extends :-
     (
         Inherits = [],
         (
-            Kind = mlds__struct,
+            Kind = mlds.struct,
             Parent = il_generic_valuetype_name,
             Extends = extends(Parent)
         ;
-            Kind = mlds__enum,
+            Kind = mlds.enum,
             Parent = il_generic_enum_name,
             Extends = extends(Parent)
         ;
-            ( Kind = mlds__class
-            ; Kind = mlds__package
-            ; Kind = mlds__interface
+            ( Kind = mlds.class
+            ; Kind = mlds.package
+            ; Kind = mlds.interface
             ),
             Parent = il_generic_class_name,
             Extends = extends_nothing
@@ -760,10 +760,10 @@
 sym_name_to_list(qualified(Module, Name))
     = sym_name_to_list(Module) ++ [Name].

-:- func decl_flags_to_classattrs(mlds__decl_flags) = list(ilasm__classattr).
+:- func decl_flags_to_classattrs(mlds.decl_flags) = list(ilasm.classattr).

 decl_flags_to_classattrs(Flags) =
-        list__condense([Access, decl_flags_to_classattrs_2(Flags)]) :-
+        list.condense([Access, decl_flags_to_classattrs_2(Flags)]) :-
     AccessFlag = access(Flags),
     (
         AccessFlag = public,
@@ -786,11 +786,11 @@
             "decl_flags_to_classattrs: local access flag")
     ).

-:- func decl_flags_to_nestedclassattrs(mlds__decl_flags) =
-    list(ilasm__classattr).
+:- func decl_flags_to_nestedclassattrs(mlds.decl_flags) =
+    list(ilasm.classattr).

 decl_flags_to_nestedclassattrs(Flags)
-        = list__condense([Access, decl_flags_to_classattrs_2(Flags)]) :-
+        = list.condense([Access, decl_flags_to_classattrs_2(Flags)]) :-
     AccessFlag = access(Flags),
     (
         AccessFlag = public,
@@ -810,9 +810,9 @@
             "decl_flags_to_classattrs: local access flag")
     ).

-:- func decl_flags_to_classattrs_2(mlds__decl_flags) = list(ilasm__classattr).
+:- func decl_flags_to_classattrs_2(mlds.decl_flags) = list(ilasm.classattr).

-decl_flags_to_classattrs_2(Flags) = list__condense([Finality, Abstractness]) :-
+decl_flags_to_classattrs_2(Flags) = list.condense([Finality, Abstractness]) :-
     FinalityFlag = finality(Flags),
     (
         FinalityFlag = overridable,
@@ -830,10 +830,10 @@
         Abstractness = [abstract]
     ).

-:- func decl_flags_to_methattrs(mlds__decl_flags) = list(ilasm__methattr).
+:- func decl_flags_to_methattrs(mlds.decl_flags) = list(ilasm.methattr).

 decl_flags_to_methattrs(Flags)
-        = list__condense([Access, PerInstance, Virtuality,
+        = list.condense([Access, PerInstance, Virtuality,
             Finality, Abstractness]) :-
     AccessFlag = access(Flags),
     (
@@ -886,10 +886,10 @@
         Abstractness = [abstract]
     ).

-:- func decl_flags_to_fieldattrs(mlds__decl_flags) = list(ilasm__fieldattr).
+:- func decl_flags_to_fieldattrs(mlds.decl_flags) = list(ilasm.fieldattr).

 decl_flags_to_fieldattrs(Flags)
-    = list__condense([Access, PerInstance, Constness]) :-
+    = list.condense([Access, PerInstance, Constness]) :-
     AccessFlag = access(Flags),
     (
         AccessFlag = public,
@@ -926,17 +926,17 @@
         Constness = [initonly]
     ).

-:- func entity_name_to_ilds_id(mlds__entity_name) = ilds__id.
+:- func entity_name_to_ilds_id(mlds.entity_name) = ilds.id.

 entity_name_to_ilds_id(export(Name)) = Name.
 entity_name_to_ilds_id(function(PredLabel, ProcId, MaybeSeqNum, _)) = Name :-
     predlabel_to_id(PredLabel, ProcId, MaybeSeqNum, Name).
 entity_name_to_ilds_id(type(Name, Arity))
-    = string__format("%s_%d", [s(Name), i(Arity)]).
+    = string.format("%s_%d", [s(Name), i(Arity)]).
 entity_name_to_ilds_id(data(DataName))
     = mangle_dataname(DataName).

-:- func interface_id_to_class_name(mlds__interface_id) = ilds__class_name.
+:- func interface_id_to_class_name(mlds.interface_id) = ilds.class_name.

 interface_id_to_class_name(_) = Result :-
     % XXX
@@ -948,8 +948,8 @@

 %-----------------------------------------------------------------------------%

-:- pred generate_method(ilds__class_name::in, maybe(ilds__class_name)::in,
-    mlds__defn::in, class_member::out, il_info::in, il_info::out) is det.
+:- pred generate_method(ilds.class_name::in, maybe(ilds.class_name)::in,
+    mlds.defn::in, class_member::out, il_info::in, il_info::out) is det.

 generate_method(ClassName, _, defn(Name, Context, Flags, Entity),
         ClassMember, !Info) :-
@@ -1009,18 +1009,18 @@
     ),

     % Add a store after the alloc instrs (if necessary)
-    AllocInstrs = list__condense(tree__flatten(
+    AllocInstrs = list.condense(tree.flatten(
         tree_list([
             context_node(Context),
-            comment_node(string__append("allocation for ", FieldName)),
+            comment_node(string.append("allocation for ", FieldName)),
             AllocInstrsTree,
             StoreAllocTree]))),

     % Add a load before the init instrs (if necessary)
-    InitInstrs = list__condense(tree__flatten(
+    InitInstrs = list.condense(tree.flatten(
         tree_list([
             context_node(Context),
-            comment_node(string__append("initializer for ", FieldName)),
+            comment_node(string.append("initializer for ", FieldName)),
             LoadTree,
             InitInstrTree,
             StoreInitTree]))),
@@ -1047,11 +1047,11 @@
 %
 %   % Generate a term (we use it to emit the complete method definition
 %   % as a comment, which is nice for debugging).
-%   term__type_to_term(defn(Name, Context, Flags, Entity), _MLDSDefnTerm),
+%   term.type_to_term(defn(Name, Context, Flags, Entity), _MLDSDefnTerm),

     % Generate the signature
-    Params = mlds__func_params(Args, Returns),
-    ILArgs = list__map(mlds_arg_to_il_arg, Args),
+    Params = mlds.func_params(Args, Returns),
+    ILArgs = list.map(mlds_arg_to_il_arg, Args),
     DataRep = !.Info ^ il_data_rep,
     ILSignature = params_to_il_signature(DataRep, ModuleName, Params),

@@ -1095,15 +1095,15 @@
         % C# file associated with this file.  This is very hackish.
         ForeignLangs = !.Info ^ file_foreign_langs,
         !:Info = !.Info ^ file_foreign_langs :=
-            set__insert(ForeignLangs, csharp),
+            set.insert(ForeignLangs, csharp),

         mangle_dataname_module(no, ModuleName, NewModuleName),
         ClassName = mlds_module_name_to_class_name(NewModuleName),

         ILSignature = signature(_, ILRetType, ILParams),

-        assoc_list__keys(ILParams, TypeParams),
-        list__map_foldl(
+        assoc_list.keys(ILParams, TypeParams),
+        list.map_foldl(
             (pred(_::in, Instr::out, Num::in, Num+1::out) is det :-
                 Instr = ldarg(index(Num))
             ), TypeParams, LoadInstrs, 0, _),
@@ -1164,7 +1164,7 @@
             type_cat_user_ctor, non_foreign_type(UnivMercuryType)),
         UnivType = mlds_type_to_ilds_type(DataRep, UnivMLDSType),

-        RenameNode = (func(N) = list__map(RenameRets, N)),
+        RenameNode = (func(N) = list.map(RenameRets, N)),

         MercuryExceptionClassName = mercury_runtime_name(["Exception"]),

@@ -1256,7 +1256,7 @@

             % inner try block
             instr_node(start_block(try, InnerTryBlockId)),
-            tree__map(RenameNode, InstrsTree2),
+            tree.map(RenameNode, InstrsTree2),
             instr_node(leave(label_target(DoneLabel))),
             instr_node(end_block(try, InnerTryBlockId)),

@@ -1284,10 +1284,10 @@
         InstrsTree),
     CustomAttributes = attributes_to_custom_attributes(DataRep,
         Attributes),
-    list__condense([EntryPoint, CustomAttributes, MethodBody],
+    list.condense([EntryPoint, CustomAttributes, MethodBody],
         MethodContents),

-    ClassMember = ilasm__method(methodhead(Attrs, MemberName,
+    ClassMember = ilasm.method(methodhead(Attrs, MemberName,
         ILSignature, []), MethodContents).

 generate_method(_, _, defn(Name, Context, Flags, Entity), ClassMember,
@@ -1300,13 +1300,13 @@

 %-----------------------------------------------------------------------------%

-:- func attributes_to_custom_attributes(il_data_rep, list(mlds__attribute))
+:- func attributes_to_custom_attributes(il_data_rep, list(mlds.attribute))
     = list(method_body_decl).

 attributes_to_custom_attributes(DataRep, Attrs) =
-    list__map(attribute_to_custom_attribute(DataRep), Attrs).
+    list.map(attribute_to_custom_attribute(DataRep), Attrs).

-:- func attribute_to_custom_attribute(il_data_rep, mlds__attribute)
+:- func attribute_to_custom_attribute(il_data_rep, mlds.attribute)
     = method_body_decl.

 attribute_to_custom_attribute(DataRep, custom(MLDSType))
@@ -1317,14 +1317,14 @@

 %-----------------------------------------------------------------------------%

-:- func mangle_dataname(mlds__data_name) = string.
+:- func mangle_dataname(mlds.data_name) = string.

 mangle_dataname(var(MLDSVarName))
     = mangle_mlds_var_name(MLDSVarName).
 mangle_dataname(common(Int))
-    = string__format("common_%d", [i(Int)]).
+    = string.format("common_%d", [i(Int)]).
 mangle_dataname(rtti(RttiId)) = MangledName :-
-    rtti__id_to_c_identifier(RttiId, MangledName).
+    rtti.id_to_c_identifier(RttiId, MangledName).
 mangle_dataname(module_layout) = _MangledName :-
     unexpected(this_file, "unimplemented: mangling module_layout").
 mangle_dataname(proc_layout(_)) = _MangledName :-
@@ -1349,15 +1349,15 @@
     % We could use almost the same approach for outline_foreign_code
     % to generate the forwarding function.
     %
-:- pred mlds_export_to_mlds_defn(mlds__pragma_export::in, mlds__defn::out)
+:- pred mlds_export_to_mlds_defn(mlds.pragma_export::in, mlds.defn::out)
     is det.

 mlds_export_to_mlds_defn(
     ml_pragma_export(ExportName, EntityName, Params, Context), Defn) :-
     EntityName = qual(ModuleName, _QualKind, UnqualName),

-    Params = mlds__func_params(Inputs, RetTypes),
-    list__map_foldl(
+    Params = mlds.func_params(Inputs, RetTypes),
+    list.map_foldl(
         (pred(RT::in, RV - Lval::out, N0::in, N0 + 1::out) is det :-
             VN = var_name("returnval" ++ int_to_string(N0), no),
             % We don't need to worry about tracing variables for
@@ -1378,15 +1378,15 @@
                 "exported method has argument without var name")
         )
     ),
-    ArgTypes = mlds__get_arg_types(Inputs),
-    ArgRvals = list__map(
-        (func(mlds__argument(EntName, Type, _GC_TraceCode)) =
+    ArgTypes = mlds.get_arg_types(Inputs),
+    ArgRvals = list.map(
+        (func(mlds.argument(EntName, Type, _GC_TraceCode)) =
                 lval(var(VarName, Type)) :-
             VarName = EntNameToVarName(EntName)
         ), Inputs),
-    ReturnVarDecls = assoc_list__keys(ReturnVars),
-    ReturnLvals = assoc_list__values(ReturnVars),
-    ReturnRvals = list__map((func(X) = lval(X)), ReturnLvals),
+    ReturnVarDecls = assoc_list.keys(ReturnVars),
+    ReturnLvals = assoc_list.values(ReturnVars),
+    ReturnRvals = list.map((func(X) = lval(X)), ReturnLvals),

     Signature = func_signature(ArgTypes, RetTypes),
     ( UnqualName = function(PredLabel, ProcId, _MaybeSeq, _PredId) ->
@@ -1402,7 +1402,7 @@
             ordinary_call), Context),
     ReturnStatement = statement(return(ReturnRvals), Context),

-    Statement = statement(mlds__block(ReturnVarDecls,
+    Statement = statement(mlds.block(ReturnVarDecls,
         ( ReturnRvals = [] ->
             [CallStatement]
         ;
@@ -1426,14 +1426,14 @@
     % Generate initializer code from an MLDS defn. We are only expecting
     % data defns at this point (local vars), not functions or classes.
     %
-:- pred generate_defn_initializer(mlds__defn::in,
+:- pred generate_defn_initializer(mlds.defn::in,
     instr_tree::in, instr_tree::out, il_info::in, il_info::out) is det.

 generate_defn_initializer(defn(Name, Context, _DeclFlags, Entity),
         !Tree, !Info) :-
     (
         Name = data(DataName),
-        Entity = mlds__data(MLDSType, Initializer, _GC_TraceCode)
+        Entity = mlds.data(MLDSType, Initializer, _GC_TraceCode)
     ->
         ( Initializer = no_initializer ->
             true
@@ -1452,7 +1452,7 @@
             ),
             data_initializer_to_instrs(Initializer, MLDSType,
                 AllocInstrs, InitInstrs, !Info),
-            string__append("initializer for ", NameString,
+            string.append("initializer for ", NameString,
                 Comment),
             !:Tree = tree_list([
                 !.Tree,
@@ -1472,7 +1472,7 @@
     % XXX the code generator doesn't box these values
     % we need to look ahead at them and box them appropriately.
     %
-:- pred data_initializer_to_instrs(mlds__initializer::in, mlds_type::in,
+:- pred data_initializer_to_instrs(mlds.initializer::in, mlds_type::in,
     instr_tree::out, instr_tree::out, il_info::in, il_info::out) is det.

 data_initializer_to_instrs(init_obj(Rval), _Type, node([]), InitInstrs,
@@ -1502,16 +1502,16 @@

     % Figure out the array element type.
     DataRep = !.Info ^ il_data_rep,
-    ( Type = mlds__array_type(ElemType0) ->
+    ( Type = mlds.array_type(ElemType0) ->
         ElemType = ElemType0,
         ILElemType = mlds_type_to_ilds_type(DataRep, ElemType)
     ;
-        % XXX We assume struct fields have type mlds__generic_type
+        % XXX We assume struct fields have type mlds.generic_type
         % This is probably wrong for --high-level-data.
-        ElemType = mlds__generic_type,
+        ElemType = mlds.generic_type,
         ILElemType = il_generic_type
     ),
-    ILElemType = ilds__type(_, ILElemSimpleType),
+    ILElemType = il_type(_, ILElemSimpleType),

     % To initialize an array, we generate the following code:
     %   ldc <length of array>
@@ -1528,14 +1528,14 @@
     % The initialization will leave the array on the stack.
     %
     AllocInstrs = node([
-        ldc(int32, i(list__length(InitList))),
+        ldc(int32, i(list.length(InitList))),
         newarr(ILElemType)]),
     AddInitializer =
         (pred(Init0::in, X0 - Tree0::in, (X0 + 1) - Tree::out,
                 Info0::in, Info::out) is det :-
             % we may need to box the arguments
             % XXX is this right?
-            ( ElemType = mlds__generic_type ->
+            ( ElemType = mlds.generic_type ->
                 maybe_box_initializer(Init0, Init)
             ;
                 Init = Init0
@@ -1545,13 +1545,13 @@
             Tree = tree(tree(Tree0, node([dup, ldc(int32, i(X0))])),
                 tree(tree(ATree1, ITree1), node([stelem(ILElemSimpleType)])))
         ),
-    list__foldl2(AddInitializer, InitList, 0 - empty, _ - InitInstrs, !Info).
+    list.foldl2(AddInitializer, InitList, 0 - empty, _ - InitInstrs, !Info).
 data_initializer_to_instrs(no_initializer, _, node([]), node([]), !Info).

     % If we are initializing an array or struct, we need to box
     % all the things inside it.
     %
-:- pred maybe_box_initializer(mlds__initializer::in, mlds__initializer::out)
+:- pred maybe_box_initializer(mlds.initializer::in, mlds.initializer::out)
     is det.

     % nothing to do
@@ -1567,11 +1567,11 @@

     % Code to flatten nested intializers.
     %
-:- func flatten_inits(list(mlds__initializer)) = list(mlds__initializer).
+:- func flatten_inits(list(mlds.initializer)) = list(mlds.initializer).

-flatten_inits(Inits) = list__condense(list__map(flatten_init, Inits)).
+flatten_inits(Inits) = list.condense(list.map(flatten_init, Inits)).

-:- func flatten_init(mlds__initializer) = list(mlds__initializer).
+:- func flatten_init(mlds.initializer) = list(mlds.initializer).

 flatten_init(I) = Inits :-
     ( I = init_struct(_Type, Inits0) ->
@@ -1601,13 +1601,13 @@
 statement_to_il(statement(block(Defns, Statements), Context), Instrs, !Info) :-
     il_info_get_module_name(!.Info, ModuleName),
     il_info_get_next_block_id(BlockId, !Info),
-    list__map(defn_to_local(ModuleName), Defns, Locals),
+    list.map(defn_to_local(ModuleName), Defns, Locals),
     il_info_add_locals(Locals, !Info),
-    list__foldl2(generate_defn_initializer, Defns, empty,
+    list.foldl2(generate_defn_initializer, Defns, empty,
         InitInstrsTree, !Info),
     statements_to_il(Statements, BlockInstrs, !Info),
     DataRep = !.Info ^ il_data_rep,
-    list__map((pred((K - V)::in, (K - W)::out) is det :-
+    list.map((pred((K - V)::in, (K - W)::out) is det :-
         W = mlds_type_to_ilds_type(DataRep, V)), Locals, ILLocals),
     Scope = scope(ILLocals),
     Instrs = tree_list([
@@ -1643,10 +1643,10 @@
         \+ (
             VerifiableCode = yes,
             some [Ref] (
-                list__member(Ref, TypeParams),
-                ( Ref = ilds__type(_, '&'(_))
-                ; Ref = ilds__type(_, '*'(_))
-                ; Ref = ilds__type(_, refany)
+                list.member(Ref, TypeParams),
+                ( Ref = il_type(_, '&'(_))
+                ; Ref = il_type(_, '*'(_))
+                ; Ref = il_type(_, refany)
                 )
             ),
             ByRefTailCalls = no
@@ -1688,7 +1688,7 @@
         get_all_load_store_lval_instrs(Returns,
             LoadMemRefInstrs, ReturnsStoredInstrs, !Info)
     ),
-    list__map_foldl(load, Args, ArgsLoadInstrsTrees, !Info),
+    list.map_foldl(load, Args, ArgsLoadInstrsTrees, !Info),
     ArgsLoadInstrs = tree_list(ArgsLoadInstrsTrees),
     ( Function = const(Const) ->
         FunctionLoadInstrs = empty,
@@ -1697,9 +1697,9 @@
             ReturnParam, MemberName, TypeParams))]
     ;
         load(Function, FunctionLoadInstrs, !Info),
-        list__length(TypeParams, Length),
-        list__duplicate(Length, no, NoList),
-        assoc_list__from_corresponding_lists(TypeParams, NoList, ParamsList),
+        list.length(TypeParams, Length),
+        list.duplicate(Length, no, NoList),
+        assoc_list.from_corresponding_lists(TypeParams, NoList, ParamsList),
         Instrs0 = [calli(signature(call_conv(no, default),
             ReturnParam, ParamsList))]
     ),
@@ -1791,7 +1791,7 @@
     ).

 statement_to_il(statement(label(Label), Context), Instrs, !Info) :-
-    string__format("label %s", [s(Label)], Comment),
+    string.format("label %s", [s(Label)], Comment),
     Instrs = node([
         comment(Comment),
         context_instr(Context),
@@ -1799,7 +1799,7 @@
     ]).

 statement_to_il(statement(goto(label(Label)), Context), Instrs, !Info) :-
-    string__format("goto %s", [s(Label)], Comment),
+    string.format("goto %s", [s(Label)], Comment),
     Instrs = node([
         comment(Comment),
         context_instr(Context),
@@ -1879,7 +1879,7 @@
 statement_to_il(statement(computed_goto(Rval, MLDSLabels), Context),
         Instrs, !Info) :-
     load(Rval, RvalLoadInstrs, !Info),
-    Targets = list__map(func(L) = label_target(L), MLDSLabels),
+    Targets = list.map(func(L) = label_target(L), MLDSLabels),
     Instrs = tree_list([
         context_node(Context),
         comment_node("computed goto"),
@@ -1887,7 +1887,7 @@
         instr_node(switch(Targets))
     ]).

-:- pred atomic_statement_to_il(mlds__atomic_statement::in, instr_tree::out,
+:- pred atomic_statement_to_il(mlds.atomic_statement::in, instr_tree::out,
     il_info::in, il_info::out) is det.

 atomic_statement_to_il(gc_check, node(Instrs), !Info) :-
@@ -1905,7 +1905,7 @@
         Info0 = !.Info,
         !:Info = !.Info ^ method_foreign_lang := yes(Lang),
         !:Info = !.Info ^ file_foreign_langs :=
-            set__insert(Info0 ^ file_foreign_langs, Lang),
+            set.insert(Info0 ^ file_foreign_langs, Lang),
         mangle_foreign_code_module(Lang, ModuleName, OutlineLangModuleName),
         ClassName = mlds_module_name_to_class_name(OutlineLangModuleName),
         signature(_, RetType, Params) = !.Info ^ signature,
@@ -1931,8 +1931,8 @@
             sorry(this_file, "multiple return values")
         ),
         MethodName = !.Info ^ method_name,
-        assoc_list__keys(Params, TypeParams),
-        list__map_foldl((pred(_::in, Instr::out,
+        assoc_list.keys(Params, TypeParams),
+        list.map_foldl((pred(_::in, Instr::out,
             Num::in, Num + 1::out) is det :-
                 Instr = ldarg(index(Num))),
             TypeParams, LoadArgInstrs, 0, _),
@@ -2000,12 +2000,12 @@
     DataRep = !.Info ^ il_data_rep,
     (
         (
-            Type = mlds__generic_env_ptr_type
+            Type = mlds.generic_env_ptr_type
         ;
-            Type = mlds__class_type(_, _, mlds__class)
+            Type = mlds.class_type(_, _, mlds.class)
         ;
             DataRep ^ highlevel_data = yes,
-            Type = mlds__mercury_type(MercuryType, type_cat_user_ctor, _),
+            Type = mlds.mercury_type(MercuryType, type_cat_user_ctor, _),
             \+ type_needs_lowlevel_rep(il, MercuryType)
         )
     ->
@@ -2046,8 +2046,8 @@
             ArgTypes = ArgTypes0,
             Args = Args0
         ),
-        ILArgTypes = list__map(mlds_type_to_ilds_type(DataRep), ArgTypes),
-        list__map_foldl(load, Args, ArgsLoadInstrsTrees, !Info),
+        ILArgTypes = list.map(mlds_type_to_ilds_type(DataRep), ArgTypes),
+        list.map_foldl(load, Args, ArgsLoadInstrsTrees, !Info),
         ArgsLoadInstrs = tree_list(ArgsLoadInstrsTrees),
         get_load_store_lval_instrs(Target, LoadMemRefInstrs,
             StoreLvalInstrs, !Info),
@@ -2107,7 +2107,7 @@
             I = tree_list([I0, I1, I2, I3]),
             Arg = (Index + 1) - S
         ),
-        list__map_foldl(LoadInArray, Args0, ArgsLoadInstrsTrees,
+        list.map_foldl(LoadInArray, Args0, ArgsLoadInstrsTrees,
             0 - !.Info, _ - !:Info),
         ArgsLoadInstrs = tree_list(ArgsLoadInstrsTrees),

@@ -2144,7 +2144,7 @@
         ( yes(max_stack_size(N)) = get_max_stack_attribute(Attrs) ->
             Instrs = tree_list([
                 ( MaybeContext = yes(Context) ->
-                    context_node(mlds__make_context( Context))
+                    context_node(mlds.make_context( Context))
                 ;
                     empty
                 ),
@@ -2211,7 +2211,7 @@
         StoreLvalInstrs = instr_node(stind(SimpleType))
     ; Lval = field(_MaybeTag, FieldRval, FieldNum, FieldType, ClassType) ->
         ClassILType = mlds_type_to_ilds_type(DataRep, ClassType),
-        ( ClassILType = ilds__type(_, '[]'(_, _)) ->
+        ( ClassILType = il_type(_, '[]'(_, _)) ->
             ( FieldNum = offset(OffsetRval),
                 FieldILType = mlds_type_to_ilds_simple_type(DataRep,
                     FieldType),
@@ -2451,17 +2451,17 @@
     % IL has special instructions for those
     (
         % Is it a cast to refany?
-        DestILType = ilds__type(_, refany)
+        DestILType = il_type(_, refany)
     ->
         (
             % Is it from refany?
-            SrcILType = ilds__type(_, refany)
+            SrcILType = il_type(_, refany)
         ->
             % Cast from refany to refany is a NOP.
             Instrs = empty
         ;
             % Cast to refany: use "mkrefany" instruction.
-            ( SrcILType = ilds__type(_Qual, '&'(ReferencedType)) ->
+            ( SrcILType = il_type(_Qual, '&'(ReferencedType)) ->
                 Instrs = node([mkrefany(ReferencedType)])
             ;
                 unexpected(this_file, "cast from non-ref type to refany")
@@ -2472,10 +2472,10 @@
         SrcRval = lval(_),
         rval_to_type(SrcRval, SrcType),
         SrcILType = mlds_type_to_ilds_type(DataRep, SrcType),
-        SrcILType = ilds__type(_, refany)
+        SrcILType = il_type(_, refany)
     ->
         % Cast from refany: use "refanyval" instruction.
-        ( DestILType = ilds__type(_Qual, '&'(ReferencedType)) ->
+        ( DestILType = il_type(_Qual, '&'(ReferencedType)) ->
             Instrs = node([refanyval(ReferencedType)])
         ;
             unexpected(this_file, "cast from non-ref type to refany")
@@ -2491,8 +2491,8 @@
         % because that's what IL does, but we should probably define a
         % separate ilds type for this.

-        ( DestILType = ilds__type(_, native_uint)
-        ; SrcILType = ilds__type(_, native_uint)
+        ( DestILType = il_type(_, native_uint)
+        ; SrcILType = il_type(_, native_uint)
         )
     ->
         Instrs = empty
@@ -2546,7 +2546,7 @@
                 ])
             )
         ;
-            DestILType = ilds__type(_, DestSimpleType),
+            DestILType = il_type(_, DestSimpleType),
             Instrs = tree_list([
                 comment_node("cast between value types"),
                 instr_node(conv(DestSimpleType))
@@ -2580,16 +2580,16 @@
         Instrs = convert_from_object(UnboxedILType)
     ).

-:- pred already_boxed(ilds__type::in) is semidet.
+:- pred already_boxed(il_type::in) is semidet.

-already_boxed(ilds__type(_, object)).
-already_boxed(ilds__type(_, string)).
-already_boxed(ilds__type(_, refany)).
-already_boxed(ilds__type(_, class(_))).
-already_boxed(ilds__type(_, interface(_))).
-already_boxed(ilds__type(_, '[]'(_, _))).
-already_boxed(ilds__type(_, '&'(_))).
-already_boxed(ilds__type(_, '*'(_))).
+already_boxed(il_type(_, object)).
+already_boxed(il_type(_, string)).
+already_boxed(il_type(_, refany)).
+already_boxed(il_type(_, class(_))).
+already_boxed(il_type(_, interface(_))).
+already_boxed(il_type(_, '[]'(_, _))).
+already_boxed(il_type(_, '&'(_))).
+already_boxed(il_type(_, '*'(_))).

 :- pred binaryop_to_il(binary_op::in, instr_tree::out,
     il_info::in, il_info::out) is det.
@@ -2865,7 +2865,7 @@
     %   // Maybe initialise the runtime
     %   call void [mercury]mercury.runtime::init_runtime(bool)
     %
-:- pred make_class_constructor_class_member(fieldref::in, mlds__imports::in,
+:- pred make_class_constructor_class_member(fieldref::in, mlds.imports::in,
     list(instr)::in, list(instr)::in, class_member::out,
     il_info::in, il_info::out) is det.

@@ -2877,13 +2877,13 @@
     RuntimeInitInstrs = runtime_initialization_instrs,
     test_rtti_initialization_field(DoneFieldRef, TestInstrs, !Info),
     set_rtti_initialization_field(DoneFieldRef, SetInstrs, !Info),
-    CCtorCalls = list__filter_map(
+    CCtorCalls = list.filter_map(
         (func(I::in) = (C::out) is semidet :-
             I = mercury_import(compiler_visible_interface, ImportName),
             C = call_class_constructor(
                 class_name(ImportName, wrapper_class_name))
         ), Imports),
-    AllInstrs = list__condense([ResponsibleInitRuntimeInstrs, TestInstrs,
+    AllInstrs = list.condense([ResponsibleInitRuntimeInstrs, TestInstrs,
         AllocInstrs, SetInstrs, CCtorCalls, InitInstrs, RuntimeInitInstrs,
         [ret]]),
     MethodDecls = [instrs(AllInstrs)].
@@ -2902,15 +2902,15 @@
 set_rtti_initialization_field(FieldRef, Instrs, !Info) :-
     Instrs = [ldc(int32, i(1)), stsfld(FieldRef)].

-:- pred generate_rtti_initialization_field(ilds__class_name::in,
+:- pred generate_rtti_initialization_field(ilds.class_name::in,
     fieldref::out, class_member::out) is det.

 generate_rtti_initialization_field(ClassName, AllocDoneFieldRef,
         AllocDoneField) :-
     AllocDoneFieldName = "rtti_initialized",
-    AllocDoneField = field([public, static], ilds__type([], bool),
+    AllocDoneField = field([public, static], il_type([], bool),
         AllocDoneFieldName, no, none),
-    AllocDoneFieldRef = make_fieldref(ilds__type([], bool),
+    AllocDoneFieldRef = make_fieldref(il_type([], bool),
         ClassName, AllocDoneFieldName).

 %-----------------------------------------------------------------------------
@@ -2918,7 +2918,7 @@
 % Conversion of MLDS types to IL types.

 :- func mlds_inherits_to_ilds_inherits(il_data_rep, list(mlds_type))
-    = ilasm__extends.
+    = ilasm.extends.

 mlds_inherits_to_ilds_inherits(DataRep, Inherits) = Extends :-
     (
@@ -2933,25 +2933,25 @@
     ).

 :- pred mlds_signature_to_ilds_type_params(il_data_rep::in,
-    mlds__func_signature::in, list(ilds__type)::out) is det.
+    mlds.func_signature::in, list(il_type)::out) is det.

 mlds_signature_to_ilds_type_params(DataRep,
         func_signature(Args, _Returns), Params) :-
-    Params = list__map(mlds_type_to_ilds_type(DataRep), Args).
+    Params = list.map(mlds_type_to_ilds_type(DataRep), Args).

-:- func mlds_arg_to_il_arg(mlds__argument) = pair(ilds__id, mlds_type).
+:- func mlds_arg_to_il_arg(mlds.argument) = pair(ilds.id, mlds_type).

-mlds_arg_to_il_arg(mlds__argument(EntityName, Type, _GC_TraceCode)) =
+mlds_arg_to_il_arg(mlds.argument(EntityName, Type, _GC_TraceCode)) =
         Id - Type :-
     mangle_entity_name(EntityName, Id).

-:- func mlds_signature_to_ilds_type_params(il_data_rep, mlds__func_signature)
-    = list(ilds__type).
+:- func mlds_signature_to_ilds_type_params(il_data_rep, mlds.func_signature)
+    = list(il_type).

 mlds_signature_to_ilds_type_params(DataRep, func_signature(Args, _Returns)) =
-    list__map(mlds_type_to_ilds_type(DataRep), Args).
+    list.map(mlds_type_to_ilds_type(DataRep), Args).

-:- func mlds_signature_to_il_return_param(il_data_rep, mlds__func_signature)
+:- func mlds_signature_to_il_return_param(il_data_rep, mlds.func_signature)
     = ret_type.

 mlds_signature_to_il_return_param(DataRep, func_signature(_, Returns))
@@ -2970,9 +2970,9 @@
     ).

 params_to_il_signature(DataRep, ModuleName, FuncParams) = ILSignature :-
-    ILInputTypes = list__map(input_param_to_ilds_type(DataRep, ModuleName),
+    ILInputTypes = list.map(input_param_to_ilds_type(DataRep, ModuleName),
         Inputs),
-    FuncParams = mlds__func_params(Inputs, Outputs),
+    FuncParams = mlds.func_params(Inputs, Outputs),
     (
         Outputs = [],
         Param = void
@@ -2987,78 +2987,78 @@
     ),
     ILSignature = signature(call_conv(no, default), Param, ILInputTypes).

-:- func input_param_to_ilds_type(il_data_rep, mlds_module_name, mlds__argument)
-    = ilds__param.
+:- func input_param_to_ilds_type(il_data_rep, mlds_module_name, mlds.argument)
+    = ilds.param.

 input_param_to_ilds_type(DataRep, _ModuleName, Arg) = ILType - yes(Id) :-
-    Arg = mlds__argument(EntityName, MldsType, _GC_TraceCode),
+    Arg = mlds.argument(EntityName, MldsType, _GC_TraceCode),
     mangle_entity_name(EntityName, Id),
     ILType = mlds_type_to_ilds_type(DataRep, MldsType).

-:- func mlds_type_to_ilds_simple_type(il_data_rep, mlds_type) =
-     ilds__simple_type.
+:- func mlds_type_to_ilds_simple_type(il_data_rep, mlds_type)
+    = ilds.simple_type.

 mlds_type_to_ilds_simple_type(DataRep, MLDSType) = SimpleType :-
-    ilds__type(_, SimpleType) = mlds_type_to_ilds_type(DataRep, MLDSType).
+    il_type(_, SimpleType) = mlds_type_to_ilds_type(DataRep, MLDSType).

     % XXX Make sure all the types are converted correctly.

-mlds_type_to_ilds_type(_, mlds__rtti_type(_RttiName)) = il_object_array_type.
+mlds_type_to_ilds_type(_, mlds.rtti_type(_RttiName)) = il_object_array_type.

-mlds_type_to_ilds_type(DataRep, mlds__mercury_array_type(ElementType)) =
-    ( ElementType = mlds__mercury_type(_, type_cat_variable, _) ->
+mlds_type_to_ilds_type(DataRep, mlds.mercury_array_type(ElementType)) =
+    ( ElementType = mlds.mercury_type(_, type_cat_variable, _) ->
         il_generic_array_type
     ;
-        ilds__type([], '[]'(mlds_type_to_ilds_type(DataRep,
+        il_type([], '[]'(mlds_type_to_ilds_type(DataRep,
             ElementType), []))
     ).

-mlds_type_to_ilds_type(DataRep, mlds__array_type(ElementType)) =
-    ilds__type([], '[]'(mlds_type_to_ilds_type(DataRep, ElementType), [])).
+mlds_type_to_ilds_type(DataRep, mlds.array_type(ElementType)) =
+    il_type([], '[]'(mlds_type_to_ilds_type(DataRep, ElementType), [])).

     % XXX Should be checked.
-mlds_type_to_ilds_type(_, mlds__type_info_type) = il_generic_type.
+mlds_type_to_ilds_type(_, mlds.type_info_type) = il_generic_type.

     % This is tricky. It could be an integer, or it could be a System.Array.
-mlds_type_to_ilds_type(_, mlds__pseudo_type_info_type) = il_generic_type.
+mlds_type_to_ilds_type(_, mlds.pseudo_type_info_type) = il_generic_type.

     % IL has a pretty fuzzy idea about function types. We treat them
     % as integers for now
     % XXX This means the code is not verifiable.
-mlds_type_to_ilds_type(_, mlds__func_type(_)) = ilds__type([], int32).
+mlds_type_to_ilds_type(_, mlds.func_type(_)) = il_type([], int32).

-mlds_type_to_ilds_type(_, mlds__generic_type) = il_generic_type.
+mlds_type_to_ilds_type(_, mlds.generic_type) = il_generic_type.

     % XXX Using int32 here means the code is not verifiable
     % see comments about function types above.
-mlds_type_to_ilds_type(_, mlds__cont_type(_ArgTypes)) = ilds__type([], int32).
+mlds_type_to_ilds_type(_, mlds.cont_type(_ArgTypes)) = il_type([], int32).

-mlds_type_to_ilds_type(_, mlds__class_type(Class, Arity, Kind)) =
-        ilds__type([], SimpleType) :-
+mlds_type_to_ilds_type(_, mlds.class_type(Class, Arity, Kind)) =
+        il_type([], SimpleType) :-
     ClassName = mlds_class_name_to_ilds_class_name(Class, Arity),
     SimpleType = mlds_class_to_ilds_simple_type(Kind, ClassName).

-mlds_type_to_ilds_type(_, mlds__commit_type) = il_commit_type.
+mlds_type_to_ilds_type(_, mlds.commit_type) = il_commit_type.

-mlds_type_to_ilds_type(ILDataRep, mlds__generic_env_ptr_type) =
+mlds_type_to_ilds_type(ILDataRep, mlds.generic_env_ptr_type) =
     ILDataRep^il_envptr_type.

-mlds_type_to_ilds_type(_, mlds__native_bool_type) = ilds__type([], bool).
+mlds_type_to_ilds_type(_, mlds.native_bool_type) = il_type([], bool).

-mlds_type_to_ilds_type(_, mlds__native_char_type) = ilds__type([], char).
+mlds_type_to_ilds_type(_, mlds.native_char_type) = il_type([], char).

     % These two following choices are arbitrary -- IL has native integer
     % and float types too. It's not clear whether there is any benefit
     % in mapping to them instead -- it all depends what the indended use
-    % of mlds__native_int_type and mlds__native_float_type is.
+    % of mlds.native_int_type and mlds.native_float_type is.
     % Any mapping other than int32 would have to be examined to see
     % whether it is going to be compatible with int32.
-mlds_type_to_ilds_type(_, mlds__native_int_type) = ilds__type([], int32).
+mlds_type_to_ilds_type(_, mlds.native_int_type) = il_type([], int32).

-mlds_type_to_ilds_type(_, mlds__native_float_type) = ilds__type([], float64).
+mlds_type_to_ilds_type(_, mlds.native_float_type) = il_type([], float64).

-mlds_type_to_ilds_type(_, mlds__foreign_type(ForeignType))
-        = ilds__type([], Class) :-
+mlds_type_to_ilds_type(_, mlds.foreign_type(ForeignType))
+        = il_type([], Class) :-
     (
         ForeignType = il(il(RefOrVal, Assembly, Type)),
         sym_name_to_class_name(Type, ForeignClassName),
@@ -3079,13 +3079,13 @@
         unexpected(this_file, "java foreign type")
     ).

-mlds_type_to_ilds_type(ILDataRep, mlds__ptr_type(MLDSType)) =
-    ilds__type([], '&'(mlds_type_to_ilds_type(ILDataRep, MLDSType))).
+mlds_type_to_ilds_type(ILDataRep, mlds.ptr_type(MLDSType)) =
+    il_type([], '&'(mlds_type_to_ilds_type(ILDataRep, MLDSType))).

 mlds_type_to_ilds_type(ILDataRep, mercury_type(MercuryType, TypeCategory, _)) =
     mlds_mercury_type_to_ilds_type(ILDataRep, MercuryType, TypeCategory).

-mlds_type_to_ilds_type(_, mlds__unknown_type) = _ :-
+mlds_type_to_ilds_type(_, mlds.unknown_type) = _ :-
     unexpected(this_file, "mlds_type_to_ilds_type: unknown_type").

     % Get the corresponding ILDS type for an MLDS mercury type
@@ -3094,13 +3094,13 @@
     % of type void, so the type is moot.
     %
 :- func mlds_mercury_type_to_ilds_type(il_data_rep, mer_type,
-    type_category) = ilds__type.
+    type_category) = il_type.

-mlds_mercury_type_to_ilds_type(_, _, type_cat_int) =   ilds__type([], int32).
-mlds_mercury_type_to_ilds_type(_, _, type_cat_char) =  ilds__type([], char).
-mlds_mercury_type_to_ilds_type(_, _, type_cat_float) = ilds__type([], float64).
+mlds_mercury_type_to_ilds_type(_, _, type_cat_int)    = il_type([], int32).
+mlds_mercury_type_to_ilds_type(_, _, type_cat_char)   = il_type([], char).
+mlds_mercury_type_to_ilds_type(_, _, type_cat_float)  = il_type([], float64).
 mlds_mercury_type_to_ilds_type(_, _, type_cat_string) =   il_string_type.
-mlds_mercury_type_to_ilds_type(_, _, type_cat_void) =  ilds__type([], int32).
+mlds_mercury_type_to_ilds_type(_, _, type_cat_void)   = il_type([], int32).
 mlds_mercury_type_to_ilds_type(_, _, type_cat_higher_order) =
     il_object_array_type.
 mlds_mercury_type_to_ilds_type(_, _, type_cat_tuple) = il_object_array_type.
@@ -3126,46 +3126,46 @@
         il_object_array_type
     ).

-:- func mlds_class_to_ilds_simple_type(mlds__class_kind, ilds__class_name) =
-    ilds__simple_type.
+:- func mlds_class_to_ilds_simple_type(mlds.class_kind, ilds.class_name) =
+    ilds.simple_type.

 mlds_class_to_ilds_simple_type(Kind, ClassName) = SimpleType :-
-    ( Kind = mlds__package,     SimpleType = class(ClassName)
-    ; Kind = mlds__class,       SimpleType = class(ClassName)
-    ; Kind = mlds__interface,   SimpleType = class(ClassName)
-    ; Kind = mlds__struct,      SimpleType = valuetype(ClassName)
-    ; Kind = mlds__enum,        SimpleType = valuetype(ClassName)
+    ( Kind = mlds.package,     SimpleType = class(ClassName)
+    ; Kind = mlds.class,       SimpleType = class(ClassName)
+    ; Kind = mlds.interface,   SimpleType = class(ClassName)
+    ; Kind = mlds.struct,      SimpleType = valuetype(ClassName)
+    ; Kind = mlds.enum,        SimpleType = valuetype(ClassName)
     ).

-:- func mercury_type_to_highlevel_class_type(mer_type) = ilds__type.
+:- func mercury_type_to_highlevel_class_type(mer_type) = il_type.

 mercury_type_to_highlevel_class_type(MercuryType) = ILType :-
     ( type_to_ctor_and_args(MercuryType, TypeCtor, _Args) ->
         ml_gen_type_name(TypeCtor, ClassName, Arity),
-        ILType = ilds__type([], class(
+        ILType = il_type([], class(
             mlds_class_name_to_ilds_class_name(ClassName, Arity)))
     ;
         unexpected(this_file, "type_to_ctor_and_args failed")
     ).

-:- func mlds_class_name_to_ilds_class_name(mlds__class, arity) =
-    ilds__class_name.
+:- func mlds_class_name_to_ilds_class_name(mlds.class, arity) =
+    ilds.class_name.

 mlds_class_name_to_ilds_class_name(QualClassName, Arity) = IldsClassName :-
     QualClassName = qual(MldsModuleName, _QualKind, MldsClassName0),
-    MldsClassName = string__format("%s_%d", [s(MldsClassName0), i(Arity)]),
+    MldsClassName = string.format("%s_%d", [s(MldsClassName0), i(Arity)]),
     IldsClassName = append_toplevel_class_name(
         mlds_module_name_to_class_name(MldsModuleName), MldsClassName).

 mlds_type_to_ilds_class_name(DataRep, MldsType) =
     get_ilds_type_class_name(mlds_type_to_ilds_type(DataRep, MldsType)).

-:- func get_ilds_type_class_name(ilds__type) = ilds__class_name.
+:- func get_ilds_type_class_name(il_type) = ilds.class_name.

 get_ilds_type_class_name(ILType) = ClassName :-
     (
-        ( ILType = ilds__type(_, class(ClassName0))
-        ; ILType = ilds__type(_, valuetype(ClassName0))
+        ( ILType = il_type(_, class(ClassName0))
+        ; ILType = il_type(_, valuetype(ClassName0))
         )
     ->
         ClassName = ClassName0
@@ -3184,7 +3184,7 @@
     %   - Problem:
     %     Two preds or funcs with different arities in Mercury
     %     end up having the same types and arities in IL, e.g.
-    %     because one of them takes io__state arguments which
+    %     because one of them takes io.state arguments which
     %     get omitted in IL.
     %
     %     To avoid this we append _<arity> to every procedure
@@ -3234,8 +3234,8 @@
         NonOutputFunc), ProcId, MaybeSeqNum, Id) :-
     (
         MaybeModuleName = yes(ModuleName),
-        mlds_to_il__sym_name_to_string(ModuleName, MStr),
-        string__format("%s_", [s(MStr)], MaybeModuleStr)
+        mlds_to_il.sym_name_to_string(ModuleName, MStr),
+        string.format("%s_", [s(MStr)], MaybeModuleStr)
     ;
         MaybeModuleName = no,
         MaybeModuleStr = ""
@@ -3257,16 +3257,16 @@
     ( ProcIdInt = 0 ->
         MaybeProcIdInt = ""
     ;
-        string__format("_m%d", [i(ProcIdInt)], MaybeProcIdInt)
+        string.format("_m%d", [i(ProcIdInt)], MaybeProcIdInt)
     ),
     (
         MaybeSeqNum = yes(SeqNum),
-        string__format("_i%d", [i(SeqNum)], MaybeSeqNumStr)
+        string.format("_i%d", [i(SeqNum)], MaybeSeqNumStr)
     ;
         MaybeSeqNum = no,
         MaybeSeqNumStr = ""
     ),
-    string__format("%s%s_%d%s%s%s", [
+    string.format("%s%s_%d%s%s%s", [
         s(MaybeModuleStr), s(Name),
         i(Arity), s(PredOrFuncStr), s(MaybeProcIdInt),
         s(MaybeSeqNumStr)], UnMangledId),
@@ -3278,33 +3278,33 @@
     proc_id_to_int(ProcId, ProcIdInt),
     (
         MaybeModuleName = yes(ModuleName),
-        mlds_to_il__sym_name_to_string(ModuleName, MStr),
-        string__format("%s_", [s(MStr)], MaybeModuleStr)
+        mlds_to_il.sym_name_to_string(ModuleName, MStr),
+        string.format("%s_", [s(MStr)], MaybeModuleStr)
     ;
         MaybeModuleName = no,
         MaybeModuleStr = ""
     ),
     (
         MaybeSeqNum = yes(SeqNum),
-        string__format("_%d", [i(SeqNum)], MaybeSeqNumStr)
+        string.format("_%d", [i(SeqNum)], MaybeSeqNumStr)
     ;
         MaybeSeqNum = no,
         MaybeSeqNumStr = ""
     ),
-    string__format("special_%s%s_%s_%d_%d%s",
+    string.format("special_%s%s_%s_%d_%d%s",
         [s(MaybeModuleStr), s(PredName), s(TypeName), i(Arity),
             i(ProcIdInt), s(MaybeSeqNumStr)], UnMangledId),
     Id = UnMangledId.
     % Id = name_mangle(UnMangledId).

-    % If an mlds__var is not an argument or a local, what is it?
+    % If an mlds.var is not an argument or a local, what is it?
     % We assume the given variable is a static field;
     % either a compiler-generated static,
     % or possibly a handwritten RTTI reference or a
     % reference to some hand-written code in the
     % modulename__csharp_code.mercury_code class.
     %
-:- func make_static_fieldref(il_data_rep, mlds__var, mlds_type) = fieldref.
+:- func make_static_fieldref(il_data_rep, mlds.var, mlds_type) = fieldref.

 make_static_fieldref(DataRep, Var, VarType) = FieldRef :-
     Var = qual(ModuleName, _QualKind, VarName),
@@ -3322,11 +3322,11 @@
     PackageName0 = mlds_module_name_to_package_name(ModuleName0),
     (
         PackageName0 = qualified(Q, M0),
-        M = string__format("%s__%s_code", [s(M0), s(LangStr)]),
+        M = string.format("%s__%s_code", [s(M0), s(LangStr)]),
         PackageName = qualified(Q, M)
     ;
         PackageName0 = unqualified(M0),
-        M = string__format("%s__%s_code", [s(M0), s(LangStr)]),
+        M = string.format("%s__%s_code", [s(M0), s(LangStr)]),
         PackageName = unqualified(M)
     ),
     SymName0 = mlds_module_name_to_sym_name(ModuleName0),
@@ -3335,22 +3335,22 @@
     ( SymName0 = qualified(SymName1, wrapper_class_name) ->
         (
             SymName1 = qualified(SQ, SM0),
-            SM = string__format("%s__%s_code", [s(SM0), s(LangStr)]),
+            SM = string.format("%s__%s_code", [s(SM0), s(LangStr)]),
             SymName2 = qualified(SQ, SM)
         ;
             SymName1 = unqualified(SM0),
-            SM = string__format("%s__%s_code", [s(SM0), s(LangStr)]),
+            SM = string.format("%s__%s_code", [s(SM0), s(LangStr)]),
             SymName2 = unqualified(SM)
         ),
         SymName = qualified(SymName2, wrapper_class_name)
     ;
         (
             SymName0 = qualified(SQ, SM0),
-            SM = string__format("%s__%s_code", [s(SM0), s(LangStr)]),
+            SM = string.format("%s__%s_code", [s(SM0), s(LangStr)]),
             SymName = qualified(qualified(SQ, SM), wrapper_class_name)
         ;
             SymName0 = unqualified(SM0),
-            SM = string__format("%s__%s_code", [s(SM0), s(LangStr)]),
+            SM = string.format("%s__%s_code", [s(SM0), s(LangStr)]),
             SymName = qualified(unqualified(SM), wrapper_class_name)
         )
     ),
@@ -3360,7 +3360,7 @@
     % if the RTTI is defined in C code by hand. If no data_name is provided,
     % always do the mangling.
     %
-:- pred mangle_dataname_module(maybe(mlds__data_name)::in,
+:- pred mangle_dataname_module(maybe(mlds.data_name)::in,
     mlds_module_name::in, mlds_module_name::out) is det.

 mangle_dataname_module(no, !ModuleName) :-
@@ -3375,7 +3375,7 @@
         LibModuleName0 = "private_builtin",
         CodeString = "__csharp_code"
     ->
-        string__append(LibModuleName0, CodeString, LibModuleName),
+        string.append(LibModuleName0, CodeString, LibModuleName),
         !:ModuleName = mercury_module_name_to_mlds(
             qualified(qualified(unqualified("mercury"),
             LibModuleName), wrapper_class_name))
@@ -3383,14 +3383,14 @@
         true
     ).

-:- pred mangle_dataname(mlds__data_name::in, string::out) is det.
+:- pred mangle_dataname(mlds.data_name::in, string::out) is det.

 mangle_dataname(var(MLDSVarName), Name) :-
     Name = mangle_mlds_var_name(MLDSVarName).
 mangle_dataname(common(Int), MangledName) :-
-    string__format("common_%d", [i(Int)], MangledName).
+    string.format("common_%d", [i(Int)], MangledName).
 mangle_dataname(rtti(RttiId), MangledName) :-
-    rtti__id_to_c_identifier(RttiId, MangledName).
+    rtti.id_to_c_identifier(RttiId, MangledName).
 mangle_dataname(module_layout, _MangledName) :-
     sorry(this_file, "unimplemented: mangling module_layout").
 mangle_dataname(proc_layout(_), _MangledName) :-
@@ -3406,7 +3406,7 @@
     ClassName = mlds_module_name_to_class_name(ModuleName),
     predlabel_to_id(PredLabel, ProcId, MaybeSeqNum, PredStr).

-:- pred mangle_entity_name(mlds__entity_name::in, string::out) is det.
+:- pred mangle_entity_name(mlds.entity_name::in, string::out) is det.

 mangle_entity_name(type(_TypeName, _), _MangledName) :-
     unexpected(this_file, "can't mangle type names").
@@ -3423,36 +3423,37 @@
 mangle_mlds_var(qual(_ModuleName, _, VarName), Str) :-
     Str = mangle_mlds_var_name(VarName).

-:- func mangle_mlds_var_name(mlds__var_name) = string.
+:- func mangle_mlds_var_name(mlds.var_name) = string.

-mangle_mlds_var_name(mlds__var_name(Name, yes(Num))) =
-    string__format("%s_%d", [s(Name), i(Num)]).
-mangle_mlds_var_name(mlds__var_name(Name, no)) = Name.
+mangle_mlds_var_name(mlds.var_name(Name, yes(Num))) =
+    string.format("%s_%d", [s(Name), i(Num)]).
+mangle_mlds_var_name(mlds.var_name(Name, no)) = Name.

-:- pred mlds_to_il__sym_name_to_string(sym_name::in, string::out) is det.
+:- pred mlds_to_il.sym_name_to_string(sym_name::in, string::out) is det.

-mlds_to_il__sym_name_to_string(SymName, String) :-
-    mlds_to_il__sym_name_to_string(SymName, ".", String).
+mlds_to_il.sym_name_to_string(SymName, String) :-
+    mlds_to_il.sym_name_to_string(SymName, ".", String).

-:- pred mlds_to_il__sym_name_to_string(sym_name::in, string::in, string::out)
+:- pred mlds_to_il.sym_name_to_string(sym_name::in, string::in, string::out)
     is det.

-mlds_to_il__sym_name_to_string(SymName, Separator, String) :-
-    mlds_to_il__sym_name_to_string_2(SymName, Separator, [], Parts),
-    string__append_list(Parts, String).
+mlds_to_il.sym_name_to_string(SymName, Separator, String) :-
+    mlds_to_il.sym_name_to_string_2(SymName, Separator, [], Parts),
+    string.append_list(Parts, String).

-:- pred mlds_to_il__sym_name_to_string_2(sym_name::in, string::in,
+:- pred mlds_to_il.sym_name_to_string_2(sym_name::in, string::in,
     list(string)::in, list(string)::out) is det.

-mlds_to_il__sym_name_to_string_2(qualified(ModuleSpec,Name), Separator,
+mlds_to_il.sym_name_to_string_2(qualified(ModuleSpec,Name), Separator,
         !Strs) :-
-    mlds_to_il__sym_name_to_string_2(ModuleSpec, Separator, !Strs),
+    mlds_to_il.sym_name_to_string_2(ModuleSpec, Separator, !Strs),
     !:Strs = [Separator, Name | !.Strs].
-mlds_to_il__sym_name_to_string_2(unqualified(Name), _, !Strs) :-
+mlds_to_il.sym_name_to_string_2(unqualified(Name), _, !Strs) :-
     !:Strs = [Name | !.Strs].

     % Turn an MLDS module name into a class_name name.
-:- func mlds_module_name_to_class_name(mlds_module_name) = ilds__class_name.
+    %
+:- func mlds_module_name_to_class_name(mlds_module_name) = ilds.class_name.

 mlds_module_name_to_class_name(MldsModuleName) =
         structured_name(AssemblyName, ClassName, []) :-
@@ -3474,14 +3475,14 @@
         % Foreign code currently resides in it's own assembly even if it is
         % in a sub-module.
         PackageSymName = qualified(_, Name),
-        ( string__remove_suffix(Name, "__csharp_code", _)
-        ; string__remove_suffix(Name, "__cpp_code", _)
+        ( string.remove_suffix(Name, "__csharp_code", _)
+        ; string.remove_suffix(Name, "__cpp_code", _)
         )
     ->
-        mlds_to_il__sym_name_to_string(PackageSymName, PackageString),
+        mlds_to_il.sym_name_to_string(PackageSymName, PackageString),
         AssemblyName = assembly(PackageString)
     ;
-        mlds_to_il__sym_name_to_string(PackageSymName, PackageString),
+        mlds_to_il.sym_name_to_string(PackageSymName, PackageString),
         (
             PackageSymName = unqualified(_),
             AssemblyName = assembly(PackageString)
@@ -3492,13 +3493,13 @@
         )
     ).

-:- pred sym_name_to_class_name(sym_name::in, list(ilds__id)::out) is det.
+:- pred sym_name_to_class_name(sym_name::in, list(ilds.id)::out) is det.

 sym_name_to_class_name(SymName, Ids) :-
     sym_name_to_class_name_2(SymName, Ids0),
-    list__reverse(Ids0, Ids).
+    list.reverse(Ids0, Ids).

-:- pred sym_name_to_class_name_2(sym_name::in, list(ilds__id)::out) is det.
+:- pred sym_name_to_class_name_2(sym_name::in, list(ilds.id)::out) is det.

 sym_name_to_class_name_2(qualified(ModuleSpec, Name), [Name | Modules]) :-
     sym_name_to_class_name_2(ModuleSpec, Modules).
@@ -3506,25 +3507,25 @@

 %-----------------------------------------------------------------------------%
 %
-% Predicates for checking various attributes of variables.
+% Predicates for checking various attributes of variables
 %

-:- pred is_argument(ilds__id::in, il_info::in) is semidet.
+:- pred is_argument(ilds.id::in, il_info::in) is semidet.

 is_argument(VarName, Info) :-
-    list__member(VarName - _, Info ^ arguments).
+    list.member(VarName - _, Info ^ arguments).

-:- pred is_local(ilds__id::in, il_info::in) is semidet.
+:- pred is_local(ilds.id::in, il_info::in) is semidet.

 is_local(VarName, Info) :-
-    map__contains(Info ^ locals, VarName).
+    map.contains(Info ^ locals, VarName).

-:- pred is_local_field(mlds__var::in, mlds_type::in, il_info::in,
+:- pred is_local_field(mlds.var::in, mlds_type::in, il_info::in,
     fieldref::out) is semidet.

 is_local_field(Var, VarType, Info, FieldRef) :-
     mangle_mlds_var(Var, VarName),
-    set__member(VarName, Info ^ field_names),
+    set.member(VarName, Info ^ field_names),
     Var = qual(ModuleName, _, _),
     ClassName = mlds_module_name_to_class_name(ModuleName),
     FieldRef = make_fieldref(
@@ -3533,7 +3534,7 @@

 %-----------------------------------------------------------------------------%
 %
-% Preds and funcs to find the types of rvals.
+% Preds and funcs to find the types of rvals
 %

     % This gives us the type of an rval. This type is an MLDS type,
@@ -3552,7 +3553,7 @@
 rval_to_type(unop(Unop, _), Type) :-
     (
         Unop = box(_),
-        Type = mlds__generic_type
+        Type = mlds.generic_type
     ;
         Unop = unbox(UnboxType),
         Type = UnboxType
@@ -3574,9 +3575,9 @@

 :- func rval_const_to_type(mlds_rval_const) = mlds_type.

-rval_const_to_type(data_addr_const(_)) = mlds__array_type(mlds__generic_type).
+rval_const_to_type(data_addr_const(_)) = mlds.array_type(mlds.generic_type).
 rval_const_to_type(code_addr_const(_))
-        = mlds__func_type(mlds__func_params([], [])).
+        = mlds.func_type(mlds.func_params([], [])).
 rval_const_to_type(int_const(_))
         = mercury_type(IntType, type_cat_int, non_foreign_type(IntType)) :-
     IntType = builtin(int).
@@ -3584,8 +3585,8 @@
         = mercury_type(FloatType, type_cat_float,
             non_foreign_type(FloatType)) :-
     FloatType = builtin(float).
-rval_const_to_type(false) = mlds__native_bool_type.
-rval_const_to_type(true) = mlds__native_bool_type.
+rval_const_to_type(false) = mlds.native_bool_type.
+rval_const_to_type(true) = mlds.native_bool_type.
 rval_const_to_type(string_const(_))
         = mercury_type(StrType, type_cat_string, non_foreign_type(StrType)) :-
     StrType = builtin(string).
@@ -3596,7 +3597,7 @@

 %-----------------------------------------------------------------------------%

-:- func code_addr_constant_to_methodref(il_data_rep, mlds__code_addr) =
+:- func code_addr_constant_to_methodref(il_data_rep, mlds.code_addr) =
     methodref.

 code_addr_constant_to_methodref(DataRep, proc(ProcLabel, Sig)) = MethodRef :-
@@ -3618,7 +3619,7 @@

     % Assumed to be a field of a class.
     %
-:- pred data_addr_constant_to_fieldref(mlds__data_addr::in, fieldref::out)
+:- pred data_addr_constant_to_fieldref(mlds.data_addr::in, fieldref::out)
     is det.

 data_addr_constant_to_fieldref(data_addr(ModuleName, DataName), FieldRef) :-
@@ -3643,13 +3644,13 @@

 get_fieldref(DataRep, FieldNum, FieldType, ClassType0, FieldRef,
         CastClassInstrs) :-
-    ( ClassType0 = mlds__ptr_type(ClassType1) ->
+    ( ClassType0 = mlds.ptr_type(ClassType1) ->
         ClassType = ClassType1
     ;
         ClassType = ClassType0
     ),
     FieldILType0 = mlds_type_to_ilds_type(DataRep, FieldType),
-    ( FieldILType0 = ilds__type(_, '&'(FieldILType1)) ->
+    ( FieldILType0 = il_type(_, '&'(FieldILType1)) ->
         FieldILType = FieldILType1
     ;
         FieldILType = FieldILType0
@@ -3658,7 +3659,7 @@
         FieldNum = offset(OffsetRval),
         ClassName = mlds_type_to_ilds_class_name(DataRep, ClassType),
         ( OffsetRval = const(int_const(Num)) ->
-            string__format("f%d", [i(Num)], FieldId)
+            string.format("f%d", [i(Num)], FieldId)
         ;
             sorry(this_file, "offsets for non-int_const rvals")
         ),
@@ -3678,7 +3679,7 @@
             CastClassInstrs = empty
         ;
             CastClassInstrs = instr_node(
-                castclass(ilds__type([], class(ClassName))))
+                castclass(il_type([], class(ClassName))))
         )
     ),
     FieldRef = make_fieldref(FieldILType, ClassName, FieldId).
@@ -3689,8 +3690,8 @@
     % CtorClassName by moving the nested parts into the
     % third field of the structured_name.
     %
-:- func fixup_class_qualifiers(ilds__class_name, ilds__class_name) =
-    ilds__class_name.
+:- func fixup_class_qualifiers(ilds.class_name, ilds.class_name) =
+    ilds.class_name.

 fixup_class_qualifiers(CtorClassName0, PtrClassName) = CtorClassName :-
     PtrClassName = structured_name(PtrAssembly, PtrClass, PtrNested),
@@ -3733,14 +3734,14 @@

 %-----------------------------------------------------------------------------%

-:- pred defn_to_local(mlds_module_name::in, mlds__defn::in,
-    pair(ilds__id, mlds_type)::out) is det.
+:- pred defn_to_local(mlds_module_name::in, mlds.defn::in,
+    pair(ilds.id, mlds_type)::out) is det.

 defn_to_local(ModuleName, Defn, Id - MLDSType) :-
-    Defn = mlds__defn(Name, _Context, _DeclFlags, Entity),
+    Defn = mlds.defn(Name, _Context, _DeclFlags, Entity),
     (
         Name = data(DataName),
-        Entity = mlds__data(MLDSType0, _Initializer, _GC_TraceCode)
+        Entity = mlds.data(MLDSType0, _Initializer, _GC_TraceCode)
     ->
         mangle_dataname(DataName, MangledDataName),
         mangle_mlds_var(qual(ModuleName, module_qual,
@@ -3755,53 +3756,53 @@
 % These functions are for converting to/from generic objects.
 %

-:- func convert_to_object(ilds__type) = instr_tree.
+:- func convert_to_object(il_type) = instr_tree.

 convert_to_object(Type) = instr_node(box(ValueType)) :-
-    Type = ilds__type(_, SimpleType),
+    Type = il_type(_, SimpleType),
     ValueType = simple_type_to_valuetype(SimpleType).

-:- func convert_from_object(ilds__type) = instr_tree.
+:- func convert_from_object(il_type) = instr_tree.

 convert_from_object(Type) = node([unbox(Type), ldobj(Type)]).

-:- func simple_type_to_valuetype(simple_type) = ilds__type.
+:- func simple_type_to_valuetype(simple_type) = il_type.
 simple_type_to_valuetype(int8) =
-    ilds__type([], valuetype(il_system_name(["SByte"]))).
+    il_type([], valuetype(il_system_name(["SByte"]))).
 simple_type_to_valuetype(int16) =
-    ilds__type([], valuetype(il_system_name(["Int16"]))).
+    il_type([], valuetype(il_system_name(["Int16"]))).
 simple_type_to_valuetype(int32) =
-    ilds__type([], valuetype(il_system_name(["Int32"]))).
+    il_type([], valuetype(il_system_name(["Int32"]))).
 simple_type_to_valuetype(int64) =
-    ilds__type([], valuetype(il_system_name(["Int64"]))).
+    il_type([], valuetype(il_system_name(["Int64"]))).
 simple_type_to_valuetype(uint8) =
-    ilds__type([], valuetype(il_system_name(["Byte"]))).
+    il_type([], valuetype(il_system_name(["Byte"]))).
 simple_type_to_valuetype(uint16) =
-    ilds__type([], valuetype(il_system_name(["UInt16"]))).
+    il_type([], valuetype(il_system_name(["UInt16"]))).
 simple_type_to_valuetype(uint32) =
-    ilds__type([], valuetype(il_system_name(["UInt32"]))).
+    il_type([], valuetype(il_system_name(["UInt32"]))).
 simple_type_to_valuetype(uint64) =
-    ilds__type([], valuetype(il_system_name(["UInt64"]))).
+    il_type([], valuetype(il_system_name(["UInt64"]))).
 simple_type_to_valuetype(float32) =
-    ilds__type([], valuetype(il_system_name(["Single"]))).
+    il_type([], valuetype(il_system_name(["Single"]))).
 simple_type_to_valuetype(float64) =
-    ilds__type([], valuetype(il_system_name(["Double"]))).
+    il_type([], valuetype(il_system_name(["Double"]))).
 simple_type_to_valuetype(bool) =
-    ilds__type([], valuetype(il_system_name(["Boolean"]))).
+    il_type([], valuetype(il_system_name(["Boolean"]))).
 simple_type_to_valuetype(char) =
-    ilds__type([], valuetype(il_system_name(["Char"]))).
+    il_type([], valuetype(il_system_name(["Char"]))).
 simple_type_to_valuetype(object) = _ :-
-    % ilds__type([], valuetype(il_system_name(["Object"]))).
+    % il_type([], valuetype(il_system_name(["Object"]))).
     unexpected(this_file, "no value class for System.Object").
 simple_type_to_valuetype(string) = _ :-
-    % ilds__type([], valuetype(il_system_name(["String"]))).
+    % il_type([], valuetype(il_system_name(["String"]))).
     unexpected(this_file, "no value class for System.String").
 simple_type_to_valuetype(refany) = _ :-
     unexpected(this_file, "no value class for refany").
 simple_type_to_valuetype(class(_)) = _ :-
     unexpected(this_file, "no value class for class").
 simple_type_to_valuetype(valuetype(Name)) =
-    ilds__type([], valuetype(Name)).
+    il_type([], valuetype(Name)).
 simple_type_to_valuetype(interface(_)) = _ :-
     unexpected(this_file, "no value class for interface").
 simple_type_to_valuetype('[]'(_, _)) = _ :-
@@ -3819,7 +3820,7 @@

 %-----------------------------------------------------------------------------%

-:- func il_bool_type = ilds__type.
+:- func il_bool_type = il_type.

 il_bool_type = simple_type_to_valuetype(bool).

@@ -3848,7 +3849,7 @@
 il_mercury_string_hash = get_static_methodref(mercury_string_class_name,
     id("hash_2"), simple_type(int32), [il_string_type]).

-:- func il_string_class_name = ilds__class_name.
+:- func il_string_class_name = ilds.class_name.

 il_string_class_name = il_system_name(["String"]).

@@ -3856,11 +3857,11 @@

 il_string_simple_type = class(il_string_class_name).

-:- func il_string_type = ilds__type.
+:- func il_string_type = il_type.

-il_string_type = ilds__type([], il_string_simple_type).
+il_string_type = il_type([], il_string_simple_type).

-:- func mercury_string_class_name = ilds__class_name.
+:- func mercury_string_class_name = ilds.class_name.

 mercury_string_class_name = mercury_library_name(StringClass) :-
     sym_name_to_class_name(qualified(unqualified("string"),
@@ -3868,12 +3869,12 @@

 %-----------------------------------------------------------------------------%
 %
-% The mapping of the generic type (used like MR_Box).
+% The mapping of the generic type (used like MR_Box)
 %

-:- func il_generic_type = ilds__type.
+:- func il_generic_type = il_type.

-il_generic_type = ilds__type([], il_generic_simple_type).
+il_generic_type = il_type([], il_generic_simple_type).

 :- func il_generic_simple_type = simple_type.

@@ -3883,13 +3884,13 @@

     % Return the class name for System.ValueType.
     %
-:- func il_generic_valuetype_name = ilds__class_name.
+:- func il_generic_valuetype_name = ilds.class_name.

 il_generic_valuetype_name = il_system_name(["ValueType"]).

     % Return the class name for System.Enum
     %
-:- func il_generic_enum_name = ilds__class_name.
+:- func il_generic_enum_name = ilds.class_name.

 il_generic_enum_name = il_system_name(["Enum"]).

@@ -3899,9 +3900,9 @@
 %
     % il_object_array_type means array of System.Object.
     %
-:- func il_object_array_type = ilds__type.
+:- func il_object_array_type = il_type.

-il_object_array_type = ilds__type([], '[]'(il_generic_type, [])).
+il_object_array_type = il_type([], '[]'(il_generic_type, [])).

 %-----------------------------------------------------------------------------%
 %
@@ -3910,16 +3911,16 @@

     % il_generic_array_type means array of System.Object.
     %
-:- func il_generic_array_type = ilds__type.
+:- func il_generic_array_type = il_type.

-il_generic_array_type = ilds__type([], class(il_system_name(["Array"]))).
+il_generic_array_type = il_type([], class(il_system_name(["Array"]))).

 %-----------------------------------------------------------------------------%
 %
 % The class that performs conversion operations
 %

-:- func il_conversion_class_name = ilds__class_name.
+:- func il_conversion_class_name = ilds.class_name.

 il_conversion_class_name = mercury_runtime_name(["Convert"]).

@@ -3928,15 +3929,15 @@
 % The mapping of the exception type.
 %

-:- func il_exception_type = ilds__type.
+:- func il_exception_type = il_type.

-il_exception_type = ilds__type([], il_exception_simple_type).
+il_exception_type = il_type([], il_exception_simple_type).

 :- func il_exception_simple_type = simple_type.

 il_exception_simple_type = class(il_exception_class_name).

-:- func il_exception_class_name = ilds__class_name.
+:- func il_exception_class_name = ilds.class_name.

 il_exception_class_name = mercury_runtime_name(["Exception"]).

@@ -3949,9 +3950,9 @@
 :- func il_set_exit_code = methodref.

 il_set_exit_code = get_static_methodref(system_environment_class_name,
-    id("set_ExitCode"), void, [ilds__type([], int32)]).
+    id("set_ExitCode"), void, [il_type([], int32)]).

-:- func system_environment_class_name = ilds__class_name.
+:- func system_environment_class_name = ilds.class_name.

 system_environment_class_name = il_system_name(["Environment"]).

@@ -3972,52 +3973,52 @@
 % For unverifiable code we allocate environments on the stack and use
 % unmanaged pointers.

-:- func choose_il_envptr_type(globals) = ilds__type.
+:- func choose_il_envptr_type(globals) = il_type.

 choose_il_envptr_type(Globals) = ILType :-
-    globals__lookup_bool_option(Globals, put_nondet_env_on_heap, OnHeap),
-    globals__lookup_bool_option(Globals, verifiable_code, Verifiable),
+    globals.lookup_bool_option(Globals, put_nondet_env_on_heap, OnHeap),
+    globals.lookup_bool_option(Globals, verifiable_code, Verifiable),
     ( OnHeap = yes ->
         % Use an object reference type.
         ILType = il_heap_envptr_type
     ; Verifiable = yes ->
         % Use "refany", the generic managed pointer type
-        ILType = ilds__type([], refany)
+        ILType = il_type([], refany)
     ;
         % Use unmanaged pointers
-        ILType = ilds__type([], native_uint)
+        ILType = il_type([], native_uint)
         % XXX We should introduce an ILDS type for unmanaged pointers,
         % rather than using native_uint; that's what IL does, but it sucks
         % -- we should delay the loss of type information to the last possible
         % moment, i.e. when writing out IL.
     ).

-:- func il_heap_envptr_type = ilds__type.
+:- func il_heap_envptr_type = il_type.

-il_heap_envptr_type = ilds__type([], il_heap_envptr_simple_type).
+il_heap_envptr_type = il_type([], il_heap_envptr_simple_type).

 :- func il_heap_envptr_simple_type = simple_type.

 il_heap_envptr_simple_type = class(il_heap_envptr_class_name).

-:- func il_heap_envptr_class_name = ilds__class_name.
+:- func il_heap_envptr_class_name = ilds.class_name.

 il_heap_envptr_class_name = mercury_runtime_name(["Environment"]).

 %-----------------------------------------------------------------------------%
 %
-% The mapping of the commit type.
+% The mapping of the commit type
 %

-:- func il_commit_type = ilds__type.
+:- func il_commit_type = il_type.

-il_commit_type = ilds__type([], il_commit_simple_type).
+il_commit_type = il_type([], il_commit_simple_type).

 :- func il_commit_simple_type = simple_type.

 il_commit_simple_type = class(il_commit_class_name).

-:- func il_commit_class_name = ilds__class_name.
+:- func il_commit_class_name = ilds.class_name.

 il_commit_class_name = mercury_runtime_name(["Commit"]).

@@ -4025,7 +4026,7 @@

     % Qualify a name with "[mercury]mercury.".
     %
-:- func mercury_library_name(ilds__namespace_qual_name) = ilds__class_name.
+:- func mercury_library_name(ilds.namespace_qual_name) = ilds.class_name.

 mercury_library_name(Name) =
     structured_name(assembly("mercury"), ["mercury" | Name], []).
@@ -4033,8 +4034,8 @@
     % Qualify a name with "[mercury]mercury." and add the wrapper class
     % name on the end.
     %
-:- func mercury_library_wrapper_class_name(ilds__namespace_qual_name) =
-    ilds__class_name.
+:- func mercury_library_wrapper_class_name(ilds.namespace_qual_name) =
+    ilds.class_name.

 mercury_library_wrapper_class_name(Name) =
     structured_name(assembly("mercury"),
@@ -4044,7 +4045,7 @@

     % Qualifiy a name with "[mercury]mercury.runtime.".
     %
-:- func mercury_runtime_name(ilds__namespace_qual_name) = ilds__class_name.
+:- func mercury_runtime_name(ilds.namespace_qual_name) = ilds.class_name.

 mercury_runtime_name(Name) =
     structured_name(assembly("mercury"), ["mercury", "runtime" | Name], []).
@@ -4053,7 +4054,7 @@

     % Qualifiy a name with "[mscorlib]System.".
     %
-:- func il_system_name(ilds__namespace_qual_name) = ilds__class_name.
+:- func il_system_name(ilds.namespace_qual_name) = ilds.class_name.

 il_system_name(Name) =
     structured_name(il_system_assembly_name,
@@ -4071,10 +4072,10 @@

     % Generate extern decls for any assembly we reference.
     %
-:- pred mlds_to_il__generate_extern_assembly(string::in, assembly_decl::in,
-    bool::in, bool::in, mlds__imports::in, list(decl)::out) is det.
+:- pred generate_extern_assembly(string::in, assembly_decl::in,
+    bool::in, bool::in, mlds.imports::in, list(decl)::out) is det.

-mlds_to_il__generate_extern_assembly(CurrentAssembly, Version, SignAssembly,
+generate_extern_assembly(CurrentAssembly, Version, SignAssembly,
         SeparateAssemblies, Imports, AllDecls) :-
     Gen = (pred(Import::in, Decl::out) is semidet :-
         (
@@ -4090,9 +4091,8 @@
             Import = foreign_import(ForeignImportName),
             ForeignImportName = il_assembly_name(ImportName),
             PackageName = mlds_module_name_to_package_name( ImportName),
-            mdbcomp__prim_data__sym_name_to_string(PackageName,
-                ForeignPackageStr),
-            ( string__prefix(ForeignPackageStr, "System") ->
+            prim_data.sym_name_to_string(PackageName, ForeignPackageStr),
+            ( string.prefix(ForeignPackageStr, "System") ->
                 AsmDecls = dotnet_system_assembly_decls(Version)
             ;
                 AsmDecls = []
@@ -4120,8 +4120,8 @@
             )
         )
     ),
-    list__filter_map(Gen, Imports, Decls0),
-    list__sort_and_remove_dups(list__condense(Decls0), Decls),
+    list.filter_map(Gen, Imports, Decls0),
+    list.sort_and_remove_dups(list.condense(Decls0), Decls),
     AllDecls = [
         extern_assembly("mercury", [
             version(0, 0, 0, 0),
@@ -4167,7 +4167,7 @@
         DebugIlAsm = no,
         Add = 0
     ),
-    Instrs = list__condense(tree__flatten(InstrTree)),
+    Instrs = list.condense(tree.flatten(InstrTree)),
     MaxStack = maxstack(int32(calculate_max_stack(Instrs) + Add)),
     % .zeroinit (which initializes all variables to zero) is required for
     % verifiable code. But if we're generating non-verifiable code, then
@@ -4182,18 +4182,20 @@
     ).

 %-----------------------------------------------------------------------------
-% Some useful functions for generating IL fragments.
+%
+% Some useful functions for generating IL fragments
+%

 :- func load_this = instr.

 load_this = ldarg(index(0)).

-:- func call_class_constructor(ilds__class_name) = instr.
+:- func call_class_constructor(ilds.class_name) = instr.

 call_class_constructor(CtorMemberName) =
     call(get_static_methodref(CtorMemberName, cctor, void, [])).

-:- func call_constructor(ilds__class_name) = instr.
+:- func call_constructor(ilds.class_name) = instr.

 call_constructor(CtorMemberName) =
     call(get_constructor_methoddef(CtorMemberName, [])).
@@ -4208,26 +4210,26 @@
         throw]
     ).

-:- func newobj_constructor(ilds__class_name, list(ilds__type)) = instr.
+:- func newobj_constructor(ilds.class_name, list(il_type)) = instr.

 newobj_constructor(CtorMemberName, ArgTypes) =
     newobj(get_constructor_methoddef(CtorMemberName, ArgTypes)).

-:- func get_constructor_methoddef(ilds__class_name, list(ilds__type))
+:- func get_constructor_methoddef(ilds.class_name, list(il_type))
     = methodref.

 get_constructor_methoddef(CtorMemberName, ArgTypes) =
     get_instance_methodref(CtorMemberName, ctor, void, ArgTypes).

-:- func get_instance_methodref(ilds__class_name, member_name, ret_type,
-    list(ilds__type)) = methodref.
+:- func get_instance_methodref(ilds.class_name, member_name, ret_type,
+    list(il_type)) = methodref.

 get_instance_methodref(ClassName, MethodName, RetType, TypeParams) =
     methoddef(call_conv(yes, default), RetType,
         class_member_name(ClassName, MethodName), TypeParams).

-:- func get_static_methodref(ilds__class_name, member_name, ret_type,
-    list(ilds__type)) = methodref.
+:- func get_static_methodref(ilds.class_name, member_name, ret_type,
+    list(il_type)) = methodref.

 get_static_methodref(ClassName, MethodName, RetType, TypeParams) =
     methoddef(call_conv(no, default), RetType,
@@ -4239,7 +4241,7 @@
     methodhead([], ctor, signature(call_conv(no, default),
         void, []), []), MethodDecls).

-:- func make_fieldref(ilds__type, ilds__class_name, ilds__id) = fieldref.
+:- func make_fieldref(il_type, ilds.class_name, ilds.id) = fieldref.

 make_fieldref(ILType, ClassName, Id) =
     fieldref(ILType, class_member_name(ClassName, id(Id))).
@@ -4258,34 +4260,34 @@
         runtime_init_method_name, void, [il_bool_type]))
     ].

-:- func runtime_init_module_name = ilds__class_name.
+:- func runtime_init_module_name = ilds.class_name.

 runtime_init_module_name =
     structured_name(assembly("mercury"),
         ["mercury", "runtime", "Init"], []).

-:- func runtime_init_method_name = ilds__member_name.
+:- func runtime_init_method_name = ilds.member_name.

 runtime_init_method_name = id("init_runtime").

-:- func responsible_for_init_runtime_name = ilds__member_name.
+:- func responsible_for_init_runtime_name = ilds.member_name.

 responsible_for_init_runtime_name = id("responsible_for_initialising_runtime").

 %-----------------------------------------------------------------------------%
 %
-% Predicates for manipulating il_info.
+% Predicates for manipulating il_info
 %

-:- func il_info_init(mlds_module_name, ilds__id, mlds__imports,
+:- func il_info_init(mlds_module_name, ilds.id, mlds.imports,
     il_data_rep, bool, bool, bool, bool, bool) = il_info.

 il_info_init(ModuleName, AssemblyName, Imports, ILDataRep,
         DebugIlAsm, VerifiableCode, ByRefTailCalls, MsCLR, RotorCLR) =
-    il_info(ModuleName, AssemblyName, Imports, set__init, ILDataRep,
+    il_info(ModuleName, AssemblyName, Imports, set.init, ILDataRep,
         DebugIlAsm, VerifiableCode, ByRefTailCalls, MsCLR, RotorCLR,
-        empty, empty, [], no, set__init, set__init,
-        map__init, empty, counter__init(1), counter__init(1), no,
+        empty, empty, [], no, set.init, set.init,
+        map.init, empty, counter.init(1), counter.init(1), no,
         Args, MethodName, DefaultSignature) :-
     Args = [],
     DefaultSignature = signature(call_conv(no, default), void, []),
@@ -4295,16 +4297,16 @@

 il_info_new_class(ClassDefn, !Info) :-
     ClassDefn = class_defn(_, _, _, _, _, Members),
-    list__filter_map((pred(M::in, S::out) is semidet :-
-            M = mlds__defn(Name, _, _, data(_, _, _)),
+    list.filter_map((pred(M::in, S::out) is semidet :-
+            M = mlds.defn(Name, _, _, data(_, _, _)),
             S = entity_name_to_ilds_id(Name)
         ), Members, FieldNames),
     !:Info = !.Info ^ alloc_instrs := empty,
     !:Info = !.Info ^ init_instrs := empty,
     !:Info = !.Info ^ class_members := [],
     !:Info = !.Info ^ has_main := no,
-    !:Info = !.Info ^ class_foreign_langs := set__init,
-    !:Info = !.Info ^ field_names := set__list_to_set(FieldNames).
+    !:Info = !.Info ^ class_foreign_langs := set.init,
+    !:Info = !.Info ^ field_names := set.list_to_set(FieldNames).

     % Reset the il_info for processing a new method.
     %
@@ -4316,22 +4318,22 @@
     (
         !.Info ^ method_foreign_lang = yes(SomeLang),
         !:Info = !.Info ^ file_foreign_langs :=
-            set__insert(Info0 ^ file_foreign_langs, SomeLang),
+            set.insert(Info0 ^ file_foreign_langs, SomeLang),
         !:Info = !.Info ^ class_foreign_langs :=
-            set__insert(Info0 ^ class_foreign_langs, SomeLang)
+            set.insert(Info0 ^ class_foreign_langs, SomeLang)
     ;
         !.Info ^ method_foreign_lang = no
     ),
-    !:Info = !.Info ^ locals := map__init,
+    !:Info = !.Info ^ locals := map.init,
     !:Info = !.Info ^ instr_tree := empty,
-    !:Info = !.Info ^ label_counter := counter__init(1),
-    !:Info = !.Info ^ block_counter := counter__init(1),
+    !:Info = !.Info ^ label_counter := counter.init(1),
+    !:Info = !.Info ^ block_counter := counter.init(1),
     !:Info = !.Info ^ method_foreign_lang := no,
     !:Info = !.Info ^ arguments := ILArgs,
     !:Info = !.Info ^ method_name := MethodName,
     !:Info = !.Info ^ signature := ILSignature.

-:- pred il_info_set_arguments(assoc_list(ilds__id, mlds_type)::in,
+:- pred il_info_set_arguments(assoc_list(ilds.id, mlds_type)::in,
     il_info::in, il_info::out) is det.

 il_info_set_arguments(Arguments, !Info) :-
@@ -4342,13 +4344,13 @@
 il_info_get_arguments(Info, Arguments) :-
     Arguments = Info ^ arguments.

-:- pred il_info_get_mlds_type(ilds__id::in, mlds_type::out,
+:- pred il_info_get_mlds_type(ilds.id::in, mlds_type::out,
     il_info::in, il_info::out) is det.

 il_info_get_mlds_type(Id, Type, !Info) :-
-    ( map__search(!.Info ^ locals, Id, Type0) ->
+    ( map.search(!.Info ^ locals, Id, Type0) ->
         Type = Type0
-    ; assoc_list__search(!.Info ^ arguments, Id, Type0) ->
+    ; assoc_list.search(!.Info ^ arguments, Id, Type0) ->
         Type = Type0
     ;
         % XXX If it isn't a local or an argument, it can only be a
@@ -4357,7 +4359,7 @@
     ).

     % RTTI creates global variables -- these all happen to be of
-    % type mlds__native_int_type.
+    % type mlds.native_int_type.
     %
 :- func mlds_type_for_rtti_global = mlds_type.

@@ -4369,19 +4371,19 @@
 il_info_set_modulename(ModuleName, !Info) :-
     !:Info = !.Info ^ module_name := ModuleName.

-:- pred il_info_add_locals(assoc_list(ilds__id, mlds_type)::in,
+:- pred il_info_add_locals(assoc_list(ilds.id, mlds_type)::in,
     il_info::in, il_info::out) is det.

 il_info_add_locals(NewLocals, !Info) :-
     !:Info = !.Info ^ locals :=
-        map__det_insert_from_assoc_list(!.Info ^ locals, NewLocals).
+        map.det_insert_from_assoc_list(!.Info ^ locals, NewLocals).

-:- pred il_info_remove_locals(assoc_list(ilds__id, mlds_type)::in,
+:- pred il_info_remove_locals(assoc_list(ilds.id, mlds_type)::in,
     il_info::in, il_info::out) is det.

 il_info_remove_locals(RemoveLocals, !Info) :-
-    assoc_list__keys(RemoveLocals, Keys),
-    map__delete_list(!.Info ^ locals, Keys, NewLocals),
+    assoc_list.keys(RemoveLocals, Keys),
+    map.delete_list(!.Info ^ locals, Keys, NewLocals),
     !:Info = !.Info ^ locals := NewLocals.

 :- pred il_info_add_class_member(list(class_member)::in,
@@ -4389,7 +4391,7 @@

 il_info_add_class_member(ClassMembers, !Info) :-
     !:Info = !.Info ^ class_members :=
-        list__append(ClassMembers, !.Info ^ class_members).
+        list.append(ClassMembers, !.Info ^ class_members).

 :- pred il_info_add_instructions(list(instr)::in,
     il_info::in, il_info::out) is det.
@@ -4418,14 +4420,14 @@
     Instrs = Info ^ instr_tree.

 :- pred il_info_get_locals_list(il_info::in,
-    assoc_list(ilds__id, ilds__type)::out) is det.
+    assoc_list(ilds.id, il_type)::out) is det.

 il_info_get_locals_list(Info, Locals) :-
     DataRep = Info ^ il_data_rep,
-    map__map_values((pred(_K::in, V::in, W::out) is det :-
+    map.map_values((pred(_K::in, V::in, W::out) is det :-
         W = mlds_type_to_ilds_type(DataRep, V)),
         Info ^ locals, LocalsMap),
-    map__to_assoc_list(LocalsMap, Locals).
+    map.to_assoc_list(LocalsMap, Locals).

 :- pred il_info_get_module_name(il_info::in, mlds_module_name::out) is det.

@@ -4436,21 +4438,21 @@
     is det.

 il_info_get_next_block_id(N, !Info) :-
-    counter__allocate(N, !.Info ^ block_counter, NewCounter),
+    counter.allocate(N, !.Info ^ block_counter, NewCounter),
     !:Info = !.Info ^ block_counter := NewCounter.

 :- pred il_info_get_next_label_num(int::out, il_info::in, il_info::out) is det.

 il_info_get_next_label_num(N, !Info) :-
-    counter__allocate(N, !.Info ^ label_counter, NewCounter),
+    counter.allocate(N, !.Info ^ label_counter, NewCounter),
     !:Info = !.Info ^ label_counter := NewCounter.

-:- pred il_info_make_next_label(ilds__label::out, il_info::in, il_info::out)
+:- pred il_info_make_next_label(ilds.label::out, il_info::in, il_info::out)
     is det.

 il_info_make_next_label(Label, !Info) :-
     il_info_get_next_label_num(LabelNnum, !Info),
-    string__format("l%d", [i(LabelNnum)], Label).
+    string.format("l%d", [i(LabelNnum)], Label).

 %-----------------------------------------------------------------------------%

@@ -4462,16 +4464,16 @@

     % Use this to make contexts into trees easily.
     %
-:- func context_node(mlds__context) = instr_tree.
+:- func context_node(mlds.context) = instr_tree.

 context_node(Context) = node([context_instr(Context)]).

-:- func context_instr(mlds__context) = instr.
+:- func context_instr(mlds.context) = instr.

 context_instr(Context) = context(FileName, LineNumber) :-
-    ProgContext = mlds__get_prog_context(Context),
-    term__context_file(ProgContext, FileName),
-    term__context_line(ProgContext, LineNumber).
+    ProgContext = mlds.get_prog_context(Context),
+    term.context_file(ProgContext, FileName),
+    term.context_line(ProgContext, LineNumber).

     % Use this to make instructions into trees easily.
     %
Index: mlds_to_ilasm.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds_to_ilasm.m,v
retrieving revision 1.30
diff -u -b -r1.30 mlds_to_ilasm.m
--- mlds_to_ilasm.m	28 Nov 2005 04:11:48 -0000	1.30
+++ mlds_to_ilasm.m	14 Mar 2006 13:50:49 -0000
@@ -1,10 +1,12 @@
 %-----------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et
+%-----------------------------------------------------------------------------%
 % Copyright (C) 1999-2005 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.
 %-----------------------------------------------------------------------------%

-% File: mlds_to_ilasm.
+% File: mlds_to_ilasm.m.
 % Main author: trd.

 % This code converts the MLDS representation into IL assembler.  This module
@@ -13,7 +15,7 @@

 %-----------------------------------------------------------------------------%

-:- module ml_backend__mlds_to_ilasm.
+:- module ml_backend.mlds_to_ilasm.
 :- interface.

 :- import_module ml_backend.mlds.
@@ -22,7 +24,7 @@

 	% Convert the MLDS to IL and write it to a file.
 	%
-:- pred mlds_to_ilasm__output_mlds(mlds::in, io::di, io::uo) is det.
+:- pred mlds_to_ilasm.output_mlds(mlds::in, io::di, io::uo) is det.

 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
@@ -67,7 +69,7 @@
 %-----------------------------------------------------------------------------%

 output_mlds(MLDS, !IO) :-
-	ModuleName = mlds__get_module_name(MLDS),
+    ModuleName = mlds.get_module_name(MLDS),
 	module_name_to_file_name(ModuleName, ".il", yes, ILAsmFile, !IO),
 	output_to_file(ILAsmFile, output_assembler(MLDS), Result, !IO),

@@ -75,8 +77,8 @@
 		Result = yes(ForeignLangs),
 		% Output any outline foreign_code to the appropriate foreign
 		% language file.
-		list__foldl(output_foreign_file(MLDS),
-			set__to_sorted_list(ForeignLangs), !IO)
+        list.foldl(output_foreign_file(MLDS),
+            set.to_sorted_list(ForeignLangs), !IO)
 	;
 		% An I/O error occurred; output_to_file has already reported
 		% an error message, so we don't need to do anything here.
@@ -87,7 +89,7 @@
 	io::di, io::uo) is det.

 output_foreign_file(MLDS, ForeignLang, !IO) :-
-	ModuleName = mlds__get_module_name(MLDS),
+    ModuleName = mlds.get_module_name(MLDS),
 	(
 		ForeignModuleName = foreign_language_module_name(ModuleName,
 			ForeignLang),
@@ -104,7 +106,7 @@
 	).

 :- pred handle_foreign_lang(foreign_language::in,
-	pred(mlds, io__state, io__state)::out(pred(in, di, uo) is det)) is det.
+    pred(mlds, io, io)::out(pred(in, di, uo) is det)) is det.

 handle_foreign_lang(managed_cplusplus, output_managed_code(managed_cplusplus)).
 handle_foreign_lang(csharp, output_managed_code(csharp)).
@@ -115,7 +117,6 @@
 handle_foreign_lang(java, _) :-
 	sorry(this_file, "language Java foreign code not supported").

-	%
 	% Generate the `.il' file.
 	% Returns the set of foreign language
 	%
@@ -126,7 +127,7 @@
 	MLDS = mlds(ModuleName, _ForeignCode, _Imports, _Defns,
 		_InitPreds, _FinalPreds),
 	output_src_start(ModuleName, !IO),
-	io__nl(!IO),
+    io.nl(!IO),

 	generate_il(MLDS, ILAsm0, ForeignLangs, !IO),

@@ -135,24 +136,28 @@
 		% the peephole optimization pass, because some of the peephole
 		% optimizations are actually needed for verifiability of the
 		% generated IL.
-	globals__io_lookup_bool_option(optimize_peep, Peephole, !IO),
-	globals__io_lookup_bool_option(verifiable_code, Verifiable, !IO),
+    globals.io_lookup_bool_option(optimize_peep, Peephole, !IO),
+    globals.io_lookup_bool_option(verifiable_code, Verifiable, !IO),
 	( Peephole = yes ->
 		VerifyOnly = no,
-		il_peephole__optimize(VerifyOnly, ILAsm0, ILAsm)
+        il_peephole.optimize(VerifyOnly, ILAsm0, ILAsm)
 	; Verifiable = yes ->
 		VerifyOnly = yes,
-		il_peephole__optimize(VerifyOnly, ILAsm0, ILAsm)
+        il_peephole.optimize(VerifyOnly, ILAsm0, ILAsm)
 	;
 		ILAsm0 = ILAsm
 	),

 		% Output the assembly.
-	ilasm__output(ILAsm, !IO),
+    ilasm.output(ILAsm, !IO),
 	output_src_end(ModuleName, !IO).

+%-----------------------------------------------------------------------------%
+
 :- func this_file = string.

 this_file = "mlds_to_ilasm.m".

+%-----------------------------------------------------------------------------%
 :- end_module mlds_to_ilasm.
+%-----------------------------------------------------------------------------%
Index: mlds_to_managed.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds_to_managed.m,v
retrieving revision 1.24
diff -u -b -r1.24 mlds_to_managed.m
--- mlds_to_managed.m	28 Nov 2005 04:11:48 -0000	1.24
+++ mlds_to_managed.m	14 Mar 2006 13:02:08 -0000
@@ -13,7 +13,7 @@

 %-----------------------------------------------------------------------------%

-:- module ml_backend__mlds_to_managed.
+:- module ml_backend.mlds_to_managed.
 :- interface.

 :- import_module libs.globals.
@@ -21,6 +21,8 @@

 :- import_module io.

+%-----------------------------------------------------------------------------%
+
 :- inst managed_lang == bound(csharp; managed_cplusplus).

     % Convert the MLDS to the specified foreign language and write
@@ -50,7 +52,6 @@
 :- import_module hlds.hlds_pred. % for `pred_proc_id'.
 :- import_module hlds.passes_aux.
 :- import_module libs.compiler_util.
-:- import_module libs.globals.
 :- import_module libs.options.
 :- import_module libs.tree.
 :- import_module mdbcomp.prim_data.
@@ -82,16 +83,16 @@
     MLDS = mlds(ModuleName, _ForeignCode, _Imports, _Defns,
         _InitPreds, _FinalPreds),
     output_src_start(ModuleName, !IO),
-    io__nl(!IO),
+    io.nl(!IO),
     generate_code(Lang, MLDS, !IO),
     output_src_end(ModuleName, !IO).

 %-----------------------------------------------------------------------------%

 output_src_start(ModuleName, !IO) :-
-    library__version(Version),
+    library.version(Version),
     sym_name_to_string(ModuleName, ModuleNameStr),
-    io__write_strings(
+    io.write_strings(
         ["//\n// Automatically generated from `",
         ModuleNameStr,
         ".m' by the\n",
@@ -102,9 +103,9 @@
         "\n\n"], !IO).

 output_src_end(ModuleName, !IO) :-
-    io__write_string("// End of module: ", !IO),
-    prog_out__write_sym_name(ModuleName, !IO),
-    io__write_string(". \n", !IO).
+    io.write_string("// End of module: ", !IO),
+    prog_out.write_sym_name(ModuleName, !IO),
+    io.write_string(". \n", !IO).

 %-----------------------------------------------------------------------------%

@@ -116,29 +117,29 @@
         _InitPreds, _FinalPreds),
     ClassName = class_name(mercury_module_name_to_mlds(ModuleName),
         wrapper_class_name),
-    io__nl(!IO),
+    io.nl(!IO),

     % Output any generic header code specific to the target language.
     output_language_specific_header_code(Lang, ModuleName, Imports, !IO),

     % Get the foreign code for the required language.
-    ForeignCode = map__lookup(AllForeignCode, Lang),
+    ForeignCode = map.lookup(AllForeignCode, Lang),
     generate_foreign_header_code(Lang, ModuleName, ForeignCode, !IO),

     % Output the namespace.
     generate_namespace_details(Lang, ClassName, NameSpaceFmtStr, Namespace),
-    io__write_list(Namespace, "\n",
-        (pred(N::in, di, uo) is det -->
-            io__format(NameSpaceFmtStr, [s(N)])
+    io.write_list(Namespace, "\n",
+        (pred(N::in, !.IO::di, !:IO::uo) is det :-
+            io.format(NameSpaceFmtStr, [s(N)], !IO)
     ), !IO),

     (
         Lang = csharp,
-        io__write_strings(["\npublic class " ++ wrapper_class_name, "{\n"],
+        io.write_strings(["\npublic class " ++ wrapper_class_name, "{\n"],
             !IO)
     ;
         Lang = managed_cplusplus,
-        io__write_strings(["\n__gc public class " ++ wrapper_class_name,
+        io.write_strings(["\n__gc public class " ++ wrapper_class_name,
             "{\n", "public:\n"], !IO)
     ),

@@ -146,30 +147,30 @@
     generate_foreign_code(Lang,
         mercury_module_name_to_mlds(ModuleName), ForeignCode, !IO),

-    io__write_string("\n", !IO),
+    io.nl(!IO),

     % Output the contents of foreign_proc declarations.
     % Put each one inside a method.
-    list__foldl(generate_method_code(Lang,
+    list.foldl(generate_method_code(Lang,
         mercury_module_name_to_mlds(ModuleName)), Defns, !IO),

-    io__write_string("};\n", !IO),
+    io.write_string("};\n", !IO),

     % Close the namespace braces.
-    io__write_list(Namespace, "\n",
-        (pred(_N::in, di, uo) is det -->
-            io__write_string("}")
+    io.write_list(Namespace, "\n",
+        (pred(_N::in, !.IO::di, !:IO::uo) is det :-
+            io.write_string("}", !IO)
     ), !IO),
-    io__nl(!IO).
+    io.nl(!IO).

 :- pred output_language_specific_header_code(
     foreign_language::in(managed_lang), mercury_module_name::in,
-    mlds__imports::in, io::di, io::uo) is det.
+    mlds.imports::in, io::di, io::uo) is det.

 output_language_specific_header_code(csharp, _ModuleName, _Imports, !IO) :-
     get_il_data_rep(DataRep, !IO),
     ( DataRep = il_data_rep(yes, _) ->
-        io__write_string("#define MR_HIGHLEVEL_DATA\n", !IO)
+        io.write_string("#define MR_HIGHLEVEL_DATA\n", !IO)
     ;
         true
     ),
@@ -177,12 +178,12 @@
     % XXX We may be able to drop the mercury namespace soon,
     % as there doesn't appear to be any llds generated code
     % in the C# code anymore.
-    io__write_string("using mercury;\n\n", !IO),
+    io.write_string("using mercury;\n\n", !IO),

-    globals__io_lookup_bool_option(sign_assembly, SignAssembly, !IO),
+    globals.io_lookup_bool_option(sign_assembly, SignAssembly, !IO),
     (
         SignAssembly = yes,
-        io__write_string("[assembly:System.Reflection." ++
+        io.write_string("[assembly:System.Reflection." ++
             "AssemblyKeyFileAttribute(\"mercury.sn\")]\n", !IO)
     ;
         SignAssembly = no
@@ -191,15 +192,15 @@
         !IO) :-
     get_il_data_rep(DataRep, !IO),
     ( DataRep = il_data_rep(yes, _) ->
-        io__write_string("#define MR_HIGHLEVEL_DATA\n", !IO)
+        io.write_string("#define MR_HIGHLEVEL_DATA\n", !IO)
     ;
         true
     ),

-    io__write_string("#using <mscorlib.dll>\n", !IO),
+    io.write_string("#using <mscorlib.dll>\n", !IO),

     ( mercury_std_library_module_name(ModuleName) ->
-        io__write_strings([
+        io.write_strings([
             "#using ""mercury_dotnet.dll""\n",
             "#using ""mercury_il.dll""\n"
             %,
@@ -210,7 +211,7 @@
         true
     ),

-    list__map(
+    list.map(
         (pred(Import::in, Result::out) is det :-
             ( Import = mercury_import(_, Name) ->
                 ( is_std_lib_module(Name, StdLibName) ->
@@ -230,14 +231,14 @@
         ), Imports, ImportListList),
     ActualImports = remove_dups(condense(ImportListList)),

-    list__foldl((pred(I::in, di, uo) is det -->
-            io__write_string("#using """),
-            io__write_string(I),
-            io__write_string(".dll""\n")
+    list.foldl((pred(I::in, !.IO::di, !:IO::uo) is det :-
+            io.write_string("#using """, !IO),
+            io.write_string(I, !IO),
+            io.write_string(".dll""\n", !IO)
         ), ActualImports, !IO),

     sym_name_to_string(ModuleName, ModuleNameStr),
-    io__write_strings([
+    io.write_strings([
         "#using """, ModuleNameStr, ".dll""\n",
         "#include ""mercury_mcpp.h""\n",

@@ -248,54 +249,55 @@
         "using namespace mercury;\n",
         "\n"], !IO),

-    globals__io_lookup_bool_option(sign_assembly, SignAssembly, !IO),
+    globals.io_lookup_bool_option(sign_assembly, SignAssembly, !IO),
     (
         SignAssembly = yes,
-        io__write_string("[assembly:System::Reflection::" ++
+        io.write_string("[assembly:System::Reflection::" ++
             "AssemblyKeyFileAttribute(\"mercury.sn\")];\n", !IO)
     ;
         SignAssembly = no
     ).

 :- pred generate_foreign_header_code(foreign_language::in(managed_lang),
-    module_name::in, mlds__foreign_code::in, io::di, io::uo) is det.
+    module_name::in, mlds.foreign_code::in, io::di, io::uo) is det.

 generate_foreign_header_code(Lang, ModuleName, ForeignCode, !IO) :-
-    ForeignCode = mlds__foreign_code(RevHeaderCode, RevImports,
+    ForeignCode = mlds.foreign_code(RevHeaderCode, RevImports,
         _RevBodyCode, _ExportDefns),
     % Only MC++ can declare which assemblies it refers to in its
     % source file.  C# declares which assemblies it refers to via
     % command line arguments to the C# compiler.
     (
         Lang = managed_cplusplus,
-        Imports = list__reverse(RevImports),
-        list__foldl(
-            (pred(ForeignImport::in, di, uo) is det -->
+        Imports = list.reverse(RevImports),
+        list.foldl(
+            (pred(ForeignImport::in, !.IO::di, !:IO::uo) is det :-
                 module_name_to_search_file_name(
                     foreign_import_module_name(ForeignImport, ModuleName),
-                        ".dll", FileName),
-                io__write_strings(["#using """, FileName, """\n"])
+                        ".dll", FileName, !IO),
+                io.write_strings(["#using """, FileName, """\n"], !IO)
             ), Imports, !IO)
     ;
         Lang = csharp
     ),

-    HeaderCode = list__reverse(RevHeaderCode),
-    io__write_list(HeaderCode, "\n",
+    HeaderCode = list.reverse(RevHeaderCode),
+    io.write_list(HeaderCode, "\n",
         % XXX Ignoring _IsLocal may not be the right thing to do.
         (pred(foreign_decl_code(CodeLang, _IsLocal, Code, Context)::in,
-                di, uo) is det -->
-            output_context(Lang, Context),
-            ( { CodeLang = Lang } ->
-                io__write_string(Code), io__nl
+                !.IO::di, !:IO::uo) is det :-
+            output_context(Lang, Context, !IO),
+            ( CodeLang = Lang ->
+                io.write_string(Code, !IO),
+                io.nl(!IO)
             ;
-                { sorry(this_file, "wrong foreign code") }
+                sorry(this_file, "wrong foreign code")
             ),
-            output_reset_context(Lang)
+            output_reset_context(Lang, !IO)
         ), !IO).

 :- pred generate_namespace_details(foreign_language::in(managed_lang),
-    ilds__class_name::in, string::out, list(string)::out) is det.
+    ilds.class_name::in, string::out, list(string)::out) is det.

 generate_namespace_details(Lang, ClassName, NameSpaceFmtStr, Namespace) :-
     % XXX We should consider what happens if we need to mangle
@@ -311,34 +313,34 @@
     ),

     Namespace0 = get_class_namespace(ClassName),
-    ( list__reverse(Namespace0) = [Head | Tail] ->
-        Namespace = list__reverse([Head ++ NameExt | Tail])
+    ( list.reverse(Namespace0) = [Head | Tail] ->
+        Namespace = list.reverse([Head ++ NameExt | Tail])
     ;
         Namespace = Namespace0
     ).

 :- pred generate_foreign_code(foreign_language::in(managed_lang),
-    mlds_module_name::in, mlds__foreign_code::in,
-    io::di, io::uo) is det.
+    mlds_module_name::in, mlds.foreign_code::in, io::di, io::uo) is det.

 generate_foreign_code(Lang, _ModuleName, ForeignCode, !IO) :-
-    ForeignCode = mlds__foreign_code(_RevHeaderCode, _RevImports,
+    ForeignCode = mlds.foreign_code(_RevHeaderCode, _RevImports,
         RevBodyCode, _ExportDefns),
-    BodyCode = list__reverse(RevBodyCode),
-    io__write_list(BodyCode, "\n",
+    BodyCode = list.reverse(RevBodyCode),
+    io.write_list(BodyCode, "\n",
         (pred(user_foreign_code(CodeLang, Code, Context)::in,
-                di, uo) is det -->
-            output_context(Lang, Context),
-            ( { Lang = CodeLang } ->
-                io__write_string(Code), io__nl
+                !.IO::di, !:IO::uo) is det :-
+            output_context(Lang, Context, !IO),
+            ( Lang = CodeLang ->
+                io.write_string(Code, !IO),
+                io.nl(!IO)
             ;
-                { sorry(this_file, "wrong foreign code") }
+                sorry(this_file, "wrong foreign code")
             ),
-            output_reset_context(Lang)
+            output_reset_context(Lang, !IO)
     ), !IO).

 :- pred generate_method_code(foreign_language::in(managed_lang),
-    mlds_module_name::in, mlds__defn::in, io::di, io::uo) is det.
+    mlds_module_name::in, mlds.defn::in, io::di, io::uo) is det.

 generate_method_code(_, _, defn(export(_), _, _, _), !IO).
 generate_method_code(_, _, defn(data(_), _, _, _), !IO).
@@ -348,20 +350,20 @@
         _Context, _DeclFlags, Entity),
     (
         % XXX we ignore the attributes
-        Entity = mlds__function(_, Params, defined_here(Statement),
+        Entity = mlds.function(_, Params, defined_here(Statement),
             _Attributes),
         has_foreign_languages(Statement, Langs),
-        list__member(Lang, Langs)
+        list.member(Lang, Langs)
     ->
         get_il_data_rep(DataRep, !IO),
-        Params = mlds__func_params(Inputs, Outputs),
+        Params = mlds.func_params(Inputs, Outputs),
         (
             Outputs = [],
             ReturnType = void
         ;
             Outputs = [MLDSReturnType],
             mlds_type_to_ilds_type(DataRep, MLDSReturnType) =
-                ilds__type(_, SimpleType),
+                il_type(_, SimpleType),
             ReturnType = simple_type(SimpleType)
         ;
             Outputs = [_, _ | _],
@@ -372,31 +374,31 @@
         predlabel_to_id(PredLabel, ProcId, MaybeSeqNum, Id),
         (
             Lang = csharp,
-            io__write_string("public static ", !IO)
+            io.write_string("public static ", !IO)
         ;
             Lang = managed_cplusplus,
-            io__write_string("static ", !IO)
+            io.write_string("static ", !IO)
         ),
         write_il_ret_type_as_foreign_type(Lang, ReturnType, !IO),

-        io__write_string(" ", !IO),
+        io.write_string(" ", !IO),

-        io__write_string(Id, !IO),
-        io__write_string("(", !IO),
-        io__write_list(Inputs, ", ",
+        io.write_string(Id, !IO),
+        io.write_string("(", !IO),
+        io.write_list(Inputs, ", ",
                 write_input_arg_as_foreign_type(Lang), !IO),
-        io__write_string(")", !IO),
-        io__nl(!IO),
+        io.write_string(")", !IO),
+        io.nl(!IO),

-        io__write_string("{\n", !IO),
+        io.write_string("{\n", !IO),
         write_statement(Lang, Inputs, Statement, !IO),
-        io__write_string("}\n", !IO)
+        io.write_string("}\n", !IO)
     ;
         true
     ).

 :- pred write_statement(foreign_language::in(managed_lang),
-    mlds__arguments::in, statement::in, io::di, io::uo) is det.
+    mlds.arguments::in, statement::in, io::di, io::uo) is det.

 write_statement(Lang, Args, statement(Statement, Context), !IO) :-
     (
@@ -404,26 +406,26 @@
         Statement = atomic(outline_foreign_proc(Lang, OutlineArgs,
             _Lvals, Code))
     ->
-        list__foldl(write_outline_arg_init(Lang), OutlineArgs, !IO),
+        list.foldl(write_outline_arg_init(Lang), OutlineArgs, !IO),
         output_context(Lang, get_prog_context(Context), !IO),
-        io__write_string(Code, !IO),
-        io__nl(!IO),
+        io.write_string(Code, !IO),
+        io.nl(!IO),
         output_reset_context(Lang, !IO),
-        list__foldl(write_outline_arg_final(Lang), OutlineArgs, !IO)
+        list.foldl(write_outline_arg_final(Lang), OutlineArgs, !IO)
     ;
         Statement = block(Defns, Statements)
     ->
-        io__write_list(Defns, "", write_defn_decl(Lang), !IO),
-        io__write_string("{\n", !IO),
-        io__write_list(Statements, "", write_statement(Lang, Args), !IO),
-        io__write_string("\n}\n", !IO)
+        io.write_list(Defns, "", write_defn_decl(Lang), !IO),
+        io.write_string("{\n", !IO),
+        io.write_list(Statements, "", write_statement(Lang, Args), !IO),
+        io.write_string("\n}\n", !IO)
     ;
         Statement = return(Rvals)
     ->
         ( Rvals = [Rval] ->
-            io__write_string("return ", !IO),
+            io.write_string("return ", !IO),
             write_rval(Lang, Rval, !IO),
-            io__write_string(";\n", !IO)
+            io.write_string(";\n", !IO)
         ;
             sorry(this_file, "multiple return values")
         )
@@ -431,9 +433,9 @@
         Statement = atomic(assign(LVal, RVal))
     ->
         write_lval(Lang, LVal, !IO),
-        io__write_string(" = ", !IO),
+        io.write_string(" = ", !IO),
         write_rval(Lang, RVal, !IO),
-        io__write_string(";\n", !IO)
+        io.write_string(";\n", !IO)
     ;
         functor(Statement, SFunctor, _Arity),
         sorry(this_file, "foreign code output for " ++ SFunctor)
@@ -444,24 +446,24 @@

 write_outline_arg_init(Lang, in(Type, VarName, Rval), !IO) :-
     write_parameter_type(Lang, Type, !IO),
-    io__write_string(" ", !IO),
-    io__write_string(VarName, !IO),
-    io__write_string(" = ", !IO),
+    io.write_string(" ", !IO),
+    io.write_string(VarName, !IO),
+    io.write_string(" = ", !IO),
     write_rval(Lang, Rval, !IO),
-    io__write_string(";\n", !IO).
+    io.write_string(";\n", !IO).
 write_outline_arg_init(Lang, out(Type, VarName, _Lval), !IO) :-
     write_parameter_type(Lang, Type, !IO),
-    io__write_string(" ", !IO),
-    io__write_string(VarName, !IO),
+    io.write_string(" ", !IO),
+    io.write_string(VarName, !IO),
     % In C# give output variables a default value to avoid warnings.
     (
         Lang = csharp,
-        io__write_string(" = ", !IO),
+        io.write_string(" = ", !IO),
         write_parameter_initializer(Lang, Type, !IO)
     ;
         Lang = managed_cplusplus
     ),
-    io__write_string(";\n", !IO).
+    io.write_string(";\n", !IO).
 write_outline_arg_init(_Lang, unused, !IO).

 :- pred write_outline_arg_final(foreign_language::in(managed_lang),
@@ -470,13 +472,13 @@
 write_outline_arg_final(_Lang, in(_, _, _), !IO).
 write_outline_arg_final(Lang, out(_Type, VarName, Lval), !IO) :-
     write_lval(Lang, Lval, !IO),
-    io__write_string(" = ", !IO),
-    io__write_string(VarName, !IO),
-    io__write_string(";\n", !IO).
+    io.write_string(" = ", !IO),
+    io.write_string(VarName, !IO),
+    io.write_string(";\n", !IO).
 write_outline_arg_final(_Lang, unused, !IO).

 :- pred write_declare_and_assign_local(foreign_language::in(managed_lang),
-    mlds__argument::in, io::di, io::uo) is det.
+    mlds.argument::in, io::di, io::uo) is det.

 write_declare_and_assign_local(Lang, argument(Name, Type, _GcCode), !IO) :-
     ( Name = data(var(VarName0)) ->
@@ -486,36 +488,36 @@
     ),

     % A pointer type is an output type.
-    ( Type = mlds__ptr_type(OutputType) ->
+    ( Type = mlds.ptr_type(OutputType) ->
         ( is_anonymous_variable(VarName) ->
             true
         ;
             write_parameter_type(Lang, OutputType, !IO),
-            io__write_string(" ", !IO),
+            io.write_string(" ", !IO),
             write_mlds_var_name_for_local(VarName, !IO),

             % In C# give output types a default value to
             % avoid warnings.
             (
                 Lang = csharp,
-                io__write_string(" = ", !IO),
+                io.write_string(" = ", !IO),
                 write_parameter_initializer(Lang, OutputType, !IO)
             ;
                 Lang = managed_cplusplus
             ),
-            io__write_string(";\n", !IO)
+            io.write_string(";\n", !IO)
         )
     ;
         write_parameter_type(Lang, Type, !IO),
-        io__write_string(" ", !IO),
+        io.write_string(" ", !IO),
         write_mlds_var_name_for_local(VarName, !IO),
-        io__write_string(" = ", !IO),
+        io.write_string(" = ", !IO),
         write_mlds_var_name_for_parameter(VarName, !IO),
-        io__write_string(";\n", !IO)
+        io.write_string(";\n", !IO)
     ).

 :- pred write_assign_local_to_output(foreign_language::in(managed_lang),
-    mlds__argument::in, io::di, io::uo) is det.
+    mlds.argument::in, io::di, io::uo) is det.

 write_assign_local_to_output(Lang, argument(Name, Type, _GcCode), !IO) :-
     ( Name = data(var(VarName0)) ->
@@ -526,19 +528,19 @@

     % A pointer type is an output type.
     (
-        Type = mlds__ptr_type(_OutputType),
+        Type = mlds.ptr_type(_OutputType),
         not is_anonymous_variable(VarName)
     ->
         (
             Lang = csharp
         ;
             Lang = managed_cplusplus,
-            io__write_string("*", !IO)
+            io.write_string("*", !IO)
         ),
         write_mlds_var_name_for_parameter(VarName, !IO),
-        io__write_string(" = ", !IO),
+        io.write_string(" = ", !IO),
         write_mlds_var_name_for_local(VarName, !IO),
-        io__write_string(";\n", !IO)
+        io.write_string(";\n", !IO)
     ;
         true
     ).
@@ -546,7 +548,7 @@
 :- pred is_anonymous_variable(var_name::in) is semidet.

 is_anonymous_variable(var_name(Name, _)) :-
-    string__prefix(Name, "_").
+    string.prefix(Name, "_").

 %-----------------------------------------------------------------------------%

@@ -554,15 +556,15 @@
     io::di, io::uo) is det.

 output_context(_Lang, Context, !IO) :-
-    term__context_file(Context, File),
-    term__context_line(Context, Line),
-    c_util__set_line_num(File, Line, !IO).
+    term.context_file(Context, File),
+    term.context_line(Context, Line),
+    c_util.set_line_num(File, Line, !IO).

 :- pred output_reset_context(foreign_language::in(managed_lang),
     io::di, io::uo) is det.

 output_reset_context(_i, !IO) :-
-    c_util__reset_line_num(!IO).
+    c_util.reset_line_num(!IO).

 :- pred write_rval(foreign_language::in(managed_lang), mlds_rval::in,
     io::di, io::uo) is det.
@@ -576,31 +578,31 @@
 write_rval(Lang, unop(Unop, Rval), !IO) :-
     (
         Unop = std_unop(StdUnop),
-        c_util__unary_prefix_op(StdUnop, UnopStr)
+        c_util.unary_prefix_op(StdUnop, UnopStr)
     ->
-        io__write_string(UnopStr, !IO),
-        io__write_string("(", !IO),
+        io.write_string(UnopStr, !IO),
+        io.write_string("(", !IO),
         write_rval(Lang, Rval, !IO),
-        io__write_string(")", !IO)
+        io.write_string(")", !IO)
     ;
         Unop = cast(Type)
     ->
-        io__write_string("(", !IO),
+        io.write_string("(", !IO),
         write_parameter_type(Lang, Type, !IO),
-        io__write_string(") ", !IO),
+        io.write_string(") ", !IO),
         write_rval(Lang, Rval, !IO)
     ;
         sorry(this_file, "box or unbox unop")
     ).
 write_rval(Lang, binop(Binop, Rval1, Rval2), !IO) :-
-    ( c_util__binary_infix_op(Binop, BinopStr) ->
-        io__write_string("(", !IO),
+    ( c_util.binary_infix_op(Binop, BinopStr) ->
+        io.write_string("(", !IO),
         write_rval(Lang, Rval1, !IO),
-        io__write_string(") ", !IO),
-        io__write_string(BinopStr, !IO),
-        io__write_string(" (", !IO),
+        io.write_string(") ", !IO),
+        io.write_string(BinopStr, !IO),
+        io.write_string(" (", !IO),
         write_rval(Lang, Rval2, !IO),
-        io__write_string(")", !IO)
+        io.write_string(")", !IO)
     ;
         sorry(this_file, "binop rval")
     ).
@@ -613,68 +615,68 @@
     mlds_rval_const::in, io::di, io::uo) is det.

 write_rval_const(_Lang, true, !IO) :-
-    io__write_string("1", !IO).
+    io.write_string("1", !IO).
 write_rval_const(_Lang, false, !IO) :-
-    io__write_string("0", !IO).
+    io.write_string("0", !IO).
 write_rval_const(_Lang, int_const(I), !IO) :-
-    io__write_int(I, !IO).
+    io.write_int(I, !IO).
 write_rval_const(_Lang, float_const(F), !IO) :-
-    io__write_float(F, !IO).
+    io.write_float(F, !IO).
     % XXX We don't quote this correctly.
 write_rval_const(_Lang, string_const(S), !IO) :-
-    io__write_string("""", !IO),
-    c_util__output_quoted_string(S, !IO),
-    io__write_string("""", !IO).
+    io.write_string("""", !IO),
+    c_util.output_quoted_string(S, !IO),
+    io.write_string("""", !IO).
 write_rval_const(_Lang, multi_string_const(L, S), !IO) :-
-    io__write_string("""", !IO),
-    c_util__output_quoted_multi_string(L, S, !IO),
-    io__write_string("""", !IO).
+    io.write_string("""", !IO),
+    c_util.output_quoted_multi_string(L, S, !IO),
+    io.write_string("""", !IO).
 write_rval_const(Lang, code_addr_const(CodeAddrConst), !IO) :-
     (
         CodeAddrConst = proc(ProcLabel, _FuncSignature),
         mangle_mlds_proc_label(ProcLabel, no, ClassName, MangledName),
         write_class_name(Lang, ClassName, !IO),
         write_field_selector(Lang, !IO),
-        io__write_string(MangledName, !IO)
+        io.write_string(MangledName, !IO)
     ;
         CodeAddrConst = internal(ProcLabel, SeqNum, _FuncSignature),
         mangle_mlds_proc_label(ProcLabel, yes(SeqNum), ClassName, MangledName),
         write_class_name(Lang, ClassName, !IO),
         write_field_selector(Lang, !IO),
-        io__write_string(MangledName, !IO)
+        io.write_string(MangledName, !IO)
     ).
 write_rval_const(_Lang, data_addr_const(_), !IO) :-
     sorry(this_file, "data_addr_const rval").
 write_rval_const(Lang, null(_), !IO) :-
     (
         Lang = csharp,
-        io__write_string("null", !IO)
+        io.write_string("null", !IO)
     ;
         Lang = managed_cplusplus,
-        io__write_string("NULL", !IO)
+        io.write_string("NULL", !IO)
     ).

 :- pred write_lval(foreign_language::in(managed_lang), mlds_lval::in,
     io::di, io::uo) is det.

 write_lval(Lang, field(_, Rval, named_field(FieldId, _Type), _, _), !IO) :-
-    io__write_string("(", !IO),
+    io.write_string("(", !IO),
     write_rval(Lang, Rval, !IO),
-    io__write_string(")", !IO),
+    io.write_string(")", !IO),
     write_field_selector(Lang, !IO),
     FieldId = qual(_, _, FieldName),
-    io__write_string(FieldName, !IO).
+    io.write_string(FieldName, !IO).
 write_lval(Lang, field(_, Rval, offset(OffSet), _, _), !IO) :-
-    io__write_string("(", !IO),
+    io.write_string("(", !IO),
     write_rval(Lang, Rval, !IO),
-    io__write_string(")", !IO),
-    io__write_string("[", !IO),
+    io.write_string(")", !IO),
+    io.write_string("[", !IO),
     write_rval(Lang, OffSet, !IO),
-    io__write_string("]", !IO).
+    io.write_string("]", !IO).
 write_lval(Lang, mem_ref(Rval, _), !IO) :-
     (
         Lang = managed_cplusplus,
-        io__write_string("*", !IO)
+        io.write_string("*", !IO)
     ;
         Lang = csharp
     ),
@@ -687,23 +689,23 @@
     io::di, io::uo) is det.

 write_field_selector(csharp, !IO) :-
-    io__write_string(".", !IO).
+    io.write_string(".", !IO).
 write_field_selector(managed_cplusplus, !IO) :-
-    io__write_string("->", !IO).
+    io.write_string("->", !IO).

-:- pred write_defn_decl(foreign_language::in(managed_lang), mlds__defn::in,
+:- pred write_defn_decl(foreign_language::in(managed_lang), mlds.defn::in,
     io::di, io::uo) is det.

 write_defn_decl(Lang, Defn, !IO) :-
-    Defn = mlds__defn(Name, _Context, _Flags, DefnBody),
+    Defn = mlds.defn(Name, _Context, _Flags, DefnBody),
     (
         DefnBody = data(Type, _Initializer, _GC_TraceCode),
         Name = data(var(VarName))
     ->
         write_parameter_type(Lang, Type, !IO),
-        io__write_string(" ", !IO),
+        io.write_string(" ", !IO),
         write_mlds_var_name_for_parameter(VarName, !IO),
-        io__write_string(";\n", !IO)
+        io.write_string(";\n", !IO)
     ;
         % XXX We should implement others.
         sorry(this_file, "data_addr_const rval")
@@ -718,14 +720,14 @@
     write_il_type_as_foreign_type(Lang, ILType, !IO).

 :- pred write_input_arg_as_foreign_type(foreign_language::in(managed_lang),
-    mlds__argument::in, io::di, io::uo) is det.
+    mlds.argument::in, io::di, io::uo) is det.

 write_input_arg_as_foreign_type(Lang, Arg, !IO) :-
-    Arg = mlds__argument(EntityName, Type, _GC_TraceCode),
+    Arg = mlds.argument(EntityName, Type, _GC_TraceCode),
     get_il_data_rep(DataRep, !IO),
     write_il_type_as_foreign_type(Lang, mlds_type_to_ilds_type(DataRep, Type),
         !IO),
-    io__write_string(" ", !IO),
+    io.write_string(" ", !IO),
     ( EntityName = data(var(VarName)) ->
         write_mlds_var_name_for_parameter(VarName, !IO)
     ;
@@ -740,35 +742,35 @@
 write_parameter_initializer(csharp, Type, !IO) :-
     get_il_data_rep(DataRep, !IO),
     ILType = mlds_type_to_ilds_type(DataRep, Type),
-    ILType = type(_, ILSimpleType),
+    ILType = il_type(_, ILSimpleType),
     write_csharp_initializer(ILSimpleType, !IO).

 :- pred write_il_ret_type_as_foreign_type(foreign_language::in(managed_lang),
     ret_type::in, io::di, io::uo) is det.

 write_il_ret_type_as_foreign_type(_Lang, void, !IO) :-
-    io__write_string("void", !IO).
+    io.write_string("void", !IO).
 write_il_ret_type_as_foreign_type(Lang, simple_type(T), !IO) :-
     write_il_simple_type_as_foreign_type(Lang, T, !IO).

 :- pred write_il_type_as_foreign_type(foreign_language::in(managed_lang),
-    ilds__type::in, io::di, io::uo) is det.
+    il_type::in, io::di, io::uo) is det.

-write_il_type_as_foreign_type(Lang, ilds__type(Modifiers, SimpleType), !IO) :-
-    io__write_list(Modifiers, " ",
+write_il_type_as_foreign_type(Lang, il_type(Modifiers, SimpleType), !IO) :-
+    io.write_list(Modifiers, " ",
         write_il_type_modifier_as_foreign_type(Lang), !IO),
     write_il_simple_type_as_foreign_type(Lang, SimpleType, !IO).

 :- pred write_il_type_modifier_as_foreign_type(
-    foreign_language::in(managed_lang), ilds__type_modifier::in,
+    foreign_language::in(managed_lang), ilds.type_modifier::in,
     io::di, io::uo) is det.

 write_il_type_modifier_as_foreign_type(_Lang, const, !IO) :-
-    io__write_string("const", !IO).
+    io.write_string("const", !IO).
 write_il_type_modifier_as_foreign_type(_Lang, readonly, !IO) :-
-    io__write_string("readonly", !IO).
+    io.write_string("readonly", !IO).
 write_il_type_modifier_as_foreign_type(_Lang, volatile, !IO) :-
-    io__write_string("volatile", !IO).
+    io.write_string("volatile", !IO).

     % XXX Need to revisit this and choose types appropriately.
     %
@@ -785,41 +787,41 @@
     simple_type::in, io::di, io::uo) is det.

 write_il_simple_type_as_foreign_type_cs(int8, !IO) :-
-    io__write_string("sbyte", !IO).
+    io.write_string("sbyte", !IO).
 write_il_simple_type_as_foreign_type_cs(int16, !IO) :-
-    io__write_string("short", !IO).
+    io.write_string("short", !IO).
 write_il_simple_type_as_foreign_type_cs(int32, !IO) :-
-    io__write_string("int", !IO).
+    io.write_string("int", !IO).
 write_il_simple_type_as_foreign_type_cs(int64, !IO) :-
-    io__write_string("long", !IO).
+    io.write_string("long", !IO).
 write_il_simple_type_as_foreign_type_cs(uint8, !IO) :-
-    io__write_string("byte", !IO).
+    io.write_string("byte", !IO).
 write_il_simple_type_as_foreign_type_cs(uint16, !IO) :-
-    io__write_string("ushort", !IO).
+    io.write_string("ushort", !IO).
 write_il_simple_type_as_foreign_type_cs(uint32, !IO) :-
-    io__write_string("uint", !IO).
+    io.write_string("uint", !IO).
 write_il_simple_type_as_foreign_type_cs(uint64, !IO) :-
-    io__write_string("ulong", !IO).
+    io.write_string("ulong", !IO).
 write_il_simple_type_as_foreign_type_cs(native_int, !IO) :-
-    io__write_string("int", !IO).
+    io.write_string("int", !IO).
 write_il_simple_type_as_foreign_type_cs(native_uint, !IO) :-
-    io__write_string("uint", !IO).
+    io.write_string("uint", !IO).
 write_il_simple_type_as_foreign_type_cs(float32, !IO) :-
-    io__write_string("float", !IO).
+    io.write_string("float", !IO).
 write_il_simple_type_as_foreign_type_cs(float64, !IO) :-
-    io__write_string("double", !IO).
+    io.write_string("double", !IO).
 write_il_simple_type_as_foreign_type_cs(native_float, !IO) :-
-    io__write_string("float", !IO).
+    io.write_string("float", !IO).
 write_il_simple_type_as_foreign_type_cs(bool, !IO) :-
-    io__write_string("bool", !IO).
+    io.write_string("bool", !IO).
 write_il_simple_type_as_foreign_type_cs(char, !IO) :-
-    io__write_string("char", !IO).
+    io.write_string("char", !IO).
 write_il_simple_type_as_foreign_type_cs(string, !IO) :-
-    io__write_string("string", !IO).
+    io.write_string("string", !IO).
 write_il_simple_type_as_foreign_type_cs(object, !IO) :-
-    io__write_string("object", !IO).
+    io.write_string("object", !IO).
 write_il_simple_type_as_foreign_type_cs(refany, !IO) :-
-    io__write_string("mercury.MR_RefAny", !IO).
+    io.write_string("mercury.MR_RefAny", !IO).
 write_il_simple_type_as_foreign_type_cs(class(ClassName), !IO) :-
     write_class_name(csharp, ClassName, !IO).
 write_il_simple_type_as_foreign_type_cs(valuetype(ClassName), !IO) :-
@@ -828,7 +830,7 @@
     sorry(this_file, "interfaces").
 write_il_simple_type_as_foreign_type_cs('[]'(Type, Bounds), !IO) :-
     write_il_type_as_foreign_type(csharp, Type, !IO),
-    io__write_string("[]", !IO),
+    io.write_string("[]", !IO),
     (
         Bounds = []
     ;
@@ -837,130 +839,130 @@
     ).
 write_il_simple_type_as_foreign_type_cs('&'(Type), !IO) :-
     % XXX Is this always right?
-    io__write_string("ref ", !IO),
+    io.write_string("ref ", !IO),
     write_il_type_as_foreign_type(csharp, Type, !IO).
 write_il_simple_type_as_foreign_type_cs('*'(Type), !IO) :-
     write_il_type_as_foreign_type(csharp, Type, !IO),
-    io__write_string(" *", !IO).
+    io.write_string(" *", !IO).

 :- pred write_il_simple_type_as_foreign_type_mcpp(
     simple_type::in, io::di, io::uo) is det.

 write_il_simple_type_as_foreign_type_mcpp(int8, !IO) :-
-    io__write_string("mercury::MR_Integer8", !IO).
+    io.write_string("mercury::MR_Integer8", !IO).
 write_il_simple_type_as_foreign_type_mcpp(int16, !IO) :-
-    io__write_string("mercury::MR_Integer16", !IO).
+    io.write_string("mercury::MR_Integer16", !IO).
 write_il_simple_type_as_foreign_type_mcpp(int32, !IO) :-
-    io__write_string("mercury::MR_Integer", !IO).
+    io.write_string("mercury::MR_Integer", !IO).
 write_il_simple_type_as_foreign_type_mcpp(int64, !IO) :-
-    io__write_string("mercury::MR_Integer64", !IO).
+    io.write_string("mercury::MR_Integer64", !IO).
 write_il_simple_type_as_foreign_type_mcpp(uint8, !IO) :-
-    io__write_string("unsigned int", !IO).
+    io.write_string("unsigned int", !IO).
 write_il_simple_type_as_foreign_type_mcpp(uint16, !IO) :-
-    io__write_string("unsigned int", !IO).
+    io.write_string("unsigned int", !IO).
 write_il_simple_type_as_foreign_type_mcpp(uint32, !IO) :-
-    io__write_string("unsigned int", !IO).
+    io.write_string("unsigned int", !IO).
 write_il_simple_type_as_foreign_type_mcpp(uint64, !IO) :-
-    io__write_string("unsigned int", !IO).
+    io.write_string("unsigned int", !IO).
 write_il_simple_type_as_foreign_type_mcpp(native_int, !IO) :-
-    io__write_string("mercury::MR_Integer", !IO).
+    io.write_string("mercury::MR_Integer", !IO).
 write_il_simple_type_as_foreign_type_mcpp(native_uint, !IO) :-
-    io__write_string("unsigned int", !IO).
+    io.write_string("unsigned int", !IO).
 write_il_simple_type_as_foreign_type_mcpp(float32, !IO) :-
-    io__write_string("float", !IO).
+    io.write_string("float", !IO).
 write_il_simple_type_as_foreign_type_mcpp(float64, !IO) :-
-    io__write_string("mercury::MR_Float", !IO).
+    io.write_string("mercury::MR_Float", !IO).
 write_il_simple_type_as_foreign_type_mcpp(native_float, !IO) :-
-    io__write_string("mercury::MR_Float", !IO).
+    io.write_string("mercury::MR_Float", !IO).
 write_il_simple_type_as_foreign_type_mcpp(bool, !IO) :-
-    io__write_string("mercury::MR_Bool", !IO).
+    io.write_string("mercury::MR_Bool", !IO).
 write_il_simple_type_as_foreign_type_mcpp(char, !IO) :-
-    io__write_string("mercury::MR_Char", !IO).
+    io.write_string("mercury::MR_Char", !IO).
 write_il_simple_type_as_foreign_type_mcpp(string, !IO) :-
-    io__write_string("mercury::MR_String", !IO).
+    io.write_string("mercury::MR_String", !IO).
 write_il_simple_type_as_foreign_type_mcpp(object, !IO) :-
-    io__write_string("mercury::MR_Box", !IO).
+    io.write_string("mercury::MR_Box", !IO).
 write_il_simple_type_as_foreign_type_mcpp(refany, !IO) :-
-    io__write_string("mercury::MR_RefAny", !IO).
+    io.write_string("mercury::MR_RefAny", !IO).
 write_il_simple_type_as_foreign_type_mcpp(class(ClassName), !IO) :-
     ( ClassName = il_generic_class_name ->
-        io__write_string("mercury::MR_Box", !IO)
+        io.write_string("mercury::MR_Box", !IO)
     ;
-        io__write_string("public class ", !IO),
+        io.write_string("public class ", !IO),
         write_class_name(managed_cplusplus, ClassName, !IO),
-        io__write_string(" *", !IO)
+        io.write_string(" *", !IO)
     ).
 write_il_simple_type_as_foreign_type_mcpp(valuetype(ClassName), !IO) :-
-    io__write_string("__value class ", !IO),
+    io.write_string("__value class ", !IO),
     write_class_name(managed_cplusplus, ClassName, !IO).
         % XXX this is not the right syntax
 write_il_simple_type_as_foreign_type_mcpp(interface(ClassName), !IO) :-
-    io__write_string("interface ", !IO),
+    io.write_string("interface ", !IO),
     write_class_name(managed_cplusplus, ClassName, !IO),
-    io__write_string(" *", !IO).
+    io.write_string(" *", !IO).
         % XXX this needs more work
 write_il_simple_type_as_foreign_type_mcpp('[]'(_Type, _Bounds), !IO) :-
-    io__write_string("mercury::MR_Word", !IO).
+    io.write_string("mercury::MR_Word", !IO).
 write_il_simple_type_as_foreign_type_mcpp('&'(Type), !IO) :-
-    io__write_string("MR_Ref(", !IO),
+    io.write_string("MR_Ref(", !IO),
     write_il_type_as_foreign_type(managed_cplusplus, Type, !IO),
-    io__write_string(")", !IO).
+    io.write_string(")", !IO).
 write_il_simple_type_as_foreign_type_mcpp('*'(Type), !IO) :-
     write_il_type_as_foreign_type(managed_cplusplus, Type, !IO),
-    io__write_string(" *", !IO).
+    io.write_string(" *", !IO).

 :- pred write_csharp_initializer(simple_type::in, io::di, io::uo) is det.

 write_csharp_initializer(int8, !IO) :-
-    io__write_string("0", !IO).
+    io.write_string("0", !IO).
 write_csharp_initializer(int16, !IO) :-
-    io__write_string("0", !IO).
+    io.write_string("0", !IO).
 write_csharp_initializer(int32, !IO) :-
-    io__write_string("0", !IO).
+    io.write_string("0", !IO).
 write_csharp_initializer(int64, !IO) :-
-    io__write_string("0", !IO).
+    io.write_string("0", !IO).
 write_csharp_initializer(uint8, !IO) :-
-    io__write_string("0", !IO).
+    io.write_string("0", !IO).
 write_csharp_initializer(uint16, !IO) :-
-    io__write_string("0", !IO).
+    io.write_string("0", !IO).
 write_csharp_initializer(uint32, !IO) :-
-    io__write_string("0", !IO).
+    io.write_string("0", !IO).
 write_csharp_initializer(uint64, !IO) :-
-    io__write_string("0", !IO).
+    io.write_string("0", !IO).
 write_csharp_initializer(native_int, !IO) :-
-    io__write_string("0", !IO).
+    io.write_string("0", !IO).
 write_csharp_initializer(native_uint, !IO) :-
-    io__write_string("0", !IO).
+    io.write_string("0", !IO).
 write_csharp_initializer(float32, !IO) :-
-    io__write_string("0.0", !IO).
+    io.write_string("0.0", !IO).
 write_csharp_initializer(float64, !IO) :-
-    io__write_string("0.0", !IO).
+    io.write_string("0.0", !IO).
 write_csharp_initializer(native_float, !IO) :-
-    io__write_string("0.0", !IO).
+    io.write_string("0.0", !IO).
 write_csharp_initializer(bool, !IO) :-
-    io__write_string("false", !IO).
+    io.write_string("false", !IO).
 write_csharp_initializer(char, !IO) :-
-    io__write_string("'\\0'", !IO).
+    io.write_string("'\\0'", !IO).
 write_csharp_initializer(string, !IO) :-
-    io__write_string("null", !IO).
+    io.write_string("null", !IO).
 write_csharp_initializer(object, !IO) :-
-    io__write_string("null", !IO).
+    io.write_string("null", !IO).
 write_csharp_initializer(refany, !IO) :-
-    io__write_string("null", !IO).
+    io.write_string("null", !IO).
 write_csharp_initializer(class(_ClassName), !IO) :-
-    io__write_string("null", !IO).
+    io.write_string("null", !IO).
 write_csharp_initializer(interface(_ClassName), !IO) :-
-    io__write_string("null", !IO).
+    io.write_string("null", !IO).
 write_csharp_initializer('[]'(_Type, _Bounds), !IO) :-
-    io__write_string("null", !IO).
+    io.write_string("null", !IO).
 write_csharp_initializer('&'(_Type), !IO) :-
-    io__write_string("null", !IO).
+    io.write_string("null", !IO).
 write_csharp_initializer('*'(_Type), !IO) :-
-    io__write_string("null", !IO).
+    io.write_string("null", !IO).
 write_csharp_initializer(valuetype(ClassName), !IO) :-
-    io__write_string("new ", !IO),
+    io.write_string("new ", !IO),
     write_class_name(csharp, ClassName, !IO),
-    io__write_string("()", !IO).
+    io.write_string("()", !IO).

 :- pred write_class_name(foreign_language::in(managed_lang),
     structured_name::in, io::di, io::uo) is det.
@@ -974,23 +976,23 @@
         Lang = managed_cplusplus,
         Sep = "::"
     ),
-    io__write_list(DottedName ++ NestedClasses, Sep, io__write_string, !IO).
+    io.write_list(DottedName ++ NestedClasses, Sep, io.write_string, !IO).

-:- pred write_mlds_var_name_for_local(mlds__var_name::in,
+:- pred write_mlds_var_name_for_local(mlds.var_name::in,
     io::di, io::uo) is det.

 write_mlds_var_name_for_local(var_name(Name, _MaybeNum), !IO) :-
-    io__write_string(Name, !IO).
+    io.write_string(Name, !IO).

-:- pred write_mlds_var_name_for_parameter(mlds__var_name::in,
+:- pred write_mlds_var_name_for_parameter(mlds.var_name::in,
     io::di, io::uo) is det.

 write_mlds_var_name_for_parameter(var_name(Name, MaybeNum), !IO) :-
-    io__write_string(Name, !IO),
+    io.write_string(Name, !IO),
     (
         MaybeNum = yes(Num),
-        io__write_string("_", !IO),
-        io__write_int(Num, !IO)
+        io.write_string("_", !IO),
+        io.write_int(Num, !IO)
     ;
         MaybeNum = no
     ).

--------------------------------------------------------------------------
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