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

Data Structures

struct  reg_pref

Functions

void reg_set_to_hard_reg_set ()
void init_reg_sets ()
void save_register_info ()
static void restore_register_info ()
static void init_reg_sets_1 ()
void init_reg_modes_target ()
void init_regs ()
void reinit_regs ()
void init_fake_stack_mems ()
int register_move_cost ()
int memory_move_cost ()
int memory_move_secondary_cost (enum machine_mode mode, reg_class_t rclass, bool in)
enum machine_mode choose_hard_reg_mode (unsigned int regno, unsigned int nregs, bool call_saved)
void fix_register ()
void globalize_reg ()
enum reg_class reg_preferred_class ()
enum reg_class reg_alternate_class ()
enum reg_class reg_allocno_class ()
static void allocate_reg_info ()
bool resize_reg_info ()
void free_reg_info ()
static unsigned int reginfo_init ()
rtl_opt_passmake_pass_reginfo_init ()
void setup_reg_classes (int regno, enum reg_class prefclass, enum reg_class altclass, enum reg_class allocnoclass)
static void reg_scan_mark_refs (rtx, rtx)
void reg_scan ()
static void reg_scan_mark_refs ()
int reg_class_subset_p ()
int reg_classes_intersect_p ()
static void record_subregs_of_mode ()
static void find_subregs_of_mode ()
void init_subregs_of_mode ()
bool invalid_mode_change_p (unsigned int regno, enum reg_class rclass)
void finish_subregs_of_mode ()

Variables

int max_regno
struct target_hard_regs default_target_hard_regs
struct target_regs default_target_regs
struct target_hard_regsthis_target_hard_regs = &default_target_hard_regs
struct target_regsthis_target_regs = &default_target_regs
static const char initial_fixed_regs [] = FIXED_REGISTERS
static const char initial_call_used_regs [] = CALL_USED_REGISTERS
static const char initial_call_really_used_regs [] = CALL_REALLY_USED_REGISTERS
char global_regs [FIRST_PSEUDO_REGISTER]
static tree global_regs_decl [FIRST_PSEUDO_REGISTER]
regset regs_invalidated_by_call_regset
regset fixed_reg_set_regset
static bitmap_obstack persistent_obstack
static int initial_reg_alloc_order [FIRST_PSEUDO_REGISTER] = REG_ALLOC_ORDER
static const unsigned int_reg_class_contents [N_REG_CLASSES][N_REG_INTS] = REG_CLASS_CONTENTS
static const char *const initial_reg_names [] = REGISTER_NAMES
const char * reg_class_names [] = REG_CLASS_NAMES
static int no_global_reg_vars = 0
static char saved_fixed_regs [FIRST_PSEUDO_REGISTER]
static char saved_call_used_regs [FIRST_PSEUDO_REGISTER]
static char saved_call_really_used_regs [FIRST_PSEUDO_REGISTER]
static const char * saved_reg_names [FIRST_PSEUDO_REGISTER]
static HARD_REG_SET saved_accessible_reg_set
static HARD_REG_SET saved_operand_reg_set
static struct reg_prefreg_pref
static int reg_info_size
static int max_regno_since_last_resize
static bitmap invalid_mode_changes

Function Documentation

static void allocate_reg_info ( )
static
Allocate space for reg info and initilize it.   

References reg_pref::allocnoclass, reg_pref::altclass, max_reg_num(), memset(), reg_pref::prefclass, reg_info_size, and reg_renumber.

Referenced by resize_reg_info().

enum machine_mode choose_hard_reg_mode ( unsigned int  regno,
unsigned int  nregs,
bool  call_saved 
)
Return a machine mode that is legitimate for hard reg REGNO and large
   enough to save nregs.  If we can't find one, return VOIDmode.
   If CALL_SAVED is true, only consider modes that are call saved.   

Referenced by expand_builtin_init_dwarf_reg_sizes(), and init_reg_modes_target().

static void find_subregs_of_mode ( )
static
Call record_subregs_of_mode for all the subregs in X.   

References record_subregs_of_mode().

Referenced by init_subregs_of_mode().

void finish_subregs_of_mode ( void  )

Referenced by finish_costs().

void fix_register ( )
Specify the usage characteristics of the register named NAME.
   It should be a fixed register if FIXED and a
   call-used register if CALL_USED.   

References decode_reg_name_and_count(), error(), and warning().

Referenced by handle_common_deferred_options().

void free_reg_info ( void  )
Free up the space allocated by allocate_reg_info.   

References free(), and reg_renumber.

Referenced by move_loop_invariants(), one_code_hoisting_pass(), regmove_optimize(), and rest_of_handle_final().

void globalize_reg ( )
Mark register number I as global.   

References error(), error_at(), global_regs, global_regs_decl, inform(), reinit_regs(), and warning_at().

Referenced by make_decl_rtl().

void init_fake_stack_mems ( void  )
Initialize some fake stack-frame MEM references for use in
   memory_move_secondary_cost.   

References gen_rtx_MEM().

Referenced by backend_init_target().

void init_reg_modes_target ( void  )
Compute the table of register modes.
   These values are used to record death information for individual registers
   (as opposed to a multi-register mode).
   This function might be invoked more than once, if the target has support
   for changing register usage conventions on a per-function basis.

References choose_hard_reg_mode(), and word_mode.

Referenced by init_emit_regs().

void init_reg_sets ( void  )
Function called only once per target_globals to initialize the
   target_hard_regs structure.  Once this is done, various switches
   may override.   

References initial_call_really_used_regs, initial_call_used_regs, initial_fixed_regs, int_reg_class_contents, and memcpy().

Referenced by general_init(), and save_target_globals().

static void init_reg_sets_1 ( )
static
After switches have been processed, which perhaps alter
   `fixed_regs' and `call_used_regs', convert them to HARD_REG_SETs.   

References bitmap_obstack_initialize(), global_regs, hard_reg_set_intersect_p(), hard_reg_set_subset_p(), memset(), restore_register_info(), and targetm.

Referenced by init_regs().

void init_regs ( void  )
Finish initializing the register sets and initialize the register modes.
   This function might be invoked more than once, if the target has support
   for changing register usage conventions on a per-function basis.

References init_reg_sets_1().

Referenced by backend_init_target(), and reinit_regs().

void init_subregs_of_mode ( void  )
bool invalid_mode_change_p ( unsigned int  regno,
enum reg_class  rclass 
)
Return 1 if REGNO has had an invalid mode change in CLASS from FROM
   mode.   

References bitmap_bit_p().

Referenced by find_costs_and_classes(), print_allocno_costs(), and print_pseudo_costs().

rtl_opt_pass* make_pass_reginfo_init ( )
int memory_move_cost ( )
Compute cost of moving registers to/from memory.   

References targetm.

Referenced by choose_reload_regs(), reload_cse_simplify_set(), and setup_class_subset_and_memory_move_costs().

int memory_move_secondary_cost ( enum machine_mode  mode,
reg_class_t  rclass,
bool  in 
)
Compute extra cost of moving registers to/from memory due to reloads.
   Only needed if secondary reloads are required for memory moves.   

References memory_move_secondary_cost(), register_move_cost(), and secondary_reload_class().

Referenced by default_memory_move_cost(), and memory_move_secondary_cost().

static void record_subregs_of_mode ( )
static

References bitmap_bit_p(), and bitmap_set_bit().

Referenced by find_subregs_of_mode().

enum reg_class reg_allocno_class ( )
enum reg_class reg_alternate_class ( )
int reg_class_subset_p ( )
int reg_classes_intersect_p ( )
Return nonzero if there is a register that is in both C1 and C2.   

References hard_reg_set_intersect_p().

