Patchwork [H8300] Hookize GO_IF_MODE_DEPENDENT_ADDRESS

login
register
mail settings
Submitter Anatoly Sokolov
Date March 31, 2011, 6:22 a.m.
Message ID <88671551.20110331102249@post.ru>
Download mbox | patch
Permalink /patch/89019/
State New
Headers show

Comments

Anatoly Sokolov - March 31, 2011, 6:22 a.m.
Hello.

  This patch removes obsolete GO_IF_MODE_DEPENDENT_ADDRESS macros from H8300 
back end in the GCC and introduces equivalent TARGET_MODE_DEPENDENT_ADDRESS_P 
target hook.


  Regression tested on h8300-unknown-elf with no new failure.

  OK to install? 

        * config/h8300/h8300.h (GO_IF_MODE_DEPENDENT_ADDRESS): Remove macro.
        * config/h8300/h8300-protos.h (h8300_get_index): Remove.
        * config/h8300/h8300.c (TARGET_MODE_DEPENDENT_ADDRESS_P): Define.
        (h8300_mode_dependent_address_p): New function.
        (h8300_get_index): Make static.



Anatoly.
Jeff Law - March 31, 2011, 12:57 p.m.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 03/31/11 00:22, Anatoly Sokolov wrote:
> Hello.
> 
>   This patch removes obsolete GO_IF_MODE_DEPENDENT_ADDRESS macros from H8300 
> back end in the GCC and introduces equivalent TARGET_MODE_DEPENDENT_ADDRESS_P 
> target hook.
> 
> 
>   Regression tested on h8300-unknown-elf with no new failure.
> 
>   OK to install? 
> 
>         * config/h8300/h8300.h (GO_IF_MODE_DEPENDENT_ADDRESS): Remove macro.
>         * config/h8300/h8300-protos.h (h8300_get_index): Remove.
>         * config/h8300/h8300.c (TARGET_MODE_DEPENDENT_ADDRESS_P): Define.
>         (h8300_mode_dependent_address_p): New function.
>         (h8300_get_index): Make static.
OK.
Jeff
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJNlHodAAoJEBRtltQi2kC7LJIH/3y/xMzR0EzU6hpSU+fmqcJU
UPX7KtSlK+bGuEi9gn63Q/gY8o2V8YyS401Ijeicks2ydTJVA/YDEUQk074KWwTq
SgCkLIstAMh4ARbqN6BrzZV1BSosS5YOk9LA/RslaMcr/6/FkxiCQJFfnJCsCx5l
+aIHX6L8rH3iAChJ4OM8Vzb+rCNqHSldt0adCOtfwEOqKbqbzsUhpJaAX2/5+waQ
xET1f3EaI0jLU1txadAG1443eCvnBeNBnQcblpUlwyll6dilMiVHNc2rxBM7KB1w
B8O20SPEeWVVcuxiiis/lz14eRBG30b2jrN/J+3L1+Ma5YLj3xP5azK1CSrhdU8=
=KT9+
-----END PGP SIGNATURE-----

Patch

Index: gcc/config/h8300/h8300.c
===================================================================
--- gcc/config/h8300/h8300.c    (revision 171675)
+++ gcc/config/h8300/h8300.c    (working copy)
@@ -113,6 +113,7 @@ 
 static bool          h8300_short_move_mem_p       (rtx, enum rtx_code);
 static unsigned int  h8300_move_length            (rtx *, const h8300_length_table *);
 static bool         h8300_hard_regno_scratch_ok  (unsigned int);
+static rtx          h8300_get_index (rtx, enum machine_mode mode, int *);
 
 /* CPU_TYPE, says what cpu we're compiling for.  */
 int cpu_type;
@@ -2094,7 +2097,7 @@ 
    MODE is the mode of the value being accessed.  It can be VOIDmode
    if the address is known to be valid, but its mode is unknown.  */
 
-rtx
+static rtx
 h8300_get_index (rtx x, enum machine_mode mode, int *size)
 {
   int dummy, factor;
@@ -2156,6 +2159,21 @@ 
   return x;
 }
 
+/* Worker function for TARGET_MODE_DEPENDENT_ADDRESS_P.
+
+   On the H8/300, the predecrement and postincrement address depend thus
+   (the amount of decrement or increment being the length of the operand).  */
+
+static bool
+h8300_mode_dependent_address_p (const_rtx addr)
+{
+  if (GET_CODE (addr) == PLUS
+      && h8300_get_index (XEXP (addr, 0), VOIDmode, 0) != XEXP (addr, 0))
+    return true;
+
+  return false;
+}
+
 static const h8300_length_table addb_length_table =
 {
   /* #xx  Rs   @aa  @Rs  @xx  */
@@ -6026,4 +6044,7 @@ 
 #undef TARGET_EXCEPT_UNWIND_INFO
 #define TARGET_EXCEPT_UNWIND_INFO sjlj_except_unwind_info
 
+#undef TARGET_MODE_DEPENDENT_ADDRESS_P
+#define TARGET_MODE_DEPENDENT_ADDRESS_P h8300_mode_dependent_address_p
+
 struct gcc_target targetm = TARGET_INITIALIZER;
Index: gcc/config/h8300/h8300.h
===================================================================
--- gcc/config/h8300/h8300.h    (revision 171675)
+++ gcc/config/h8300/h8300.h    (working copy)
@@ -771,11 +771,6 @@ 
 
    On the H8/300, the predecrement and postincrement address depend thus
    (the amount of decrement or increment being the length of the operand).  */
-
-#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR, LABEL) \
-  if (GET_CODE (ADDR) == PLUS \
-      && h8300_get_index (XEXP (ADDR, 0), VOIDmode, 0) != XEXP (ADDR, 0)) \
-    goto LABEL;
 
 /* Specify the machine mode that this machine uses
    for the index in the tablejump instruction.  */
Index: gcc/config/h8300/h8300-protos.h
===================================================================
--- gcc/config/h8300/h8300-protos.h     (revision 171675)
+++ gcc/config/h8300/h8300-protos.h     (working copy)
@@ -110,7 +110,6 @@ 
 extern void h8300_pr_interrupt (struct cpp_reader *);
 extern void h8300_pr_saveall (struct cpp_reader *);
 extern enum reg_class  h8300_reg_class_from_letter (int);
-extern rtx             h8300_get_index (rtx, enum machine_mode mode, int *);
 extern unsigned int    h8300_insn_length_from_table (rtx, rtx *);
 extern const char *    output_h8sx_shift (rtx *, int, int);
 extern bool            h8300_operands_match_p (rtx *);