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 that ...
that has been designed to be relatively easy to modify to generate code for different
CPU A central processing unit (CPU), also called a central processor, main processor or just processor, is the electronic circuitry that executes instructions comprising a computer program. The CPU performs basic arithmetic, logic, controlling, an ...
instruction set architecture In computer science, an instruction set architecture (ISA), also called computer architecture, is an abstract model of a computer. A device that executes instructions described by that ISA, such as a central processing unit (CPU), is called an ...
s. The history of this idea dates back to the 1950s when UNCOL 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 co ...
. 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 a ...
(the compiler itself can run on several different CPUs) and self-hosting. Examples of retargetable compilers: * GCC * ACK * lcc * VBCC * Portable C Compiler * 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 Small-C is both a subset of the C programming language, suitable for resource-limited microcomputers and embedded systems, and an implementation of that subset. Originally valuable as an early compiler for microcomputer systems available during t ...
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 Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use the source code, design documents, or content of the product. The open-source model is a decentralized sof ...
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 daemon (computing), services for computer programs. Time-sharing operating systems scheduler (computing), schedule tasks for ef ...
s that run on the same
CPU architecture Processor design is a subfield of computer engineering and electronics engineering (fabrication) that deals with creating a processor, a key component of computer hardware. The design process involves choosing an instruction set and a certain ex ...
(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 ...
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, which i ...
on the x86 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