GCC Middle and Back End API Reference
expmed.h File Reference

Go to the source code of this file.

Data Structures

struct  mult_cost
struct  algorithm
struct  alg_hash_entry
struct  expmed_op_cheap
struct  expmed_op_costs
struct  target_expmed

Enumerations

enum  alg_code {
  alg_unknown, alg_zero, alg_m, alg_shift,
  alg_add_t_m2, alg_sub_t_m2, alg_add_factor, alg_sub_factor,
  alg_add_t2_m, alg_sub_t2_m, alg_impossible
}

Functions

static struct alg_hash_entryalg_hash_entry_ptr ()
static bool alg_hash_used_p ()
static void set_alg_hash_used_p ()
static int expmed_mode_index ()
static bool * expmed_op_cheap_ptr (struct expmed_op_cheap *eoc, bool speed, enum machine_mode mode)
static int * expmed_op_cost_ptr (struct expmed_op_costs *costs, bool speed, enum machine_mode mode)
static bool * sdiv_pow2_cheap_ptr ()
static void set_sdiv_pow2_cheap ()
static bool sdiv_pow2_cheap ()
static bool * smod_pow2_cheap_ptr ()
static void set_smod_pow2_cheap ()
static bool smod_pow2_cheap ()
static int * zero_cost_ptr ()
static void set_zero_cost ()
static int zero_cost ()
static int * add_cost_ptr ()
static void set_add_cost ()
static int add_cost ()
static int * neg_cost_ptr ()
static void set_neg_cost ()
static int neg_cost ()
static int * shift_cost_ptr ()
static void set_shift_cost ()
static int shift_cost ()
static int * shiftadd_cost_ptr ()
static void set_shiftadd_cost ()
static int shiftadd_cost ()
static int * shiftsub0_cost_ptr ()
static void set_shiftsub0_cost ()
static int shiftsub0_cost ()
static int * shiftsub1_cost_ptr ()
static void set_shiftsub1_cost ()
static int shiftsub1_cost ()
static int * mul_cost_ptr ()
static void set_mul_cost ()
static int mul_cost ()
static int * sdiv_cost_ptr ()
static void set_sdiv_cost ()
static int sdiv_cost ()
static int * udiv_cost_ptr ()
static void set_udiv_cost ()
static int udiv_cost ()
static int * mul_widen_cost_ptr ()
static void set_mul_widen_cost ()
static int mul_widen_cost ()
static int * mul_highpart_cost_ptr ()
static void set_mul_highpart_cost ()
static int mul_highpart_cost ()
static int * convert_cost_ptr (enum machine_mode to_mode, enum machine_mode from_mode, bool speed)
static void set_convert_cost (enum machine_mode to_mode, enum machine_mode from_mode, bool speed, int cost)
static int convert_cost (enum machine_mode to_mode, enum machine_mode from_mode, bool speed)
int mult_by_coeff_cost (HOST_WIDE_INT, enum machine_mode, bool)

Variables

struct target_expmed default_target_expmed
struct target_expmedthis_target_expmed

Enumeration Type Documentation

enum alg_code
Enumerator:
alg_unknown 
alg_zero 
alg_m 
alg_shift 
alg_add_t_m2 
alg_sub_t_m2 
alg_add_factor 
alg_sub_factor 
alg_add_t2_m 
alg_sub_t2_m 
alg_impossible 

Function Documentation

static int* add_cost_ptr ( )
inlinestatic
Subroutine of {set_,}add_cost.  Not to be used otherwise.   

References expmed_op_cost_ptr(), and target_expmed::x_add_cost.

Referenced by add_cost(), and set_add_cost().

static struct alg_hash_entry* alg_hash_entry_ptr ( )
staticread
Return a pointer to the alg_hash_entry at IDX.   

References target_expmed::x_alg_hash.

Referenced by init_expmed(), and synth_mult().

static bool alg_hash_used_p ( )
inlinestatic
Return true if the x_alg_hash field might have been used.   

References target_expmed::x_alg_hash_used_p.

Referenced by init_expmed().

static int convert_cost ( enum machine_mode  to_mode,
enum machine_mode  from_mode,
bool  speed 
)
inlinestatic
Return the cost for converting from FROM_MODE to TO_MODE when optimizing
   for SPEED.   

References convert_cost_ptr().

Referenced by stmt_cost().

static int* convert_cost_ptr ( enum machine_mode  to_mode,
enum machine_mode  from_mode,
bool  speed 
)
inlinestatic
Subroutine of {set_,}convert_cost.  Not to be used otherwise.   

References expmed_mode_index(), alg_hash_entry::speed, and target_expmed::x_convert_cost.

Referenced by convert_cost(), and set_convert_cost().

static int expmed_mode_index ( )
inlinestatic
Compute an index into the cost arrays by mode class.   

Referenced by convert_cost_ptr(), expmed_op_cheap_ptr(), and expmed_op_cost_ptr().

static bool* expmed_op_cheap_ptr ( struct expmed_op_cheap eoc,
bool  speed,
enum machine_mode  mode 
)
inlinestatic
Return a pointer to a boolean contained in EOC indicating whether
   a particular operation performed in MODE is cheap when optimizing
   for SPEED.   

References expmed_op_cheap::cheap, expmed_mode_index(), and alg_hash_entry::speed.

Referenced by sdiv_pow2_cheap_ptr(), and smod_pow2_cheap_ptr().

static int* expmed_op_cost_ptr ( struct expmed_op_costs costs,
bool  speed,
enum machine_mode  mode 
)
inlinestatic
Return a pointer to a cost contained in COSTS when a particular
   operation is performed in MODE when optimizing for SPEED.   

References expmed_op_costs::cost, expmed_mode_index(), and alg_hash_entry::speed.

Referenced by add_cost_ptr(), mul_cost_ptr(), neg_cost_ptr(), sdiv_cost_ptr(), shift_cost_ptr(), shiftadd_cost_ptr(), shiftsub0_cost_ptr(), shiftsub1_cost_ptr(), and udiv_cost_ptr().

static int mul_cost ( )
inlinestatic
Return the cost of doing a multiplication in MODE when optimizing
   for SPEED.   

References mul_cost_ptr().

Referenced by analyze_increments(), expand_divmod(), expmed_mult_highpart_optab(), and stmt_cost().

static int* mul_cost_ptr ( )
inlinestatic
Subroutine of {set_,}mul_cost.  Not to be used otherwise.   

References expmed_op_cost_ptr(), and target_expmed::x_mul_cost.

Referenced by mul_cost(), and set_mul_cost().

static int mul_highpart_cost ( )
inlinestatic
Return the cost for computing the high part of a multiplication in MODE
   when optimizing for SPEED.   

References mul_highpart_cost_ptr().

Referenced by expmed_mult_highpart_optab().

static int* mul_highpart_cost_ptr ( )
inlinestatic
Subroutine of {set_,}mul_highpart_cost.  Not to be used otherwise.   

References alg_hash_entry::speed, and target_expmed::x_mul_highpart_cost.

Referenced by mul_highpart_cost(), and set_mul_highpart_cost().

static int mul_widen_cost ( )
inlinestatic
Return the cost for computing a widening multiplication in MODE when
   optimizing for SPEED.   

References mul_widen_cost_ptr().

Referenced by expand_widening_mult(), and expmed_mult_highpart_optab().

static int* mul_widen_cost_ptr ( )
inlinestatic
Subroutine of {set_,}mul_widen_cost.  Not to be used otherwise.   

References alg_hash_entry::speed, and target_expmed::x_mul_widen_cost.

Referenced by mul_widen_cost(), and set_mul_widen_cost().

int mult_by_coeff_cost ( HOST_WIDE_INT  ,
enum  machine_mode,
bool   
)
static int neg_cost ( )
inlinestatic
Return the cost of computing a negation in MODE when optimizing for
   SPEED.   

References neg_cost_ptr().

Referenced by choose_mult_variant(), expand_mult(), and stmt_cost().

static int* neg_cost_ptr ( )
inlinestatic
Subroutine of {set_,}neg_cost.  Not to be used otherwise.   

References expmed_op_cost_ptr(), and target_expmed::x_neg_cost.

Referenced by neg_cost(), and set_neg_cost().

static int sdiv_cost ( )
inlinestatic
Return the cost of doing a signed division in MODE when optimizing
   for SPEED.   

References sdiv_cost_ptr().

Referenced by expand_divmod().

static int* sdiv_cost_ptr ( )
inlinestatic
Subroutine of {set_,}sdiv_cost.  Not to be used otherwise.   

References expmed_op_cost_ptr(), and target_expmed::x_sdiv_cost.

