GCC Middle and Back End API Reference
tree-into-ssa.h File Reference

Go to the source code of this file.


tree get_current_def (tree)
void set_current_def (tree, tree)
void delete_update_ssa (void)
tree create_new_def_for (tree, gimple *, def_operand_p)
void mark_virtual_operands_for_renaming (struct function *)
void mark_virtual_operand_for_renaming (tree)
void mark_virtual_phi_result_for_renaming (gphi *)
bool need_ssa_update_p (struct function *)
bool name_registered_for_update_p (tree)
void release_ssa_name_after_update_ssa (tree)
void update_ssa (unsigned)
void debug_decl_set (bitmap set)
void dump_defs_stack (FILE *, int)
void debug_defs_stack (int)
void dump_currdefs (FILE *)
void debug_currdefs (void)
void dump_tree_ssa (FILE *)
void debug_tree_ssa (void)
void dump_tree_ssa_stats (FILE *)
void debug_tree_ssa_stats (void)
void dump_var_infos (FILE *)
void debug_var_infos (void)
void dump_names_replaced_by (FILE *, tree)
void debug_names_replaced_by (tree)
void dump_update_ssa (FILE *)
void debug_update_ssa (void)


bitmap names_to_release

Function Documentation

◆ create_new_def_for()

tree create_new_def_for ( tree old_name,
gimple * stmt,
def_operand_p def )
Create a new name for OLD_NAME in statement STMT and replace the
operand pointed to by DEF_P with the newly created name.  If DEF_P
is NULL then STMT should be a GIMPLE assignment.
Return the new name and register the replacement mapping <NEW, OLD> in
update_ssa's tables.   

References add_new_name_mapping(), bb_has_abnormal_pred(), cfun, common_info::current_def, duplicate_ssa_name(), gcc_assert, get_ssa_name_ann(), gimple_assign_set_lhs(), gimple_bb(), ssa_name_info::info, init_update_ssa(), SET_DEF, SSA_NAME_OCCURS_IN_ABNORMAL_PHI, timevar_pop(), timevar_push(), and update_ssa_initialized_fn.

Referenced by add_exit_phi(), gimple_duplicate_bb(), sese_add_exit_phis_edge(), worker_single_copy(), and worker_single_simple().

◆ debug_currdefs()

void debug_currdefs ( void )
Dump the current reaching definition of every symbol to stderr.   

References dump_currdefs().

◆ debug_decl_set()

void debug_decl_set ( bitmap set)
Prototypes for debugging functions.   
Dump bitmap SET (assumed to contain VAR_DECLs) to FILE.   

References dump_decl_set().

◆ debug_defs_stack()

void debug_defs_stack ( int n)
Dump the renaming stack (block_defs_stack) to stderr.  Traverse the
stack up to a maximum of N levels.  If N is -1, the whole stack is
dumped.  New levels are created when the dominator tree traversal
used for renaming enters a new sub-tree.   

References dump_defs_stack().

◆ debug_names_replaced_by()

void debug_names_replaced_by ( tree name)
Dump all the names replaced by NAME to stderr.   

References dump_names_replaced_by().

◆ debug_tree_ssa()

void debug_tree_ssa ( void )
Dump SSA information to stderr.   

References dump_tree_ssa().

◆ debug_tree_ssa_stats()

void debug_tree_ssa_stats ( void )
Dump SSA statistics on stderr.   

References dump_tree_ssa_stats().

◆ debug_update_ssa()

void debug_update_ssa ( void )
Dump SSA update information to stderr.   

References dump_update_ssa().

◆ debug_var_infos()

void debug_var_infos ( void )
Dump the VAR_INFOS hash table on stderr.   

References dump_var_infos().

◆ delete_update_ssa()

◆ dump_currdefs()

void dump_currdefs ( FILE * file)
Dump the current reaching definition of every symbol to FILE.   

References common_info::current_def, get_common_info(), print_generic_expr(), and symbols_to_rename.

Referenced by debug_currdefs(), and dump_tree_ssa().

◆ dump_defs_stack()

void dump_defs_stack ( FILE * file,
int n )
Dump the renaming stack (block_defs_stack) to FILE.  Traverse the
stack up to a maximum of N levels.  If N is -1, the whole stack is
dumped.  New levels are created when the dominator tree traversal
used for renaming enters a new sub-tree.   

References block_defs_stack, DECL_P, i, is_gimple_reg(), NULL_TREE, print_generic_expr(), and SSA_NAME_VAR.

Referenced by debug_defs_stack(), and dump_tree_ssa().

