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

Functions

static void get_expr_operands (gimple, tree *, int)
static struct ssa_operandsgimple_ssa_operands ()
bool ssa_operands_active ()
static void create_vop_var ()
void init_ssa_operands ()
void fini_ssa_operands ()
static void * ssa_operand_alloc ()
static struct use_optype_dalloc_use ()
static use_optype_p add_use_op ()
static void finalize_ssa_defs ()
static void finalize_ssa_uses ()
static void cleanup_build_arrays ()
static void finalize_ssa_stmt_operands ()
static void start_ssa_stmt_operands ()
static void append_use ()
static void append_vdef ()
static void append_vuse ()
static void add_virtual_operand ()
static void add_stmt_operand ()
static void mark_address_taken ()
static void get_indirect_ref_operands ()
static void get_tmr_operands ()
static void maybe_add_call_vops ()
static void get_asm_expr_operands ()
static void get_expr_operands ()
static void parse_ssa_operands ()
static void build_ssa_operands ()
DEBUG_FUNCTION bool verify_ssa_operands ()
void free_stmt_operands ()
void update_stmt_operands ()
void swap_ssa_operands ()
DEBUG_FUNCTION bool verify_imm_links ()
void dump_immediate_uses_for ()
void dump_immediate_uses ()
DEBUG_FUNCTION void debug_immediate_uses ()
DEBUG_FUNCTION void debug_immediate_uses_for ()
void unlink_stmt_vdef ()
bool has_zero_uses_1 ()
bool single_imm_use_1 (const ssa_use_operand_t *head, use_operand_p *use_p, gimple *stmt)

Variables

static vec< treebuild_uses
static tree build_vdef
static tree build_vuse
static bitmap_obstack operands_bitmap_obstack
static int n_initialized = 0

Function Documentation

static void add_stmt_operand ( )
static
   Add *VAR_P to the appropriate operand array for statement STMT.
   FLAGS is as in get_expr_operands.  If *VAR_P is a GIMPLE register,
   it will be added to the statement's real operands, otherwise it is
   added to virtual operands.  
         The variable is a GIMPLE register.  Add it to real operands.  
         Mark statements with volatile operands.  
         The variable is a memory access.  Add virtual operands.  

Referenced by get_asm_expr_operands().

static use_optype_p add_use_op ( )
inlinestatic
   Adds OP to the list of uses of statement STMT after LAST.  
static void add_virtual_operand ( )
static
   Add virtual operands for STMT.  FLAGS is as in get_expr_operands.  
     Add virtual operands to the stmt, unless the caller has specifically
     requested not to do that (used when adding operands inside an
     ADDR_EXPR expression).  

Referenced by mark_address_taken().

static struct use_optype_d* alloc_use ( )
staticread
   Allocate a USE operand.  
static void append_use ( )
inlinestatic
   Add USE_P to the list of pointers to operands.  
static void append_vdef ( )
inlinestatic
   Add VAR to the set of variables that require a VDEF operator.  
static void append_vuse ( )
inlinestatic
   Add VAR to the set of variables that require a VUSE operator.  
static void build_ssa_operands ( )
static
   Create an operands cache for STMT.  
     Initially assume that the statement has no volatile operands.  

References debug_generic_expr(), and error().

static void cleanup_build_arrays ( )
inlinestatic
   Clear the in_list bits and empty the build array for VDEFs and
   VUSEs.  
static void create_vop_var ( )
static
   Create the VOP variable, an artificial global variable to act as a
   representative of all of the virtual operands FUD chain.  
DEBUG_FUNCTION void debug_immediate_uses ( void  )
   Dump def-use edges on stderr.  
DEBUG_FUNCTION void debug_immediate_uses_for ( )
   Dump def-use edges on stderr.  
void dump_immediate_uses ( )
   Dump all the immediate uses to FILE.  
void dump_immediate_uses_for ( )
   Dump all the immediate uses to FILE.  

References is_gimple_debug(), and ssa_use_operand_d::next.

