Commit af4ba423 by Kenneth Zadeck Committed by Richard Sandiford

Makefile.in (lower-subreg.o, [...]): Depend on lower-subreg.h.

gcc/
2012-03-31  Kenneth Zadeck  <zadeck@naturalbridge.com>
	    Richard Sandiford  <r.sandiford@uk.ibm.com>

	* Makefile.in (lower-subreg.o, target-globals.o): Depend on
	lower-subreg.h.
	* lower-subreg.h: New file.
	* target-globals.h (this_target_lower_subreg): Declare.
	(target_globals): Add lower_subreg;
	(restore_target_globals): Restore this_target_lower_subreg.
	* target-globals.c: Include it.
	(default_target_globals): Add default_target_lower_subreg.
	(save_target_globals): Initialize target_lower_subreg.
	* rtl.h (init_lower_subreg): Added declaration.
	* toplev.c (backend_init_target): Call initializer for lower-subreg
	pass.
	* lower-subreg.c (LOG_COSTS, FORCE_LOWERING): New macros.
	(default_target_lower_subreg): New variable.
	(this_target_lower_subreg): Likewise.
	(twice_word_mode, choices): New macros.
	(shift_cost, compute_splitting_shift, compute_costs)
	(init_lower_subreg): New functions.
	(resolve_simple_move): Add speed_p argument.  Check choices.
	(find_pseudo_copy): Don't check the mode size here.
	(resolve_simple_move): Assert the mode size.
	(find_decomposable_shift_zext): Add speed_p argument and return
	a bool.  Check choices.
	(resolve_shift_zext): Add comment.
	(dump_shift_choices, dump_choices): New functions.
	(decompose_multiword_subregs): Dump list of profitable
	transformations.  Add code to skip non profitable transformations.
	Update calls to simple_move and find_decomposable_shift_zext.

Co-Authored-By: Richard Sandiford <r.sandiford@uk.ibm.com>

