X-Git-Url: http://git.joshuawise.com/snipe.git/blobdiff_plain/6ade8b0a3251e44b34c6bdbbd9403e36d6fd6231..6c5506c5b97dabd72ba38c1f033dc4fded52cbfd:/README?ds=inline diff --git a/README b/README index 4c6899b..3c068e3 100644 --- a/README +++ b/README @@ -1,69 +1,69 @@ 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 L5 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 L5: - * 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 4, and mainly + just a straight-forward extension of the L4 parser to have increments, + decrements, conditionals, and hex constants. + + * AST utilities were updated to use the new temp typing system. - * 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. + * Temporaries now are the only source of sizing information until we hit + the stage at which point instructions are generated. At that point, + instructions get sizing info, too, but really, that's about it. - * The translator was extended with a CALL. + * The typechecker was mostly unchanged. - * 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 translator was changed to use the new sizing system. Of interest, + the 'safe' alloc routine and the 'safe' dereference routines have been + moved into the IR stage, as opposed to having custom instructions + generated for them at the munch stage. This was done with the addition + of the 'stmvar' IR function, which is equivalent to the GCC C extension: + ({ stm; stm; ... expr }) + in that it evaluates the statements first, then returns the evaluation + of the expression. - * 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 munch modules were updated to remove a lot of their suck and make + them correct again. Specifically, they were updated to use the new + typing system and perform type inference of sorts (i.e. adding a + quadword base pointer and a long offset yields a quad, etc.). This is + far superior to the previous sizing method, in which we gave some loose + (and disgusting) annotations of size and left the final sizing decisions + to the stringifier (O.o). - * 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 liveness analyzer was mainly unchanged. - * The color orderer had no changes. + * The grapher was fully unchanged. Nice. - * The coloring module was slightly updated to recognize more fixed-color - registers. It implements a greedy coloring algorithm. + * The color orderer was optimized a bit. - * 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 coloring module was fully unchanged. Nice. - * The peepholer is upgraded somewhat; it now eliminates more redundant - instructions (such as adding/subtracting 0). + * The solidifier was similarly ripped out and hit by the diqing beam, sent + on a flight to Diqing airport, which is in Diqing which is in + the Diqing province in China, and subsequently it was diqed. It is now + much happier. + + * The peepholer has been moved into the optimization framework. + + * An optimization framework was added, allowing optimizers to be + individually turned off from the command line with approximately no work + on our part. I'm particularly proud of the simplicity with which it + allows one to write optimizations; see optimize/feckful.sml. They need + only be hooked in one place (in particular, in a list at the top of + top.sml). Individual optimizations will be discussed in the paper to be + handed in tomorrow. * 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 write in ML. - * Our internal representation of x86 assembly was changed. In particular, - conditional sets and jumps are now SETcc of cc * oper and Jcc of cc * - oper, instead of a separate SET or J for each condition code. This - simplifies other parts of the code as well. - We believe that it is fully functional. We generate correct code whenever we are supposed to, and we pass every test that we can lay our hands on -(including all of l2, and one of ours that killed the reference compiler). -Of course, our last bug was caught by only one failing test, so... \ No newline at end of file +(including all of the regression suite). There are a number of optimizations +that we wish to do, especially various interprocedural ones, but we ran out +of time.