GCC Middle and Back End API Reference
immediate_use_iterator_d Struct Reference

#include <ssa-iterators.h>

Collaboration diagram for immediate_use_iterator_d:

Data Fields

ssa_use_operand_timm_use
ssa_use_operand_tend_p
ssa_use_operand_t iter_node
ssa_use_operand_tnext_imm_name

Detailed Description

Header file for SSA iterators. Copyright (C) 2013 Free Software Foundation, Inc.

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/. Immediate use lists are used to directly access all uses for an SSA name and get pointers to the statement for each use.

The structure ssa_use_operand_d consists of PREV and NEXT pointers to maintain the list. A USE pointer, which points to address where the use is located and a LOC pointer which can point to the statement where the use is located, or, in the case of the root node, it points to the SSA name itself.

The list is anchored by an occurrence of ssa_operand_d in the ssa_name node itself (named 'imm_uses'). This node is uniquely identified by having a NULL USE pointer. and the LOC pointer pointing back to the ssa_name node itself. This node forms the base for a circular list, and initially this is the only node in the list.

Fast iteration allows each use to be examined, but does not allow any modifications to the uses or stmts.

Normal iteration allows insertion, deletion, and modification. the iterator manages this by inserting a marker node into the list immediately before the node currently being examined in the list. this marker node is uniquely identified by having null stmt and a null use pointer.

When iterating to the next use, the iteration routines check to see if the node after the marker has changed. if it has, then the node following the marker is now the next one to be visited. if not, the marker node is moved past that node in the list (visualize it as bumping the marker node through the list). this continues until the marker node is moved to the original anchor position. the marker node is then removed from the list.

If iteration is halted early, the marker node must be removed from the list before continuing.


Field Documentation

ssa_use_operand_t* immediate_use_iterator_d::end_p

This marks the last use in the list (use node from SSA_NAME)

Referenced by end_imm_use_stmt_traverse(), relink_imm_use(), and single_phi_def().

ssa_use_operand_t* immediate_use_iterator_d::imm_use

This is the current use the iterator is processing.

Referenced by end_imm_use_stmt_traverse(), link_use_stmts_after(), relink_imm_use(), relink_imm_use_stmt(), and single_phi_def().

ssa_use_operand_t immediate_use_iterator_d::iter_node

This node is inserted and used to mark the end of the uses for a stmt.

Referenced by end_imm_use_stmt_traverse(), op_iter_init_phiuse(), and relink_imm_use_stmt().

ssa_use_operand_t* immediate_use_iterator_d::next_imm_name

This is the next ssa_name to visit. IMM_USE may get removed before the next one is traversed to, so it must be cached early.

Referenced by end_imm_use_stmt_traverse(), and link_use_stmts_after().


The documentation for this struct was generated from the following file: