public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Alexandre Oliva <aoliva@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc(refs/users/aoliva/heads/testme)] drop obsolete compat gunk from strub
Date: Fri,  9 Jun 2023 06:18:18 +0000 (GMT)	[thread overview]
Message-ID: <20230609061818.E83873856DCB@sourceware.org> (raw)

https://gcc.gnu.org/g:0bf96d42bcc722abfbf0ecceebe085343f177d0c

commit 0bf96d42bcc722abfbf0ecceebe085343f177d0c
Author: Alexandre Oliva <oliva@gnu.org>
Date:   Thu Jun 8 07:40:04 2023 -0300

    drop obsolete compat gunk from strub

Diff:
---
 gcc/ipa-strub.cc | 69 ++++----------------------------------------------------
 1 file changed, 4 insertions(+), 65 deletions(-)

diff --git a/gcc/ipa-strub.cc b/gcc/ipa-strub.cc
index 5fc4fca550d..921e4eb05ac 100644
--- a/gcc/ipa-strub.cc
+++ b/gcc/ipa-strub.cc
@@ -58,16 +58,8 @@ along with GCC; see the file COPYING3.  If not see
 #include "diagnostic.h"
 #include "intl.h"
 #include "ipa-strub.h"
-
-#if BUILDING_GCC_MAJOR >= 11
-# include "symtab-thunks.h"
-# include "attr-fnspec.h"
-# define HAVE_ATTR_FNSPEC 1
-# define FOR_GCC_11P 1
-#else
-# define HAVE_ATTR_FNSPEC 0
-# define FOR_GCC_11P 0
-#endif
+#include "symtab-thunks.h"
+#include "attr-fnspec.h"
 
 /* Const and pure functions that gain a watermark parameter for strub purposes
    are still regarded as such, which may cause the inline expansions of the
@@ -1675,7 +1667,7 @@ public:
       {								\
 	tree type = build_function_type_list FNTYPELIST;	\
 	tree attrs = NULL;					\
-	if (FNSPEC && HAVE_ATTR_FNSPEC)				\
+	if (FNSPEC)						\
 	  attrs = tree_cons (get_identifier ("fn spec"),	\
 			     build_tree_list			\
 			     (NULL_TREE,			\
@@ -1737,11 +1729,7 @@ public:
 	gimple_set_location (update, DECL_SOURCE_LOCATION (node->decl));
       gimple_seq_add_stmt (&seq, update);
       if (node)
-#if !IMPLICIT_CGRAPH_EDGES
 	node->create_edge (cgraph_node::get_create (uwm), update, count, false);
-#else
-	(void)count;
-#endif
       return seq;
     }
 
@@ -1932,10 +1920,6 @@ build_ref_type_for (tree parm, bool nonaliased = true)
 static void
 add_call_edges_for_seq (gimple_seq seq, profile_count count)
 {
-#if IMPLICIT_CGRAPH_EDGES
-  return;
-#endif
-
   cgraph_node *node = cgraph_node::get_create (current_function_decl);
 
   for (gimple_stmt_iterator gsi = gsi_start (seq);
@@ -2326,10 +2310,8 @@ pass_ipa_strub::adjust_at_calls_call (cgraph_edge *e, int named_args,
       if (gimple_has_location (ocall))
 	gimple_set_location (stptr, gimple_location (ocall));
       gsi_insert_before (&gsi, stptr, GSI_SAME_STMT);
-#if !IMPLICIT_CGRAPH_EDGES
       e->caller->create_edge (cgraph_node::get_create (enter),
 			      stptr, gsi_bb (gsi)->count, false);
-#endif
     }
 
 
@@ -2757,11 +2739,7 @@ pass_ipa_strub::execute (function *)
 	  relayout_decl (nparm);
 	  TREE_ADDRESSABLE (nparm) = 0;
 	  DECL_BY_REFERENCE (nparm) = 0;
-#if FOR_GCC_11P
 	  DECL_NOT_GIMPLE_REG_P (nparm) = 0;
-#else
-	  DECL_GIMPLE_REG_P (nparm) = 1;
-#endif
 	  /* ??? This avoids mismatches in debug info bind stmts in
 	     e.g. a-chahan .  */
 	  DECL_ABSTRACT_ORIGIN (nparm) = NULL;
