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
Code generation (compiler)
(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|Converting computer code into a machine readable form}} {{Refimprove|Code generation intro|date=November 2006}} {{distinguish|text = Code generation in the context of [[Vibe coding]]}} In [[computing]], '''code generation''' is part of the process chain of a [[compiler]], in which an [[intermediate representation]] of [[source code]] is converted into a form (e.g., [[machine code]]) that can be readily executed by the target system. Sophisticated compilers typically perform [[multipass compiler|multiple passes]] over various intermediate forms. This multi-stage process is used because many [[algorithm]]s for [[code optimization]] are easier to apply one at a time, or because the input to one optimization relies on the completed processing performed by another optimization. This organization also facilitates the creation of a single compiler that can target multiple architectures, as only the last of the code generation stages (the ''backend'') needs to change from target to target. (For more information on compiler design, see [[Compiler]].) The input to the code generator typically consists of a [[parse tree]] or an [[abstract syntax tree]].<ref name="MuchnickAssociates1997">{{cite book|author1=Steven Muchnick|author2=Muchnick and Associates|title=Advanced Compiler Design Implementation|url=https://archive.org/details/advancedcompiler00much|url-access=registration|quote=code generation.|date=15 August 1997|publisher=Morgan Kaufmann|isbn=978-1-55860-320-2}}</ref> The tree is converted into a linear sequence of instructions, usually in an [[intermediate language]] such as [[three-address code]]. Further stages of compilation may or may not be referred to as "code generation", depending on whether they involve a significant change in the representation of the program. (For example, a [[peephole optimization]] pass would not likely be called "code generation", although a code generator might incorporate a peephole optimization pass.)
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)