Implemented a complete redesign of MLRISC pseudo-ops. Now there
ought to never be any question of incompatabilities with
pseudo-op syntax expected by host assemblers.
For now, only modules supporting GAS syntax are implemented
but more should follow, such as MASM, and vendor assembler
syntax, e.g. IBM as, Sun as, etc.

Implemented a complete redesign of MLRISC pseudo-ops. Now there
ought to never be any question of incompatabilities with
pseudo-op syntax expected by host assemblers.
For now, only modules supporting GAS syntax are implemented
but more should follow, such as MASM, and vendor assembler
syntax, e.g. IBM as, Sun as, etc.

Fix for a backpatching bug reported by Allen.
Because the boundary between short and long span-dependent
instructions is +/- 128, there are an astounding number of
span-dependent instructions whose size is over estimated.
Allen came up with the idea of letting the size of span
dependent instructions be non-monotonic, for a maxIter
number of times, after which the size must be monotonically
increasing.
This table shows the number of span-dependent instructions
whose size was over-estimated as a function of maxIter, for the
file Parse/parse/ml.grm.sml:
maxIter # of instructions:
10 687
20 438
30 198
40 0
In compiling the compiler, there is no significant difference in
compilation speed between maxIter=10 and maxIter=40. Actually,
my measurements showed that maxIter=40 was a tad faster than
maxIter=10! Also 96% of the files in the compiler reach a fix
point within 13 iterations, so fixing maxIter at 40, while high,
is okay.

(sml-rightalign-and): New defcustom.
(sml-tyvarseq-re): New var.
(sml-font-lock-keywords): Use it.
(sml-imenu-create-index): Don't get confused by tyvarseq's.
(sml-mode-variables): Don't set `comment-column'.
(sml-funname-of-and): New function.
(sml-electric-pipe): Use it.
(sml-find-comment-indent): Try to ignore comment-markers in strings.
(sml-calculate-indentation): Handle closing parens specially.
(sml-indent-pipe): Recognize the case where `and' defines a datatype.
(sml-dangling-sym): Make it work if the symbol is an open-paren.
(sml-indent-default): Change the behavior when preceded by `end',
although I'm not quite sure why.
Understand dangling open-parens.
Properly skip *all* subexpressions of lower precedence.
Allow use of sml-symbol-indent to outdent lines starting with , or ;.
(sml-insert-form): Use preceding-char to avoid bug at bobp.

I have dramatically simplified the interface for CELLS in MLRISC.
In summary, the cells interface is broken up into three parts:
1. CellsBasis : CELLS_BASIS
CellsBasis is a top level structure and common for all
architectures. it contains the definitions of basic datatypes
and utility functions over these types.
2. functor Cells() : CELLS
Cells generates an interface for CELLS that incorporates the
specific resources on the target architecture, such as the
presence of special register classes, their number and size,
and various useful substructures.
3. <ARCH>CELLS
e.g. SparcCells: SPARCCELLS
<ARCH>CELLS usually contains additional bindings for special
registers on the architecture, such as:
val r0 : cell (* register zero *)
val y : cell (* Y register *)
val psr : cell (* processor status register *)
...
The structure returned by applying the Cells functor is opened
in this interface.
The main implication of all this is that the datatypes for cells is
split between CellsBasis and CELLS -- a fairly simple change for user
code.
In the old scheme the CELLS interface had a definitional binding of
the form:
signature CELLS = sig
structure CellsBasis = CellsBasis
...
end
With all the sharing constraints that goes on in MLRISC, this old
design quickly leads to errors such as:
"structure definition spec inside of sharing ... "
and appears to require an unacceptable amount of sharing and where
constraint hackery.
I think this error message (the interaction of definitional specs and
sharing) requires more explanation on our web page.

A CVS update record!
Changed type cell from int to datatype, and numerous other changes.
Affect every client of MLRISC. Lal says this can be bootstrapped on all
machines. See smlnj/HISTORY for details.
Tag: leunga-20001207-cell-monster-hack

Slight cleanup on the Alpha.
Added a bunch of instructions to the x86 instruction set.
The module ra-rewrite-with-renaming has been improved.
These should have no effect on SML/NJ.
CVS tag=leunga-20000515-alpha-x86-ra

