GCC Middle and Back End API Reference
expmed.h File Reference
This graph shows which files directly or indirectly include this file:

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

Macros

#define MULT_COST_LESS(X, Y)
#define CHEAPER_MULT_COST(X, Y)
#define NUM_ALG_HASH_ENTRIES   307
#define NUM_MODE_INT   (MAX_MODE_INT - MIN_MODE_INT + 1)
#define NUM_MODE_PARTIAL_INT
#define NUM_MODE_VECTOR_INT
#define NUM_MODE_IP_INT   (NUM_MODE_INT + NUM_MODE_PARTIAL_INT)
#define NUM_MODE_IPV_INT   (NUM_MODE_IP_INT + NUM_MODE_VECTOR_INT)
#define this_target_expmed   (&default_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 boolexpmed_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 boolsdiv_pow2_cheap_ptr ()
static void set_sdiv_pow2_cheap ()
static bool sdiv_pow2_cheap ()
static boolsmod_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

Macro Definition Documentation

#define CHEAPER_MULT_COST (   X,
  Y 
)
Value:
((X)->cost < (Y)->cost \
|| ((X)->cost == (Y)->cost \
&& (X)->latency < (Y)->latency))

This macro is used to compare two pointers to mult_costs against each other. The macro returns true if X is cheaper than Y. Currently, the cheaper of two mult_costs is the one with the lower "cost". If "cost"s are tied, the lower latency is cheaper.

#define MULT_COST_LESS (   X,
  Y 
)
Value:
((X)->cost < (Y) \
|| ((X)->cost == (Y) && (X)->latency < (Y)))

This macro is used to compare a pointer to a mult_cost against an single integer "rtx_cost" value. This is equivalent to the macro CHEAPER_MULT_COST(X,Z) where Z = {Y,Y}.

#define NUM_ALG_HASH_ENTRIES   307

The number of cache/hash entries.

#define NUM_MODE_INT   (MAX_MODE_INT - MIN_MODE_INT + 1)
#define NUM_MODE_IP_INT   (NUM_MODE_INT + NUM_MODE_PARTIAL_INT)
#define NUM_MODE_IPV_INT   (NUM_MODE_IP_INT + NUM_MODE_VECTOR_INT)
#define NUM_MODE_PARTIAL_INT
Value:
(MIN_MODE_PARTIAL_INT == VOIDmode ? 0 \
: MAX_MODE_PARTIAL_INT - MIN_MODE_PARTIAL_INT + 1)
#define NUM_MODE_VECTOR_INT
Value:
(MIN_MODE_VECTOR_INT == VOIDmode ? 0 \
: MAX_MODE_VECTOR_INT - MIN_MODE_VECTOR_INT + 1)
#define this_target_expmed   (&default_target_expmed)

Enumeration Type Documentation

enum alg_code

Target-dependent costs for expmed.c. 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/.

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 ( )
inlinestatic

Return the cost of computing an add in MODE when optimizing for SPEED.

Referenced by alloc_cand_and_find_basis(), invert_mod2n(), and process_bb_node_for_costs().

static int* add_cost_ptr ( )
inlinestatic

Subroutine of {set_,}add_cost. Not to be used otherwise.

Referenced by set_zero_cost(), and zero_cost_ptr().

static struct alg_hash_entry* alg_hash_entry_ptr ( )
staticread

Return a pointer to the alg_hash_entry at IDX.

References GET_MODE_CLASS.

static bool alg_hash_used_p ( )
inlinestatic

Return true if the x_alg_hash field might have been used.

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.

Referenced by alloc_cand_and_find_basis().

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.

Referenced by mul_widen_cost(), and set_mul_widen_cost().

static int expmed_mode_index ( )
inlinestatic

Compute an index into the cost arrays by mode class.

Referenced by udiv_cost().

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.

Referenced by sdiv_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 sdiv_pow2_cheap_ptr().

Referenced by mul_cost_ptr(), set_neg_cost(), set_shift_cost(), set_shiftadd_cost(), shiftsub1_cost_ptr(), and smod_pow2_cheap().

static int mul_cost ( )
inlinestatic

Return the cost of doing a multiplication in MODE when optimizing for SPEED.

Referenced by alloc_cand_and_find_basis(), and expand_widening_mult().

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_udiv_cost.

Referenced by set_shiftsub0_cost(), and shiftsub0_cost().

static int mul_highpart_cost ( )
inlinestatic

Return the cost for computing the high part of a multiplication in MODE when optimizing for SPEED.

Referenced by expand_widening_mult().

static int* mul_highpart_cost_ptr ( )
inlinestatic

Subroutine of {set_,}mul_highpart_cost. Not to be used otherwise.

Referenced by set_udiv_cost().

static int mul_widen_cost ( )
inlinestatic

Return the cost for computing a widening multiplication in MODE when optimizing for SPEED.

References convert_cost_ptr().

Referenced by expand_mult(), and expand_widening_mult().

