GCC Middle and Back End API Reference
tree-ssanames.c File Reference
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "tm.h"
#include "tree.h"
#include "gimple.h"
#include "gimple-ssa.h"
#include "tree-phinodes.h"
#include "ssa-iterators.h"
#include "tree-ssanames.h"
#include "tree-into-ssa.h"
#include "tree-ssa.h"
#include "tree-pass.h"
Include dependency graph for tree-ssanames.c:

Macros

#define UNUSED_NAME_VERSION   0
#define FREE_SSANAMES(fun)   (fun)->gimple_df->free_ssanames

Functions

void init_ssanames ()
void fini_ssanames ()
void ssanames_print_statistics ()
tree make_ssa_name_fn ()
void set_range_info ()
enum value_range_type get_range_info ()
void release_ssa_name ()
bool get_ptr_info_alignment (struct ptr_info_def *pi, unsigned int *alignp, unsigned int *misalignp)
void mark_ptr_info_alignment_unknown ()
void set_ptr_info_alignment (struct ptr_info_def *pi, unsigned int align, unsigned int misalign)
void adjust_ptr_info_misalignment (struct ptr_info_def *pi, unsigned int increment)
struct ptr_info_defget_ptr_info ()
tree copy_ssa_name_fn ()
void duplicate_ssa_name_ptr_info ()
void duplicate_ssa_name_range_info ()
tree duplicate_ssa_name_fn ()
void release_defs ()
void replace_ssa_name_symbol ()
static unsigned int release_dead_ssa_names ()
gimple_opt_passmake_pass_release_ssa_names ()

Variables

unsigned int ssa_name_nodes_reused
unsigned int ssa_name_nodes_created

Macro Definition Documentation

#define FREE_SSANAMES (   fun)    (fun)->gimple_df->free_ssanames

Referenced by release_ssa_name().

#define UNUSED_NAME_VERSION   0

Generic routines for manipulating SSA_NAME expressions Copyright (C) 2003-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/. Rewriting a function into SSA form can create a huge number of SSA_NAMEs, many of which may be thrown away shortly after their creation if jumps were threaded through PHI nodes.

While our garbage collection mechanisms will handle this situation, it is extremely wasteful to create nodes and throw them away, especially when the nodes can be reused.

For PR 8361, we can significantly reduce the number of nodes allocated and thus the total amount of memory allocated by managing SSA_NAMEs a little. This additionally helps reduce the amount of work done by the garbage collector. Similar results have been seen on a wider variety of tests (such as the compiler itself).

Right now we maintain our free list on a per-function basis. It may or may not make sense to maintain the free list for the duration of a compilation unit.

External code should rely solely upon HIGHEST_SSA_VERSION and the externally defined functions. External code should not know about the details of the free list management.

External code should also not assume the version number on nodes is monotonically increasing. We reuse the version number when we reuse an SSA_NAME expression. This helps keep arrays and bitmaps more compact. Version numbers with special meanings. We start allocating new version numbers after the special ones.


Function Documentation

void adjust_ptr_info_misalignment ( struct ptr_info_def pi,
unsigned int  increment 
)

If pointer described by PI has known alignment, increase its known misalignment by INCREMENT modulo its current alignment.

References make_ssa_name_fn(), SSA_NAME_VAR, and TREE_TYPE.

tree copy_ssa_name_fn ( )

Creates a new SSA name using the template NAME tobe defined by statement STMT in function FN.

Referenced by duplicate_ssa_name_ptr_info().

tree duplicate_ssa_name_fn ( )

Creates a duplicate of a ssa name NAME tobe defined by statement STMT in function FN.

References SET_SSA_NAME_VAR_OR_IDENTIFIER, and TREE_TYPE.

Referenced by make_ssa_name().

void duplicate_ssa_name_ptr_info ( )

Creates a duplicate of the ptr_info_def at PTR_INFO for use by the SSA name NAME.

References copy_ssa_name_fn(), POINTER_TYPE_P, SSA_NAME_PTR_INFO, SSA_NAME_RANGE_INFO, and TREE_TYPE.

Referenced by get_address_description(), and get_value().

void duplicate_ssa_name_range_info ( )

Creates a duplicate of the range_info_def at RANGE_INFO for use by the SSA name NAME.

Referenced by get_value().

void fini_ssanames ( void  )

Finalize management of SSA_NAMEs.

References ssa_name_nodes_created, and ssa_name_nodes_reused.

Referenced by execute_init_datastructures().

struct ptr_info_def* get_ptr_info ( )
read

Return the alias information associated with pointer T. It creates a new instance if none existed.

bool get_ptr_info_alignment ( struct ptr_info_def pi,
unsigned int *  alignp,
unsigned int *  misalignp 
)

If the alignment of the pointer described by PI is known, return true and store the alignment and the deviation from it into *ALIGNP and *MISALIGNP respectively. Otherwise return false.

References ptr_info_def::align, gcc_assert, gcc_checking_assert, and ptr_info_def::misalign.

Referenced by get_address_description(), and get_object_alignment().

enum value_range_type get_range_info ( )

