README
------
-This compiler is a big long chain of modules that transform l3 code into
+This compiler is a big long chain of modules that transform l4 code into
x86_64 assembly.
-Here is a breakdown of the modules and changes from l2:
+Here is a breakdown of the modules and changes from l3:
- * The parser. The parser was mainly brought in from lab 2, and mainly
- just a straight-forward extension of the l2 parser. We added the
- ability to parse functions, function calls, and variable declarations.
+ * The parser. The parser was mainly brought in from lab 3, and mainly
+ just a straight-forward extension of the l3 parser. We changed asops,
+ since they now side-effect and need special properties. We also added
+ dereferences, arrays, other nice things.
+
+ * AST utilities. Some of those now exist to make common operations on raw
+ AST structures less painful.
- * The typechecker. This module is mostly the same as that from l2. It
- performs function-related typechecking as well now, such as ensuring
- that the correct number of arguments is supplied in a function call,
- that there are no multiple definitions of functions, and that there is a
- main function that takes only one argument.
+ * The typechecker. The typechecker was significantly revamped. A
+ 'typeof' function was added that did most of the typechecking work;
+ the rest was relatively trivial compared to typeof. There were many
+ annoying things other than typeof, but typeof was the most interesting
+ to comment on.
- * The translator was extended with a CALL.
+ * The translator was extended with support for sizing up structs. It now
+ is smarter about translating asops. A MEMORY thingo was added to the
+ Tree, as was ALLOC.
- * The munch module was also extended with the ability to munch CALL; a
- major improvement was made when we realized we could determine what
- expressions had effects and what had fixed registers. Any expressions
- that use no fixed registers and have no effects can be reordered during
- evaluation of a function call's arguments. This enabled us to save a
- bunch of register-register moves. Saving the caller save registers is
- left to the liveness analyzer, which we believe results in substantially
- better code than saving and restoring all caller saves.
+ * The x86/munch modules were extended with support for multiple operand
+ sizes. This was done in a fashion of extreme type A, and needs to be
+ blasted before the next lab, for it is worthless, terrible, awful, ... A
+ major falling-down of this compiler is that it passes size information
+ around in no less than 235784 different fashions, and the translation
+ between each has caused us no end of grief. If we had time to rewrite
+ it instead of firefighting broken tests, uh... we would. Many of our
+ optimizations from last lab needed to be commented out because of this
+ temporary sizing sadness.
- * The liveness analyzer remains in more or less the same form, but with
- substantial performance and cleanliness improvements by replacing lists
- with maps (via BinaryMapFn) and sets (via ListSetFn). Also, a bug of
- incredible type A was discovered through much pain and suffering, and
- promptly fixed; it involved not realizing that a def on one line led to
- an interference on any succeeding lines. Somehow we got away with this
- for lab 2. Otherwise, we just explicitly state rules to generate
- def/use/succ predicates which we then iterate over to find a fixed point
- for livenesses using the standard rules.
+ * The liveness analyzer was mainly unchanged, but for a few rules.
- * The grapher was changed to use the binary map and list set for
- performance boosts (needed to pass certain large tests, like
- pine-tree_print.l3). It generates an interference graph from a list of
- livenesses at each source line.
+ * The grapher was fully unchanged. Nice.
- * The color orderer had no changes.
+ * The color orderer was fully unchanged. Nice.
- * The coloring module was slightly updated to recognize more fixed-color
- registers. It implements a greedy coloring algorithm.
+ * The coloring module was fully unchanged. Nice.
- * The solidifier was modified to change the callee save system. Now we
- only save the registers we need to. This improvement was pushed by
- excessively slow execution time on one of the tests.
+ * The solidifier was modified to deal with the fact that certain things
+ could not be accessed directly. It, too, has become an unmitigated
+ disaster. It must deal with all 875847384 of the sizes, and I am sad
+ about this.
- * The peepholer is upgraded somewhat; it now eliminates more redundant
- instructions (such as adding/subtracting 0).
+ * The peepholer lost one form of fail and loss sizing.
* The stringifier is of no interest to you, for it does real things that
interact with the real world, and that is not of interest to people who