* opt/abcopt.sml: New file.
* main/flintcomp.sml: Change `Compiler' to `FLINT' or `CPS' in the
name of phases printed by Compiler.Stats.
(abcopt): New phase.
* viscomp-core.cm: Add FLINT.opt/abcopt.sml.

(curry): Make sure that uncurrying will not make a
function recursive, but allow uncurrying a mix of functor and function
in some restricted cases.
(uncurry): Properly handle the new functor/function case.
(SWITCH): Don't change the ordering while folding over the arms.
Plus some cosmetic code movements to avoid long lines.

More assembly output problems involving the indexed addressing mode
on the x86 have been found and corrected. Thanks to Fermin Reig for the
fix.
The interface and implementation of the register allocator have been changed
slightly to accommodate the possibility to skip the register allocation
phases completely and go directly to memory allocation. This is needed
for C-- use.
This fix only affects the x86 assembly output.

- size info in BOOTLIST
* no fixed upper limits for number of bootfiles or length of
bootfile names in runtime
* falling back to old behavior if no BOOTLIST size info found
- allocation size heuristics in .run-sml
* tries to read cache size from /proc/cpuinfo (this is important for
small-cache Celeron systems!)
- install.sh robustified
- CM manual updates
- paranoid mode
* no more CMB.deliver() (i.e., all done by CMB.make())
* can re-use existing sml.boot.* files
* init.cmi now treated as library
* library stamps for consistency checks
- sml.boot.<arch>-<os>/PIDMAP file
* This file is read by the CM startup code. This is used to minimize
the amount of dynamic state that needs to be stowed away for the
purpose of sharing between interactive system and user code.
- CM.Anchor.anchor instead of CM.Anchor.{set,cancel}
* Upon request by Elsa. Anchors now controlled by get-set-pair
like most other CM state variables.
- Compiler.CMSA eliminated
* No longer supported by CM anyway.
- fixed bugs in pickler that kept biting Stefan
* past refs to past refs (was caused by the possibility that
ad-hoc sharing is more discriminating than hash-cons sharing)
* integer overflow on LargeInt.minInt
- ml-{lex,yacc} build scripts now use new mechanism
for building standalone programs
- fixed several gcc -Wall warnings that were caused by missing header
files, missing initializations, etc., in runtime (not all warnings
eliminated, though)

* sml-mode.el (sml-find-matching-starter): Use a list of syms instead of a
regexp.
(sml-indent-default): Use symbol membership rather than a regexp.
Also, use `sym-indent' instead of (current-column). This fixes a problem
with a hanging `structure Foo = (struct|let)' (due to `structure' having
a sml-indent-rule, as opposed to `fun'). Hopefully it won't introduce
other problems.
(sml-font-lock-keywords): Match vars `val x : int' also.
(sml-electric-pipe): Update to the new `sml-find-matching-starter' and
return a sensible default instead of raising an error in case of
unexpected situations.
(sml-indent-line): Ignore errors and keep the cursor where it is.
(sml-calculate-indentation, sml-indent-pipe): Use syms instead of regexps.
* sml-defs.el (sml-starters-re, sml-pipehead-re): Remove.
* testcases.sml: New file.
* makefile.pkg (test): new target to run the test suite.

* sml-util.el (make-temp-dir, make-temp-file, temp-file-dir,
delete-temp-dirs): Replaced by the make-temp-file from Emacs-21.
(custom-create-map): add :group arg and allow key to be a list.
(define-major-mode): Removed (use define-derived-mode instead).
(sml-builtin-nested-comments-flag): New var.
* sml-proc.el (sml-host-name): New var.
(sml-make-file-name): Replaced by `sml-compile-commands'.
(sml-config-file): New var.
(sml-compile-commands-alist): New var.
(inferior-sml-load-hook): Removed.
(sml-buffer): Query if the current buffer is not a *sml*.
(inferior-sml-mode): Use minor-mode-overriding-map-alist to disable
compilation-minor-mode's keybindings.
(run-sml): Turn into an alias for sml-run.
(sml-run): Query the user for the command. If prefix is set (or if
default value is not null) query for args and host. Use `split-string'
rather than our own function. Run cmd on another host if requested and
pass it an init file if it exists. Pop to the buffer at the end.
(sml-args-to-list): Remove.
(sml-compile): Look for special files (sml-compile-command-alist) in
the current dir (and its parents) to choose a default command. Remember
the command for next time in the same buffer. Make the `cd' explicit in
the command so the user can change it.
(sml-make-error): Fix for when `endline' is absent.
* sml-mode.el: Pass it rhough checkdoc.
(sml-mode-version): Remove.
(sml-load-hook): Remove.
(sml-mode-info): Use `info' rather than `Info-goto-node'.
(sml-keywords-regexp): Add "o".
(sml-syntax-prop-table): Use `defsyntax'.
(sml-font-lock-syntactic-keywords): Only use nested comments if supported.
(sml-mode): Use `define-derived-mode'.
(sml-electric-pipe): `sml-indent-line' -> `indent-according-to-mode'.
(sml-indent-line): Use `indent-line-to'.
(sml-cm-mode): New mode for CM files.
* Makefile: Update.
* sml-mode-startup.el: Remove since it's now autogenerated.
* sml-defs.el (sml-bindings): Remove left over C-c` binding.
(sml-mode-map): Add binding for sml-drag-region (was in sml-proc.el).
(sml-mode-syntax-table): Only use nested comments if supported.
(sml-mode-menu): Use next-error rather than the old sml-next-error.
(sml-pipehead-re): Remove "of".
* sml-compat.el (set-keymap-=parents): Make sure it also works when called
with a single keymap rather than a list.
(temporary-file-directory): Add a default definition for XEmacs.
(make-temp-file): New function.

