This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, RFA] Pass address space to REGNO_MODE_CODE_OK_FOR_BASE_P


Ulrich Weigand schrieb:
> Hello,
> 
> Georg-Johann Lay has proposed a patch to add named address space support
> to the AVR target here:
> http://gcc.gnu.org/ml/gcc-patches/2011-10/msg00471.html
> 
> Since the target needs to make register allocation decisions for
> address base registers depending on the target address space, a
> prerequiste for this is a patch of mine that I posted a while ago
> to add the address space to the MODE_CODE_BASE_REG_CLASS and
> REGNO_MODE_CODE_OK_FOR_BASE_P target macros.
> 
> I've updated the patch for current mainline and re-tested on SPU
> with no regressions.

Meanwhile, there was some code clean-up to avr backend. Would you add this?

Johann
	* config/avr/avr.h (MODE_CODE_BASE_REG_CLASS): Add address space
	argument.
	(REGNO_MODE_CODE_OK_FOR_BASE_P): Ditto.
	* config/avr/avr-protos.h (avr_mode_code_base_reg_class): Ditto.
	(avr_regno_mode_code_ok_for_base_p): Ditto.
	* config/avr/avr.c (avr_mode_code_base_reg_class): Ditto.
	(avr_regno_mode_code_ok_for_base_p): Ditto.
	(avr_reg_ok_for_addr_p): Pass AS down to
	avr_regno_mode_code_ok_for_base_p.

