GCC Middle and Back End API Reference
tree-dfa.c File Reference
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "tm.h"
#include "hashtab.h"
#include "pointer-set.h"
#include "tree.h"
#include "tm_p.h"
#include "basic-block.h"
#include "ggc.h"
#include "langhooks.h"
#include "flags.h"
#include "function.h"
#include "tree-pretty-print.h"
#include "gimple.h"
#include "gimple-ssa.h"
#include "tree-phinodes.h"
#include "ssa-iterators.h"
#include "tree-ssanames.h"
#include "tree-dfa.h"
#include "tree-inline.h"
#include "tree-pass.h"
#include "convert.h"
#include "params.h"
Include dependency graph for tree-dfa.c:

Data Structures

struct  dfa_stats_d
struct  numbered_tree_d

Typedefs

typedef struct numbered_tree_d numbered_tree

Functions

static void collect_dfa_stats (struct dfa_stats_d *)
void renumber_gimple_stmt_uids ()
void renumber_gimple_stmt_uids_in_blocks ()
void dump_variable ()
DEBUG_FUNCTION void debug_variable ()
void dump_dfa_stats ()
DEBUG_FUNCTION void debug_dfa_stats ()
static void collect_dfa_stats ()
tree ssa_default_def ()
void set_ssa_default_def ()
tree get_or_create_ssa_default_def ()
tree get_ref_base_and_extent (tree exp, HOST_WIDE_INT *poffset, HOST_WIDE_INT *psize, HOST_WIDE_INT *pmax_size)
tree get_addr_base_and_unit_offset ()
bool stmt_references_abnormal_ssa_name ()
static int compare_decls_by_uid ()
static tree dump_enumerated_decls_push ()
void dump_enumerated_decls ()

Typedef Documentation


Function Documentation

static void collect_dfa_stats ( struct dfa_stats_d )
static

Local functions.

static void collect_dfa_stats ( )
static

Collect DFA statistics and store them in the structure pointed to by DFA_STATS_P.

Walk all the statements in the function counting references.

static int compare_decls_by_uid ( )
static

Compare two declarations references by their DECL_UID / sequence number. Called via qsort.

DEBUG_FUNCTION void debug_dfa_stats ( void  )

Dump DFA statistics on stderr.

References FOR_EACH_BB, and gcc_assert.

DEBUG_FUNCTION void debug_variable ( )

Dump variable VAR and its may-aliases to stderr.

void dump_dfa_stats ( )

Dump various DFA statistics to FILE.

void dump_enumerated_decls ( )

Find all the declarations used by the current function, sort them by uid, and emit the sorted list. Each declaration is tagged with a sequence number indicating when it was found during statement / tree walking, so that TDF_NOUID comparisons of anonymous declarations are still meaningful. Where a declaration was encountered more than once, we emit only the sequence number of the first encounter. FILE is the dump file where to output the list and FLAGS is as in print_generic_expr.

static tree dump_enumerated_decls_push ( )
static

Called via walk_gimple_stmt / walk_gimple_op by dump_enumerated_decls.

void dump_variable ( )

Dump variable VAR and its may-aliases to FILE.

tree get_addr_base_and_unit_offset ( )

Returns the base object and a constant BITS_PER_UNIT offset in *POFFSET that denotes the starting address of the memory access EXP. Returns NULL_TREE if the offset is not constant or any component is not BITS_PER_UNIT-aligned.

References DECL_UID, numbered_tree_d::num, and numbered_tree_d::t.

Referenced by build1_stat(), compute_antic(), make_fancy_name(), and strinfo_shared().

tree get_or_create_ssa_default_def ( )

Retrieve or create a default definition for VAR.

References DECL_SIZE, double_int_zero, HOST_WIDE_INT, NULL_TREE, TREE_CODE, TREE_OPERAND, TREE_TYPE, and VOID_TYPE_P.

Referenced by insert_phi_nodes(), and load_assign_lhs_subreplacements().

tree get_ref_base_and_extent ( tree  exp,
HOST_WIDE_INT poffset,
HOST_WIDE_INT psize,
HOST_WIDE_INT pmax_size 
)

