djrieger / mjplusplus

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

Shifts instead of Mul/div for powers of 2 (bitwise AND instead of Mod) #105

Closed maxvogel closed 9 years ago

maxvogel commented 9 years ago

Could be done during optimizations as well as during code generation, while I think that it should be implemented as optimization in the LocalOptimizer or in its own class.

ratefuchs commented 9 years ago

There's a problem with doing it too early (e.g. in LocalOptimizer): we have to take care of new type of nodes during other optimizations. We can make an own class for it and run it after our optimization loop or we do it during code generation.