> ChangeLog:
> 
> 	* doc/tm.texi.in (MODE_CODE_BASE_REG_CLASS): Add address space
> 	argument.
> 	(REGNO_MODE_CODE_OK_FOR_BASE_P): Likewise.
> 	* doc/tm.texi: Regenerate.
> 
> 	* config/cris/cris.h (MODE_CODE_BASE_REG_CLASS): Add address
> 	space argument.
> 	(REGNO_MODE_CODE_OK_FOR_BASE_P): Likewise.
> 	* config/bfin/bfin.h (MODE_CODE_BASE_REG_CLASS): Likewise.
> 	(REGNO_MODE_CODE_OK_FOR_BASE_P): Likewise.
> 
> 	* addresses.h (base_reg_class): Add address space argument.
> 	Pass to MODE_CODE_BASE_REG_CLASS.
> 	(ok_for_base_p_1): Add address space argument.  Pass to
> 	REGNO_MODE_CODE_OK_FOR_BASE_P.
> 	(regno_ok_for_base_p): Add address space argument.  Pass to
> 	ok_for_base_p_1.
> 
> 	* regrename.c (scan_rtx_address): Add address space argument.
> 	Pass address space to regno_ok_for_base_p and base_reg_class.
> 	Update recursive calls.
> 	(scan_rtx): Pass address space to scan_rtx_address.
> 	(build_def_use): Likewise.
> 	* regcprop.c (replace_oldest_value_addr): Add address space
> 	argument.  Pass to regno_ok_for_base_p and base_reg_class.
> 	Update recursive calls.
> 	(replace_oldest_value_mem): Pass address space to
> 	replace_oldest_value_addr.
> 	(copyprop_hardreg_forward_1): Likewise.
> 
> 	* reload.c (find_reloads_address_1): Add address space argument.
> 	Pass address space to base_reg_class and regno_ok_for_base_p.
> 	Update recursive calls.
> 	(find_reloads_address): Pass address space to base_reg_class,
> 	regno_ok_for_base_p, and find_reloads_address_1.
> 	(find_reloads): Pass address space to base_reg_class.
> 	(find_reloads_subreg_address): Likewise.
> 
> 	* ira-costs.c (record_reg_classes): Update calls to base_reg_class.
> 	(ok_for_base_p_nonstrict): Add address space argument.  Pass to
> 	ok_for_base_p_1.
> 	(record_address_regs): Add address space argument.  Pass to
> 	base_reg_class and ok_for_base_p_nonstrict.  Update recursive calls.
> 	(record_operand_costs): Pass address space to record_address_regs.
> 	(scan_one_insn): Likewise.
> 
> 	* caller-save.c (init_caller_save): Update call to base_reg_class.
> 	* ira-conflicts.c (ira_build_conflicts): Likewise.
> 	* reload1.c (maybe_fix_stack_asms): Likewise.
Index: config/avr/avr-protos.h
===================================================================
--- config/avr/avr-protos.h	(revision 180193)
+++ config/avr/avr-protos.h	(working copy)
@@ -107,8 +107,8 @@ extern int avr_simplify_comparison_p (en
 extern RTX_CODE avr_normalize_condition (RTX_CODE condition);
 extern void out_shift_with_cnt (const char *templ, rtx insn,
 				rtx operands[], int *len, int t_len);
-extern reg_class_t avr_mode_code_base_reg_class (enum machine_mode, RTX_CODE, RTX_CODE);
-extern bool avr_regno_mode_code_ok_for_base_p (int, enum machine_mode, RTX_CODE, RTX_CODE);
+extern reg_class_t avr_mode_code_base_reg_class (enum machine_mode, addr_space_t, RTX_CODE, RTX_CODE);
+extern bool avr_regno_mode_code_ok_for_base_p (int, enum machine_mode, addr_space_t, RTX_CODE, RTX_CODE);
 extern rtx avr_incoming_return_addr_rtx (void);
 extern rtx avr_legitimize_reload_address (rtx, enum machine_mode, int, int, int, int, rtx (*)(rtx,int));
 #endif /* RTX_CODE */
Index: config/avr/avr.c
===================================================================
--- config/avr/avr.c	(revision 180193)
+++ config/avr/avr.c	(working copy)
@@ -1213,12 +1213,12 @@ avr_cannot_modify_jumps_p (void)
 /* Helper function for `avr_legitimate_address_p'.  */
 
 static inline bool
-avr_reg_ok_for_addr_p (rtx reg, addr_space_t as ATTRIBUTE_UNUSED,
+avr_reg_ok_for_addr_p (rtx reg, addr_space_t as,
                        RTX_CODE outer_code, bool strict)
 {
   return (REG_P (reg)
-          && (avr_regno_mode_code_ok_for_base_p (REGNO (reg),
-                                                 QImode, outer_code, UNKNOWN)
+          && (avr_regno_mode_code_ok_for_base_p (REGNO (reg), QImode,
+                                                 as, outer_code, UNKNOWN)
               || (!strict
                   && REGNO (reg) >= FIRST_PSEUDO_REGISTER)));
 }
@@ -7361,6 +7361,7 @@ avr_hard_regno_mode_ok (int regno, enum
 
 reg_class_t
 avr_mode_code_base_reg_class (enum machine_mode mode ATTRIBUTE_UNUSED,
+                              addr_space_t as ATTRIBUTE_UNUSED,
                               RTX_CODE outer_code,
                               RTX_CODE index_code ATTRIBUTE_UNUSED)
 {
@@ -7376,6 +7377,7 @@ avr_mode_code_base_reg_class (enum machi
 bool
 avr_regno_mode_code_ok_for_base_p (int regno,
                                    enum machine_mode mode ATTRIBUTE_UNUSED,
+                                   addr_space_t as ATTRIBUTE_UNUSED,
                                    RTX_CODE outer_code,
                                    RTX_CODE index_code ATTRIBUTE_UNUSED)
 {
Index: config/avr/avr.h
===================================================================
--- config/avr/avr.h	(revision 180192)
+++ config/avr/avr.h	(working copy)
@@ -308,13 +308,13 @@ enum reg_class {
 
 #define REGNO_REG_CLASS(R) avr_regno_reg_class(R)
 
-#define MODE_CODE_BASE_REG_CLASS(mode, outer_code, index_code) \
-  avr_mode_code_base_reg_class (mode, outer_code, index_code)
+#define MODE_CODE_BASE_REG_CLASS(mode, as, outer_code, index_code)   \
+  avr_mode_code_base_reg_class (mode, as, outer_code, index_code)
 
 #define INDEX_REG_CLASS NO_REGS
 
-#define REGNO_MODE_CODE_OK_FOR_BASE_P(num, mode, outer_code, index_code) \
-  avr_regno_mode_code_ok_for_base_p (num, mode, outer_code, index_code)
+#define REGNO_MODE_CODE_OK_FOR_BASE_P(num, mode, as, outer_code, index_code) \
+  avr_regno_mode_code_ok_for_base_p (num, mode, as, outer_code, index_code)
 
 #define REGNO_OK_FOR_INDEX_P(NUM) 0
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]