Estimated hours taken: 4
code_exprn:
Made a start towards getting better code generated for nested creates
and towards getting rid of useless "shuffle lval" instructions.
Also, some minor cleanup.
exprn_aux:
Add some auxiliary predicates for the new code_exprn.
delay_info:
Remove a useless import of hlds, which is now empty.
Estimated hours taken: 1.5
code_exprn:
Distribute the initial comments among the declarations of the exported
predicates. This makes it much less likely that the declarations will
be modified without changes in the comments. Since this has happened
in the past, some predicates are now without comments.
Changed code_exprn__place_var to prefer to get even a constant term
from a location if it has been produced before, and factor out some
code that is shared between the handling of cached and evaled
expressions.
code_exprm, code_info:
Removed an unnecessary argument from code_exprn__get_varlocs.
dead_proc_elim:
Changed the predicate name prefix from dead__ to dead_proc_elim__
to conform to notes/CODING_STANDARDS.
handle_options:
Remove an inappropriate comment.
jumpopt:
Filter out redundant livevals whether --optimize-fulljumps is given
or not. (I thought they aren't created if the option isn't given,
but they are.)
options:
Change the meaning of -O from --c-optimize to --opt-level.
Disabled unused args until the bug is fixed.
Estimated hours taken: 2
code_exprn:
When we are processing the flushing of create expressions, make sure
the Lval we are creating into isn't a field reference. This avoids
deep field of field of field of ... nesting. It does introduce
references to high register numbers, but this is a lesser evil,
and Tom and I plan to fix this anyway.
arg_info, globals, options:
Change --args old to --args simple.
options:
Make some help messages more specific.
code_aux, code_exprn, code_info, det_report, make_hlds, mercury_to_goedel,
prog_io, typecheck:
Changes to accommodate the move from varset__lookup_name
to varset__search_name.
Estimated hours taken: 2
exprn_aux:
Both code_exprn and lookup_switch had code to check whether an
expression is constant or not. Some of the code is different
due to different handling of variables in rvals, but exprn_aux
now contains the common subset.
This common subset used to treat some address constants incorrectly,
simply by not considering them; they are now considered and treated
properly.
code_exprn, lookup_switch, exprn_aux:
Remove redundant option lookups in the process of checking for
constant expressions.
code_exprn:
Other minor cleanups, including removal of a block of code Tom
says was "deep magic" (but which turns out to be unnecessary).
code_info:
Removed some dead code.
options:
Added real support for --opt-level, in the form of a table of
default values of options for each optimization level between
0 and 5 (both inclusive). This needs a new form of documentation.
How do you do tables in texinfo?
Estimated hours taken: 6
mercury_to_mercury:
Wrap parentheses around pred insts, since they are needed.
value_number, vn_verify:
Value numbering now reapplies itself to both halves of a block if
it cannot optimize the block as a whole.
Split the verification code into its own module, and fix line lengths.
vn_order:
Fix the computation of the label at which blocks should be divided.
Fix line lengths.
vn_debug:
Add a message to support the new block dividing capability.
code_exprn:
Redirect option lookup operations from options to getopt.
passes_aux:
Prepare for some further changes.
prog_io:
Formatting changes.
Estimated hours taken: 1.5
Undo dylan's changes in the names of some library entities,
by applying the following sed script
s/term_atom/term__atom/g
s/term_string/term__string/g
s/term_integer/term__integer/g
s/term_float/term__float/g
s/term_context/term__context/g
s/term_functor/term__functor/g
s/term_variable/term__variable/g
s/_term__/_term_/g
s/std_util__bool_/bool__/g
to all the `.m' and `.pp' files in the compiler and library directories.
The reason for undoing these changes was to minimize incompatibilities
with 0.4 (and besides, the changes were not a really good idea in the first
place).
I also moved `bool' to a separate module.
The main reason for that change is to ensure that the `__' prefix is
only used when it genuinely represents a module qualifier.
(That's what dylan's changes were trying to acheive, but `term__'
does genuinely represent a module qualifier.)
compiler/*.m:
Apply sed script above;
where appropriate, add `bool' to the list of imported modules.
code_exprn.m:
Improve error message for one of the internal errors.
det_analysis.m:
Make sure we don't generated unnecessary nested `some' goals.
prog_io.m, inst_match.m, mode_util.m, mercury_to_mercury.m:
Add new insts `mostly_unique' and `mostly_clobbered', with
semantics similar to `unique' and `clobbered', except that
mostly-unique variables might be needed on backtracking.
unique_modes.m:
A good start on the code to check that `unique' modes
are not used for nondet live variables. Still incomplete,
but just about all the code is there except the code to
actually compute the set of nondet live variables as you
traverse the goal.
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.
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_...".
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.)
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.
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.
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.
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.
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!!!)
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.
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.