If EXP is a handled component reference for a structure, return the base variable. The access range is delimited by bit positions *POFFSET and *POFFSET + *PMAX_SIZE. The access size is *PSIZE bits. If either *PSIZE or *PMAX_SIZE is -1, they could not be determined. If *PSIZE and *PMAX_SIZE are equal, the access is non-variable.

 First get the final access size from just the outermost expression.   
 Initially, maxsize is the same as the accessed element size.
 In the following it will only grow (or become -1).   
 Compute cumulative bit-offset for nested component-refs and array-refs,
 and find the ultimate containing object.   
               If we had seen a variable array ref already and we just
               referenced the last field of a struct or a union member
               then we have to adjust maxsize by the padding at the end
               of our field.   
               We need to adjust maxsize to the whole structure bitsize.
               But we can subtract any constant offset seen so far,
               because that would get us out of the structure otherwise.   
           If the resulting bit-offset is constant, track it.   
               An array ref with a constant index up in the structure
               hierarchy will constrain the size of any variable array ref
               lower in the access hierarchy.   
               We need to adjust maxsize to the whole array bitsize.
               But we can subtract any constant offset seen so far,
               because that would get us outside of the array otherwise.   
               Remember that we have seen an array ref with a variable
               index.   
         Hand back the decl for MEM[&decl, off].   
         Hand back the decl for MEM[&decl, off].   
             Via the variable index or index2 we can reach the
             whole object.   
 We need to deal with variable arrays ending structures such as
   struct { int length; int a[1]; } x;           x.a[d]
   struct { struct { int a; int b; } a[1]; } x;  x.a[d].a
   struct { struct { int a[1]; } a[1]; } x;      x.a[0][d], x.a[d][0]
   struct { int len; union { int a[1]; struct X x; } u; } x; x.u.a[d]
 where we do not know maxsize for variable index accesses to
 the array.  The simplest way to conservatively deal with this
 is to punt in the case that offset + maxsize reaches the
 base type boundary.  This needs to include possible trailing padding
 that is there for alignment purposes.   
 In case of a decl or constant base object we can do better.   
     If maxsize is unknown adjust it according to the size of the
     base decl.   
     If maxsize is unknown adjust it according to the size of the
     base type constant.   
 ???  Due to negative offsets in ARRAY_REF we can end up with
 negative bit_offset here.  We might want to store a zero offset
 in this case.   

References GET_MODE_BITSIZE, TREE_TYPE, TYPE_MODE, and TYPE_SIZE.

Referenced by fold_builtin_logarithm(), get_ssa_def_if_simple_copy(), new_die(), parm_ref_data_preserved_p(), and vn_reference_lookup_3().

void renumber_gimple_stmt_uids ( void  )
void renumber_gimple_stmt_uids_in_blocks ( )

Like renumber_gimple_stmt_uids, but only do work on the basic blocks in BLOCKS, of which there are N_BLOCKS. Also renumbers PHIs.

References cfun, gimple_set_uid(), gsi_end_p(), gsi_next(), gsi_start_bb(), gsi_start_phis(), gsi_stmt(), and inc_gimple_stmt_max_uid().

Referenced by rewrite_use_compare().

void set_ssa_default_def ( )

Insert the pair VAR's UID, DEF into the default_defs hashtable of function FN.

Default definition might be changed by tail call optimization.

  Mark DEF as the default definition for VAR.   
tree ssa_default_def ( )

Lookup VAR UID in the default_defs hashtable and return the associated variable.

References DECL_UID, DEFAULT_DEFS, gcc_assert, and TREE_CODE.

Referenced by adjust_return_value(), DFS(), dump_live_info(), initialize_parameter_reductions(), ipa_analyze_call_uses(), and update_complex_components_on_edge().

bool stmt_references_abnormal_ssa_name ( )

Returns true if STMT references an SSA_NAME that has SSA_NAME_OCCURS_IN_ABNORMAL_PHI set, otherwise false.

References DECL_P, walk_stmt_info::info, and NULL_TREE.