public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Anatoly Sokolov <aesok@post.ru>
To: gcc-patches@gcc.gnu.org
Subject: [MN10300] Remove FUNCTION_VALUE, FUNCTION_OUTGOING_VALUE and LIBCALL_VALUE macros.
Date: Sun, 25 Oct 2009 12:02:00 -0000	[thread overview]
Message-ID: <1529218693.20091025145911@post.ru> (raw)

Hello.

  This patch removes obsolete FUNCTION_VALUE, FUNCTION_OUTGOING_VALUE and
LIBCALL_VALUE macros from mn10300 back end in the GCC and introduces
equivalent TARGET_FUNCTION_VALUE,  TARGET_FUNCTION_OUTGOING_VALUE and
TARGET_LIBCALL_VALUE target hooks. Also this patch convert
FUNCTION_VALUE_REGNO_P macro to mn10300_function_value_regno_p function, this
should simplify hookize FUNCTION_VALUE_REGNO_P macro in the future.

  Regression tested on mn10300-unknown-elf.

        * config/mn10300/mn10300.c (mn10300_function_value): Make static, add
        new 'outgoing' argument.
        (mn10300_libcall_value, mn10300_function_value_regno_p): New
        functions.
        (TARGET_FUNCTION_VALUE, TARGET_LIBCALL_VALUE): Declare.
        * config/mn10300/mn10300.h: (FUNCTION_VALUE, FUNCTION_OUTGOING_VALUE,
        LIBCALL_VALUE): Remove.
        (FUNCTION_VALUE_REGNO_P): Redefine, use mn10300_function_value_regno_p.
        * config/mn10300/mn10300-protos.h (mh10300_function_value_regno_p):
        Declare.


  OK to install?

Index: gcc/config/mn10300/mn10300.c
===================================================================
--- gcc/config/mn10300/mn10300.c        (revision 153538)
+++ gcc/config/mn10300/mn10300.c        (working copy)
@@ -86,6 +86,8 @@
 static void mn10300_encode_section_info (tree, rtx, int);
 static void mn10300_asm_trampoline_template (FILE *);
 static void mn10300_trampoline_init (rtx, tree, rtx);
+static rtx mn10300_function_value (const_tree, const_tree, bool);
+static rtx mn10300_libcall_value (enum machine_mode, const_rtx);
 \f
 /* Initialize the GCC target structure.  */
 #undef TARGET_ASM_ALIGNED_HI_OP
@@ -139,6 +141,11 @@
 #undef TARGET_TRAMPOLINE_INIT
 #define TARGET_TRAMPOLINE_INIT mn10300_trampoline_init
 
+#undef TARGET_FUNCTION_VALUE
+#define TARGET_FUNCTION_VALUE mn10300_function_value
+#undef TARGET_LIBCALL_VALUE
+#define TARGET_LIBCALL_VALUE mn10300_libcall_value
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
 /* Implement TARGET_HANDLE_OPTION.  */
@@ -1624,8 +1631,10 @@
    we only return the PARALLEL for outgoing values; we do not want
    callers relying on this extra copy.  */
 
-rtx
-mn10300_function_value (const_tree valtype, const_tree func, int outgoing)
+static rtx
+mn10300_function_value (const_tree valtype,
+                       const_tree fn_decl_or_type ATTRIBUTE_UNUSED,
+                       bool outgoing)
 {
   rtx rv;
   enum machine_mode mode = TYPE_MODE (valtype);
@@ -1649,6 +1658,23 @@
   return rv;
 }
 
+/* Implements TARGET_LIBCALL_VALUE.  */
+
+static rtx
+mn10300_libcall_value (enum machine_mode mode,
+                      const_rtx fun ATTRIBUTE_UNUSED)
+{
+  return gen_rtx_REG (mode, FIRST_DATA_REGNUM);
+}
+
+/* Implements FUNCTION_VALUE_REGNO_P.  */
+
+bool
+mn10300_function_value_regno_p (const unsigned int regno)
+{
+ return (regno == FIRST_DATA_REGNUM || regno == FIRST_ADDRESS_REGNUM);
+}
+
 /* Output a tst insn.  */
 const char *
 output_tst (rtx operand, rtx insn)
Index: gcc/config/mn10300/mn10300.h
===================================================================
--- gcc/config/mn10300/mn10300.h        (revision 153538)
+++ gcc/config/mn10300/mn10300.h        (working copy)
@@ -564,26 +564,8 @@
 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
   function_arg (&CUM, MODE, TYPE, NAMED)
 
-/* Define how to find the value returned by a function.
-   VALTYPE is the data type of the value (as a tree).
-   If the precise function being called is known, FUNC is its FUNCTION_DECL;
-   otherwise, FUNC is 0.  */
+#define FUNCTION_VALUE_REGNO_P(N)  mn10300_function_value_regno_p (N)
 
-#define FUNCTION_VALUE(VALTYPE, FUNC) \
-  mn10300_function_value (VALTYPE, FUNC, 0)
-#define FUNCTION_OUTGOING_VALUE(VALTYPE, FUNC) \
-  mn10300_function_value (VALTYPE, FUNC, 1)
-
-/* Define how to find the value returned by a library function
-   assuming the value has mode MODE.  */
-
-#define LIBCALL_VALUE(MODE) gen_rtx_REG (MODE, FIRST_DATA_REGNUM)
-
-/* 1 if N is a possible register number for a function value.  */
-
-#define FUNCTION_VALUE_REGNO_P(N) \
-  ((N) == FIRST_DATA_REGNUM || (N) == FIRST_ADDRESS_REGNUM)
-
 #define DEFAULT_PCC_STRUCT_RETURN 0
 
 /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
Index: gcc/config/mn10300/mn10300-protos.h
===================================================================
--- gcc/config/mn10300/mn10300-protos.h	(revision 153538)
+++ gcc/config/mn10300/mn10300-protos.h	(working copy)
@@ -37,12 +37,13 @@
 extern int impossible_plus_operand (rtx, enum machine_mode);
 
 extern bool mn10300_wide_const_load_uses_clr (rtx operands[2]);
+
+extern bool mn10300_function_value_regno_p (const unsigned int);
 #endif /* RTX_CODE */
 
 #ifdef TREE_CODE
 extern struct rtx_def *function_arg (CUMULATIVE_ARGS *,
                                     enum machine_mode, tree, int);
-extern rtx mn10300_function_value (const_tree, const_tree, int);
 #endif /* TREE_CODE */
 
 extern void expand_prologue (void);


Anatoly.

             reply	other threads:[~2009-10-25 11:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-25 12:02 Anatoly Sokolov [this message]
2009-10-26 15:44 ` Jeff Law

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1529218693.20091025145911@post.ru \
    --to=aesok@post.ru \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).