Retargetable compiler

From Wikipedia, the free encyclopedia

A retargetable compiler is a compiler that can relatively easily be modified to generate code for different CPU architectures. The object code produced by these is frequently of lesser quality than that produced by a compiler developed specifically for a processor. Retargetable compilers are often also cross compilers.

Typically the design of a compiler divides the functionality so that the code generation is separate from parsing and syntax checking. The design and implementation of a retargetable compiler uses polymorphism in the code generating section so that code can be generated for any of several different processors.

The goal of easily retargeting the compiler conflicts to a degree with the goal of providing fast execution and small code size. The optimization of code for some high performance processors requires a detailed and specific knowledge of the architecture and how the instructions are executed. The optimizations usually done by a retargetable compiler are only those applicable to any processor. This is unless developers have taken the large amount of time necessary to write a code generator specifically for an architecture.

Examples of retargetable compilers:

[edit] External reference