From-SVN: r187015
parent 90911ab6
2012-05-01 Kenneth Zadeck <zadeck@naturalbridge.com>
Richard Sandiford <r.sandiford@uk.ibm.com>
* Makefile.in (lower-subreg.o, target-globals.o): Depend on
lower-subreg.h.
* lower-subreg.h: New file.
* target-globals.h (this_target_lower_subreg): Declare.
(target_globals): Add lower_subreg;
(restore_target_globals): Restore this_target_lower_subreg.
* target-globals.c: Include it.
(default_target_globals): Add default_target_lower_subreg.
(save_target_globals): Initialize target_lower_subreg.
* rtl.h (init_lower_subreg): Added declaration.
* toplev.c (backend_init_target): Call initializer for lower-subreg
pass.
* lower-subreg.c (LOG_COSTS, FORCE_LOWERING): New macros.
(default_target_lower_subreg): New variable.
(this_target_lower_subreg): Likewise.
(twice_word_mode, choices): New macros.
(shift_cost, compute_splitting_shift, compute_costs)
(init_lower_subreg): New functions.
(resolve_simple_move): Add speed_p argument. Check choices.
(find_pseudo_copy): Don't check the mode size here.
(resolve_simple_move): Assert the mode size.
(find_decomposable_shift_zext): Add speed_p argument and return
a bool. Check choices.
(resolve_shift_zext): Add comment.
(dump_shift_choices, dump_choices): New functions.
(decompose_multiword_subregs): Dump list of profitable
transformations. Add code to skip non profitable transformations.
Update calls to simple_move and find_decomposable_shift_zext.
2012-05-01 Ian Bolton <ian.bolton@arm.com> 2012-05-01 Ian Bolton <ian.bolton@arm.com>
Sameera Deshpande <sameera.deshpande@arm.com> Sameera Deshpande <sameera.deshpande@arm.com>
Greta Yorsh <greta.yorsh@arm.com> Greta Yorsh <greta.yorsh@arm.com>
......
...@@ -3428,11 +3428,13 @@ dbgcnt.o: dbgcnt.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(DIAGNOSTIC_CORE_H) $(DB ...@@ -3428,11 +3428,13 @@ dbgcnt.o: dbgcnt.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(DIAGNOSTIC_CORE_H) $(DB
lower-subreg.o : lower-subreg.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ lower-subreg.o : lower-subreg.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(MACHMODE_H) $(TM_H) $(RTL_H) $(TM_P_H) $(TIMEVAR_H) $(FLAGS_H) \ $(MACHMODE_H) $(TM_H) $(RTL_H) $(TM_P_H) $(TIMEVAR_H) $(FLAGS_H) \
insn-config.h $(BASIC_BLOCK_H) $(RECOG_H) $(OBSTACK_H) $(BITMAP_H) \ insn-config.h $(BASIC_BLOCK_H) $(RECOG_H) $(OBSTACK_H) $(BITMAP_H) \
$(EXPR_H) $(EXCEPT_H) $(REGS_H) $(TREE_PASS_H) $(DF_H) dce.h $(EXPR_H) $(EXCEPT_H) $(REGS_H) $(TREE_PASS_H) $(DF_H) dce.h \
lower-subreg.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 expmed.h $(EXPR_H) $(OPTABS_H) \ $(FLAGS_H) $(REGS_H) $(RTL_H) reload.h expmed.h $(EXPR_H) $(OPTABS_H) \
$(LIBFUNCS_H) $(CFGLOOP_H) $(IRA_INT_H) builtins.h gcse.h bb-reorder.h $(LIBFUNCS_H) $(CFGLOOP_H) $(IRA_INT_H) builtins.h gcse.h bb-reorder.h \
lower-subreg.h
hw-doloop.o : hw-doloop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ hw-doloop.o : hw-doloop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(RTL_H) $(FLAGS_H) $(EXPR_H) hard-reg-set.h $(BASIC_BLOCK_H) $(TM_P_H) \ $(RTL_H) $(FLAGS_H) $(EXPR_H) hard-reg-set.h $(BASIC_BLOCK_H) $(TM_P_H) \
$(DF_H) $(CFGLAYOUT_H) $(CFGLOOP_H) output.h $(RECOG_H) $(TARGET_H) \ $(DF_H) $(CFGLAYOUT_H) $(CFGLOOP_H) output.h $(RECOG_H) $(TARGET_H) \
......
/* Target-dependent costs for lower-subreg.c.
Copyright (C) 2012 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 LOWER_SUBREG_H
#define LOWER_SUBREG_H 1
/* Information about whether, and where, lower-subreg should be applied. */
struct lower_subreg_choices {
/* A boolean vector for move splitting that is indexed by mode and is
true for each mode that is to have its copies split. */
bool move_modes_to_split[MAX_MACHINE_MODE];
/* True if zero-extensions from word_mode to twice_word_mode should
be split. */
bool splitting_zext;
/* Index X is true if twice_word_mode shifts by X + BITS_PER_WORD
should be split. */
bool splitting_ashift[MAX_BITS_PER_WORD];
bool splitting_lshiftrt[MAX_BITS_PER_WORD];
/* True if there is at least one mode that is worth splitting. */
bool something_to_do;
};
/* Target-specific information for the subreg lowering pass. */
struct target_lower_subreg {
/* An integer mode that is twice as wide as word_mode. */
enum machine_mode x_twice_word_mode;
/* What we have decided to do when optimizing for size (index 0)
and speed (index 1). */
struct lower_subreg_choices x_choices[2];
};
extern struct target_lower_subreg default_target_lower_subreg;
#if SWITCHABLE_TARGET
extern struct target_lower_subreg *this_target_lower_subreg;
#else
#define this_target_lower_subreg (&default_target_lower_subreg)
#endif
#endif
...@@ -2526,6 +2526,9 @@ extern void init_expmed (void); ...@@ -2526,6 +2526,9 @@ extern void init_expmed (void);
extern void expand_inc (rtx, rtx); extern void expand_inc (rtx, rtx);
extern void expand_dec (rtx, rtx); extern void expand_dec (rtx, rtx);
/* In lower-subreg.c */
extern void init_lower_subreg (void);
/* In gcse.c */ /* In gcse.c */
extern bool can_copy_p (enum machine_mode); extern bool can_copy_p (enum machine_mode);
extern bool can_assign_to_reg_without_clobbers_p (rtx); extern bool can_assign_to_reg_without_clobbers_p (rtx);
......
...@@ -40,6 +40,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -40,6 +40,7 @@ along with GCC; see the file COPYING3. If not see
#include "builtins.h" #include "builtins.h"
#include "gcse.h" #include "gcse.h"
#include "bb-reorder.h" #include "bb-reorder.h"
#include "lower-subreg.h"
#if SWITCHABLE_TARGET #if SWITCHABLE_TARGET
struct target_globals default_target_globals = { struct target_globals default_target_globals = {
...@@ -56,7 +57,8 @@ struct target_globals default_target_globals = { ...@@ -56,7 +57,8 @@ struct target_globals default_target_globals = {
&default_target_ira_int, &default_target_ira_int,
&default_target_builtins, &default_target_builtins,
&default_target_gcse, &default_target_gcse,
&default_target_bb_reorder &default_target_bb_reorder,
&default_target_lower_subreg
}; };
struct target_globals * struct target_globals *
...@@ -79,6 +81,7 @@ save_target_globals (void) ...@@ -79,6 +81,7 @@ save_target_globals (void)
g->builtins = XCNEW (struct target_builtins); g->builtins = XCNEW (struct target_builtins);
g->gcse = XCNEW (struct target_gcse); g->gcse = XCNEW (struct target_gcse);
g->bb_reorder = XCNEW (struct target_bb_reorder); g->bb_reorder = XCNEW (struct target_bb_reorder);
g->lower_subreg = XCNEW (struct target_lower_subreg);
restore_target_globals (g); restore_target_globals (g);
init_reg_sets (); init_reg_sets ();
target_reinit (); target_reinit ();
......
...@@ -35,6 +35,7 @@ extern struct target_ira_int *this_target_ira_int; ...@@ -35,6 +35,7 @@ extern struct target_ira_int *this_target_ira_int;
extern struct target_builtins *this_target_builtins; extern struct target_builtins *this_target_builtins;
extern struct target_gcse *this_target_gcse; extern struct target_gcse *this_target_gcse;
extern struct target_bb_reorder *this_target_bb_reorder; extern struct target_bb_reorder *this_target_bb_reorder;
extern struct target_lower_subreg *this_target_lower_subreg;
struct GTY(()) target_globals { struct GTY(()) target_globals {
struct target_flag_state *GTY((skip)) flag_state; struct target_flag_state *GTY((skip)) flag_state;
...@@ -51,6 +52,7 @@ struct GTY(()) target_globals { ...@@ -51,6 +52,7 @@ struct GTY(()) target_globals {
struct target_builtins *GTY((skip)) builtins; struct target_builtins *GTY((skip)) builtins;
struct target_gcse *GTY((skip)) gcse; struct target_gcse *GTY((skip)) gcse;
struct target_bb_reorder *GTY((skip)) bb_reorder; struct target_bb_reorder *GTY((skip)) bb_reorder;
struct target_lower_subreg *GTY((skip)) lower_subreg;
}; };
extern struct target_globals default_target_globals; extern struct target_globals default_target_globals;
...@@ -74,6 +76,7 @@ restore_target_globals (struct target_globals *g) ...@@ -74,6 +76,7 @@ restore_target_globals (struct target_globals *g)
this_target_builtins = g->builtins; this_target_builtins = g->builtins;
this_target_gcse = g->gcse; this_target_gcse = g->gcse;
this_target_bb_reorder = g->bb_reorder; this_target_bb_reorder = g->bb_reorder;
this_target_lower_subreg = g->lower_subreg;
} }
#endif #endif
......
...@@ -1601,6 +1601,7 @@ backend_init_target (void) ...@@ -1601,6 +1601,7 @@ backend_init_target (void)
/* rtx_cost is mode-dependent, so cached values need to be recomputed /* rtx_cost is mode-dependent, so cached values need to be recomputed
on a mode change. */ on a mode change. */
init_expmed (); init_expmed ();
init_lower_subreg ();
/* We may need to recompute regno_save_code[] and regno_restore_code[] /* We may need to recompute regno_save_code[] and regno_restore_code[]
after a mode change as well. */ after a mode change as well. */
......
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