Tart status update

Sunday, March 6, 2011
Over the course of the last week I completely gutted and re-built the statement analyzer and major parts of the code generator. The result is a significantly simpler design, as well as a bunch of additions:
  • Nested 'finally' blocks are now handled.
  • If you break out of a try block via a return, break, or continue statement, the finally block will execute correctly.
  • The generated IR code is now significantly more readable, due to the emission of sensible names for many internal variables.
This change also paves the way for a couple of things - statements returning expressions, and the 'with' statement. It will also make it easier to simplify the logic for generating source line debug information.

Basically what has been changed is that the Tart compiler no longer builds its own code flow graph (CFG) on top of LLVM's CFG. The new compiler goes directly from an expression node tree to the LLVM CFG. This means that when generating code, the compiler always has complete information about block scopes, as opposed to a 'flattened' CFG graph in which everything has been reduced to simple 'goto'-like branches. This does mean that the compiler now generates more branch instructions than before, but LLVM's optimizer will clean those up trivially.

A few other changes made over the course of this week:
  • Streamlined the configuration scripts, which now use the 'llvm-config' to determine what libraries need to be linked for each of the various Tart programs. This will also make it easier to adapt to future changes to the LLVM libraries.
  • Fixed a bunch of miscellaneous build problems.
  • Updated everything to work with the latest LLVM head.

0 comments:

Post a Comment