You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
99 lines
4.2 KiB
HTML
99 lines
4.2 KiB
HTML
<html lang="en">
|
|
<head>
|
|
<title>Overview - GNU Compiler Collection (GCC) Internals</title>
|
|
<meta http-equiv="Content-Type" content="text/html">
|
|
<meta name="description" content="GNU Compiler Collection (GCC) Internals">
|
|
<meta name="generator" content="makeinfo 4.13">
|
|
<link title="Top" rel="start" href="index.html#Top">
|
|
<link rel="up" href="Machine-Desc.html#Machine-Desc" title="Machine Desc">
|
|
<link rel="next" href="Patterns.html#Patterns" title="Patterns">
|
|
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
|
|
<!--
|
|
Copyright (C) 1988-2015 Free Software Foundation, Inc.
|
|
|
|
Permission is granted to copy, distribute and/or modify this document
|
|
under the terms of the GNU Free Documentation License, Version 1.3 or
|
|
any later version published by the Free Software Foundation; with the
|
|
Invariant Sections being ``Funding Free Software'', the Front-Cover
|
|
Texts being (a) (see below), and with the Back-Cover Texts being (b)
|
|
(see below). A copy of the license is included in the section entitled
|
|
``GNU Free Documentation License''.
|
|
|
|
(a) The FSF's Front-Cover Text is:
|
|
|
|
A GNU Manual
|
|
|
|
(b) The FSF's Back-Cover Text is:
|
|
|
|
You have freedom to copy and modify this GNU Manual, like GNU
|
|
software. Copies published by the Free Software Foundation raise
|
|
funds for GNU development.-->
|
|
<meta http-equiv="Content-Style-Type" content="text/css">
|
|
<style type="text/css"><!--
|
|
pre.display { font-family:inherit }
|
|
pre.format { font-family:inherit }
|
|
pre.smalldisplay { font-family:inherit; font-size:smaller }
|
|
pre.smallformat { font-family:inherit; font-size:smaller }
|
|
pre.smallexample { font-size:smaller }
|
|
pre.smalllisp { font-size:smaller }
|
|
span.sc { font-variant:small-caps }
|
|
span.roman { font-family:serif; font-weight:normal; }
|
|
span.sansserif { font-family:sans-serif; font-weight:normal; }
|
|
--></style>
|
|
</head>
|
|
<body>
|
|
<div class="node">
|
|
<a name="Overview"></a>
|
|
<p>
|
|
Next: <a rel="next" accesskey="n" href="Patterns.html#Patterns">Patterns</a>,
|
|
Up: <a rel="up" accesskey="u" href="Machine-Desc.html#Machine-Desc">Machine Desc</a>
|
|
<hr>
|
|
</div>
|
|
|
|
<h3 class="section">16.1 Overview of How the Machine Description is Used</h3>
|
|
|
|
<p>There are three main conversions that happen in the compiler:
|
|
|
|
<ol type=1 start=1>
|
|
|
|
<li>The front end reads the source code and builds a parse tree.
|
|
|
|
<li>The parse tree is used to generate an RTL insn list based on named
|
|
instruction patterns.
|
|
|
|
<li>The insn list is matched against the RTL templates to produce assembler
|
|
code.
|
|
|
|
</ol>
|
|
|
|
<p>For the generate pass, only the names of the insns matter, from either a
|
|
named <code>define_insn</code> or a <code>define_expand</code>. The compiler will
|
|
choose the pattern with the right name and apply the operands according
|
|
to the documentation later in this chapter, without regard for the RTL
|
|
template or operand constraints. Note that the names the compiler looks
|
|
for are hard-coded in the compiler—it will ignore unnamed patterns and
|
|
patterns with names it doesn't know about, but if you don't provide a
|
|
named pattern it needs, it will abort.
|
|
|
|
<p>If a <code>define_insn</code> is used, the template given is inserted into the
|
|
insn list. If a <code>define_expand</code> is used, one of three things
|
|
happens, based on the condition logic. The condition logic may manually
|
|
create new insns for the insn list, say via <code>emit_insn()</code>, and
|
|
invoke <code>DONE</code>. For certain named patterns, it may invoke <code>FAIL</code> to tell the
|
|
compiler to use an alternate way of performing that task. If it invokes
|
|
neither <code>DONE</code> nor <code>FAIL</code>, the template given in the pattern
|
|
is inserted, as if the <code>define_expand</code> were a <code>define_insn</code>.
|
|
|
|
<p>Once the insn list is generated, various optimization passes convert,
|
|
replace, and rearrange the insns in the insn list. This is where the
|
|
<code>define_split</code> and <code>define_peephole</code> patterns get used, for
|
|
example.
|
|
|
|
<p>Finally, the insn list's RTL is matched up with the RTL templates in the
|
|
<code>define_insn</code> patterns, and those patterns are used to emit the
|
|
final assembly code. For this purpose, each named <code>define_insn</code>
|
|
acts like it's unnamed, since the names are ignored.
|
|
|
|
</body></html>
|
|
|