HOME

TheInfoList



OR:

In
software engineering Software engineering is a systematic engineering approach to software development. A software engineer is a person who applies the principles of software engineering to design, develop, maintain, test, and evaluate computer software. The term '' ...
, 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 In computing, a compiler is a computer program that translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primarily used for programs tha ...
that has been designed to be relatively easy to modify to generate code for different CPU instruction set architectures. The history of this idea dates back to the 1950s when
UNCOL UNCOL (Universal Computer Oriented Language) is a universal intermediate language for compilers. The idea was introduced in 1958, by a SHARE ad-hoc committee. It was never fully specified or implemented; in many ways it was more a concept than a l ...
was proposed as the universal intermediate language. The Pasca
P-compiler
is an example of an early widely used retargetable compiler. The cost of producing a retargetable compiler that generates code of similar quality to a non-retargetable compiler (i.e., one designed to only ever produce code for a single processor) is higher because it is not possible to make use of cpu specific details throughout all phases of compilation. The benefits of a retargetable compiler is that the total cost over multiple CPUs is much lower than the combined cost of many individual non-targetable compilers. Some retargetable compilers, e.g., GCC, became so widely ported and developed that they now include support for many optimizations and machine specific details that the quality of code often surpasses that of non-retargetable compilers on many CPUs. A general-purpose global optimizer followed by machine-specific peephole optimization is a commonly used implementation technique. The optimization of code for some high performance processors requires a detailed and specific knowledge of the architecture and how the instructions are executed. Unless developers invest the large amount of time necessary to write a code generator specifically for an architecture, the optimizations performed by a retargetable compiler will only be those applicable to generic processor characteristics. A retargetable compiler is a kind of
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 running. For example, a compiler that runs on a PC but generates code that runs on an Android smartphone is a cross c ...
. Often (but not always) a retargetable compiler is
portable Portable may refer to: General * Portable building, a manufactured structure that is built off site and moved in upon completion of site and utility work * Portable classroom, a temporary building installed on the grounds of a school to provide ...
(the compiler itself can run on several different CPUs) and self-hosting. Examples of retargetable compilers: * GCC * ACK * lcc * VBCC *
Portable C Compiler The Portable C Compiler (also known as pcc or sometimes pccm - portable C compiler machine) is an early compiler for the C programming language written by Stephen C. Johnson of Bell Labs in the mid-1970s, based in part on ideas proposed by Alan ...
* SDCC *
LLVM LLVM is a set of compiler and toolchain technologies that can be used to develop a front end for any programming language and a back end for any instruction set architecture. LLVM is designed around a language-independent intermediate repre ...
* The Small-C compiler * MPG, the "machine-independent efficient microprogram generator" Rainer Leupers, Peter Marwedel
"Retargetable Compiler Technology for Embedded Systems"
2001. () p. 63.


Decompiler

retdec ("Retargetable Decompiler") is an open source retargetable machine-code
decompiler A decompiler is a computer program that translates an executable file to a high-level source file which can be recompiled successfully. It does therefore the opposite of a typical compiler, which translates a high-level language to a low-level l ...
based on
LLVM LLVM is a set of compiler and toolchain technologies that can be used to develop a front end for any programming language and a back end for any instruction set architecture. LLVM is designed around a language-independent intermediate repre ...
. * The decompiler is not limited to any particular target architecture, operating system, or executable file format: * Supported file formats: ELF, PE, Mach-O, COFF, AR (archive), Intel HEX, and raw machine code. * Supported architectures (currently 32bit only): Intel x86, ARM, MIPS, PIC32, and PowerPC.


Assemblers

Conversely, retargetable assemblers are capable of generating object files of different formats, which is useful in porting assembly language programs to various
operating system An operating system (OS) is system software that manages computer hardware, software resources, and provides common services for computer programs. Time-sharing operating systems schedule tasks for efficient use of the system and may also i ...
s that run on the same CPU architecture (such as
Windows Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for ser ...
and
Linux Linux ( or ) is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged as a Linux distribution, w ...
on the
x86 x86 (also known as 80x86 or the 8086 family) is a family of complex instruction set computer (CISC) instruction set architectures initially developed by Intel based on the Intel 8086 microprocessor and its 8088 variant. The 8086 was intr ...
platform). NASM is one such assembler.


Further reading

*''A Retargetable C Compiler: Design and Implementation'' ()


References

{{Reflist


External links


LANCE compiler website

The LLVM compiler infrastructure website

The (open-source) ACK sourceforge page

Nils Weller's C compiler page

RetDec website
Compilers