static void finalize_ssa_defs ( )
inlinestatic
   Takes elements from build_defs and turns them into def operands of STMT.
   TODO -- Make build_defs vec of tree *.  
     Pre-pend the vdef we may have built.  
     Clear and unlink a no longer necessary VDEF.  
     If we have a non-SSA_NAME VDEF, mark it for renaming.  

References cfun, function::gimple_df, gimple_df::rename_vops, and gimple_df::ssa_renaming_needed.

static void finalize_ssa_stmt_operands ( )
inlinestatic
   Finalize all the build vectors, fill the new ones into INFO.  
static void finalize_ssa_uses ( )
inlinestatic
   Takes elements from build_uses and turns them into use operands of STMT.
   TODO -- Make build_uses vec of tree *.  
     Pre-pend the VUSE we may have built.  
     Clear a no longer necessary VUSE.  
     If there is anything in the old list, free it.  
     If we added a VUSE, make sure to set the operand if it is not already
     present and mark it for renaming.  
     Now create nodes for all the new nodes.  
     Now set the stmt's operands.  

References cfun, delink_imm_use(), ssa_operands::free_uses, and gimple_ssa_operands().

void fini_ssa_operands ( void  )
   Dispose of anything required by the operand routines.  

Referenced by execute_init_datastructures().

void free_stmt_operands ( )
   Releases the operands of STMT back to their freelists, and clears
   the stmt operand lists.  
static void get_asm_expr_operands ( )
static
   Scan operands in the ASM_EXPR stmt referred to in INFO.  
     Gather all output operands.  
         This should have been split in gimplify_asm_expr.  
         Memory operands are addressable.  Note that STMT needs the
         address of this operand.  
     Gather all input operands.  
         Memory operands are addressable.  Note that STMT needs the
         address of this operand.  
     Clobber all memory and addressable symbols for asm ("" : : : "memory");  

References add_stmt_operand(), get_expr_operands(), get_indirect_ref_operands(), get_tmr_operands(), gimple_debug_bind_p(), is_gimple_debug(), is_gimple_min_invariant(), and mark_address_taken().

static void get_expr_operands ( gimple  ,
tree ,
int   
)
static
static void get_expr_operands ( )
static
   Recursively scan the expression pointed to by EXPR_P in statement
   STMT.  FLAGS is one of the OPF_* constants modifying how to
   interpret the operands found.  
         Taking the address of a variable does not represent a
         reference to it, but the fact that the statement takes its
         address will be of interest to some passes (e.g. alias
         resolution).  
         If the address is invariant, there may be no interesting
         variable references inside.  
         Otherwise, there may be variables referenced inside but there
         should be no VUSEs created, since the referenced objects are
         not really accessed.  The only operands that we should find
         here are ARRAY_REF indices which will always be real operands
         (GIMPLE does not allow non-registers as array indices).  
         WITH_SIZE_EXPR is a pass-through reference to its first argument,
         and an rvalue reference to its second argument.  
           General aggregate CONSTRUCTORs have been decomposed, but they
           are still in use as the COMPLEX_EXPR equivalent for vectors.  
           A volatile constructor is actually TREE_CLOBBER_P, transfer
           the volatility to the statement, don't use TREE_CLOBBER_P for
           mirroring the other uses of THIS_VOLATILE in this file.  
         FALLTHRU 
         Expressions that make no memory references.  
     If we get here, something has gone wrong.  

References get_expr_operands(), and gimple_set_has_volatile_ops().

static void get_indirect_ref_operands ( )
static
   A subroutine of get_expr_operands to handle MEM_REF.

   STMT is the statement being processed, EXPR is the MEM_REF
      that got us here.

   FLAGS is as in get_expr_operands.  
     Add the VOP.  
     If requested, add a USE operand for the base pointer.  

Referenced by get_asm_expr_operands().

static void get_tmr_operands ( )
static
   A subroutine of get_expr_operands to handle TARGET_MEM_REF.  
     First record the real operands.  

Referenced by get_asm_expr_operands().

static struct ssa_operands* gimple_ssa_operands ( )
staticread
   Accessor to tree-ssa-operands.c caches.  

Referenced by finalize_ssa_uses(), and init_ssa_operands().

bool has_zero_uses_1 ( )
   Return true if the var whose chain of uses starts at PTR has no
   nondebug uses.  
