public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [SH][committed] Convert GET_SH_ARG_CLASS into a function
@ 2016-05-08 14:17 Oleg Endo
  0 siblings, 0 replies; only message in thread
From: Oleg Endo @ 2016-05-08 14:17 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 430 bytes --]

Hi,

The attached patch converts the GET_SH_ARG_CLASS macro into a function.
 No functional change.

Tested on sh-elf with
make -k check RUNTESTFLAGS="--target_board=sh-sim\{-m2/-ml,-m2/-mb,
-m2a/-mb,-m4/-ml,-m4/-mb,-m4a/-ml,-m4a/-mb}"

Committed as r236009.

Cheers,
Oleg

gcc/ChangeLog:
	* config/sh/sh.h (GET_SH_ARG_CLASS): Convert macro into ...
	* config/sh/sh.c (get_sh_arg_class): ... this new function.  Update its
	users.

[-- Attachment #2: sh_cleanup_1.patch --]
[-- Type: text/x-patch, Size: 2415 bytes --]

diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index 51f983c..a36b098 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -7898,6 +7898,20 @@ sh_callee_copies (cumulative_args_t cum, machine_mode mode,
 	      % SH_MIN_ALIGN_FOR_CALLEE_COPY == 0));
 }
 
+static sh_arg_class
+get_sh_arg_class (machine_mode mode)
+{
+  if (TARGET_FPU_ANY && mode == SFmode)
+    return SH_ARG_FLOAT;
+
+  if (TARGET_FPU_DOUBLE
+      && (GET_MODE_CLASS (mode) == MODE_FLOAT
+	  || GET_MODE_CLASS (mode) == MODE_COMPLEX_FLOAT))
+    return SH_ARG_FLOAT;
+
+  return SH_ARG_INT;
+}
+
 /* Round a register number up to a proper boundary for an arg of mode
    MODE.
    The SH doesn't care about double alignment, so we only
@@ -7913,9 +7927,9 @@ sh_round_reg (const CUMULATIVE_ARGS& cum, machine_mode mode)
 	  && (mode == DFmode || mode == DCmode)
 	  && cum.arg_count[(int) SH_ARG_FLOAT] < NPARM_REGS (mode)))
      && GET_MODE_UNIT_SIZE (mode) > UNITS_PER_WORD)
-    ? (cum.arg_count[(int) GET_SH_ARG_CLASS (mode)]
-       + (cum.arg_count[(int) GET_SH_ARG_CLASS (mode)] & 1))
-    : cum.arg_count[(int) GET_SH_ARG_CLASS (mode)]);
+    ? (cum.arg_count[(int) get_sh_arg_class (mode)]
+       + (cum.arg_count[(int) get_sh_arg_class (mode)] & 1))
+    : cum.arg_count[(int) get_sh_arg_class (mode)]);
 }
 
 /* Return true if arg of the specified mode should be passed in a register
@@ -8067,7 +8081,7 @@ sh_function_arg_advance (cumulative_args_t ca_v, machine_mode mode,
 
   if (! ((TARGET_SH4 || TARGET_SH2A) || ca->renesas_abi)
       || sh_pass_in_reg_p (*ca, mode, type))
-    (ca->arg_count[(int) GET_SH_ARG_CLASS (mode)]
+    (ca->arg_count[(int) get_sh_arg_class (mode)]
      = (sh_round_reg (*ca, mode)
 	+ (mode == BLKmode
 	   ? CEIL (int_size_in_bytes (type), UNITS_PER_WORD)
diff --git a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h
index 34dd135..f725535 100644
--- a/gcc/config/sh/sh.h
+++ b/gcc/config/sh/sh.h
@@ -1198,13 +1198,6 @@ extern bool current_function_interrupt;
 
 #endif // __cplusplus
 
-#define GET_SH_ARG_CLASS(MODE) \
-  ((TARGET_FPU_ANY && (MODE) == SFmode) \
-   ? SH_ARG_FLOAT \
-   : TARGET_FPU_DOUBLE && (GET_MODE_CLASS (MODE) == MODE_FLOAT \
-			   || GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT) \
-     ? SH_ARG_FLOAT : SH_ARG_INT)
-
 /* Initialize a variable CUM of type CUMULATIVE_ARGS
    for a call to a function whose data type is FNTYPE.
    For a library call, FNTYPE is 0.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-05-08 14:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-08 14:17 [SH][committed] Convert GET_SH_ARG_CLASS into a function Oleg Endo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).