Commit Graph

65 Commits

Author SHA1 Message Date
Zoltan Somogyi
3224e94532 A new pass to remove unnecessary assignment unifications.
excess:
	A new pass to remove unnecessary assignment unifications.

mercury_compile:
	Call the new excess assignment module.

options:
	Add a new option, excess_assign, to control the new optimization.
	Add another, num-real-regs, to specify how many of r1, r2 etc are
	actually real registers. The default is now set to 5 for kryten;
	later it should be supplied by the mc script, with a value determined
	at configuration time.

tag_switch:
	Use num-real-regs to figure out whether it is likely to be worthwhile
	to eliminate the common subexpression of taking the primary tag of
	a variable. Also fix an old performance bug: the test for when a
	jump table is worthwhile was reversed.

value_number, vn_block:
	Do value numbering on extended basic blocks, not basic blocks.

vn_debug:
	Modify an information message.

labelopt:
	Clean up an export an internal predicate for value numbering. Replace
	bintree_set with set.

middle_rec:
	Prepare for the generalization of middle recursion optimization
	to include predicates with an if-then-else structure.

cse_detection:
	Fix a bug: when hoisting a common desconstruction X = f(Yi), create
	new variables for the Yi. This avoids problems with any of the Yis
	appearing in other branches of the code.

goal_util:
	Add a new predicate for use by cse_detection.

common:
	Fix a bug: recompute instmap deltas, since they may be affected by the
	optimization of common structures.

code_info:
	Make an error message more explicit.

det_analysis:
	Restrict import list to the needed modules.

*.m:
	Import assoc_list.
1995-10-27 09:39:28 +00:00
Fergus Henderson
432eee8f1f Fix singleton variable warnings by deleting useless code.
code_exprn.m, modes.m:
	Fix singleton variable warnings by deleting useless code.

shapes.m, typecheck.m:
	Fix singleton variable warnings by renaming variables so that they
	start with an underscore.

make_hlds.m:
	Pass the context down into transform_goal_2, unravel_unification,
	insert_arg_unifications, and append_arg_unifications, so that
	the goal_info_context in the newly built HLDS is never empty.
	This is needed because the new warn_singletons uses the context,
	so it has to be valid.

unify_proc.m:
	Pass a term__context to unravel_unification (as required by
	above change).

quantification.m:
	Rearrange some comments that got shifted a dozen
	lines from the code they referred to.

vn_util.m:
	Fix omission in Zoltan's changes with `succip(FramePointer)'
	which caused "Software Error: unexpected lval in vn_...".
1995-09-06 17:29:28 +00:00
Fergus Henderson
ce9a5cf7d5 Optimize away unifications with dead variables.
modes.m:
	Optimize away unifications with dead variables.
	(The code generator already does that, but by
	that time we have already allocated unnecessary
	stack slots for them.)

code_exprn.m:
	Avoid generating sequences such as `r2 = r3; r3 = r2;'
	when a register already contains the correct value.
	(This change was in fact at least as much Tom's work as mine.)

store_alloc.m:
	For disjunctions, we only want to allocate registers
	for the variables that are output by the disjunction.
	The inputs should go in framevars, not in registers.
	This avoids much of the register-shuffling
	in the code generated for e.g. list__member(out, in).
	(This change was in fact at least as much Tom's work as mine.)
1995-09-06 11:42:11 +00:00
Zoltan Somogyi
bebe96be34 Look inside blocks introduced by value numbering when looking
frameopt:
	Look inside blocks introduced by value numbering when looking
	restorations of succip.

value_number, opt_util:
	If we are using conservative garbage collection, disable value
	numbering for blocks that allocate more than one cell on the heap.
	This allows value numbering of most blocks to work in the absence
	of -DALL_INTERIOR_POINTERS.

all other source files:
	Clean up "blank" lines that nevertheless contain space or tab
	characters.
1995-08-27 11:10:20 +00:00
Fergus Henderson
62d57a5ab5 Fix bug reported by Dylan: float constants are boxed and thus
code_exprn.m:
	Fix bug reported by Dylan: float constants are boxed and thus
	cannot be considered constant.
1995-07-17 02:46:41 +00:00
Thomas Conway
1b9ff54448 Double bug fix. Static ground terms were not being correctly
code_exprn.m:
	Double bug fix. Static ground terms were not being correctly
	handled. Neither were partially instantiated terms. Both are
	now handled correctly (famous last words, no doubt).

det_analysis.m:
	I thought I'd committed this change at *least* once before
	(though I havn;t checked the revision history). I fixed the
	code generator bug that was causing a commented out section
	to fail. So I've uncommented out that section.
1995-07-14 00:56:26 +00:00
Andrew Bromage
9dddf14a3f OK, finally, everything should be back in order. 1995-07-05 23:38:32 +00:00
Andrew Bromage
fda56846cb With any luck, this should be the call_graph branch successfully
merged.  Do not use --constraint-propagation, because it doesn't
schedule conjunctions properly yet.
1995-07-04 03:15:30 +00:00
Thomas Conway
0dc8ca50d8 Implement an improved method of handling negated contexts.
code*.m & *gen.m:
	Implement an improved method of handling negated contexts.
	The new method avoids saving things onto the stack before
	an if-then-else or negation if it can.
	Also, fix the implementation of nondet if-then-else so that
	it does the soft cut properly.
1995-06-22 23:55:59 +00:00
Thomas Conway
57e3bc01db Fix a bug that was causing the code generator to loose
code_exprn.m:
	Fix a bug that was causing the code generator to loose
	track of how many references there are to a register.
	The bug was what caused incorrect results for one of
	Bart's programs.
1995-04-30 10:12:37 +00:00
Fergus Henderson
ac4f8ba0fb Add copyright messages.
compiler/*:
	Add copyright messages.
	Change all occurences of *.nl in comments to *.m.

compiler/mercury_compile.pp:
	Change the output to the .dep files to use *.m rather than *.nl.
	(NOTE: this means that `mmake' will not work any more if you
	call your files *.nl!!!)
1995-03-30 21:03:41 +00:00
Thomas Conway
215b965214 The interface of set changed slightly.
code_exprn.m, common.m graph_colour.m, quantification.m:
	The interface of set changed slightly.
1995-03-24 09:21:12 +00:00
Thomas Conway
1fd52bc3a5 Fix an overly conservative sanity check.
code_exprn.m
code_info.m:
	Fix an overly conservative sanity check.

mercury_compile.pp
typecheck.m:
	Fix type errors due to the changed implementation of map.
	Possibly these bits of code should be removed or something
	so that map is properly abstract.
1995-03-22 11:40:54 +00:00
Thomas Conway
a0140a10e9 Thread options down into the new part of the code generator
code_exprn.m:
code_info.m:
	Thread options down into the new part of the code generator
	so that it does the right thing with constant expressions.
1995-03-18 09:41:06 +00:00
Thomas Conway
56185418db a new module for manipulating rvals and lvals.
exprn_aux.nl:
	a new module for manipulating rvals and lvals.

code_exprn.nl:
	the new bottom level of the new code generator. This replaces
	a large chunk of code_info.

*code* & *gen*:
	various small changes to use the new bottom level of the
	code generator.
1995-03-15 08:07:56 +00:00