GCC Middle and Back End API Reference
web.c File Reference


struct web_entryunionfind_root ()
bool unionfind_union ()
static void union_match_dups (rtx insn, struct web_entry *def_entry, struct web_entry *use_entry, bool(*fun)(struct web_entry *, struct web_entry *))
void union_defs (df_ref use, struct web_entry *def_entry, unsigned int *used, struct web_entry *use_entry, bool(*fun)(struct web_entry *, struct web_entry *))
static rtx entry_register ()
static void replace_ref ()
static bool gate_handle_web ()
static unsigned int web_main ()
rtl_opt_passmake_pass_web ()

Function Documentation

static rtx entry_register ( )
   Find the corresponding register for the given entry.  
     Find the corresponding web and see if it has been visited.  
     We are seeing this web for the first time, do the assignment.  
     In case the original register is already assigned, generate new
     one.  Since we use USED to merge uninitialized refs into a single
     web, we might found an element to be nonzero without our having
     used it.  Test for 1, because union_defs saves it for our use,
     and there won't be any use for the other values when we get to
     this point.  

References dump_file, and gen_reg_rtx().

static bool gate_handle_web ( )
rtl_opt_pass* make_pass_web ( )
static void replace_ref ( )
   Replace the reference by REG.  
void union_defs ( df_ref  use,
struct web_entry def_entry,
unsigned int *  used,
struct web_entry use_entry,
bool(*)(struct web_entry *, struct web_entry *)  fun 
   For each use, all possible defs reaching it must come in the same
   register, union them.
   FUN is the function that does the union.

   In USED, we keep the DF_REF_ID of the first uninitialized uses of a
   register, so that all uninitialized uses of the register can be
   combined into a single web.  We actually offset it by 2, because
   the values 0 and 1 are reserved for use by entry_register.  
         An artificial use.  It links up with nothing.  
     Union all occurrences of the same register in reg notes.  
     Recognize trivial noop moves and attempt to keep them as noop.  
     UD chains of uninitialized REGs are empty.  Keeping all uses of
     the same uninitialized REG in a single web is not necessary for
     correctness, since the uses are undefined, but it's wasteful to
     allocate one register or slot for each reference.  Furthermore,
     creating new pseudos for uninitialized references in debug insns
     (see PR 42631) causes -fcompare-debug failures.  We record the
     number of the first uninitialized reference we found, and merge
     with it any other uninitialized references to the same
     A READ_WRITE use requires the corresponding def to be in the same
     register.  Find it and union.  

References df_insn_info::insn.

static void union_match_dups ( rtx  insn,
struct web_entry def_entry,
struct web_entry use_entry,
bool(*)(struct web_entry *, struct web_entry *)  fun 
   For INSN, union all defs and uses that are linked by match_dup.
   FUN is the function that does the union.  
         ??? *DUPREF can still be zero, because when an operand matches
         a memory, DF_REF_LOC (use_link[n]) points to the register part
         of the address, whereas recog_data.dup_loc[m] points to the
         entire memory ref, thus we fail to find the duplicate entry,
         even though it is there.
         Example: i686-pc-linux-gnu gcc.c-torture/compile/950607-1.c
                  -O3 -fomit-frame-pointer -funroll-loops  
struct web_entry* unionfind_root ( )

Web construction code for GNU compiler. Contributed by Jan Hubicka. Copyright (C) 2001-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/.

   Simple optimization pass that splits independent uses of each pseudo,
   increasing effectiveness of other optimizations.  The optimization can
   serve as an example of use for the dataflow module.

   We don't split registers with REG_USERVAR set unless -fmessy-debugging
   is specified, because debugging information about such split variables
   is almost unusable.

    - We may use profile information and ignore infrequent use for the
      purpose of web unifying, inserting the compensation code later to
      implement full induction variable expansion for loops (currently
      we expand only if the induction variable is dead afterward, which
      is often the case).  
   Find the root of unionfind tree (the representative of set).  

References web_entry::pred.

bool unionfind_union ( )
   Union sets.
   Return true if FIRST and SECOND points to the same web entry structure and
   nothing is done.  Otherwise, return false.  
static unsigned int web_main ( )
   Main entry point.  
     Assign ids to the uses.  
     Record the number of uses and defs at the beginning of the optimization.  
     Produce the web.  
     Update the instruction stream, allocating new registers for split pseudos
     in progress.  
             Ignore naked clobber.  For example, reg 134 in the second insn
             of the following sequence will not be replaced.

               (insn (clobber (reg:SI 134)))

               (insn (set (reg:SI 0 r0) (reg:SI 134)))

             Thus the later passes can optimize them away.