Here is code for an upgraded expression compiler. On the good side, it runs all of the standard presets. On the not-so-good side, it doesn't seem to have much impact on AVS, which makes all the work that went into it kinda disappointing... but at least I had fun generating machine code.
What it does do: Reduces memory accesses by keeping values and intermediate results on the x87 stack as long as is safe. Reduces re-calculation by searching for duplicate expressions or sub-expressions that were already calculated. Places the branches of an 'if' within the bounds of conditional jumps instead of creating calls to separate blocks of code.
What it does not do (yet.. or well): Constant folding. SSE2/3 (MMX, 3DNow, and SSE are out of the question thanks to doubles. Not sure SSE2 would be much improvement anyway without parallelizing). Making sure all values on the stack are immediately useful
Other caveats: Many special cases thanks to the awkward meta-functions
Code cleanup needed. APEs that provide custom functions would need to provide STDCALL or (untested) CDECL calls instead of FASTCALL, and take doubles instead of pointers to double. NSEEL_addfunctionex has changed.