◆ dump_names_replaced_by()

void dump_names_replaced_by ( FILE * file,
tree name )
Dump all the names replaced by NAME to FILE.   

References EXECUTE_IF_SET_IN_BITMAP, i, names_replaced_by(), print_generic_expr(), and ssa_name.

Referenced by debug_names_replaced_by(), and dump_update_ssa().

◆ dump_tree_ssa()

void dump_tree_ssa ( FILE * file)

◆ dump_tree_ssa_stats()

void dump_tree_ssa_stats ( FILE * file)
Dump SSA statistics on FILE.   

References htab_statistics(), and var_infos.

Referenced by debug_tree_ssa_stats(), dump_tree_ssa(), and rewrite_blocks().

◆ dump_update_ssa()

void dump_update_ssa ( FILE * file)

◆ dump_var_infos()

void dump_var_infos ( FILE * file)
Dump the VAR_INFOS hash table on FILE.   

References debug_var_infos_r(), and var_infos.

Referenced by debug_var_infos(), and dump_tree_ssa().

◆ get_current_def()

tree get_current_def ( tree var)
Header file for normal form into SSA.
   Copyright (C) 2013-2024 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

GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
 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
Return the current definition for VAR.   

References common_info::current_def, and get_common_info().

Referenced by copy_loop_before(), maybe_add_asan_poison_write(), rename_use_op(), and vect_loop_versioning().

◆ mark_virtual_operand_for_renaming()

void mark_virtual_operand_for_renaming ( tree name)
Replace all uses of NAME by underlying variable and mark it
for renaming.  This assumes the defining statement of NAME is
going to be removed.   

References cfun, FOR_EACH_IMM_USE_ON_STMT, FOR_EACH_IMM_USE_STMT, gcc_assert, mark_virtual_operands_for_renaming(), SET_USE, SSA_NAME_VAR, and VAR_DECL_IS_VIRTUAL_OPERAND.

Referenced by destroy_loop(), mark_virtual_phi_result_for_renaming(), release_last_vdef(), and sink_clobbers().

◆ mark_virtual_operands_for_renaming()

void mark_virtual_operands_for_renaming ( struct function * fn)

◆ mark_virtual_phi_result_for_renaming()

void mark_virtual_phi_result_for_renaming ( gphi * phi)
Replace all uses of the virtual PHI result by its underlying variable
and mark it for renaming.  This assumes the PHI node is going to be

References dump_file, dump_flags, gimple_phi_result(), mark_virtual_operand_for_renaming(), print_gimple_stmt(), TDF_DETAILS, and TDF_SLIM.

Referenced by destroy_loop(), eliminate_unnecessary_stmts(), release_last_vdef(), and split_function().

◆ name_registered_for_update_p()

◆ need_ssa_update_p()

◆ release_ssa_name_after_update_ssa()

void release_ssa_name_after_update_ssa ( tree name)
Mark NAME to be released after update_ssa has finished.   

References BITMAP_ALLOC, bitmap_set_bit, cfun, gcc_assert, names_to_release, NULL, SSA_NAME_VERSION, and update_ssa_initialized_fn.

Referenced by release_ssa_name_fn().

◆ set_current_def()

void set_current_def ( tree var,
tree def )
Sets current definition of VAR to DEF.   

References common_info::current_def, and get_common_info().

◆ update_ssa()

void update_ssa ( unsigned update_flags)
Given a set of newly created SSA names (NEW_SSA_NAMES) and a set of
existing SSA names (OLD_SSA_NAMES), update the SSA form so that:

1- The names in OLD_SSA_NAMES dominated by the definitions of
   NEW_SSA_NAMES are all re-written to be reached by the
   appropriate definition from NEW_SSA_NAMES.

2- If needed, new PHI nodes are added to the iterated dominance
   frontier of the blocks where each of NEW_SSA_NAMES are defined.

The mapping between OLD_SSA_NAMES and NEW_SSA_NAMES is setup by
calling create_new_def_for to create new defs for names that the
caller wants to replace.

The caller cretaes the new names to be inserted and the names that need
to be replaced by calling create_new_def_for for each old definition
to be replaced.  Note that the function assumes that the
new defining statement has already been inserted in the IL.

For instance, given the following code:

  1     L0:
  2     x_1 = PHI (0, x_5)
  3     if (x_1 < 10)
  4       if (x_1 > 7)
  5         y_2 = 0
  6       else
  7         y_3 = x_1 + x_7
  8       endif
  9       x_5 = x_1 + 1
  10   goto L0;
  11    endif