@@ -2781,7 +2759,6 @@ pass_ipa_strub::execute (function *)
 	gcc_checking_assert (TYPE_ARG_TYPES (nftype)
 			     != TYPE_ARG_TYPES (TREE_TYPE (onode->decl)));
 
-#if HAVE_ATTR_FNSPEC
 	/* Check that fnspec still works for the modified function signature,
 	   and drop it otherwise.  */
 	bool drop_fnspec = false;
@@ -2793,20 +2770,15 @@ pass_ipa_strub::execute (function *)
 	  retcopy = (unsigned) -1;
 
 	unsigned i = 0;
-#endif
 	for (tree nparm = DECL_ARGUMENTS (nnode->decl),
 	       nparmt = TYPE_ARG_TYPES (nftype);
 	     adjust_ftype > 0;
-#if HAVE_ATTR_FNSPEC
-	     i++,
-#endif
-	       nparm = DECL_CHAIN (nparm), nparmt = TREE_CHAIN (nparmt))
+	     i++, nparm = DECL_CHAIN (nparm), nparmt = TREE_CHAIN (nparmt))
 	  if (indirect_nparms.contains (nparm))
 	    {
 	      TREE_VALUE (nparmt) = TREE_TYPE (nparm);
 	      adjust_ftype--;
 
-#if HAVE_ATTR_FNSPEC
 	      if (fnspec && !drop_fnspec)
 		{
 		  if (i == retcopy)
@@ -2834,15 +2806,12 @@ pass_ipa_strub::execute (function *)
 			drop_fnspec = true;
 		    }
 		}
-#endif
 	    }
 
-#if HAVE_ATTR_FNSPEC
 	/* ??? Maybe we could adjust it instead.  */
 	if (drop_fnspec)
 	  remove_named_attribute_unsharing ("fn spec",
 					    &TYPE_ATTRIBUTES (nftype));
-#endif
 
 	TREE_TYPE (nnode->decl) = nftype;
       }
@@ -2944,17 +2913,9 @@ pass_ipa_strub::execute (function *)
 	/* Turn alias into thunk and expand it into GIMPLE representation.  */
 	onode->definition = true;
 
-#if FOR_GCC_11P
 	thunk_info::get_create (onode);
 	onode->thunk = true;
-#else
-	memset (&onode->thunk, 0, sizeof (cgraph_thunk_info));
-	onode->thunk.thunk_p = true;
-	onode->thunk.alias = target->decl;
-#endif
-#if !IMPLICIT_CGRAPH_EDGES
 	onode->create_edge (target, NULL, onode->count);
-#endif
 	onode->callees->can_throw_external = !TREE_NOTHROW (target->decl);
 
 	tree arguments = DECL_ARGUMENTS (decl);
@@ -2990,11 +2951,9 @@ pass_ipa_strub::execute (function *)
 
 	    current_function_decl = thunk_fndecl;
 
-#if FOR_GCC_11P
 	    /* Ensure thunks are emitted in their correct sections.  */
 	    resolve_unique_section (thunk_fndecl, 0,
 				    flag_function_sections);
-#endif
 
 	    bitmap_obstack_initialize (NULL);
 
@@ -3078,14 +3037,8 @@ pass_ipa_strub::execute (function *)
 		      tree addr = build1 (ADDR_EXPR, ref_type, arg);
 		      tmp = arg = addr;
 		    }
