public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Martin Liska <marxin@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-1838] v850: add v850_can_inline_p target hook
Date: Mon, 28 Jun 2021 09:28:31 +0000 (GMT)	[thread overview]
Message-ID: <20210628092831.796B13955438@sourceware.org> (raw)

https://gcc.gnu.org/g:22069036efda4661862aeee213859f1ee8511ab5

commit r12-1838-g22069036efda4661862aeee213859f1ee8511ab5
Author: Martin Liska <mliska@suse.cz>
Date:   Wed Jun 23 15:46:22 2021 +0200

    v850: add v850_can_inline_p target hook
    
    gcc/ChangeLog:
    
            * config/v850/v850.c (v850_option_override): Build default
            target node.
            (v850_can_inline_p): New.  Allow MASK_PROLOG_FUNCTION to be
            ignored for inlining.
            (TARGET_CAN_INLINE_P): New.

Diff:
---
 gcc/config/v850/v850.c | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/gcc/config/v850/v850.c b/gcc/config/v850/v850.c
index e0e5005d865..371e6026e9a 100644
--- a/gcc/config/v850/v850.c
+++ b/gcc/config/v850/v850.c
@@ -3140,6 +3140,11 @@ v850_option_override (void)
   /* The RH850 ABI does not (currently) support the use of the CALLT instruction.  */
   if (! TARGET_GCC_ABI)
     target_flags |= MASK_DISABLE_CALLT;
+
+  /* Save the initial options in case the user does function specific
+     options.  */
+  target_option_default_node = target_option_current_node
+    = build_target_option_node (&global_options, &global_options_set);
 }
 \f
 const char *
@@ -3192,6 +3197,29 @@ v850_modes_tieable_p (machine_mode mode1, machine_mode mode2)
   return (mode1 == mode2
 	  || (GET_MODE_SIZE (mode1) <= 4 && GET_MODE_SIZE (mode2) <= 4));
 }
+
+static bool
+v850_can_inline_p (tree caller, tree callee)
+{
+  tree caller_tree = DECL_FUNCTION_SPECIFIC_TARGET (caller);
+  tree callee_tree = DECL_FUNCTION_SPECIFIC_TARGET (callee);
+
+  const unsigned HOST_WIDE_INT safe_flags = MASK_PROLOG_FUNCTION;
+
+  if (!callee_tree)
+    callee_tree = target_option_default_node;
+  if (!caller_tree)
+    caller_tree = target_option_default_node;
+  if (callee_tree == caller_tree)
+    return true;
+
+  cl_target_option *caller_opts = TREE_TARGET_OPTION (caller_tree);
+  cl_target_option *callee_opts = TREE_TARGET_OPTION (callee_tree);
+
+  return ((caller_opts->x_target_flags & ~safe_flags)
+	  == (callee_opts->x_target_flags & ~safe_flags));
+}
+
 \f
 /* Initialize the GCC target structure.  */
 
@@ -3306,6 +3334,10 @@ v850_modes_tieable_p (machine_mode mode1, machine_mode mode2)
 #undef  TARGET_HAVE_SPECULATION_SAFE_VALUE
 #define TARGET_HAVE_SPECULATION_SAFE_VALUE speculation_safe_value_not_needed
 
+#undef TARGET_CAN_INLINE_P
+#define TARGET_CAN_INLINE_P v850_can_inline_p
+
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 #include "gt-v850.h"


                 reply	other threads:[~2021-06-28  9:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20210628092831.796B13955438@sourceware.org \
    --to=marxin@gcc.gnu.org \
    --cc=gcc-cvs@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).