retargetable compiler
   HOME

TheInfoList



OR:

In
software engineering Software engineering is a branch of both computer science and engineering focused on designing, developing, testing, and maintaining Application software, software applications. It involves applying engineering design process, engineering principl ...
, 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 Translator (computing), translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primaril ...
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 primary processor in a given computer. Its electronic circuitry executes instructions of a computer program, such as arithmetic, log ...
instruction set architecture In computer science, an instruction set architecture (ISA) is an abstract model that generally defines how software controls the CPU in a computer or a family of computers. A device or program that executes instructions described by that ISA, ...
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 Peephole optimization is an Optimizing_compiler, optimization technique performed on a small set of compiler-generated instructions, known as a peephole or window, that involves replacing the instructions with a logically equivalent set that has b ...
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 Android devices is a cross compile ...
. 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 vbcc is a portable and retargetable ANSI C compiler. It supports C89 (C version), C89 (ISO/IEC 9899:1989) as well as parts of C99 (ISO/IEC 9899:1999). It is divided into two parts. One is target-independent and the other is target-dependent. vb ...
*
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, also called LLVM Core, is a target-independent optimizer and code generator. It can be used to develop a Compiler#Front end, frontend for any programming language and a Compiler#Back end, backend for any instruction set architecture. LLVM i ...
* 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 and view the source code, design documents, or content of the product. The open source model is a decentrali ...
retargetable machine-code
decompiler A decompiler is a computer program that translates an executable file back into high-level source code. Unlike a compiler, which converts high-level code into machine code, a decompiler performs the reverse process. While disassemblers translate e ...
based on
LLVM LLVM, also called LLVM Core, is a target-independent optimizer and code generator. It can be used to develop a Compiler#Front end, frontend for any programming language and a Compiler#Back end, backend for any instruction set architecture. LLVM i ...
. * 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 In computing, assembly language (alternatively assembler language or symbolic machine code), often referred to simply as assembly and commonly abbreviated as ASM or asm, is any low-level programming language with a very strong correspondence bet ...
programs to various
operating system An operating system (OS) is system software that manages computer hardware and software resources, and provides common daemon (computing), services for computer programs. Time-sharing operating systems scheduler (computing), schedule tasks for ...
s that run on the same
CPU architecture In computer science and computer engineering, computer architecture is a description of the structure of a computer system made from component parts. It can sometimes be a high-level description that ignores details of the implementation. At a mo ...
(such as
Windows Windows is a Product lining, product line of Proprietary software, proprietary graphical user interface, graphical operating systems developed and marketed by Microsoft. It is grouped into families and subfamilies that cater to particular sec ...
and
Linux Linux ( ) is a family of open source Unix-like operating systems based on the Linux kernel, an kernel (operating system), operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically package manager, pac ...
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 8086 microprocessor and its 8-bit-external-bus variant, the 8088. Th ...
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