Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Intermediate representation
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Data structure or code used internally by a compiler or virtual machine to represent source code}} {{redirect|Intermediate form|the use of the term in biology|Transitional fossil}} {{Use dmy dates|date=March 2020}} {{Program execution}} An '''intermediate representation''' ('''IR''') is the [[data structure]] or code used internally by a [[compiler]] or [[virtual machine]] to represent [[source code]]. An IR is designed to be conducive to further processing, such as [[Compiler optimization|optimization]] and [[Program transformation|translation]].<ref name=Walker>{{Cite web| last = Walker| first = David| title = CS320: Compilers: Intermediate Representation | format = Lecture slides | access-date = 2016-02-12 | url = http://www.cs.princeton.edu/courses/archive/spr03/cs320/notes/IR-trans1.pdf}}</ref> A "good" IR must be ''accurate'' β capable of representing the source code without loss of information<ref name=Chow>{{Cite journal| volume = 11| issue = 10| last = Chow| first = Fred| title = The Challenge of Cross-language Interoperability| journal = ACM Queue| access-date = 2016-02-12| date = 2013-11-22| url = https://queue.acm.org/detail.cfm?id=2544374}}</ref> β and ''independent'' of any particular source or target language.<ref name=Walker /> An IR may take one of several forms: an in-memory [[data structure]], or a special [[tuple]]- or [[Stack (abstract data type)|stack]]-based [[bytecode|code]] readable by the program.<ref name=Toal>{{Cite web| last = Toal| first = Ray| title = Intermediate Representations| access-date = 2016-02-12| url = http://cs.lmu.edu/~ray/notes/ir/}}</ref> In the latter case it is also called an ''intermediate language''. A canonical example is found in most modern compilers. For example, the [[CPython|CPython interpreter]] transforms the linear human-readable text representing a program into an intermediate [[graph (data structure)|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 [[Code generation (compiler)|generate code]] for many different target [[Instruction set|architectures]].
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)