Retargetable compiler
Encyclopedia
In software engineering
Software engineering
Software Engineering is the application of a systematic, disciplined, quantifiable approach to the development, operation, and maintenance of software, and the study of these approaches; that is, the application of engineering to software...

, retargeting is an attribute of software development tools that have been specifically designed to generate code for more than one computing platform.

Compilers

A retargetable compiler is a compiler
Compiler
A compiler is a computer program that transforms source code written in a programming language into another computer language...

 that has been designed to be relatively easy to modify to generate code for different CPU instruction set architectures. The machine code
Machine code
Machine code or machine language is a system of impartible instructions executed directly by a computer's central processing unit. Each instruction performs a very specific task, typically either an operation on a unit of data Machine code or machine language is a system of impartible instructions...

 produced by these is sometimes of lower quality than that produced by a compiler developed specifically for a single processor.

A retargetable compiler is a kind of cross compiler
Cross compiler
A cross compiler is a compiler capable of creating executable code for a platform other than the one on which the compiler is run. Cross compiler tools are used to generate executables for embedded system or multiple platforms. It is used to compile for a platform upon which it is not feasible to...

.
Often (but not always) a retargetable compiler is portable
Software portability
Portability in high-level computer programming is the usability of the same software in different environments. The prerequirement for portability is the generalized abstraction between the application logic and system interfaces...

 (the compiler itself can run on several different CPUs) and self-hosting
Self-hosting
The term self-hosting was coined to refer to the use of a computer program as part of the toolchain or operating system that produces new versions of that same program—for example, a compiler that can compile its own source code. Self-hosting software is commonplace on personal computers and larger...

.

The goal of easily retargeting the compiler conflicts to some 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.

A general-purpose global optimizer followed by machine-specific peephole optimization
Peephole optimization
In compiler theory, peephole optimization is a kind of optimization performed over a very small set of instructions in a segment of generated code. The set is called a "peephole" or a "window"...

 can work well.

Examples of retargetable compilers:
  • GCC
    GNU Compiler Collection
    The GNU Compiler Collection is a compiler system produced by the GNU Project supporting various programming languages. GCC is a key component of the GNU toolchain...

  • ACK
    Amsterdam Compiler Kit
    The Amsterdam Compiler Kit is a fast, lightweight and retargetable compiler suite and toolchain written by Andrew Tanenbaum and Ceriel Jacobs, and is MINIX's native toolchain. The ACK was originally closed-source software , but in April 2003 it was released under an open source BSD license...

  • lcc
  • VBCC
    VBCC
    vbcc is the name of a portable and retargetable ISO/ANSI C compiler.It supports ISO C according to ISO/IEC 9899:1989 and a subset of the new standard ISO/IEC 9899:1999....

  • Portable C Compiler
    Portable C Compiler
    The Portable C Compiler is an early compiler for the C programming language written by Stephen C...

  • SDCC
    Small Device C Compiler
    The Small Device C Compiler is an open source, partially retargetable C compiler for microcontrollers. It is distributed under the GNU General Public License. The package also contains a linker, assembler, simulator and debugger...

  • LLVM

Assemblers

Conversely, retargetable assemblers are capable of generating object files of different formats, which is useful in porting assembly language
Assembly language
An assembly language is a low-level programming language for computers, microprocessors, microcontrollers, and other programmable devices. It implements a symbolic representation of the machine codes and other constants needed to program a given CPU architecture...

 programs to various operating system
Operating system
An operating system is a set of programs that manage computer hardware resources and provide common services for application software. The operating system is the most important type of system software in a computer system...

s that run on the same CPU architecture (such as Windows
Microsoft Windows
Microsoft Windows is a series of operating systems produced by Microsoft.Microsoft introduced an operating environment named Windows on November 20, 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces . Microsoft Windows came to dominate the world's personal...

 and Linux
Linux
Linux is a Unix-like computer operating system assembled under the model of free and open source software development and distribution. The defining component of any Linux system is the Linux kernel, an operating system kernel first released October 5, 1991 by Linus Torvalds...

 on the x86 platform). NASM is one such assembler.

Further reading

  • A Retargetable C Compiler: Design and Implementation (ISBN 0-8053-1670-1)
  • Retargetable Compiler Technology for Embedded Systems (ISBN 0-7923-7578-5)

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK