GCC Middle and Back End API Reference
lower-subreg.c File Reference

Data Structures

struct  cost_rtxes

Enumerations

enum  classify_move_insn { NOT_SIMPLE_MOVE, DECOMPOSABLE_SIMPLE_MOVE, SIMPLE_MOVE }

Functions

static int shift_cost (bool speed_p, struct cost_rtxes *rtxes, enum rtx_code code, enum machine_mode mode, int op1)
static void compute_splitting_shift (bool speed_p, struct cost_rtxes *rtxes, bool *splitting, enum rtx_code code, int word_move_zero_cost, int word_move_cost)
static void compute_costs ()
void init_lower_subreg ()
static bool simple_move_operand ()
static rtx simple_move ()
static bool find_pseudo_copy ()
static void propagate_pseudo_copies ()
static int find_decomposable_subregs ()
static void decompose_register ()
static rtx simplify_subreg_concatn (enum machine_mode outermode, rtx op, unsigned int byte)
static rtx simplify_gen_subreg_concatn (enum machine_mode outermode, rtx op, enum machine_mode innermode, unsigned int byte)
static bool resolve_reg_p ()
static bool resolve_subreg_p ()
static int resolve_subreg_use ()
static int adjust_decomposed_uses ()
static void resolve_reg_notes ()
static bool can_decompose_p ()
static rtx resolve_simple_move ()
static bool resolve_clobber ()
static bool resolve_use ()
static void resolve_debug ()
static bool find_decomposable_shift_zext ()
static rtx resolve_shift_zext ()
static void dump_shift_choices ()
static void dump_choices ()
static void decompose_multiword_subregs ()
static bool gate_handle_lower_subreg ()
static unsigned int rest_of_handle_lower_subreg ()
static unsigned int rest_of_handle_lower_subreg2 ()
rtl_opt_passmake_pass_lower_subreg ()
rtl_opt_passmake_pass_lower_subreg2 ()

Variables

static bitmap decomposable_context
static bitmap non_decomposable_context
static bitmap subreg_context
static vec< bitmapreg_copy_graph
struct target_lower_subreg default_target_lower_subreg
struct target_lower_subregthis_target_lower_subreg = &default_target_lower_subreg

Enumeration Type Documentation

A pointer to one of these values is passed to
   find_decomposable_subregs via for_each_rtx.   
Enumerator:
NOT_SIMPLE_MOVE 
DECOMPOSABLE_SIMPLE_MOVE 
SIMPLE_MOVE 

Function Documentation

static int adjust_decomposed_uses ( )
static
This is called via for_each_rtx.  Look for SUBREGs which can be
   decomposed and decomposed REGs that need copying.   

References copy_rtx(), resolve_reg_p(), resolve_subreg_p(), and simplify_subreg_concatn().

Referenced by resolve_debug().

static bool can_decompose_p ( )
static
Return whether X can be decomposed into subwords.   

References bitmap_bit_p(), simplify_subreg_regno(), and word_mode.

Referenced by resolve_simple_move().

static void compute_costs ( )
static
Compute what we should do when optimizing for speed or size; SPEED_P
   selects which.  Use RTXES for computing costs.   

References compute_splitting_shift(), cost_rtxes::set, set_rtx_cost(), set_src_cost(), cost_rtxes::source, cost_rtxes::target, word_mode, and cost_rtxes::zext.

Referenced by init_lower_subreg().

static void compute_splitting_shift ( bool  speed_p,
struct cost_rtxes rtxes,
bool *  splitting,
enum rtx_code  code,
int  word_move_zero_cost,
int  word_move_cost 
)
static
For each X in the range [0, BITS_PER_WORD), set SPLITTING[X]
   to true if it is profitable to split a double-word CODE shift
   of X + BITS_PER_WORD bits.  SPEED_P says whether we are testing
   for speed or size profitability.

   Use the rtxes in RTXES to calculate costs.  WORD_MOVE_ZERO_COST is
   the cost of moving zero into a word-mode register.  WORD_MOVE_COST
   is the cost of moving between word registers.   

References shift_cost(), and word_mode.

Referenced by compute_costs().

