<html lang="en"> <head> <title>GIMPLE sequences - 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="GIMPLE.html#GIMPLE" title="GIMPLE"> <link rel="prev" href="Tuple-specific-accessors.html#Tuple-specific-accessors" title="Tuple specific accessors"> <link rel="next" href="Sequence-iterators.html#Sequence-iterators" title="Sequence iterators"> <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="GIMPLE-sequences"></a> <p> Next: <a rel="next" accesskey="n" href="Sequence-iterators.html#Sequence-iterators">Sequence iterators</a>, Previous: <a rel="previous" accesskey="p" href="Tuple-specific-accessors.html#Tuple-specific-accessors">Tuple specific accessors</a>, Up: <a rel="up" accesskey="u" href="GIMPLE.html#GIMPLE">GIMPLE</a> <hr> </div> <h3 class="section">11.9 GIMPLE sequences</h3> <p><a name="index-GIMPLE-sequences-2449"></a> GIMPLE sequences are the tuple equivalent of <code>STATEMENT_LIST</code>'s used in <code>GENERIC</code>. They are used to chain statements together, and when used in conjunction with sequence iterators, provide a framework for iterating through statements. <p>GIMPLE sequences are of type struct <code>gimple_sequence</code>, but are more commonly passed by reference to functions dealing with sequences. The type for a sequence pointer is <code>gimple_seq</code> which is the same as struct <code>gimple_sequence</code> *. When declaring a local sequence, you can define a local variable of type struct <code>gimple_sequence</code>. When declaring a sequence allocated on the garbage collected heap, use the function <code>gimple_seq_alloc</code> documented below. <p>There are convenience functions for iterating through sequences in the section entitled Sequence Iterators. <p>Below is a list of functions to manipulate and query sequences. <div class="defun"> — GIMPLE function: void <b>gimple_seq_add_stmt</b> (<var>gimple_seq *seq, gimple g</var>)<var><a name="index-gimple_005fseq_005fadd_005fstmt-2450"></a></var><br> <blockquote><p>Link a gimple statement to the end of the sequence *<code>SEQ</code> if <code>G</code> is not <code>NULL</code>. If *<code>SEQ</code> is <code>NULL</code>, allocate a sequence before linking. </p></blockquote></div> <div class="defun"> — GIMPLE function: void <b>gimple_seq_add_seq</b> (<var>gimple_seq *dest, gimple_seq src</var>)<var><a name="index-gimple_005fseq_005fadd_005fseq-2451"></a></var><br> <blockquote><p>Append sequence <code>SRC</code> to the end of sequence *<code>DEST</code> if <code>SRC</code> is not <code>NULL</code>. If *<code>DEST</code> is <code>NULL</code>, allocate a new sequence before appending. </p></blockquote></div> <div class="defun"> — GIMPLE function: gimple_seq <b>gimple_seq_deep_copy</b> (<var>gimple_seq src</var>)<var><a name="index-gimple_005fseq_005fdeep_005fcopy-2452"></a></var><br> <blockquote><p>Perform a deep copy of sequence <code>SRC</code> and return the result. </p></blockquote></div> <div class="defun"> — GIMPLE function: gimple_seq <b>gimple_seq_reverse</b> (<var>gimple_seq seq</var>)<var><a name="index-gimple_005fseq_005freverse-2453"></a></var><br> <blockquote><p>Reverse the order of the statements in the sequence <code>SEQ</code>. Return <code>SEQ</code>. </p></blockquote></div> <div class="defun"> — GIMPLE function: gimple <b>gimple_seq_first</b> (<var>gimple_seq s</var>)<var><a name="index-gimple_005fseq_005ffirst-2454"></a></var><br> <blockquote><p>Return the first statement in sequence <code>S</code>. </p></blockquote></div> <div class="defun"> — GIMPLE function: gimple <b>gimple_seq_last</b> (<var>gimple_seq s</var>)<var><a name="index-gimple_005fseq_005flast-2455"></a></var><br> <blockquote><p>Return the last statement in sequence <code>S</code>. </p></blockquote></div> <div class="defun"> — GIMPLE function: void <b>gimple_seq_set_last</b> (<var>gimple_seq s, gimple last</var>)<var><a name="index-gimple_005fseq_005fset_005flast-2456"></a></var><br> <blockquote><p>Set the last statement in sequence <code>S</code> to the statement in <code>LAST</code>. </p></blockquote></div> <div class="defun"> — GIMPLE function: void <b>gimple_seq_set_first</b> (<var>gimple_seq s, gimple first</var>)<var><a name="index-gimple_005fseq_005fset_005ffirst-2457"></a></var><br> <blockquote><p>Set the first statement in sequence <code>S</code> to the statement in <code>FIRST</code>. </p></blockquote></div> <div class="defun"> — GIMPLE function: void <b>gimple_seq_init</b> (<var>gimple_seq s</var>)<var><a name="index-gimple_005fseq_005finit-2458"></a></var><br> <blockquote><p>Initialize sequence <code>S</code> to an empty sequence. </p></blockquote></div> <div class="defun"> — GIMPLE function: gimple_seq <b>gimple_seq_alloc</b> (<var>void</var>)<var><a name="index-gimple_005fseq_005falloc-2459"></a></var><br> <blockquote><p>Allocate a new sequence in the garbage collected store and return it. </p></blockquote></div> <div class="defun"> — GIMPLE function: void <b>gimple_seq_copy</b> (<var>gimple_seq dest, gimple_seq src</var>)<var><a name="index-gimple_005fseq_005fcopy-2460"></a></var><br> <blockquote><p>Copy the sequence <code>SRC</code> into the sequence <code>DEST</code>. </p></blockquote></div> <div class="defun"> — GIMPLE function: bool <b>gimple_seq_empty_p</b> (<var>gimple_seq s</var>)<var><a name="index-gimple_005fseq_005fempty_005fp-2461"></a></var><br> <blockquote><p>Return true if the sequence <code>S</code> is empty. </p></blockquote></div> <div class="defun"> — GIMPLE function: gimple_seq <b>bb_seq</b> (<var>basic_block bb</var>)<var><a name="index-bb_005fseq-2462"></a></var><br> <blockquote><p>Returns the sequence of statements in <code>BB</code>. </p></blockquote></div> <div class="defun"> — GIMPLE function: void <b>set_bb_seq</b> (<var>basic_block bb, gimple_seq seq</var>)<var><a name="index-set_005fbb_005fseq-2463"></a></var><br> <blockquote><p>Sets the sequence of statements in <code>BB</code> to <code>SEQ</code>. </p></blockquote></div> <div class="defun"> — GIMPLE function: bool <b>gimple_seq_singleton_p</b> (<var>gimple_seq seq</var>)<var><a name="index-gimple_005fseq_005fsingleton_005fp-2464"></a></var><br> <blockquote><p>Determine whether <code>SEQ</code> contains exactly one statement. </p></blockquote></div> </body></html>