-#if ! FOR_GCC_11P
-		  else if (VECTOR_TYPE_P (TREE_TYPE (arg))
-			   || TREE_CODE (TREE_TYPE (arg)) == COMPLEX_TYPE)
-		    DECL_GIMPLE_REG_P (arg) = 1;
-#else
 		  else
 		    DECL_NOT_GIMPLE_REG_P (arg) = 0;
-#endif
 
 		  /* Convert the argument back to the type used by the calling
 		     conventions, e.g. a non-prototyped float type is passed as
@@ -3169,10 +3122,8 @@ pass_ipa_strub::execute (function *)
 	    profile_status_for_fn (cfun)
 	      = cfg_count.initialized_p () && cfg_count.ipa_p ()
 	      ? PROFILE_READ : PROFILE_GUESSED;
-#if FOR_GCC_11P
 	    /* FIXME: C++ FE should stop setting TREE_ASM_WRITTEN on thunks.  */
 	    // TREE_ASM_WRITTEN (thunk_fndecl) = false;
-#endif
 	    delete_unreachable_blocks ();
 	    update_ssa (TODO_update_ssa);
 	    checking_verify_flow_info ();
@@ -3180,11 +3131,7 @@ pass_ipa_strub::execute (function *)
 
 	    /* Since we want to emit the thunk, we explicitly mark its name as
 	       referenced.  */
-#if FOR_GCC_11P
 	    onode->thunk = false;
-#else
-	    onode->thunk.thunk_p = false;
-#endif
 	    onode->lowered = true;
 	    bitmap_obstack_release (NULL);
 	  }
@@ -3192,9 +3139,7 @@ pass_ipa_strub::execute (function *)
 	  set_cfun (NULL);
 	}
 
-#if FOR_GCC_11P
 	thunk_info::remove (onode);
-#endif
 
 	// some more of create_wrapper at the end of the next block.
       }
@@ -3381,10 +3326,8 @@ pass_ipa_strub::execute (function *)
       gcall *stptr = gimple_build_call (enter, 1, unshare_expr (swmp));
       gimple_set_location (stptr, gimple_location (wrcall));
       gsi_insert_before (&gsi, stptr, GSI_SAME_STMT);
-#if !IMPLICIT_CGRAPH_EDGES
       onode->create_edge (cgraph_node::get_create (enter),
 			  stptr, gsi_bb (gsi)->count, false);
-#endif
 
       int nargs = gimple_call_num_args (wrcall);
 
@@ -3399,10 +3342,8 @@ pass_ipa_strub::execute (function *)
 	  gimple_set_location (appargs, gimple_location (wrcall));
 	  gsi_insert_before (&gsi, appargs, GSI_SAME_STMT);
 	  gimple_call_set_arg (wrcall, nargs - 2 - is_stdarg, aalst);
-#if !IMPLICIT_CGRAPH_EDGES
 	  onode->create_edge (cgraph_node::get_create (bappargs),
 			      appargs, gsi_bb (gsi)->count, false);
-#endif
 	}
 
       if (is_stdarg)
@@ -3420,10 +3361,8 @@ pass_ipa_strub::execute (function *)
 					      integer_zero_node);
 	  gimple_set_location (vastart, gimple_location (wrcall));
 	  gsi_insert_before (&gsi, vastart, GSI_SAME_STMT);
-#if !IMPLICIT_CGRAPH_EDGES
 	  onode->create_edge (cgraph_node::get_create (bvastart),
 			      vastart, gsi_bb (gsi)->count, false);
-#endif
 
 	  tree bvaend = builtin_decl_explicit (BUILT_IN_VA_END);
 	  gcall *vaend = gimple_build_call (bvaend, 1, unshare_expr (vaptr));

             reply	other threads:[~2023-06-09  6:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-09  6:18 Alexandre Oliva [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-06-09  8:08 Alexandre Oliva
2023-06-09  6:26 Alexandre Oliva
2023-06-08 11:00 Alexandre Oliva
2023-06-08 10:44 Alexandre Oliva

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=20230609061818.E83873856DCB@sourceware.org \
    --to=aoliva@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).