[m-rev.] [reuse] diff: --promise-no-modified-source-files

Peter Ross peter.ross at miscrit.be
Fri Mar 23 00:27:02 AEDT 2001


Hi,


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


Estimated hours taken: 0.5
Branches: reuse

Add the new option --promise-no-modified-source-files.  The rationale
behind this option is that we can safely build new versions of the
trans_opt files with data from the old trans_opt files provided that no
source files have been modified.  Thus obtaining an optimized version of
the executable is simply repeatedly touching the .m files and rebuilding
the executable until the desired information has propogated around the
trans_opt files.

compiler/mercury_compile.m:
    If --promise-no-modified-source-files is set we can read in all of
    the .trans_opt files when making the trans_opt file.

compiler/options.m:
    Add the --promise-no-modified-source-files option.


Index: mercury_compile.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mercury_compile.m,v
retrieving revision 1.175.2.15
diff -u -r1.175.2.15 mercury_compile.m
--- mercury_compile.m	2001/03/21 14:25:52	1.175.2.15
+++ mercury_compile.m	2001/03/22 13:20:20
@@ -664,6 +664,8 @@
 	globals__io_lookup_bool_option(transitive_optimization, TransOpt),
 	globals__io_lookup_bool_option(make_transitive_opt_interface,
 		MakeTransOptInt),
+	globals__io_lookup_bool_option(promise_no_modified_source_files,
+			NoModifiedSrcFiles),
 	( { (UseOptInt = yes ; IntermodOpt = yes), MakeOptInt = no } ->
 		maybe_write_string(Verbose, "% Reading .opt files...\n"),
 		maybe_flush_output(Verbose),
@@ -676,11 +678,19 @@
 	( { MakeTransOptInt = yes } ->
 		( { MaybeTransOptDeps = yes(TransOptDeps) } ->
 			% When creating the trans_opt file, only import the
-			% trans_opt files which are lower in the ordering.
-			{ HigherDeps = list__delete_elems(
-					Imports0 ^ int_deps ++
-						Imports0 ^ impl_deps,
-					TransOptDeps) },
+			% trans_opt files which are lower in the ordering
+			% however when none of the src files have been
+			% modified it is safe to read in all the
+			% trans_opt files to determine better
+			% information.
+			{ NoModifiedSrcFiles = yes ->
+				HigherDeps = []
+			;
+				HigherDeps = list__delete_elems(
+						Imports0 ^ int_deps ++
+							Imports0 ^ impl_deps,
+						TransOptDeps)
+			},
 			trans_opt__grab_optfiles(yes, Imports1, 
 					[OrigModuleName | HigherDeps],
 					TransOptDeps, Imports, Error2)
Index: options.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/options.m,v
retrieving revision 1.288.2.12
diff -u -r1.288.2.12 options.m
--- options.m	2001/03/21 14:30:19	1.288.2.12
+++ options.m	2001/03/22 13:20:21
@@ -316,6 +316,7 @@
 		;	intermodule_optimization
 		;	use_opt_files
 		;	use_trans_opt_files
+		;	promise_no_modified_source_files
 		;	transitive_optimization
 		;	split_c_files
 	%	- HLDS
@@ -701,6 +702,7 @@
 	intermodule_optimization -	bool(no),
 	use_opt_files		-	bool(no),
 	use_trans_opt_files	-	bool(no),
+	promise_no_modified_source_files - bool(no),
 	transitive_optimization -	bool(no),
 	check_termination	-	bool(no),
 	verbose_check_termination -	bool(no),
@@ -1117,6 +1119,8 @@
 long_option("intermodule-optimisation", intermodule_optimization).
 long_option("use-opt-files",		use_opt_files).
 long_option("use-trans-opt-files",	use_trans_opt_files).
+long_option("promise-no-modified-source-files",
+					promise_no_modified_source_files).
 long_option("transitive-intermodule-optimization", 
 					transitive_optimization).
 long_option("transitive-intermodule-optimisation", 
@@ -2423,6 +2427,13 @@
 		"\t`.trans_opt' files which are already built,",
 		"\te.g. those for the standard library, but do",
 		"\tnot build any others.",
+		"--promise-no-modified-source-files",
+		"\tPromise that no source files have been modified. This",
+		"|t allows the compiler to propagate more information",
+		"\tduring intermodule optimization.",
+		"\tTouch any source files and rebuild",
+		"\t(repeatedly) to gain more optimization. Modifying a",
+		"\tsource file will *require* a `mmake realclean'.",
 		"--split-c-files",
 		"\tGenerate each C function in its own C file,",
 		"\tso that the linker will optimize away unused code.",

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