Gets range information MIN, MAX and returns enum value_range_type corresponding to tree ssa_name NAME. enum value_range_type returned is used to determine if MIN and MAX are valid values.

 Return VR_VARYING for SSA_NAMEs with NULL RANGE_INFO or SSA_NAMEs
 with integral types width > 2 * HOST_BITS_PER_WIDE_INT precision.   
 If min > max, it is VR_ANTI_RANGE.   
     VR_ANTI_RANGE ~[min, max] is encoded as [max + 1, min - 1].   
   Otherwise (when min <= max), it is VR_RANGE.   

References double_int_one, range_info_def::max, range_info_def::min, and VR_ANTI_RANGE.

void init_ssanames ( )

Initialize management of SSA_NAMEs to default SIZE. If SIZE is zero use default.

Version 0 is special, so reserve the first slot in the table. Though currently unused, we may use version 0 in alias analysis as part of the heuristics used to group aliases when the alias sets are too large.

We use vec::quick_push here because we know that SSA_NAMES has at least 50 elements reserved in it.

gimple_opt_pass* make_pass_release_ssa_names ( )
tree make_ssa_name_fn ( )

Return an SSA_NAME node for variable VAR defined in statement STMT in function FN. STMT may be an empty statement for artificial references (e.g., default definitions created when a variable is used without a preceding definition).

If our free list has an element, then use it.

     The node was cleared out when we put it on the free list, so
     there is no need to do so again here.   

Referenced by adjust_ptr_info_misalignment(), and copy_ssa_name().

void mark_ptr_info_alignment_unknown ( )

State that the pointer described by PI has unknown alignment.

References ptr_info_def::align, and ptr_info_def::misalign.

Referenced by set_ptr_info_alignment().

static unsigned int release_dead_ssa_names ( )
static

Return SSA names that are unused to GGC memory and compact the SSA version namespace. This is used to keep footprint of compiler during interprocedural optimization.

Now release the freelist.

 And compact the SSA number space.  We make sure to not change the
 relative order of SSA versions.   
void release_defs ( )

Release all the SSA_NAMEs created by STMT.

Make sure that we are in SSA. Otherwise, operand cache may point to garbage.

References cfun, ssa_name, and SSA_NAME_VERSION.

Referenced by dse_optimize_stmt(), execute_lower_resx(), fold_gimple_cond(), handle_pointer_plus(), process_assert_insertions_for(), stmt_is_power_of_op(), and update_call_from_tree().

void release_ssa_name ( )

We no longer need the SSA_NAME expression VAR, release it so that it may be reused.

Note it is assumed that no calls to make_ssa_name will be made until all uses of the ssa name are released and that the only use of the SSA_NAME expression is to check its SSA_NAME_VAR. All other fields must be assumed clobbered.

 Never release the default definition for a symbol.  It's a
 special SSA name that should always exist once it's created.   
 If VAR has been registered for SSA updating, don't remove it.
 After update_ssa has run, the name will be released.   
 release_ssa_name can be called multiple times on a single SSA_NAME.
 However, it should only end up on our free list one time.   We
 keep a status bit in the SSA_NAME node itself to indicate it has
 been put on the free list.

 Note that once on the freelist you can not reference the SSA_NAME's
 defining statement.   
     First put back the right tree node so that the tree checking
     macros do not complain.   
     Restore the version number.   
     Hopefully this can go away once we have the new incremental
     SSA updating code installed.   
     Note this SSA_NAME is now in the first list.   
     And finally put it on the free list.   

References cfun, delink_imm_use(), FREE_SSANAMES, insert_debug_temp_for_var_def(), ssa_use_operand_d::loc, MAY_HAVE_DEBUG_STMTS, ssa_use_operand_d::next, NULL, NULL_TREE, ssa_use_operand_d::prev, SET_SSA_NAME_VAR_OR_IDENTIFIER, ssa_use_operand_d::ssa_name, SSA_NAME_IMM_USE_NODE, SSA_NAME_IN_FREE_LIST, SSA_NAME_VAR, SSA_NAME_VERSION, SSANAMES, TREE_SET_CODE, tree_size(), vec_safe_push(), and verify_imm_links().

Referenced by extract_and_process_scc_for_name().

void replace_ssa_name_symbol ( )

Replace the symbol associated with SSA_NAME with SYM.

Referenced by determine_unroll_factor(), and set_component_ssa_name().

void set_ptr_info_alignment ( struct ptr_info_def pi,
unsigned int  align,
unsigned int  misalign 
)

Store the the power-of-two byte alignment and the deviation from that alignment of pointer described by PI to ALIOGN and MISALIGN respectively.

References gcc_assert, mark_ptr_info_alignment_unknown(), NULL, POINTER_TYPE_P, ptr_info_def::pt, pt_solution_reset(), SSA_NAME_PTR_INFO, and TREE_TYPE.

void set_range_info ( )

Store range information MIN, and MAX to tree ssa_name NAME.

Allocate if not available.

 Set the values.   
void ssanames_print_statistics ( void  )

Dump some simple statistics regarding the re-use of SSA_NAME nodes.

References gcc_assert, and TREE_CODE.


Variable Documentation

unsigned int ssa_name_nodes_created

Referenced by fini_ssanames().

unsigned int ssa_name_nodes_reused

Referenced by fini_ssanames().