Referenced by check_and_make_def_conflict(), check_and_make_def_use_conflict(), choose_reload_regs(), and make_pseudo_conflict().

enum reg_class reg_preferred_class ( )
Return the reg_class in which pseudo reg number REGNO is best allocated.
   This function is sometimes called before the info has been computed.
   When that happens, just return GENERAL_REGS, which is innocuous.   

References reg_pref::prefclass.

Referenced by dump_reg_info(), find_costs_and_classes(), find_reloads(), ira_bad_reload_regno_1(), move_invariants(), regmove_backward_pass(), setup_preferred_alternate_classes_for_new_pseudos(), update_conflict_hard_reg_costs(), and update_equiv_regs().

void reg_scan ( )

References reg_scan_mark_refs(), timevar_pop(), and timevar_push().

Referenced by cse_main().

static void reg_scan_mark_refs ( rtx  ,
rtx   
)
static
This is the `regscan' pass of the compiler, run just before cse and
   again just before loop.  It finds the first and last use of each
   pseudo-register.   

Referenced by reg_scan(), and reg_scan_mark_refs().

static void reg_scan_mark_refs ( )
static
X is the expression to scan.  INSN is the insn it appears in.
   NOTE_FLAG is nonzero if X is from INSN's notes rather than its body.
   We should only record information for REGs with numbers
   greater than or equal to MIN_REGNO.   

References find_reg_note(), reg_scan_mark_refs(), SET, and set_reg_attrs_from_value().

void reg_set_to_hard_reg_set ( )
Given a register bitmap, turn on the bits in a HARD_REG_SET that
   correspond to the hard registers, if any, set in that map.  This
   could be done far more efficiently by having all sorts of special-cases
   with moving single words, but probably isn't worth the trouble.   
static unsigned int reginfo_init ( )
static
Initialize some global data for this pass.   

References df, and df_compute_regs_ever_live().

int register_move_cost ( )
Compute cost of moving data from a register of class FROM to one of
   TO, using MODE.   

References targetm.

Referenced by choose_reload_regs(), find_reloads(), find_valid_class(), find_valid_class_1(), ira_init_register_move_cost(), memory_move_secondary_cost(), and reload_cse_simplify_set().

void reinit_regs ( void  )
The same as previous function plus initializing IRA.   

References init_regs(), and ira_init().

Referenced by globalize_reg().

bool resize_reg_info ( void  )
Resize reg info. The new elements will be initialized.  Return TRUE
   if new pseudos were added since the last call.   

References allocate_reg_info(), reg_pref::allocnoclass, reg_pref::altclass, max_reg_num(), memset(), reg_pref::prefclass, reg_info_size, and reg_renumber.

Referenced by expand_reg_data(), expand_reg_info(), find_costs_and_classes(), ira(), lra_get_allocno_class(), lra_get_regno_hard_regno(), and move_invariants().

static void restore_register_info ( )
static
Restore the register information.   

References memcpy().

Referenced by init_reg_sets_1().

void save_register_info ( void  )
Save the register information.   

References memcpy().

Referenced by backend_init().

void setup_reg_classes ( int  regno,
enum reg_class  prefclass,
enum reg_class  altclass,
enum reg_class  allocnoclass 
)

Variable Documentation

struct target_hard_regs default_target_hard_regs
struct target_regs default_target_regs
regset fixed_reg_set_regset
Same information as FIXED_REG_SET but in regset form.   

Referenced by copy_fixed_regs().

tree global_regs_decl[FIRST_PSEUDO_REGISTER]
static
Declaration for the global register.  

Referenced by globalize_reg().

const char initial_call_really_used_regs[] = CALL_REALLY_USED_REGISTERS
static
Data for initializing call_really_used_regs.   

Referenced by init_reg_sets().

const char initial_call_used_regs[] = CALL_USED_REGISTERS
static
Data for initializing call_used_regs.   

Referenced by init_reg_sets().

const char initial_fixed_regs[] = FIXED_REGISTERS
static
Data for initializing fixed_regs.   

Referenced by init_reg_sets().

int initial_reg_alloc_order[FIRST_PSEUDO_REGISTER] = REG_ALLOC_ORDER
static
Used to initialize reg_alloc_order.   
const char* const initial_reg_names[] = REGISTER_NAMES
static
Array containing all of the register names.   
const unsigned int_reg_class_contents[N_REG_CLASSES][N_REG_INTS] = REG_CLASS_CONTENTS
static

Referenced by init_reg_sets().

bitmap invalid_mode_changes
static
Passes for keeping and updating info about modes of registers
   inside subregisters.   
int max_regno
@verbatim Compute different info about registers.

Copyright (C) 1987-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/.

This file contains regscan pass of the compiler and passes for
   dealing with info about modes of pseudo-registers inside
   subregisters.  It also defines some tables of information about the
   hardware registers, function init_reg_sets to initialize the
   tables, and other auxiliary functions to deal with info about
   registers and their classes.   
Maximum register number used in this function, plus one.   

Referenced by assign_by_spills(), build_insn_chain(), calculate_elim_costs_all_insns(), choose_best_pseudo_reg(), choose_reload_regs(), create_live_range_start_chains(), dead_or_predicable(), extend_deps_reg_info(), finish_spills(), fix_reg_equiv_init(), grow_reg_equivs(), if_convert(), implicit_clobber_conflict_p(), init_eliminable_invariants(), init_live_reload_and_inheritance_pseudos(), init_lives(), init_loop_tree_node(), init_regno_assign_info(), ira(), ira_print_disposition(), ira_sort_regnos_for_alter_reg(), lra_assign(), lra_coalesce(), lra_create_live_ranges(), lra_final_code_change(), lra_need_for_spills_p(), maybe_extend_reg_info_p(), print_live_ranges(), rebuild_regno_allocno_maps(), regstat_compute_calls_crossed(), regstat_compute_ri(), regstat_init_n_sets_and_refs(), reload(), reload_as_needed(), remove_some_program_points_and_update_live_ranges(), rest_of_handle_sms(), sched_init(), setup_live_pseudos_and_spill_after_risky_transforms(), setup_preferred_alternate_classes_for_new_pseudos(), setup_reg_equiv_init(), spill_hard_reg(), subst_reloads(), and update_equiv_regs().

int max_regno_since_last_resize
static
Max_reg_num still last resize_reg_info call.   
int no_global_reg_vars = 0
static
No more global register variables may be declared; true once
   reginfo has been initialized.   
bitmap_obstack persistent_obstack
static
The bitmap_obstack is used to hold some static variables that
   should not be reset after each function is compiled.   
int reg_info_size
static
Current size of reg_info.   

Referenced by allocate_reg_info(), and resize_reg_info().

struct reg_pref* reg_pref
static
Record preferences of each pseudo.  This is available after RA is
   run.   
regset regs_invalidated_by_call_regset
Same information as REGS_INVALIDATED_BY_CALL but in regset form to be used
   in dataflow more conveniently.   

Referenced by df_lr_confluence_n(), df_md_confluence_n(), df_rd_local_compute(), and df_scan_start_dump().

HARD_REG_SET saved_accessible_reg_set
static
char saved_call_really_used_regs[FIRST_PSEUDO_REGISTER]
static
char saved_call_used_regs[FIRST_PSEUDO_REGISTER]
static
char saved_fixed_regs[FIRST_PSEUDO_REGISTER]
static
We need to save copies of some of the register information which
   can be munged by command-line switches so we can restore it during
   subsequent back-end reinitialization.   
HARD_REG_SET saved_operand_reg_set
static
const char* saved_reg_names[FIRST_PSEUDO_REGISTER]
static
struct target_hard_regs* this_target_hard_regs = &default_target_hard_regs
struct target_regs* this_target_regs = &default_target_regs