static int* mul_widen_cost_ptr ( )
inlinestatic

Subroutine of {set_,}mul_widen_cost. Not to be used otherwise.

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 alg_hash_entry::cost, and shiftadd_cost_ptr().

Referenced by alloc_cand_and_find_basis().

static int* neg_cost_ptr ( )
inlinestatic

Subroutine of {set_,}neg_cost. Not to be used otherwise.

References shift_cost_ptr().

static int sdiv_cost ( )
inlinestatic

Return the cost of doing a signed division in MODE when optimizing for SPEED.

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

static int* sdiv_cost_ptr ( )
inlinestatic

Subroutine of {set_,}sdiv_cost. Not to be used otherwise.

Referenced by set_shiftsub1_cost(), and shiftsub1_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 smod_pow2_cheap_ptr().

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_smod_pow2_cheap.

Referenced by expmed_op_cost_ptr().

static void set_add_cost ( )
inlinestatic

Set the COST of computing an add in MODE when optimizing for SPEED.

static void set_alg_hash_used_p ( )
inlinestatic

Set whether the x_alg_hash field might have been used.

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.

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.

static void set_mul_highpart_cost ( )
inlinestatic

Set the COST for computing the high part of a multiplication in MODE when optimizing for SPEED.

static void set_mul_widen_cost ( )
inlinestatic

Set the COST for computing a widening multiplication in MODE when optimizing for SPEED.

References convert_cost_ptr(), and alg_hash_entry::cost.

static void set_neg_cost ( )
inlinestatic

Set the COST of computing a negation in MODE when optimizing for SPEED.

References expmed_op_cost_ptr(), and target_expmed::x_shiftadd_cost.

static void set_sdiv_cost ( )
inlinestatic

Set the COST of doing a signed division in MODE when optimizing for SPEED.

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 smod_pow2_cheap_ptr().

static void set_shift_cost ( )
inlinestatic

Set the COST of doing a shift in MODE by BITS when optimizing for SPEED.

References expmed_op_cost_ptr(), and target_expmed::x_shiftsub0_cost.

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 expmed_op_cost_ptr(), and target_expmed::x_shiftsub1_cost.

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 mul_cost_ptr().

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 sdiv_cost_ptr().

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 zero_cost_ptr().

static void set_udiv_cost ( )
inlinestatic

Set the COST of doing an unsigned division in MODE when optimizing for SPEED.

References mul_highpart_cost_ptr().

static void set_zero_cost ( )
inlinestatic

Set the COST of loading zero when optimizing for SPEED.

References add_cost_ptr().

static int shift_cost ( )
inlinestatic

Return the cost of doing a shift in MODE by BITS when optimizing for SPEED.

References alg_hash_entry::cost, and shiftsub0_cost_ptr().

Referenced by expand_widening_mult().

static int* shift_cost_ptr ( )
inlinestatic

Subroutine of {set_,}shift_cost. Not to be used otherwise.

References shiftadd_cost_ptr().

Referenced by neg_cost_ptr().

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 alg_hash_entry::cost, and shiftsub1_cost_ptr().

static int* shiftadd_cost_ptr ( )
inlinestatic

Subroutine of {set_,}shiftadd_cost. Not to be used otherwise.

References shiftsub0_cost_ptr().

Referenced by neg_cost(), and shift_cost_ptr().

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 mul_cost_ptr().

static int* shiftsub0_cost_ptr ( )
inlinestatic

Subroutine of {set_,}shiftsub0_cost. Not to be used otherwise.

References shiftsub1_cost_ptr().

Referenced by shift_cost(), and shiftadd_cost_ptr().

static int shiftsub1_cost ( )
inlinestatic

Return the cost of subtracting a shift in MODE by BITS from a value when optimizing for SPEED.

References sdiv_cost_ptr().

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_sdiv_cost.

Referenced by shiftadd_cost(), and shiftsub0_cost_ptr().

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 expmed_op_cost_ptr(), and target_expmed::x_add_cost.

static bool* smod_pow2_cheap_ptr ( )
inlinestatic

Subroutine of {set_,}smod_pow2_cheap. Not to be used otherwise.

Referenced by sdiv_pow2_cheap(), and set_sdiv_pow2_cheap().

static int udiv_cost ( )
inlinestatic

Return the cost of doing an unsigned division in MODE when optimizing for SPEED.

References expmed_mode_index().

static int* udiv_cost_ptr ( )
inlinestatic

Subroutine of {set_,}udiv_cost. Not to be used otherwise.

static int zero_cost ( )
inlinestatic

Return the COST of loading zero when optimizing for SPEED.

static int* zero_cost_ptr ( )
inlinestatic

Subroutine of {set_,}zero_cost. Not to be used otherwise.

References add_cost_ptr(), and alg_hash_entry::cost.

Referenced by set_smod_pow2_cheap().


Variable Documentation

struct target_expmed default_target_expmed

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/.