Referenced by sdiv_cost(), and set_sdiv_cost().

static bool sdiv_pow2_cheap ( )
inlinestatic
Return whether a signed division by a power of 2 is cheap in MODE
   when optimizing for SPEED.   

References sdiv_pow2_cheap_ptr().

Referenced by expand_divmod().

static bool* sdiv_pow2_cheap_ptr ( )
inlinestatic
Subroutine of {set_,}sdiv_pow2_cheap.  Not to be used otherwise.   

References expmed_op_cheap_ptr(), and target_expmed::x_sdiv_pow2_cheap.

Referenced by sdiv_pow2_cheap(), and set_sdiv_pow2_cheap().

static void set_add_cost ( )
inlinestatic
Set the COST of computing an add in MODE when optimizing for SPEED.   

References add_cost_ptr(), and alg_hash_entry::cost.

Referenced by init_expmed_one_mode().

static void set_alg_hash_used_p ( )
inlinestatic
Set whether the x_alg_hash field might have been used.   

References target_expmed::x_alg_hash_used_p.

Referenced by init_expmed().

static void set_convert_cost ( enum machine_mode  to_mode,
enum machine_mode  from_mode,
bool  speed,
int  cost 
)
inlinestatic
Set the COST for converting from FROM_MODE to TO_MODE when optimizing
   for SPEED.   

References convert_cost_ptr(), and alg_hash_entry::cost.

Referenced by init_expmed_one_conv().

static void set_mul_cost ( )
inlinestatic
Set the COST of doing a multiplication in MODE when optimizing for
   SPEED.   

References alg_hash_entry::cost, and mul_cost_ptr().

Referenced by init_expmed_one_mode().

static void set_mul_highpart_cost ( )
inlinestatic
Set the COST for computing the high part of a multiplication in MODE
   when optimizing for SPEED.   

References alg_hash_entry::cost, and mul_highpart_cost_ptr().

Referenced by init_expmed_one_mode().

static void set_mul_widen_cost ( )
inlinestatic
Set the COST for computing a widening multiplication in MODE when
   optimizing for SPEED.   

References alg_hash_entry::cost, and mul_widen_cost_ptr().

Referenced by init_expmed_one_mode().

static void set_neg_cost ( )
inlinestatic
Set the COST of computing a negation in MODE when optimizing for SPEED.   

References alg_hash_entry::cost, and neg_cost_ptr().

Referenced by init_expmed_one_mode().

static void set_sdiv_cost ( )
inlinestatic
Set the COST of doing a signed division in MODE when optimizing
   for SPEED.   

References alg_hash_entry::cost, and sdiv_cost_ptr().

Referenced by init_expmed_one_mode().

static void set_sdiv_pow2_cheap ( )
inlinestatic
Set whether a signed division by a power of 2 is cheap in MODE
   when optimizing for SPEED.   

References sdiv_pow2_cheap_ptr().

Referenced by init_expmed_one_mode().

static void set_shift_cost ( )
inlinestatic
Set the COST of doing a shift in MODE by BITS when optimizing for SPEED.   

References alg_hash_entry::cost, and shift_cost_ptr().

Referenced by init_expmed_one_mode().

static void set_shiftadd_cost ( )
inlinestatic
Set the COST of doing a shift in MODE by BITS followed by an add when
   optimizing for SPEED.   

References alg_hash_entry::cost, and shiftadd_cost_ptr().

Referenced by init_expmed_one_mode().

static void set_shiftsub0_cost ( )
inlinestatic
Set the COST of doing a shift in MODE by BITS and then subtracting a
   value when optimizing for SPEED.   

References alg_hash_entry::cost, and shiftsub0_cost_ptr().

Referenced by init_expmed_one_mode().

static void set_shiftsub1_cost ( )
inlinestatic
Set the COST of subtracting a shift in MODE by BITS from a value when
   optimizing for SPEED.   

References alg_hash_entry::cost, and shiftsub1_cost_ptr().

Referenced by init_expmed_one_mode().

static void set_smod_pow2_cheap ( )
inlinestatic
Set whether a signed modulo by a power of 2 is CHEAP in MODE when
   optimizing for SPEED.   

References smod_pow2_cheap_ptr().

Referenced by init_expmed_one_mode().

static void set_udiv_cost ( )
inlinestatic
Set the COST of doing an unsigned division in MODE when optimizing
   for SPEED.   