static void decompose_register ( )
static
Decompose REGNO into word-sized components.  We smash the REG node
   in place.  This ensures that (1) something goes wrong quickly if we
   fail to make some replacement, and (2) the debug information inside
   the symbol table is automatically kept up to date.   

References dump_file, gen_reg_rtx_offset(), regno_reg_rtx, rtvec_alloc(), and word_mode.

Referenced by decompose_multiword_subregs().

static void dump_choices ( )
static
Print to dump_file a description of what we're doing when optimizing
   for speed or size; SPEED_P says which.  DESCRIPTION is a description
   of the SPEED_P choice.   

References dump_file, and dump_shift_choices().

Referenced by decompose_multiword_subregs().

static void dump_shift_choices ( )
static
Print to dump_file a description of what we're doing with shift code CODE.
   SPLITTING[X] is true if we are splitting shifts by X + BITS_PER_WORD.   

References dump_file.

Referenced by dump_choices().

static bool find_decomposable_shift_zext ( )
static
Check if INSN is a decomposable multiword-shift or zero-extend and
   set the decomposable_context bitmap accordingly.  SPEED_P is true
   if we are optimizing INSN for speed rather than size.  Return true
   if INSN is decomposable.   

References bitmap_set_bit(), and word_mode.

Referenced by decompose_multiword_subregs().

static int find_decomposable_subregs ( )
static
This is called via for_each_rtx.  If we find a SUBREG which we
   could use to decompose a pseudo-register, set a bit in
   DECOMPOSABLE_CONTEXT.  If we find an unadorned register which is
   not a simple pseudo-register copy, DATA will point at the type of
   move, and we set a bit in DECOMPOSABLE_CONTEXT or
   NON_DECOMPOSABLE_CONTEXT as appropriate.   

References bitmap_set_bit(), DECOMPOSABLE_SIMPLE_MOVE, for_each_rtx(), NOT_SIMPLE_MOVE, SIMPLE_MOVE, and word_mode.

Referenced by decompose_multiword_subregs().

static bool find_pseudo_copy ( )
static
If SET is a copy from one multi-word pseudo-register to another,
   record that in reg_copy_graph.  Return whether it is such a
   copy.   

References bitmap_set_bit().

Referenced by decompose_multiword_subregs().

static bool gate_handle_lower_subreg ( )
static
Gate function for lower subreg pass.   
void init_lower_subreg ( void  )
Do one-per-target initialisation.  This involves determining
   which operations on the machine are profitable.  If none are found,
   then the pass just returns when called.   

References compute_costs(), gen_rtx_REG(), memset(), cost_rtxes::set, cost_rtxes::shift, cost_rtxes::source, cost_rtxes::target, this_target_lower_subreg, word_mode, and cost_rtxes::zext.

Referenced by backend_init_target().

rtl_opt_pass* make_pass_lower_subreg ( )
rtl_opt_pass* make_pass_lower_subreg2 ( )
static void propagate_pseudo_copies ( )
static
Look through the registers in DECOMPOSABLE_CONTEXT.  For each case
   where they are copied to another register, add the register to
   which they are copied to DECOMPOSABLE_CONTEXT.  Use
   NON_DECOMPOSABLE_CONTEXT to limit this--we don't bother to track
   copies of registers which are in NON_DECOMPOSABLE_CONTEXT.   

References bitmap_and_compl(), bitmap_clear(), bitmap_copy(), bitmap_empty_p(), bitmap_ior_and_compl_into(), bitmap_ior_into(), propagate(), and queue.

Referenced by decompose_multiword_subregs().

static bool resolve_clobber ( )
static
Change a CLOBBER of a decomposed register into a CLOBBER of the
   component registers.  Return whether we changed something.   

References df_insn_rescan(), emit_insn_after(), resolve_reg_notes(), resolve_reg_p(), resolve_subreg_p(), simplify_gen_subreg_concatn(), validate_change(), and word_mode.

Referenced by decompose_multiword_subregs().

static void resolve_debug ( )
static
A VAR_LOCATION can be simplified.   

References adjust_decomposed_uses(), df_insn_rescan(), for_each_rtx(), and resolve_reg_notes().

Referenced by decompose_multiword_subregs().

static void resolve_reg_notes ( )
static
static bool resolve_reg_p ( )
static
Return whether we should resolve X into the registers into which it
   was decomposed.   