* sml-move.el (sml-(for|back)ward-sym): now also return the string if any
and take care of the "op" special keyword.
(sml-op-prec): setup an alist for the infix operators.
* version 3.9.1: sent to Roland McGrath.

* opt/split.sml: seriously reworked. Now splits TFNs as well.
* kernel/primop.sml (effect): removed DEREF and MAKEREF from the pure
primops.
* flint/flintutil.sml (copy): sort the type-map since {lt,tc}_subst
actually expects it to be sorted.
* kernel/ltyextern.{sml,sig} (lt_nvpoly): new function (digged from
recover.sml to build a LT_POLY in the case of named tvars.
* opt/recover.sml: removed unused depth arguments left behind from before
we switched to named tvars.
(addLty): added for the benefit of opt/split.sml
(lt_nvpoly): moved to ltyextern.sml

* opt/fcontract.sml: (fcexp): straightforward split into functions
(fcLet): do the BRANCH thing after contraction (plus force an additional
contraction, so the total is 3 passes for a fairly good handling of
wrap's equality-primop compilation)
(fcLet): drop TAPP if the output is unused.

* opt/fcontract.sml: generalized the BRANCH thing.
It should now be faster to detect and avoid potential code blowups while
applying to more cases. But it requires one more pass to generate the
same code quality :-(

Merged in Bratin's typelifting and Chris' named tvars.
FLINT is now using tvars from the first lcontract all the way to cps.
* reps/rttype.sml: changes from Bratin.
(rtLexp): define the NVAR case (return the tvar as an lvar).
* opt/[fl]contract.sml: removed the restriction on inlining at the same
deBruijn depth.
* opt/lift.sml: new file for typelifting.
* flint/flintutil.sml (copy): added tvar renaming.
* flint/tvarcvt.sml: new file for named tvar <-> deBruijn conversions.

* opt/optutils.sml (id): removed. That was stupid.
* opt/collect.sml: drop support for actuals (was only used for cstargs).
* opt/lcontract.sml (lpfd): reset the inline bit to a safe value.
* opt/fcontract.sml (cstargs): eliminated. Might reappear in a
specialization phase some day.
(inline): turned off unrolling because it's buggy.
(APP): use the new ifs, damit!

* opt/fcontract.sml: take advantage of single-arm SWITCH (aka decon)
(SWITCH(CON)): just compare the conreps because types may differ (?)
(inlineWitness): ugly hack used to figure out if inlining happened,
in order to decide whether to keep the inline bit or not (in cfun).

* added basic unrolling support
* changed fkind to have most annotations valid on
functors as well. It also adds a loopkind annotation as well as extends
the inline boolean into a three-way alternative.
* switched to a continuation passing style to implement the
let-associativity rule in a better way.

made changes to kind-checking so that enc_tvar need not be exported
by ltykernel. one awkwardness is that the tkLookupFreeVars function
in ltykernel manipulates a tkindenv, which is technically not defined
until ltyextern.