References alg_hash_entry::cost, and udiv_cost_ptr().

Referenced by init_expmed_one_mode().

static void set_zero_cost ( )
inlinestatic
Set the COST of loading zero when optimizing for SPEED.   

References alg_hash_entry::cost, and zero_cost_ptr().

Referenced by init_expmed().

static int shift_cost ( )
inlinestatic
Return the cost of doing a shift in MODE by BITS when optimizing for
   SPEED.   

References shift_cost_ptr().

Referenced by expand_divmod(), expand_sdiv_pow2(), expand_shift_1(), expmed_mult_highpart(), expmed_mult_highpart_optab(), and synth_mult().

static int* shift_cost_ptr ( )
inlinestatic
Subroutine of {set_,}shift_cost.  Not to be used otherwise.   

References expmed_op_cost_ptr(), and target_expmed::x_shift_cost.

Referenced by set_shift_cost(), and shift_cost().

static int shiftadd_cost ( )
inlinestatic
Return the cost of doing a shift in MODE by BITS followed by an add
   when optimizing for SPEED.   

References shiftadd_cost_ptr().

Referenced by get_shiftadd_cost(), and synth_mult().

static int* shiftadd_cost_ptr ( )
inlinestatic
Subroutine of {set_,}shiftadd_cost.  Not to be used otherwise.   

References expmed_op_cost_ptr(), and target_expmed::x_shiftadd_cost.

Referenced by set_shiftadd_cost(), and shiftadd_cost().

static int shiftsub0_cost ( )
inlinestatic
Return the cost of doing a shift in MODE by BITS and then subtracting
   a value when optimizing for SPEED.   

References shiftsub0_cost_ptr().

Referenced by get_shiftadd_cost(), and synth_mult().

static int* shiftsub0_cost_ptr ( )
inlinestatic
Subroutine of {set_,}shiftsub0_cost.  Not to be used otherwise.   

References expmed_op_cost_ptr(), and target_expmed::x_shiftsub0_cost.

Referenced by set_shiftsub0_cost(), and shiftsub0_cost().

static int shiftsub1_cost ( )
inlinestatic
Return the cost of subtracting a shift in MODE by BITS from a value
   when optimizing for SPEED.   

References shiftsub1_cost_ptr().

Referenced by get_shiftadd_cost(), and synth_mult().

static int* shiftsub1_cost_ptr ( )
inlinestatic
Subroutine of {set_,}shiftsub1_cost.  Not to be used otherwise.   

References expmed_op_cost_ptr(), and target_expmed::x_shiftsub1_cost.

Referenced by set_shiftsub1_cost(), and shiftsub1_cost().

static bool smod_pow2_cheap ( )
inlinestatic
Return whether a signed modulo by a power of 2 is cheap in MODE
   when optimizing for SPEED.   

References smod_pow2_cheap_ptr().

Referenced by expand_divmod().

static bool* smod_pow2_cheap_ptr ( )
inlinestatic
Subroutine of {set_,}smod_pow2_cheap.  Not to be used otherwise.   

References expmed_op_cheap_ptr(), and target_expmed::x_smod_pow2_cheap.

Referenced by set_smod_pow2_cheap(), and smod_pow2_cheap().

static int udiv_cost ( )
inlinestatic
Return the cost of doing an unsigned division in MODE when
   optimizing for SPEED.   

References udiv_cost_ptr().

Referenced by expand_divmod().

static int* udiv_cost_ptr ( )
inlinestatic
Subroutine of {set_,}udiv_cost.  Not to be used otherwise.   

References expmed_op_cost_ptr(), and target_expmed::x_udiv_cost.

Referenced by set_udiv_cost(), and udiv_cost().

static int zero_cost ( )
inlinestatic
Return the COST of loading zero when optimizing for SPEED.   

References zero_cost_ptr().

Referenced by synth_mult().

static int* zero_cost_ptr ( )
inlinestatic
Subroutine of {set_,}zero_cost.  Not to be used otherwise.   

References alg_hash_entry::speed, and target_expmed::x_zero_cost.

Referenced by set_zero_cost(), and zero_cost().


Variable Documentation

struct target_expmed default_target_expmed
@verbatim Medium-level subroutines: convert bit-field store and extract

and shifts, multiplies and divides to rtl instructions. 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/.

struct target_expmed* this_target_expmed