Referenced by adjust_decomposed_uses(), resolve_clobber(), resolve_reg_notes(), resolve_shift_zext(), resolve_simple_move(), resolve_subreg_p(), resolve_subreg_use(), and resolve_use().

static rtx resolve_shift_zext ( )
static
Decompose a more than word wide shift (in INSN) of a multiword
   pseudo or a multiword zero-extend of a wordmode pseudo into a move
   and 'set to zero' insn.  Return a pointer to the new insn when a
   replacement was done.   

References copy_rtx(), delete_insn(), dump_file, emit_insn_before(), emit_move_insn(), end_sequence(), expand_shift(), get_insns(), resolve_reg_p(), simplify_gen_subreg_concatn(), start_sequence(), and word_mode.

Referenced by decompose_multiword_subregs().

static bool resolve_subreg_p ( )
static
Return whether X is a SUBREG of a register which we need to
   resolve.   

References resolve_reg_p().

Referenced by adjust_decomposed_uses(), resolve_clobber(), resolve_simple_move(), resolve_subreg_use(), and resolve_use().

static int resolve_subreg_use ( )
static
This is called via for_each_rtx.  Look for SUBREGs which need to be
   decomposed.   

References resolve_reg_p(), resolve_subreg_p(), simplify_subreg_concatn(), and validate_change().

Referenced by decompose_multiword_subregs(), resolve_reg_notes(), and resolve_simple_move().

static bool resolve_use ( )
static
A USE of a decomposed register is no longer meaningful.  Return
   whether we changed something.   

References delete_insn(), resolve_reg_notes(), resolve_reg_p(), and resolve_subreg_p().

Referenced by decompose_multiword_subregs().

static unsigned int rest_of_handle_lower_subreg ( )
static
Implement first lower subreg pass.   

References decompose_multiword_subregs().

static unsigned int rest_of_handle_lower_subreg2 ( )
static
Implement second lower subreg pass.   

References decompose_multiword_subregs().

static int shift_cost ( bool  speed_p,
struct cost_rtxes rtxes,
enum rtx_code  code,
enum machine_mode  mode,
int  op1 
)
static
Return the cost of a CODE shift in mode MODE by OP1 bits, using the
   rtxes in RTXES.  SPEED_P selects between the speed and size cost.   

References set_src_cost(), cost_rtxes::shift, and cost_rtxes::source.

Referenced by compute_splitting_shift().

static rtx simple_move ( )
static
If INSN is a single set between two objects that we want to split,
   return the single set.  SPEED_P says whether we are optimizing
   INSN for speed or size.

   INSN should have been passed to recog and extract_insn before this
   is called.   

References mode_for_size(), recog_data_d::n_operands, recog_data_d::operand, recog_data, and simple_move_operand().

Referenced by decompose_multiword_subregs().

static bool simple_move_operand ( )
static

References mode_dependent_address_p().

Referenced by simple_move().

static rtx simplify_gen_subreg_concatn ( enum machine_mode  outermode,
rtx  op,
enum machine_mode  innermode,
unsigned int  byte 
)
static
Wrapper around simplify_gen_subreg which handles CONCATN.   

References simplify_gen_subreg(), and simplify_subreg_concatn().

Referenced by resolve_clobber(), resolve_shift_zext(), and resolve_simple_move().

static rtx simplify_subreg_concatn ( enum machine_mode  outermode,
rtx  op,
unsigned int  byte 
)
static

Variable Documentation

bitmap decomposable_context
static
Bit N in this bitmap is set if regno N is used in a context in
   which we can decompose it.   
struct target_lower_subreg default_target_lower_subreg
bitmap non_decomposable_context
static
Bit N in this bitmap is set if regno N is used in a context in
   which it can not be decomposed.   
vec<bitmap> reg_copy_graph
static
Bit N in the bitmap in element M of this array is set if there is a
   copy from reg M to reg N.   
bitmap subreg_context
static
Bit N in this bitmap is set if regno N is used in a subreg
   which changes the mode but not the size.  This typically happens
   when the register accessed as a floating-point value; we want to
   avoid generating accesses to its subwords in integer modes.   
struct target_lower_subreg* this_target_lower_subreg = &default_target_lower_subreg

Referenced by init_lower_subreg().