Suppose that we insert new names x_10 and x_11 (lines 4 and 8).

  1     L0:
  2     x_1 = PHI (0, x_5)
  3     if (x_1 < 10)
  4       x_10 = ...
  5       if (x_1 > 7)
  6         y_2 = 0
  7       else
  8         x_11 = ...
  9         y_3 = x_1 + x_7
  10      endif
  11      x_5 = x_1 + 1
  12      goto L0;
  13    endif

We want to replace all the uses of x_1 with the new definitions of
x_10 and x_11.  Note that the only uses that should be replaced are
those at lines 5, 9 and 11.  Also, the use of x_7 at line 9 should
*not* be replaced (this is why we cannot just mark symbol 'x' for

Additionally, we may need to insert a PHI node at line 11 because
that is a merge point for x_10 and x_11.  So the use of x_1 at line
11 will be replaced with the new PHI node.  The insertion of PHI
nodes is optional.  They are not strictly necessary to preserve the
SSA form, and depending on what the caller inserted, they may not
even be useful for the optimizers.  UPDATE_FLAGS controls various
aspects of how update_ssa operates, see the documentation for

References BITMAP_ALLOC, bitmap_clear(), bitmap_default_obstack, bitmap_empty_p(), bitmap_initialize(), bitmap_list_view(), bitmap_tree_view(), blocks_to_update, blocks_with_phis_to_rewrite, calculate_dominance_info(), CDI_DOMINATORS, cfun, compute_dominance_frontiers(), common_info::current_def, debug_gimple_stmt(), delete_update_ssa(), dom_info_state(), DOM_NONE, dump_file, dump_flags, dump_update_ssa(), ENTRY_BLOCK_PTR_FOR_FN, error(), EXECUTE_IF_SET_IN_BITMAP, FOR_EACH_BB_FN, FOR_EACH_SSA_NAME, FOR_EACH_SSA_USE_OPERAND, FOR_EACH_VEC_ELT, free(), gcc_assert, get_ssa_name_ann(), get_var_info(), gsi_end_p(), gsi_next(), gsi_start_bb(), gsi_stmt(), i, basic_block_def::index, ssa_name_info::info, var_info::info, init_update_ssa(), insert_updated_phi_nodes_compare_uids(), insert_updated_phi_nodes_for(), internal_error(), iterating_old_ssa_names, last_basic_block_for_fn, marked_for_renaming(), nearest_common_dominator_for_set(), need_ssa_update_p(), new_ssa_names, NULL, NULL_TREE, old_ssa_names, PERCENT, phis_to_rewrite, prepare_block_for_update(), prepare_names_to_update(), print_generic_expr(), rewrite_blocks(), REWRITE_UPDATE, REWRITE_UPDATE_REGION, ssa_name, SSA_NAME_IN_FREE_LIST, SSA_NAME_VAR, SSA_OP_ALL_USES, statistics_counter_event(), symbols_to_rename, TDF_DETAILS, TDF_SLIM, timevar_pop(), timevar_push(), TODO_update_ssa, TODO_update_ssa_full_phi, TODO_update_ssa_no_phi, TODO_update_ssa_only_virtuals, TREE_CODE, update_ssa_initialized_fn, USE_FROM_PTR, var_infos, and virtual_operand_p().

Referenced by autofdo::afdo_annotate_cfg(), autofdo::afdo_vpt_for_early_inline(), cleanup_tree_cfg_noloop(), compute_fn_summary(), autofdo::early_inline(), execute_function_todo(), execute_update_addresses_taken(), cgraph_node::expand(), expand_ifn_va_arg_1(), expand_omp_taskreg(), expand_thunk(), gen_parallel_loop(), cgraph_node::get_body(), ipa_tm_transform_clone(), ipa_tm_transform_transaction(), rewrite_into_loop_closed_ssa_1(), simd_clone_adjust(), tree_function_versioning(), tree_profiling(), tree_transform_and_unroll_loop(), tree_unroll_loops_completely(), tree_unswitch_single_loop(), vect_loop_versioning(), version_loop_by_alias_check(), and version_loop_for_if_conversion().

Variable Documentation

◆ names_to_release

bitmap names_to_release
Set of SSA names that have been marked to be released after they
were registered in the replacement table.  They will be finally
released after we finish updating the SSA web.   

Referenced by delete_update_ssa(), dump_update_ssa(), init_update_ssa(), prepare_def_site_for(), prepare_names_to_update(), release_ssa_name_after_update_ssa(), and verify_ssaname_freelists().