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.

122 lines
6.3 KiB
HTML

<html lang="en">
<head>
<title>Storage References - 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="Expression-trees.html#Expression-trees" title="Expression trees">
<link rel="prev" href="Constant-expressions.html#Constant-expressions" title="Constant expressions">
<link rel="next" href="Unary-and-Binary-Expressions.html#Unary-and-Binary-Expressions" title="Unary and Binary Expressions">
<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="Storage-References"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="Unary-and-Binary-Expressions.html#Unary-and-Binary-Expressions">Unary and Binary Expressions</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Constant-expressions.html#Constant-expressions">Constant expressions</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Expression-trees.html#Expression-trees">Expression trees</a>
<hr>
</div>
<h4 class="subsection">10.6.2 References to storage</h4>
<p><a name="index-ADDR_005fEXPR-1841"></a><a name="index-INDIRECT_005fREF-1842"></a><a name="index-MEM_005fREF-1843"></a><a name="index-ARRAY_005fREF-1844"></a><a name="index-ARRAY_005fRANGE_005fREF-1845"></a><a name="index-TARGET_005fMEM_005fREF-1846"></a><a name="index-COMPONENT_005fREF-1847"></a>
<dl>
<dt><code>ARRAY_REF</code><dd>These nodes represent array accesses. The first operand is the array;
the second is the index. To calculate the address of the memory
accessed, you must scale the index by the size of the type of the array
elements. The type of these expressions must be the type of a component of
the array. The third and fourth operands are used after gimplification
to represent the lower bound and component size but should not be used
directly; call <code>array_ref_low_bound</code> and <code>array_ref_element_size</code>
instead.
<br><dt><code>ARRAY_RANGE_REF</code><dd>These nodes represent access to a range (or &ldquo;slice&rdquo;) of an array. The
operands are the same as that for <code>ARRAY_REF</code> and have the same
meanings. The type of these expressions must be an array whose component
type is the same as that of the first operand. The range of that array
type determines the amount of data these expressions access.
<br><dt><code>TARGET_MEM_REF</code><dd>These nodes represent memory accesses whose address directly map to
an addressing mode of the target architecture. The first argument
is <code>TMR_SYMBOL</code> and must be a <code>VAR_DECL</code> of an object with
a fixed address. The second argument is <code>TMR_BASE</code> and the
third one is <code>TMR_INDEX</code>. The fourth argument is
<code>TMR_STEP</code> and must be an <code>INTEGER_CST</code>. The fifth
argument is <code>TMR_OFFSET</code> and must be an <code>INTEGER_CST</code>.
Any of the arguments may be NULL if the appropriate component
does not appear in the address. Address of the <code>TARGET_MEM_REF</code>
is determined in the following way.
<pre class="smallexample"> &amp;TMR_SYMBOL + TMR_BASE + TMR_INDEX * TMR_STEP + TMR_OFFSET
</pre>
<p>The sixth argument is the reference to the original memory access, which
is preserved for the purposes of the RTL alias analysis. The seventh
argument is a tag representing the results of tree level alias analysis.
<br><dt><code>ADDR_EXPR</code><dd>These nodes are used to represent the address of an object. (These
expressions will always have pointer or reference type.) The operand may
be another expression, or it may be a declaration.
<p>As an extension, GCC allows users to take the address of a label. In
this case, the operand of the <code>ADDR_EXPR</code> will be a
<code>LABEL_DECL</code>. The type of such an expression is <code>void*</code>.
<p>If the object addressed is not an lvalue, a temporary is created, and
the address of the temporary is used.
<br><dt><code>INDIRECT_REF</code><dd>These nodes are used to represent the object pointed to by a pointer.
The operand is the pointer being dereferenced; it will always have
pointer or reference type.
<br><dt><code>MEM_REF</code><dd>These nodes are used to represent the object pointed to by a pointer
offset by a constant.
The first operand is the pointer being dereferenced; it will always have
pointer or reference type. The second operand is a pointer constant.
Its type is specifying the type to be used for type-based alias analysis.
<br><dt><code>COMPONENT_REF</code><dd>These nodes represent non-static data member accesses. The first
operand is the object (rather than a pointer to it); the second operand
is the <code>FIELD_DECL</code> for the data member. The third operand represents
the byte offset of the field, but should not be used directly; call
<code>component_ref_field_offset</code> instead.
</dl>
</body></html>