Commit 462f85ce by Richard Sandiford Committed by Richard Sandiford

Makefile.in (expmed.o, [...]): Depend on expmed.h.

gcc/
	* Makefile.in (expmed.o, target-globals.o): Depend on expmed.h.
	* expmed.h: New file.
	* expmed.c (default_target_costs): New variable.
	(this_target_costs): New conditional variable.
	(sdiv_pow2_cheap, smod_pow2_cheap, zero_cost, add_cost, neg_cost)
	(shift_cost, shiftadd_cost, shiftsub0_cost, shiftsub1_cost, mul_cost)
	(sdiv_cost, udiv_cost, mul_widen_cost, mul_highpart_cost): Delete.
	* target-globals.h (this_target_expmed): Declare.
	(target_globals): Add a expmed field.
	(restore_target_globals): Copy the expmed field to
	this_target_expmed.
	* target-globals.c: Include expmed.h.
	(default_target_globals): Initialize the expmed field.
	(save_target_globals): Likewise.

From-SVN: r162094
parent d474db84
2010-07-12 Richard Sandiford <rdsandiford@googlemail.com> 2010-07-12 Richard Sandiford <rdsandiford@googlemail.com>
* Makefile.in (expmed.o, target-globals.o): Depend on expmed.h.
* expmed.h: New file.
* expmed.c (default_target_costs): New variable.
(this_target_costs): New conditional variable.
(sdiv_pow2_cheap, smod_pow2_cheap, zero_cost, add_cost, neg_cost)
(shift_cost, shiftadd_cost, shiftsub0_cost, shiftsub1_cost, mul_cost)
(sdiv_cost, udiv_cost, mul_widen_cost, mul_highpart_cost): Delete.
* target-globals.h (this_target_expmed): Declare.
(target_globals): Add a expmed field.
(restore_target_globals): Copy the expmed field to
this_target_expmed.
* target-globals.c: Include expmed.h.
(default_target_globals): Initialize the expmed field.
(save_target_globals): Likewise.
2010-07-12 Richard Sandiford <rdsandiford@googlemail.com>
* Makefile.in (target-globals.o): Depend on reload.h. * Makefile.in (target-globals.o): Depend on reload.h.
* reload.h (target_reload): New structure. * reload.h (target_reload): New structure.
(default_target_reload): Declare. (default_target_reload): Declare.
......
...@@ -2915,7 +2915,8 @@ calls.o : calls.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ ...@@ -2915,7 +2915,8 @@ calls.o : calls.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(CGRAPH_H) $(EXCEPT_H) sbitmap.h $(DBGCNT_H) $(TREE_FLOW_H) $(CGRAPH_H) $(EXCEPT_H) sbitmap.h $(DBGCNT_H) $(TREE_FLOW_H)
expmed.o : expmed.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_H) \ expmed.o : expmed.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_H) \
$(FLAGS_H) insn-config.h $(EXPR_H) $(OPTABS_H) $(RECOG_H) \ $(FLAGS_H) insn-config.h $(EXPR_H) $(OPTABS_H) $(RECOG_H) \
$(TOPLEV_H) $(DIAGNOSTIC_CORE_H) $(TM_P_H) langhooks.h $(DF_H) $(TARGET_H) $(TOPLEV_H) $(DIAGNOSTIC_CORE_H) $(TM_P_H) langhooks.h $(DF_H) $(TARGET_H) \
expmed.h
explow.o : explow.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_H) \ explow.o : explow.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_H) \
$(FLAGS_H) hard-reg-set.h insn-config.h $(EXPR_H) $(OPTABS_H) $(RECOG_H) \ $(FLAGS_H) hard-reg-set.h insn-config.h $(EXPR_H) $(OPTABS_H) $(RECOG_H) \
$(TOPLEV_H) $(DIAGNOSTIC_CORE_H) $(EXCEPT_H) $(FUNCTION_H) $(GGC_H) $(TM_P_H) langhooks.h gt-explow.h \ $(TOPLEV_H) $(DIAGNOSTIC_CORE_H) $(EXCEPT_H) $(FUNCTION_H) $(GGC_H) $(TM_P_H) langhooks.h gt-explow.h \
...@@ -3477,7 +3478,7 @@ lower-subreg.o : lower-subreg.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ ...@@ -3477,7 +3478,7 @@ lower-subreg.o : lower-subreg.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(EXPR_H) $(EXCEPT_H) $(REGS_H) $(TREE_PASS_H) $(DF_H) $(EXPR_H) $(EXCEPT_H) $(REGS_H) $(TREE_PASS_H) $(DF_H)
target-globals.o : target-globals.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ target-globals.o : target-globals.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) insn-config.h $(MACHMODE_H) $(GGC_H) $(TOPLEV_H) target-globals.h \ $(TM_H) insn-config.h $(MACHMODE_H) $(GGC_H) $(TOPLEV_H) target-globals.h \
$(FLAGS_H) $(REGS_H) $(RTL_H) reload.h $(FLAGS_H) $(REGS_H) $(RTL_H) reload.h expmed.h
$(out_object_file): $(out_file) $(CONFIG_H) coretypes.h $(TM_H) $(TREE_H) \ $(out_object_file): $(out_file) $(CONFIG_H) coretypes.h $(TM_H) $(TREE_H) \
$(RTL_H) $(REGS_H) hard-reg-set.h insn-config.h conditions.h \ $(RTL_H) $(REGS_H) hard-reg-set.h insn-config.h conditions.h \
......
...@@ -38,6 +38,12 @@ along with GCC; see the file COPYING3. If not see ...@@ -38,6 +38,12 @@ along with GCC; see the file COPYING3. If not see
#include "langhooks.h" #include "langhooks.h"
#include "df.h" #include "df.h"
#include "target.h" #include "target.h"
#include "expmed.h"
struct target_expmed default_target_expmed;
#if SWITCHABLE_TARGET
struct target_expmed *this_target_expmed = &default_target_expmed;
#endif
static void store_fixed_bit_field (rtx, unsigned HOST_WIDE_INT, static void store_fixed_bit_field (rtx, unsigned HOST_WIDE_INT,
unsigned HOST_WIDE_INT, unsigned HOST_WIDE_INT,
...@@ -59,14 +65,6 @@ static rtx expand_sdiv_pow2 (enum machine_mode, rtx, HOST_WIDE_INT); ...@@ -59,14 +65,6 @@ static rtx expand_sdiv_pow2 (enum machine_mode, rtx, HOST_WIDE_INT);
/* Test whether a value is zero of a power of two. */ /* Test whether a value is zero of a power of two. */
#define EXACT_POWER_OF_2_OR_ZERO_P(x) (((x) & ((x) - 1)) == 0) #define EXACT_POWER_OF_2_OR_ZERO_P(x) (((x) & ((x) - 1)) == 0)
/* Nonzero means divides or modulus operations are relatively cheap for
powers of two, so don't use branches; emit the operation instead.
Usually, this will mean that the MD file will emit non-branch
sequences. */
static bool sdiv_pow2_cheap[2][NUM_MACHINE_MODES];
static bool smod_pow2_cheap[2][NUM_MACHINE_MODES];
#ifndef SLOW_UNALIGNED_ACCESS #ifndef SLOW_UNALIGNED_ACCESS
#define SLOW_UNALIGNED_ACCESS(MODE, ALIGN) STRICT_ALIGNMENT #define SLOW_UNALIGNED_ACCESS(MODE, ALIGN) STRICT_ALIGNMENT
#endif #endif
...@@ -96,21 +94,6 @@ static bool smod_pow2_cheap[2][NUM_MACHINE_MODES]; ...@@ -96,21 +94,6 @@ static bool smod_pow2_cheap[2][NUM_MACHINE_MODES];
#define gen_extzv(a,b,c,d) NULL_RTX #define gen_extzv(a,b,c,d) NULL_RTX
#endif #endif
/* Cost of various pieces of RTL. Note that some of these are indexed by
shift count and some by mode. */
static int zero_cost[2];
static int add_cost[2][NUM_MACHINE_MODES];
static int neg_cost[2][NUM_MACHINE_MODES];
static int shift_cost[2][NUM_MACHINE_MODES][MAX_BITS_PER_WORD];
static int shiftadd_cost[2][NUM_MACHINE_MODES][MAX_BITS_PER_WORD];
static int shiftsub0_cost[2][NUM_MACHINE_MODES][MAX_BITS_PER_WORD];
static int shiftsub1_cost[2][NUM_MACHINE_MODES][MAX_BITS_PER_WORD];
static int mul_cost[2][NUM_MACHINE_MODES];
static int sdiv_cost[2][NUM_MACHINE_MODES];
static int udiv_cost[2][NUM_MACHINE_MODES];
static int mul_widen_cost[2][NUM_MACHINE_MODES];
static int mul_highpart_cost[2][NUM_MACHINE_MODES];
void void
init_expmed (void) init_expmed (void)
{ {
......
/* Target-dependent costs for expmed.c.
Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
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/>. */
#ifndef EXPMED_H
#define EXPMED_H 1
/* Target-dependent globals. */
struct target_expmed {
/* Nonzero means divides or modulus operations are relatively cheap for
powers of two, so don't use branches; emit the operation instead.
Usually, this will mean that the MD file will emit non-branch
sequences. */
bool x_sdiv_pow2_cheap[2][NUM_MACHINE_MODES];
bool x_smod_pow2_cheap[2][NUM_MACHINE_MODES];
/* Cost of various pieces of RTL. Note that some of these are indexed by
shift count and some by mode. */
int x_zero_cost[2];
int x_add_cost[2][NUM_MACHINE_MODES];
int x_neg_cost[2][NUM_MACHINE_MODES];
int x_shift_cost[2][NUM_MACHINE_MODES][MAX_BITS_PER_WORD];
int x_shiftadd_cost[2][NUM_MACHINE_MODES][MAX_BITS_PER_WORD];
int x_shiftsub0_cost[2][NUM_MACHINE_MODES][MAX_BITS_PER_WORD];
int x_shiftsub1_cost[2][NUM_MACHINE_MODES][MAX_BITS_PER_WORD];
int x_mul_cost[2][NUM_MACHINE_MODES];
int x_sdiv_cost[2][NUM_MACHINE_MODES];
int x_udiv_cost[2][NUM_MACHINE_MODES];
int x_mul_widen_cost[2][NUM_MACHINE_MODES];
int x_mul_highpart_cost[2][NUM_MACHINE_MODES];
};
extern struct target_expmed default_target_expmed;
#if SWITCHABLE_TARGET
extern struct target_expmed *this_target_expmed;
#else
#define this_target_expmed (&default_target_expmed)
#endif
#define sdiv_pow2_cheap \
(this_target_expmed->x_sdiv_pow2_cheap)
#define smod_pow2_cheap \
(this_target_expmed->x_smod_pow2_cheap)
#define zero_cost \
(this_target_expmed->x_zero_cost)
#define add_cost \
(this_target_expmed->x_add_cost)
#define neg_cost \
(this_target_expmed->x_neg_cost)
#define shift_cost \
(this_target_expmed->x_shift_cost)
#define shiftadd_cost \
(this_target_expmed->x_shiftadd_cost)
#define shiftsub0_cost \
(this_target_expmed->x_shiftsub0_cost)
#define shiftsub1_cost \
(this_target_expmed->x_shiftsub1_cost)
#define mul_cost \
(this_target_expmed->x_mul_cost)
#define sdiv_cost \
(this_target_expmed->x_sdiv_cost)
#define udiv_cost \
(this_target_expmed->x_udiv_cost)
#define mul_widen_cost \
(this_target_expmed->x_mul_widen_cost)
#define mul_highpart_cost \
(this_target_expmed->x_mul_highpart_cost)
#endif
...@@ -31,6 +31,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -31,6 +31,7 @@ along with GCC; see the file COPYING3. If not see
#include "rtl.h" #include "rtl.h"
#include "hard-reg-set.h" #include "hard-reg-set.h"
#include "reload.h" #include "reload.h"
#include "expmed.h"
#if SWITCHABLE_TARGET #if SWITCHABLE_TARGET
struct target_globals default_target_globals = { struct target_globals default_target_globals = {
...@@ -38,7 +39,8 @@ struct target_globals default_target_globals = { ...@@ -38,7 +39,8 @@ struct target_globals default_target_globals = {
&default_target_regs, &default_target_regs,
&default_target_rtl, &default_target_rtl,
&default_target_hard_regs, &default_target_hard_regs,
&default_target_reload &default_target_reload,
&default_target_expmed
}; };
struct target_globals * struct target_globals *
...@@ -52,6 +54,7 @@ save_target_globals (void) ...@@ -52,6 +54,7 @@ save_target_globals (void)
g->rtl = ggc_alloc_cleared_target_rtl (); g->rtl = ggc_alloc_cleared_target_rtl ();
g->hard_regs = XCNEW (struct target_hard_regs); g->hard_regs = XCNEW (struct target_hard_regs);
g->reload = XCNEW (struct target_reload); g->reload = XCNEW (struct target_reload);
g->expmed = XCNEW (struct target_expmed);
restore_target_globals (g); restore_target_globals (g);
target_reinit (); target_reinit ();
return g; return g;
......
...@@ -26,6 +26,7 @@ extern struct target_regs *this_target_regs; ...@@ -26,6 +26,7 @@ extern struct target_regs *this_target_regs;
extern struct target_rtl *this_target_rtl; extern struct target_rtl *this_target_rtl;
extern struct target_hard_regs *this_target_hard_regs; extern struct target_hard_regs *this_target_hard_regs;
extern struct target_reload *this_target_reload; extern struct target_reload *this_target_reload;
extern struct target_expmed *this_target_expmed;
struct GTY(()) target_globals { struct GTY(()) target_globals {
struct target_flag_state *GTY((skip)) flag_state; struct target_flag_state *GTY((skip)) flag_state;
...@@ -33,6 +34,7 @@ struct GTY(()) target_globals { ...@@ -33,6 +34,7 @@ struct GTY(()) target_globals {
struct target_rtl *rtl; struct target_rtl *rtl;
struct target_hard_regs *GTY((skip)) hard_regs; struct target_hard_regs *GTY((skip)) hard_regs;
struct target_reload *GTY((skip)) reload; struct target_reload *GTY((skip)) reload;
struct target_expmed *GTY((skip)) expmed;
}; };
extern struct target_globals default_target_globals; extern struct target_globals default_target_globals;
...@@ -47,6 +49,7 @@ restore_target_globals (struct target_globals *g) ...@@ -47,6 +49,7 @@ restore_target_globals (struct target_globals *g)
this_target_rtl = g->rtl; this_target_rtl = g->rtl;
this_target_hard_regs = g->hard_regs; this_target_hard_regs = g->hard_regs;
this_target_reload = g->reload; this_target_reload = g->reload;
this_target_expmed = g->expmed;
} }
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment