GCC Middle and Back End API Reference
tree-iterator.cc File Reference
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "tree.h"
#include "tree-iterator.h"
#include "gt-tree-iterator.h"
Include dependency graph for tree-iterator.cc:

Functions

tree alloc_stmt_list (void)
void free_stmt_list (tree t)
static void append_to_statement_list_1 (tree t, tree *list_p)
void append_to_statement_list (tree t, tree *list_p)
void append_to_statement_list_force (tree t, tree *list_p)
void tsi_link_before (tree_stmt_iterator *i, tree t, enum tsi_iterator_update mode)
void tsi_link_after (tree_stmt_iterator *i, tree t, enum tsi_iterator_update mode)
void tsi_delink (tree_stmt_iterator *i)
tree tsi_split_stmt_list (location_t loc, tree_stmt_iterator i)
tree expr_first (tree expr)
tree expr_last (tree expr)
tree expr_single (tree expr)

Variables

static vec< tree, va_gc > * stmt_list_cache

Function Documentation

◆ alloc_stmt_list()

◆ append_to_statement_list()

◆ append_to_statement_list_1()

void append_to_statement_list_1 ( tree t,
tree * list_p )
static
A subroutine of append_to_statement_list{,_force}. T is not NULL.

References alloc_stmt_list(), i, TREE_CODE, TSI_CONTINUE_LINKING, tsi_last(), and tsi_link_after().

Referenced by append_to_statement_list(), and append_to_statement_list_force().

◆ append_to_statement_list_force()

void append_to_statement_list_force ( tree t,
tree * list_p )
Similar, but the statement is always added, regardless of side effects.

References append_to_statement_list_1(), and NULL_TREE.

Referenced by gimplify_omp_affinity(), gimplify_omp_depend(), gimplify_omp_for(), and tsi_split_stmt_list().

◆ expr_first()

tree expr_first ( tree expr)
Return the first expression in a sequence of COMPOUND_EXPRs, or in a STATEMENT_LIST, disregarding DEBUG_BEGIN_STMTs, recursing into a STATEMENT_LIST if that's the first non-DEBUG_BEGIN_STMT.

References expr_first(), NULL_TREE, STATEMENT_LIST_HEAD, TREE_CODE, and TREE_OPERAND.

Referenced by expr_first().

◆ expr_last()

tree expr_last ( tree expr)
Return the last expression in a sequence of COMPOUND_EXPRs, or in a STATEMENT_LIST, disregarding DEBUG_BEGIN_STMTs, recursing into a STATEMENT_LIST if that's the last non-DEBUG_BEGIN_STMT.

References expr_last(), NULL_TREE, STATEMENT_LIST_TAIL, TREE_CODE, and TREE_OPERAND.

Referenced by block_may_fallthru(), expr_last(), shortcut_cond_expr(), and tree_invalid_nonnegative_warnv_p().

◆ expr_single()

tree expr_single ( tree expr)
If EXPR is a STATEMENT_LIST containing just DEBUG_BEGIN_STMTs and a single other stmt, return that other stmt (recursively). If it is a STATEMENT_LIST containing no non-DEBUG_BEGIN_STMTs or multiple, return NULL_TREE. Otherwise return EXPR.

References expr_single(), NULL_TREE, STATEMENT_LIST_HEAD, and TREE_CODE.

Referenced by expr_single(), protected_set_expr_location(), and protected_set_expr_location_if_unset().

◆ free_stmt_list()

◆ tsi_delink()

void tsi_delink ( tree_stmt_iterator * i)
Remove a stmt from the tree list. The iterator is updated to point to the next stmt.

References i, STATEMENT_LIST_HEAD, STATEMENT_LIST_TAIL, and TREE_SIDE_EFFECTS.

Referenced by gimplify_statement_list(), and tsi_split_stmt_list().

◆ tsi_link_after()

◆ tsi_link_before()

void tsi_link_before ( tree_stmt_iterator * i,
tree t,
enum tsi_iterator_update mode )

◆ tsi_split_stmt_list()

tree tsi_split_stmt_list ( location_t loc,
tree_stmt_iterator i )
Split a STATEMENT_LIST in I.contrainer into two, all statements from the start until I.ptr inclusive will remain in the original one, all statements after I.ptr are removed from that STATEMENT_LIST and returned as a new STATEMENT_LIST. If I is the last statement, an empty statement with LOC location is returned.

References append_to_statement_list_force(), build_empty_stmt(), i, NULL_TREE, tsi_delink(), tsi_end_p(), tsi_next(), tsi_one_before_end_p(), and tsi_stmt().

Variable Documentation

◆ stmt_list_cache

vec<tree, va_gc>* stmt_list_cache
static
Iterator routines for manipulating GENERIC and GIMPLE tree statements. Copyright (C) 2003-2025 Free Software Foundation, Inc. Contributed by Andrew MacLeod <amacleod@redhat.com> This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>.
This is a cache of STATEMENT_LIST nodes. We create and destroy them fairly often during gimplification.

Referenced by alloc_stmt_list(), and free_stmt_list().