Link-time optimization
Encyclopedia
Link-time optimization is a type of program optimization
performed by a compiler
to a program at link time
. Link time optimization occurs in programming languages that compile programs on a file-by-file basis (such as C
and Fortran
), rather than all at once (such as Java
).
Once all files have been compiled separately into object file
s, a compiler links (merges) the object files into a single file, the executable
. As it is in the process of doing this (or immediately thereafter) a compiler with link-time optimization capabilities can apply various forms of interprocedural optimization
to the newly merged file. The process of merging the files may have removed the knowledge limitations that occurred in the earlier stages of compilation, allowing for deeper analysis, more optimization, and ultimately better program performance.
Optimization (computer science)
In computer science, program optimization or software optimization is the process of modifying a software system to make some aspect of it work more efficiently or use fewer resources...
performed by a compiler
Compiler
A compiler is a computer program that transforms source code written in a programming language into another computer language...
to a program at link time
Link time
In computer science, link time refers to either the operations performed by a linker or programming language requirements that must be met by compiled source code for it to be successfully linked ....
. Link time optimization occurs in programming languages that compile programs on a file-by-file basis (such as C
C (programming language)
C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system....
and Fortran
Fortran
Fortran is a general-purpose, procedural, imperative programming language that is especially suited to numeric computation and scientific computing...
), rather than all at once (such as Java
Java (programming language)
Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities...
).
Once all files have been compiled separately into object file
Object file
An object file is a file containing relocatable format machine code that is usually not directly executable. Object files are produced by an assembler, compiler, or other language translator, and used as input to the linker....
s, a compiler links (merges) the object files into a single file, the executable
Executable
In computing, an executable file causes a computer "to perform indicated tasks according to encoded instructions," as opposed to a data file that must be parsed by a program to be meaningful. These instructions are traditionally machine code instructions for a physical CPU...
. As it is in the process of doing this (or immediately thereafter) a compiler with link-time optimization capabilities can apply various forms of interprocedural optimization
Interprocedural optimization
Interprocedural optimization is a collection of compiler techniques used in computer programming to improve performance in programs containing many frequently used functions of small or medium length...
to the newly merged file. The process of merging the files may have removed the knowledge limitations that occurred in the earlier stages of compilation, allowing for deeper analysis, more optimization, and ultimately better program performance.
External links
- LinkTimeOptimization branch on GCCGNU Compiler CollectionThe 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...
wiki - LLVM Link Time Optimization in LLVM