MLRISC Based Compiler
A traditional compiler will typically consist of a lex/yacc based front end, an optimization phase that is repeatedly invoked over some intermediate representation, and finally a back end code generation phase. The intermediate representation is usually at a level of detail appropriate to the optimization being performed, and may be far removed from the native instructions of the target architecture. The back end proceeds by translating the intermediate representation into instructions and registers for an abstract machine that is much closer to the target architecture. Retargetting is then achieved by mapping the registers and instructions of the abstract machine to registers and instructions of the target architecture.
An MLRISC based compiler, on the other hand, translates the intermediate representation into MLRISC instructions and it is the MLRISC instructions that get mapped onto instructions of the target architecture. Another possibility is to translate the front end abstract machine instructions instead of the intermediate representation. Once MLRISC instructions have been generated, nearly all aspects of high quality code generation come for free. A long story would be cut short if MLRISC were just another abstract machine.
The key idea behind MLRISC is that there is no single MLRISC instruction set or intermediate program representation, but the MLRISC intermediate representation is specialized to the needs of the front end source language being compiled. The specialization does not stop there, but the:
are specialized to the needs of the front end. The ability to consistently specialize each of these to create a back end for a specific language, summarizes the characteristics of MLRISC that distinguishes it from other retargetable backends.
It is important to emphasize that little optimizations performed on the MLRISC intermediate representation. Most optimizations are done on a flowgraph of target machine instructions, to enable optimizations that take advantage of the characteristics of each architectural. The MLRISC intermediate representation is just used as a stepping stone to get to the flowgraph.