djrieger / mjplusplus

A compiler for the MiniJava language
http://djrieger.github.io/mjplusplus/doc/doxygen/html/
6 stars 1 forks source link

separate fixpoint analysis and node exchange #90

Closed ratefuchs closed 9 years ago

ratefuchs commented 9 years ago

We should really rethink our current approach on constant folding/propagation. We should not exchange nodes during analysis. A better approach would be:

  1. Set all tarvals to unknown.
  2. Run fixpoint analysis for constant folding / propagation.
  3. Exchange all constant nodes (maybe check if they still exist; we need to see whether this check is necessary).

This would mean we

I think this could maybe also help eliminating the problems with our current phi optimization (#88 and #89).

Arithmetic identities (when not producing constants like 0*x), elimination of unreachable code and other optimization steps may be separated from constant analysis (and all optimizations can be repeated until they have a definite fixpoint or maybe a certain repetition threshold is reached).

ratefuchs commented 9 years ago

Done.