Estimated hours taken: 0.5 hours for the fix, 8 hours debugging
(plus a similar amount of Zoltan's time debugging)
string_switch.m:
Fix a code generation bug: it called
code_info__generate_failure from the wrong spot, and so used
the wrong exprn_info. This meant that the code generated
by generate_failure contained incorrect register shuffling,
since it thought the variables were in different locations
to where they really were.
Estimated hours taken: 10
hlds, hlds_module, hlds_pred, hlds_goal, hlds_data:
Divided the old hlds.m into four files:
hlds_module.m defines the data structures that deal with issues
that are wider than a single predicate. These data structures are
the module_info structure, dependency_info, the predicate table
and the shape table.
hlds_pred.m defined pred_info and proc_info, pred_id and proc_id.
hlds_goal.m defines hlds__goal, hlds__goal_{expr,info}, and the
other parts of goal structures.
hlsd_data.m defines the HLDS types that deal with issues related
to data and its representation: function symbols, types, insts, modes.
It also defines the types related to determinism.
hlds.m is now an empty module. I have not removed it from CVS
because we may need the name hlds.m again, and CVS does not like
the reuse of a name once removed.
other modules:
Import the necessary part of hlds.
det_analysis:
Define a type that was up to now improperly defined in hlds.m.
prog_io:
Move the definition of type determinism to hlds_data. This decision
may need to be revisited when prog_io is broken up.
dnf, lambda:
Simplify the task of defining predicates.
llds:
Fix some comments.
mercury_compile:
If the option -d all is given, dump all HLDS stages.
shape, unused_args:
Fix formatting.
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.
instructions, and the last argument from local labels. All these were
placeholders for info put in there by prof.m and used when emitting C
code.
The set of labels that serve as return points are now calculated in llds.m
just before each procedure has its C code generated. This set is passed to
output_instruction along with the label at the start of the procedure.
*.m:
Changed the way the extra field in the label type is defined. Now
all labels are initially assumed to be 'unknown' and a seperate
profiling pass (to be implemented) will determine whether the label can
be accessed externally.
prog_io, hlds: Added the functor "multidet" to the type determinism.
Added types and predicates to relate determinism to its
two components, can_fail and soln_count.
Removed the functor "unspecified" from the type determinism,
substituting maybe(determinism) for determinism in proc_info.
Replaced the type category with the type code_model,
and added predicates to compute it from determinism.
det_analysis: Redone the analyses to work with determinism, not category
(or code_model). This should enable programmers to write
their own erroneous (and failure) predicates.
other files: Use the new and renamed types and access predicates.
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!!!)
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.
io.nl:
Introduced a new predicate which ignore's any whitespace in the input.
Needs to have all the whitespace character's added to it.
*.nl and *.pp:
Changed the implementation of time profiling. Now during a compile,
the compiler identifies all the internal labels which can be accessed
externally, and marks them. At the moment, these are the continuation
labels of calls and the next disjunct in nondet disjunctions. Then
at the .mod output, it places a macro 'update_prof_current_proc' to
restore the profiling counter.
llds.nl:
Introduced an extra argument to the LLDS goto. It is the label
address of the Caller and is used for the profiling of tailcall's.
*.nl and *.pp:
Propagated the extra argument to all the appropiate files.
Makefile.common:
Add new targets `mercury_compile.sicstus' (the Mercury compiler
compiled with Sicstus) and `mercury_compile.sicstus.debug'
(debugging version of the above).
*.nl:
Use Sicstus-compatible char and string escapes.
Avoid the use of explicit existential quantification.
Various other hacks to get things to parse correctly under Sicstus.
prog_io.nl:
Don't allow (A -> B) in DCGs, since NU-Prolog and Mercury give
it different semantics to Sicstus.
sp_builtin.nl, sp_lib.nl:
Split sp_builtin.nl into sp_builtin.nl and sp_lib.nl.
sp_conv.sed:
Add sed script which converts some character escapes so that
they work with Sicstus.
term_io.nl:
Remove term_io__prefix_op etc. since they aren't used anymore.
now in dense_switch, string_switch and tag_switch, with the original
if-then-else implementation and the code that decides on optimizations
still in switch_gen.
Added options to replace the magic numbers governing the choice of switch
method.
Added comments to frameopt, jumpopt, labelopt and peephole.