GCC Middle and Back End API Reference
tree-ssa-live.c File Reference

Data Structures

struct  tree_int_map_hasher

Functions

static void verify_live_on_entry (tree_live_info_p)
static void var_map_base_init ()
static void var_map_base_fini ()
var_map init_var_map ()
void delete_var_map ()
int var_union ()
static bitmap partition_view_init ()
static void partition_view_fini ()
void partition_view_normal ()
void partition_view_bitmap ()
static bool set_is_used ()
static bool is_used_p ()
static void mark_all_vars_used (tree *)
static tree mark_all_vars_used_1 ()
static void mark_scope_block_unused ()
static bool remove_unused_scope_block_p ()
static void mark_all_vars_used ()
static tree clear_unused_block_pointer_1 ()
static void clear_unused_block_pointer ()
static void dump_scope_block ()
DEBUG_FUNCTION void debug_scope_block ()
void dump_scope_blocks ()
DEBUG_FUNCTION void debug_scope_blocks ()
void remove_unused_locals ()
static tree_live_info_p new_tree_live_info ()
void delete_tree_live_info ()
static void loe_visit_block (tree_live_info_p live, basic_block bb, sbitmap visited, bitmap tmp)
static void live_worklist ()
static void set_var_live_on_entry ()
void calculate_live_on_exit ()
tree_live_info_p calculate_live_ranges ()
void dump_var_map ()
DEBUG_FUNCTION void debug ()
void dump_live_info ()
void register_ssa_partition_check ()
static void verify_live_on_entry ()

Variables

static bitmap usedvars
static bitmap_obstack liveness_bitmap_obstack

Function Documentation

tree_live_info_p calculate_live_ranges ( )
Given partition map MAP, calculate all the live on entry bitmaps for
   each partition.  Return a new live info object.   

References bitmap_obstack_initialize(), calculate_live_on_exit(), live, live_worklist(), new_tree_live_info(), num_var_partitions(), partition_to_var(), set_var_live_on_entry(), and verify_live_on_entry().

Referenced by coalesce_ssa_name().

static void clear_unused_block_pointer ( )
static
Set all block pointer in debug or clobber stmt to NULL if the block
   is unused, so that they will not be streamed out.   

References clear_unused_block_pointer_1(), gimple_block(), gimple_clobber_p(), gimple_num_ops(), gimple_op_ptr(), gimple_set_block(), gsi_end_p(), gsi_next(), gsi_start_bb(), gsi_stmt(), and is_gimple_debug().

Referenced by remove_unused_locals().

static tree clear_unused_block_pointer_1 ( )
static
Helper function for clear_unused_block_pointer, called via walk_tree.   

Referenced by clear_unused_block_pointer().

DEBUG_FUNCTION void debug ( )
Generic dump for the above.   

References dump_var_map().

DEBUG_FUNCTION void debug_scope_block ( )
Dump the tree of lexical scopes starting at SCOPE to stderr.  FLAGS
   is as in print_generic_expr.   

References dump_scope_block().

DEBUG_FUNCTION void debug_scope_blocks ( )
Dump the tree of lexical scopes of current_function_decl to stderr.
   FLAGS is as in print_generic_expr.   

References dump_scope_blocks().

void delete_tree_live_info ( )
Free storage for live range info object LIVE.   

References bitmap_obstack_release(), free(), tree_live_info_d::livein, tree_live_info_d::liveout, and tree_live_info_d::work_stack.

Referenced by coalesce_ssa_name().

void delete_var_map ( )
void dump_live_info ( )
Output live range info LIVE to file F, controlled by FLAG.   

References basic_block_def::index, tree_live_info_d::livein, tree_live_info_d::liveout, map, tree_live_info_d::map, partition_to_var(), and print_generic_expr().

Referenced by coalesce_ssa_name().

static void dump_scope_block ( )
static
Dump scope blocks starting at SCOPE to FILE.  INDENT is the
   indentation level and FLAGS is as in print_generic_expr.   

References block_ultimate_origin(), expand_location(), and print_generic_decl().

Referenced by debug_scope_block(), and dump_scope_blocks().

void dump_scope_blocks ( )
Dump the tree of lexical scopes of current_function_decl to FILE.
   FLAGS is as in print_generic_expr.   

References current_function_decl, and dump_scope_block().

static bool is_used_p ( )
inlinestatic
Return true if VAR is marked as used.   

References bitmap_bit_p().

Referenced by remove_unused_locals(), and remove_unused_scope_block_p().

static void live_worklist ( )
static
Using LIVE, fill in all the live-on-entry blocks between the defs and uses
   of all the variables.   

References bitmap_clear(), loe_visit_block(), sbitmap_alloc(), sbitmap_free(), tree_live_info_d::stack_top, visited, and tree_live_info_d::work_stack.

Referenced by calculate_live_ranges().

static void loe_visit_block ( tree_live_info_p  live,
basic_block  bb,
sbitmap  visited,
bitmap  tmp 
)
static
Visit basic block BB and propagate any required live on entry bits from
   LIVE into the predecessors.  VISITED is the bitmap of visited blocks.
   TMP is a temporary work bitmap which is passed in to avoid reallocating
   it each time.   

References bitmap_and_compl(), bitmap_bit_p(), bitmap_clear_bit(), bitmap_ior_into(), bitmap_set_bit(), basic_block_def::index, live_on_entry(), tree_live_info_d::liveout, basic_block_def::preds, edge_def::src, and tree_live_info_d::stack_top.

Referenced by live_worklist().

static void mark_all_vars_used ( tree )
inlinestatic
static void mark_all_vars_used ( )
inlinestatic
Mark all VAR_DECLS under *EXPR_P as used, so that they won't be
   eliminated during the tree->rtl conversion process.   

