GCC Middle and Back End API Reference
regstat.c File Reference
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "tm.h"
#include "rtl.h"
#include "tm_p.h"
#include "flags.h"
#include "regs.h"
#include "except.h"
#include "hard-reg-set.h"
#include "basic-block.h"
#include "timevar.h"
#include "df.h"
Include dependency graph for regstat.c:

Functions

void regstat_init_n_sets_and_refs ()
void regstat_free_n_sets_and_refs ()
static void regstat_bb_compute_ri (unsigned int bb_index, bitmap live, bitmap artificial_uses, bitmap local_live, bitmap local_processed, int *local_live_last_luid)
void regstat_compute_ri ()
void regstat_free_ri ()
bitmap regstat_get_setjmp_crosses ()
static void regstat_bb_compute_calls_crossed ()
void regstat_compute_calls_crossed ()
void regstat_free_calls_crossed ()
void dump_reg_info ()

Variables

struct regstat_n_sets_and_refs_tregstat_n_sets_and_refs
static bitmap setjmp_crosses
struct reg_info_treg_info_p
size_t reg_info_p_size

Function Documentation

void dump_reg_info ( )

Dump the register info to FILE.

static void regstat_bb_compute_calls_crossed ( )
static

Compute calls crossed for BB. Live is a scratch bitvector.

 Process the artificial defs and uses at the bottom of the block
 to begin processing.   
     Process the defs.   
     All of the defs except the return value are some sort of
     clobber.  This code is for the return.   
             Kill this register if it is not a subreg store or conditional store.   
static void regstat_bb_compute_ri ( unsigned int  bb_index,
bitmap  live,
bitmap  artificial_uses,
bitmap  local_live,
bitmap  local_processed,
int *  local_live_last_luid 
)
static

Compute register info: lifetime, bb, and number of defs and uses for basic block BB. The three bitvectors are scratch regs used here.

 Process the regs live at the end of the block.  Mark them as
 not local to any one basic block.   
 Process the artificial defs and uses at the bottom of the block
 to begin processing.   
     Process the defs.   
             We have a problem with any pseudoreg that lives
             across the setjmp.  ANSI says that if a user variable
             does not change in value between the setjmp and the
             longjmp, then the longjmp preserves it.  This
             includes longjmp from a place where the pseudo
             appears dead.  (In principle, the value still exists
             if it is in scope.)  If the pseudo goes in a hard
             reg, some other value may occupy that hard reg where
             this pseudo is dead, thus clobbering the pseudo.
             Conclusion: such a pseudo must not go in a hard
             reg.   
     We only care about real sets for calls.  Clobbers cannot
     be depended on.
     Only do this if the value is totally dead.   
     All of the defs except the return value are some sort of
     clobber.  This code is for the return.   
                 If we have seen a use of DREGNO somewhere before (i.e.
                 later in this basic block), and DEF is not a subreg
                 store or conditional store, then kill the register
                 here and add the proper length to its REG_LIVE_LENGTH.

                 If we have not seen a use of DREGNO later in this basic
                 block, then we need to add the length from here to the
                 end of the block to the live length.   
                     Note that LOCAL_LIVE implies LOCAL_PROCESSED, so
                     we don't have to set LOCAL_PROCESSED in this clause.   
                 Kill this register if it is not a subreg store or
                 conditional store.
                 ??? This means that any partial store is live from
                 the last use in a basic block to the start of this
                 basic block.  This results in poor calculations of
                 REG_LIVE_LENGTH in large basic blocks.   
             This register is now live.  Begin to process it locally.

             Note that we don't even get here if the variable was live
             at the end of the block since just a ref inside the block
             does not effect the calculations.   
 Add the liveness length to all registers that were used somewhere
 in this bock, but not between that use and the head of this block.   
 Add the length of the block to all of the registers that were not
 referenced, but still live in this block.   
void regstat_compute_calls_crossed ( void  )

Compute register info: lifetime, bb, and number of defs and uses.

Initialize everything.

void regstat_compute_ri ( void  )

Compute register info: lifetime, bb, and number of defs and uses.

Initialize everything.

 See the setjmp comment in regstat_bb_compute_ri.   

Referenced by split_live_ranges_for_shrink_wrap().

void regstat_free_calls_crossed ( void  )

Free all storage associated with the problem.

void regstat_free_n_sets_and_refs ( void  )

Free the array that holds the REG_N_SETS and REG_N_REFS.

void regstat_free_ri ( void  )

Free all storage associated with the problem.

bitmap regstat_get_setjmp_crosses ( void  )

Return a bitmap containing the set of registers that cross a setjmp. The client should not change or delete this bitmap.

References BASIC_BLOCK, bitmap_clear_bit(), bitmap_copy(), bitmap_set_bit, df_get_artificial_defs(), df_get_artificial_uses(), df_get_live_out(), DF_REF_FLAGS, and DF_REF_REGNO.

void regstat_init_n_sets_and_refs ( void  )

If a pass need to change these values in some magical way or the pass needs to have accurate values for these and is not using incremental df scanning, then it should use REG_N_SETS and REG_N_USES. If the pass is doing incremental scanning then it should be getting the info from DF_REG_DEF_COUNT and DF_REG_USE_COUNT.

Referenced by split_live_ranges_for_shrink_wrap().


Variable Documentation

struct reg_info_t* reg_info_p
size_t reg_info_p_size

The number allocated elements of reg_info_p.

struct regstat_n_sets_and_refs_t* regstat_n_sets_and_refs

Scanning of rtl for dataflow analysis. Copyright (C) 2007-2013 Free Software Foundation, Inc. Contributed by Kenneth Zadeck (zadec.nosp@m.k@na.nosp@m.tural.nosp@m.brid.nosp@m.ge.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/.

bitmap setjmp_crosses
static