Jump to content
 







Main menu
   


Navigation  



Main page
Contents
Current events
Random article
About Wikipedia
Contact us
Donate
 




Contribute  



Help
Learn to edit
Community portal
Recent changes
Upload file
 








Search  

































Create account

Log in
 









Create account
 Log in
 




Pages for logged out editors learn more  



Contributions
Talk
 



















Contents

   



(Top)
 


1 Intermediate language  



1.1  Languages  







2 Other  





3 See also  





4 References  





5 External links  














Intermediate representation






العربية
Català
Čeština
Deutsch
Español
فارسی
Français

Italiano
Nederlands

Norsk bokmål
Português
Русский
Српски / srpski
Suomi


 

Edit links
 









Article
Talk
 

















Read
Edit
View history
 








Tools
   


Actions  



Read
Edit
View history
 




General  



What links here
Related changes
Upload file
Special pages
Permanent link
Page information
Cite this page
Get shortened URL
Download QR code
Wikidata item
 




Print/export  



Download as PDF
Printable version
 
















Appearance
   

 






From Wikipedia, the free encyclopedia
 

(Redirected from Intermediate language)

Anintermediate representation (IR) is the data structure or code used internally by a compilerorvirtual machine to represent source code. An IR is designed to be conducive to further processing, such as optimization and translation.[1] A "good" IR must be accurate – capable of representing the source code without loss of information[2] – and independent of any particular source or target language.[1] An IR may take one of several forms: an in-memory data structure, or a special tuple- or stack-based code readable by the program.[3] In the latter case it is also called an intermediate language.

A canonical example is found in most modern compilers. For example, the CPython interpreter transforms the linear human-readable text representing a program into an intermediate graph structure that allows flow analysis and re-arrangement before execution. Use of an intermediate representation such as this allows compiler systems like the GNU Compiler Collection and LLVM to be used by many different source languages to generate code for many different target architectures.

Intermediate language[edit]

Anintermediate language is the language of an abstract machine designed to aid in the analysis of computer programs. The term comes from their use in compilers, where the source code of a program is translated into a form more suitable for code-improving transformations before being used to generate objectormachine code for a target machine. The design of an intermediate language typically differs from that of a practical machine language in three fundamental ways:

A popular format for intermediate languages is three-address code.

The term is also used to refer to languages used as intermediates by some high-level programming languages which do not output object or machine code themselves, but output the intermediate language only. This intermediate language is submitted to a compiler for such language, which then outputs finished object or machine code. This is usually done to ease the process of optimization or to increase portability by using an intermediate language that has compilers for many processors and operating systems, such as C. Languages used for this fall in complexity between high-level languages and low-level languages, such as assembly languages.

Languages[edit]

Though not explicitly designed as an intermediate language, C's nature as an abstraction of assembly and its ubiquity as the de facto system languageinUnix-like and other operating systems has made it a popular intermediate language: Eiffel, Sather, Esterel, some dialectsofLisp (Lush, Gambit), Squeak's Smalltalk-subset Slang, Nim, Cython, Seed7, SystemTap, Vala, V, and others make use of C as an intermediate language. Variants of C have been designed to provide C's features as a portable assembly language, including C-- and the C Intermediate Language.

Any language targeting a virtual machineorp-code machine can be considered an intermediate language:

The GNU Compiler Collection (GCC) uses several intermediate languages internally to simplify portability and cross-compilation. Among these languages are

GCC supports generating these IRs, as a final target:

The LLVM compiler framework is based on the LLVM IR intermediate language, of which the compact, binary serialized representation is also referred to as "bitcode" and has been productized by Apple.[4][5] Like GIMPLE Bytecode, LLVM Bitcode is useful in link-time optimization. Like GCC, LLVM also targets some IRs meant for direct distribution, including Google's PNaCl IR and SPIR. A further development within LLVM is the use of Multi-Level Intermediate Representation (MLIR) with the potential to generate code for different heterogeneous targets, and to combine the outputs of different compilers.[6]

The ILOC intermediate language[7] is used in classes on compiler design as a simple target language.[8]

Other[edit]

Static analysis tools often use an intermediate representation. For instance, Radare2 is a toolbox for binary files analysis and reverse-engineering. It uses the intermediate languages ESIL[9] and REIL[10] to analyze binary files.

See also[edit]

References[edit]

  1. ^ a b Walker, David. "CS320: Compilers: Intermediate Representation" (Lecture slides). Retrieved 12 February 2016.
  • ^ Chow, Fred (22 November 2013). "The Challenge of Cross-language Interoperability". ACM Queue. 11 (10). Retrieved 12 February 2016.
  • ^ Toal, Ray. "Intermediate Representations". Retrieved 12 February 2016.
  • ^ "Bitcode (iOS, watchOS)". Hacker News. 10 June 2015. Retrieved 17 June 2015.
  • ^ "LLVM Bitcode File Format". llvm.org. Retrieved 17 June 2015.
  • ^ "MLIR".
  • ^ "An ILOC Simulator" Archived 2009-05-07 at the Wayback Machine by W. A. Barrett 2007, paraphrasing Keith Cooper and Linda Torczon, "Engineering a Compiler", Morgan Kaufmann, 2004. ISBN 1-55860-698-X.
  • ^ "CISC 471 Compiler Design" by Uli Kremer
  • ^ Radare2 Contributors. "ESIL". Radare2 Project. Archived from the original on 18 August 2015. Retrieved 17 June 2015.
  • ^ Sebastian Porst (7 March 2010). "The REIL language – Part I". zynamics.com. Retrieved 17 June 2015.
  • External links[edit]


    Retrieved from "https://en.wikipedia.org/w/index.php?title=Intermediate_representation&oldid=1221791303#Intermediate_language"

    Categories: 
    Compiler construction
    Programming language classification
    Hidden categories: 
    Webarchive template wayback links
    Articles with short description
    Short description is different from Wikidata
    Use dmy dates from March 2020
     



    This page was last edited on 2 May 2024, at 00:27 (UTC).

    Text is available under the Creative Commons Attribution-ShareAlike License 4.0; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.



    Privacy policy

    About Wikipedia

    Disclaimers

    Contact Wikipedia

    Code of Conduct

    Developers

    Statistics

    Cookie statement

    Mobile view



    Wikimedia Foundation
    Powered by MediaWiki