References mark_all_vars_used_1().

static tree mark_all_vars_used_1 ( )
static
Helper function for mark_all_vars_used, called via walk_tree.   

References is_global_var(), mark_all_vars_used(), and set_is_used().

Referenced by mark_all_vars_used().

static void mark_scope_block_unused ( )
static
Mark the scope block SCOPE and its subblocks unused when they can be
   possibly eliminated if dead.   

References debug_hooks, and gcc_debug_hooks::ignore_block.

Referenced by remove_unused_locals().

void partition_view_bitmap ( )
Create a partition view in MAP which includes just partitions which occur in
   the bitmap ONLY. If WANT_BASES is true, create the base variable map
   as well.   

References bitmap_bit_p(), bitmap_set_bit(), partition_view_fini(), partition_view_init(), var_map_base_fini(), var_map_base_init(), and _var_map::var_partition.

Referenced by coalesce_ssa_name().

static void partition_view_fini ( )
static
This routine will finalize the view data for MAP based on the partitions
   set in SELECTED.  This is either the same bitmap returned from
   partition_view_init, or a trimmed down version if some of those partitions
   were not desired in this view.  SELECTED is freed before returning.   

References bitmap_count_bits(), count, limit, memset(), _var_map::num_partitions, _var_map::partition_size, _var_map::partition_to_view, and _var_map::view_to_partition.

Referenced by partition_view_bitmap(), and partition_view_normal().

static bitmap partition_view_init ( )
static
Compress the partition numbers in MAP such that they fall in the range
   0..(num_partitions-1) instead of wherever they turned out during
   the partitioning exercise.  This removes any references to unused
   partitions, thereby allowing bitmaps and other vectors to be much
   denser.

   This is implemented such that compaction doesn't affect partitioning.
   Ie., once partitions are created and possibly merged, running one
   or more different kind of compaction will not affect the partitions
   themselves.  Their index might change, but all the same variables will
   still be members of the same partition group.  This allows work on reduced
   sets, and no loss of information when a larger set is later desired.

   In particular, coalescing can work on partitions which have 2 or more
   definitions, and then 'recompact' later to include all the single
   definitions for assignment to program variables.   
Set MAP back to the initial state of having no partition view.  Return a
   bitmap which has a bit set for each partition number which is in use in the
   varmap.   

References bitmap_set_bit(), free(), has_zero_uses(), _var_map::num_partitions, _var_map::partition_size, _var_map::partition_to_view, _var_map::var_partition, _var_map::view_to_partition, and virtual_operand_p().

Referenced by partition_view_bitmap(), and partition_view_normal().

void partition_view_normal ( )
Create a partition view which includes all the used partitions in MAP.  If
   WANT_BASES is true, create the base variable map as well.   

References partition_view_fini(), partition_view_init(), var_map_base_fini(), and var_map_base_init().

Referenced by remove_ssa_form().

void register_ssa_partition_check ( )
Verify that SSA_VAR is a non-virtual SSA_NAME.   

References internal_error(), print_generic_expr(), and virtual_operand_p().

Referenced by register_ssa_partition().

static bool remove_unused_scope_block_p ( )
static
Look if the block is dead (by possibly eliminating its dead subblocks)
   and return true if so.
   Block is declared dead if:
     1) No statements are associated with it.
     2) Declares no live variables
     3) All subblocks are dead
        or there is precisely one subblocks and the block
        has same abstract origin as outer block and declares
        no variables, so it is pure wrapper.
   When we are not outputting full debug info, we also eliminate dead variables
   out of scope blocks to let them to be recycled by GGC and to save copying work
   done by the inliner.   

References DINFO_LEVEL_NONE, DINFO_LEVEL_NORMAL, DINFO_LEVEL_TERSE, DINFO_LEVEL_VERBOSE, inlined_function_outer_scope_p(), is_used_p(), and lookup_attribute().

Referenced by remove_unused_locals().

static bool set_is_used ( )
inlinestatic
Mark VAR as used, so that it'll be preserved during rtl expansion.
   Returns true if VAR wasn't marked before.   

References bitmap_set_bit().

Referenced by mark_all_vars_used_1().

static void set_var_live_on_entry ( )
static
Calculate the initial live on entry vector for SSA_NAME using immediate_use
   links.  Set the live on entry fields in LIVE.  Def's are marked temporarily
   in the liveout vector.   

References add_block(), bitmap_set_bit(), gimple_bb(), gimple_phi_arg_edge(), tree_live_info_d::global, basic_block_def::index, is_gimple_debug(), tree_live_info_d::livein, tree_live_info_d::liveout, tree_live_info_d::map, edge_def::src, and var_to_partition().

Referenced by calculate_live_ranges().

static void var_map_base_fini ( )
static
int var_union ( )
This function will combine the partitions in MAP for VAR1 and VAR2.  It
   Returns the partition which represents the new partition.  If the two
   partitions cannot be combined, NO_PARTITION is returned.   

References _var_map::partition_to_view, and _var_map::var_partition.

Referenced by attempt_coalesce().

static void verify_live_on_entry ( tree_live_info_p  )
static
@verbatim Liveness for SSA trees.

Copyright (C) 2003-2013 Free Software Foundation, Inc. Contributed by Andrew MacLeod amacl.nosp@m.eod@.nosp@m.redha.nosp@m.t.co.nosp@m.m

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/.

Referenced by calculate_live_ranges().


Variable Documentation

bitmap_obstack liveness_bitmap_obstack
static
Obstack for globale liveness info bitmaps.  We don't want to put these
   on the default obstack because these bitmaps can grow quite large and
   we'll hold on to all that memory until the end of the compiler run.
   As a bonus, delete_tree_live_info can destroy all the bitmaps by just
   releasing the whole obstack.   
bitmap usedvars
static