void init_ssa_operands ( )
static void mark_address_taken ( )
static
   Mark the base address of REF as having its address taken.
   REF may be a single variable whose address has been taken or any
   other valid GIMPLE memory reference (structure reference, array,
   etc).  
     Note that it is *NOT OKAY* to use the target of a COMPONENT_REF
     as the only thing we take the address of.  If VAR is a structure,
     taking the address of a field means that the whole structure may
     be referenced using pointer arithmetic.  See PR 21407 and the
     ensuing mailing list discussion.  

References add_virtual_operand(), get_expr_operands(), and gimple_set_has_volatile_ops().

Referenced by get_asm_expr_operands().

static void maybe_add_call_vops ( )
static
   If STMT is a call that may clobber globals and other symbols that
   escape, add them to the VDEF/VUSE lists for it.  
     If aliases have been computed already, add VDEF or VUSE
     operands for all the symbols that have been found to be
     call-clobbered.  
         A 'pure' or a 'const' function never call-clobbers anything.
         A 'noreturn' function might, but since we don't return anyway
         there is no point in recording that.  
static void parse_ssa_operands ( )
static
   Parse STMT looking for operands.  When finished, the various
   build_* operand vectors will have potential operands in them.  
         The start of a transaction is a memory barrier.  
         Add call-clobbered operands, if needed.  
         FALLTHRU 
         FALLTHRU 
bool single_imm_use_1 ( const ssa_use_operand_t head,
use_operand_p use_p,
gimple stmt 
)
   Return true if the var whose chain of uses starts at PTR has a
   single nondebug use.  Set USE_P and STMT to that single nondebug
   use, if so, or to NULL otherwise.  

Referenced by next_readonly_imm_use().

static void* ssa_operand_alloc ( )
inlinestatic
   Return memory for an operand of size SIZE.  
bool ssa_operands_active ( )
    Return true if the SSA operands cache is active.  

Referenced by execute_init_datastructures().

static void start_ssa_stmt_operands ( )
inlinestatic
   Start the process of building up operands vectors in INFO.  

References build_vuse.

void swap_ssa_operands ( )
   Swap operands EXP0 and EXP1 in statement STMT.  No attempt is done
   to test the validity of the swap operation.  
         Attempt to preserve the relative positions of these two operands in
         their * respective immediate use lists by adjusting their use pointer
         to point to the new operand position.  
         Find the 2 operands in the cache, if they are there.  
         And adjust their location to point to the new position of the
         operand.  
         Now swap the data.  

References error(), ssa_use_operand_d::next, and ssa_use_operand_d::prev.

void unlink_stmt_vdef ( )
   Unlink STMTs virtual definition from the IL by propagating its use.  

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

void update_stmt_operands ( )
   Get the operands of statement STMT.  
     If update_stmt_operands is called before SSA is initialized, do
     nothing.  
     If the stmt is a noreturn call queue it to be processed by
     split_bbs_on_noreturn_calls during cfg cleanup.  

References ssa_use_operand_d::next.

DEBUG_FUNCTION bool verify_imm_links ( )
   Scan the immediate_use list for VAR making sure its linked properly.
   Return TRUE if there is a problem and emit an error message to F.  
         Avoid infinite loops.  50,000,000 uses probably indicates a
         problem.  
     Verify list in the other direction.  

Referenced by release_ssa_name().

DEBUG_FUNCTION bool verify_ssa_operands ( )
   Verifies SSA statement operands.  
     build_ssa_operands w/o finalizing them.  
     Now verify the built operands are the same as present in STMT.  

Variable Documentation

vec<tree> build_uses
static
   Array for building all the use operands.  
tree build_vdef
static
   The built VDEF operand.  

Referenced by init_ssa_operands().

tree build_vuse
static
   The built VUSE operand.  

Referenced by init_ssa_operands(), and start_ssa_stmt_operands().

int n_initialized = 0
static
   Number of functions with initialized ssa_operands.  

Referenced by init_ssa_operands().

bitmap_obstack operands_bitmap_obstack
static
   Bitmap obstack for our datastructures that needs to survive across
   compilations of multiple functions.