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.
126 lines
6.4 KiB
HTML
126 lines
6.4 KiB
HTML
<html lang="en">
|
|
<head>
|
|
<title>Sharing - 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="RTL.html#RTL" title="RTL">
|
|
<link rel="prev" href="Calls.html#Calls" title="Calls">
|
|
<link rel="next" href="Reading-RTL.html#Reading-RTL" title="Reading RTL">
|
|
<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="Sharing"></a>
|
|
<p>
|
|
Next: <a rel="next" accesskey="n" href="Reading-RTL.html#Reading-RTL">Reading RTL</a>,
|
|
Previous: <a rel="previous" accesskey="p" href="Calls.html#Calls">Calls</a>,
|
|
Up: <a rel="up" accesskey="u" href="RTL.html#RTL">RTL</a>
|
|
<hr>
|
|
</div>
|
|
|
|
<h3 class="section">13.21 Structure Sharing Assumptions</h3>
|
|
|
|
<p><a name="index-sharing-of-RTL-components-3136"></a><a name="index-RTL-structure-sharing-assumptions-3137"></a>
|
|
The compiler assumes that certain kinds of RTL expressions are unique;
|
|
there do not exist two distinct objects representing the same value.
|
|
In other cases, it makes an opposite assumption: that no RTL expression
|
|
object of a certain kind appears in more than one place in the
|
|
containing structure.
|
|
|
|
<p>These assumptions refer to a single function; except for the RTL
|
|
objects that describe global variables and external functions,
|
|
and a few standard objects such as small integer constants,
|
|
no RTL objects are common to two functions.
|
|
|
|
|
|
<a name="index-g_t_0040code_007breg_007d_002c-RTL-sharing-3138"></a>
|
|
<ul><li>Each pseudo-register has only a single <code>reg</code> object to represent it,
|
|
and therefore only a single machine mode.
|
|
|
|
<p><a name="index-symbolic-label-3139"></a><a name="index-g_t_0040code_007bsymbol_005fref_007d_002c-RTL-sharing-3140"></a><li>For any symbolic label, there is only one <code>symbol_ref</code> object
|
|
referring to it.
|
|
|
|
<p><a name="index-g_t_0040code_007bconst_005fint_007d_002c-RTL-sharing-3141"></a><li>All <code>const_int</code> expressions with equal values are shared.
|
|
|
|
<p><a name="index-g_t_0040code_007bpc_007d_002c-RTL-sharing-3142"></a><li>There is only one <code>pc</code> expression.
|
|
|
|
<p><a name="index-g_t_0040code_007bcc0_007d_002c-RTL-sharing-3143"></a><li>There is only one <code>cc0</code> expression.
|
|
|
|
<p><a name="index-g_t_0040code_007bconst_005fdouble_007d_002c-RTL-sharing-3144"></a><li>There is only one <code>const_double</code> expression with value 0 for
|
|
each floating point mode. Likewise for values 1 and 2.
|
|
|
|
<p><a name="index-g_t_0040code_007bconst_005fvector_007d_002c-RTL-sharing-3145"></a><li>There is only one <code>const_vector</code> expression with value 0 for
|
|
each vector mode, be it an integer or a double constant vector.
|
|
|
|
<p><a name="index-g_t_0040code_007blabel_005fref_007d_002c-RTL-sharing-3146"></a><a name="index-g_t_0040code_007bscratch_007d_002c-RTL-sharing-3147"></a><li>No <code>label_ref</code> or <code>scratch</code> appears in more than one place in
|
|
the RTL structure; in other words, it is safe to do a tree-walk of all
|
|
the insns in the function and assume that each time a <code>label_ref</code>
|
|
or <code>scratch</code> is seen it is distinct from all others that are seen.
|
|
|
|
<p><a name="index-g_t_0040code_007bmem_007d_002c-RTL-sharing-3148"></a><li>Only one <code>mem</code> object is normally created for each static
|
|
variable or stack slot, so these objects are frequently shared in all
|
|
the places they appear. However, separate but equal objects for these
|
|
variables are occasionally made.
|
|
|
|
<p><a name="index-g_t_0040code_007basm_005foperands_007d_002c-RTL-sharing-3149"></a><li>When a single <code>asm</code> statement has multiple output operands, a
|
|
distinct <code>asm_operands</code> expression is made for each output operand.
|
|
However, these all share the vector which contains the sequence of input
|
|
operands. This sharing is used later on to test whether two
|
|
<code>asm_operands</code> expressions come from the same statement, so all
|
|
optimizations must carefully preserve the sharing if they copy the
|
|
vector at all.
|
|
|
|
<li>No RTL object appears in more than one place in the RTL structure
|
|
except as described above. Many passes of the compiler rely on this
|
|
by assuming that they can modify RTL objects in place without unwanted
|
|
side-effects on other insns.
|
|
|
|
<p><a name="index-unshare_005fall_005frtl-3150"></a><li>During initial RTL generation, shared structure is freely introduced.
|
|
After all the RTL for a function has been generated, all shared
|
|
structure is copied by <code>unshare_all_rtl</code> in <samp><span class="file">emit-rtl.c</span></samp>,
|
|
after which the above rules are guaranteed to be followed.
|
|
|
|
<p><a name="index-copy_005frtx_005fif_005fshared-3151"></a><li>During the combiner pass, shared structure within an insn can exist
|
|
temporarily. However, the shared structure is copied before the
|
|
combiner is finished with the insn. This is done by calling
|
|
<code>copy_rtx_if_shared</code>, which is a subroutine of
|
|
<code>unshare_all_rtl</code>.
|
|
</ul>
|
|
|
|
</body></html>
|
|
|