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.
100 lines
4.4 KiB
HTML
100 lines
4.4 KiB
HTML
<html lang="en">
|
|
<head>
|
|
<title>Expression trees - 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="GENERIC.html#GENERIC" title="GENERIC">
|
|
<link rel="prev" href="Attributes.html#Attributes" title="Attributes">
|
|
<link rel="next" href="Statements.html#Statements" title="Statements">
|
|
<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="Expression-trees"></a>
|
|
<p>
|
|
Next: <a rel="next" accesskey="n" href="Statements.html#Statements">Statements</a>,
|
|
Previous: <a rel="previous" accesskey="p" href="Attributes.html#Attributes">Attributes</a>,
|
|
Up: <a rel="up" accesskey="u" href="GENERIC.html#GENERIC">GENERIC</a>
|
|
<hr>
|
|
</div>
|
|
|
|
<h3 class="section">10.6 Expressions</h3>
|
|
|
|
<p><a name="index-expression-1820"></a><a name="index-TREE_005fTYPE-1821"></a><a name="index-TREE_005fOPERAND-1822"></a>
|
|
The internal representation for expressions is for the most part quite
|
|
straightforward. However, there are a few facts that one must bear in
|
|
mind. In particular, the expression “tree” is actually a directed
|
|
acyclic graph. (For example there may be many references to the integer
|
|
constant zero throughout the source program; many of these will be
|
|
represented by the same expression node.) You should not rely on
|
|
certain kinds of node being shared, nor should you rely on certain kinds of
|
|
nodes being unshared.
|
|
|
|
<p>The following macros can be used with all expression nodes:
|
|
|
|
<dl>
|
|
<dt><code>TREE_TYPE</code><a name="index-TREE_005fTYPE-1823"></a><dd>Returns the type of the expression. This value may not be precisely the
|
|
same type that would be given the expression in the original program.
|
|
</dl>
|
|
|
|
<p>In what follows, some nodes that one might expect to always have type
|
|
<code>bool</code> are documented to have either integral or boolean type. At
|
|
some point in the future, the C front end may also make use of this same
|
|
intermediate representation, and at this point these nodes will
|
|
certainly have integral type. The previous sentence is not meant to
|
|
imply that the C++ front end does not or will not give these nodes
|
|
integral type.
|
|
|
|
<p>Below, we list the various kinds of expression nodes. Except where
|
|
noted otherwise, the operands to an expression are accessed using the
|
|
<code>TREE_OPERAND</code> macro. For example, to access the first operand to
|
|
a binary plus expression <code>expr</code>, use:
|
|
|
|
<pre class="smallexample"> TREE_OPERAND (expr, 0)
|
|
</pre>
|
|
<p class="noindent">As this example indicates, the operands are zero-indexed.
|
|
|
|
<ul class="menu">
|
|
<li><a accesskey="1" href="Constant-expressions.html#Constant-expressions">Constants</a>
|
|
<li><a accesskey="2" href="Storage-References.html#Storage-References">Storage References</a>
|
|
<li><a accesskey="3" href="Unary-and-Binary-Expressions.html#Unary-and-Binary-Expressions">Unary and Binary Expressions</a>
|
|
<li><a accesskey="4" href="Vectors.html#Vectors">Vectors</a>
|
|
</ul>
|
|
|
|
</body></html>
|
|
|