public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/aoliva/heads/strub)] handle unresolved aliases
@ 2021-07-26 10:06 Alexandre Oliva
  0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Oliva @ 2021-07-26 10:06 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:3eba272e2ee4b7e5b9e93f61b9778128f725c492

commit 3eba272e2ee4b7e5b9e93f61b9778128f725c492
Author: Alexandre Oliva <oliva@adacore.com>
Date:   Mon Jul 26 05:38:27 2021 -0300

    handle unresolved aliases

Diff:
---
 gcc/doc/extend.texi |  3 ++-
 gcc/ipa-strub.c     | 25 ++++++++++++++++---------
 2 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 7c1b3037699..020bb1aa808 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -77,6 +77,7 @@ extensions, accepted by GCC in C90 mode and in C++.
 * Function Names::      Printable strings which are the name of the current
                         function.
 * Return Address::      Getting the return or frame address of a function.
+* Stack Scrubbing::     Stack scrubbing interfaces.
 * Vector Extensions::   Using vector instructions through built-in functions.
 * Offsetof::            Special syntax for implementing @code{offsetof}.
 * __sync Builtins::     Legacy built-in functions for atomic memory access.
@@ -11708,7 +11709,7 @@ situations.
 This function returns the value of the stack pointer register.
 @end deftypefn
 
-@node Stack scrubbing
+@node Stack Scrubbing
 @section Stack scrubbing interfaces
 
 Stack scrubbing involves cooperation between a strub context, i.e., a
diff --git a/gcc/ipa-strub.c b/gcc/ipa-strub.c
index d634681f16f..cdabd51f357 100644
--- a/gcc/ipa-strub.c
+++ b/gcc/ipa-strub.c
@@ -263,7 +263,7 @@ can_strub_p (cgraph_node *node, bool report = false)
 	return result;
 
       sorry_at (DECL_SOURCE_LOCATION (node->decl),
-		"%qD is not eligible for strub because of attribute noipa",
+		"%qD is not eligible for strub because of attribute %<noipa%>",
 		node->decl);
     }
 
@@ -325,7 +325,7 @@ can_strub_internally_p (cgraph_node *node, bool report = false)
 
       sorry_at (DECL_SOURCE_LOCATION (node->decl),
 		"%qD is not eligible for internal strub"
-		" because of attribute noclone",
+		" because of attribute %<noclone%>",
 		node->decl);
     }
 
@@ -677,10 +677,11 @@ set_strub_mode_to (cgraph_node *node, enum strub_mode mode)
 	  if (node->alias)
 	    {
 	      cgraph_node *target = node->ultimate_alias_target ();
-	      error_at (DECL_SOURCE_LOCATION (target->decl),
-			"the incompatible selection was determined"
-			" by ultimate alias target %qD",
-			target->decl);
+	      if (target != node)
+		error_at (DECL_SOURCE_LOCATION (target->decl),
+			  "the incompatible selection was determined"
+			  " by ultimate alias target %qD",
+			  target->decl);
 	    }
 
 	  /* Report any incompatibilities with explicitly-requested strub.  */
@@ -730,8 +731,11 @@ set_strub_mode (cgraph_node *node)
 {
   tree attr = get_strub_attr_from_decl (node->decl);
 
-  enum strub_mode mode = (node->alias
-			  ? get_strub_mode (node->ultimate_alias_target ())
+  cgraph_node *xnode = node;
+  if (node->alias)
+    xnode = node->ultimate_alias_target ();
+  enum strub_mode mode = (!xnode->alias
+			  ? get_strub_mode (xnode)
 			  : compute_strub_mode (node, attr));
 
   set_strub_mode_to (node, mode);
@@ -1461,7 +1465,7 @@ verify_strub ()
 	      || callee_mode == STRUB_INTERNAL)
 	    error_at (gimple_location (e->call_stmt),
 		      "indirect non-strub call in strub context %qD",
-		      e->callee->decl, node->decl);
+		      node->decl);
 	}
       else if (!strub_callable_from_p (e->callee, node))
 	error_at (gimple_location (e->call_stmt),
@@ -1542,6 +1546,9 @@ pass_ipa_strub::execute (function *)
 	    gcall *ocall = e->call_stmt;
 	    gimple_stmt_iterator gsi = gsi_for_stmt (ocall);
 
+	    /* ??? If it's a (tail?) call within a strub context, maybe pass on
+	       the strub watermark instead of wrapping the call.  */
+
 	    /* Initialize the watermark before the call.  */
 	    tree swm = create_tmp_var (ptr_type_node, ".strub.watermark");
 	    TREE_ADDRESSABLE (swm) = true;


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [gcc(refs/users/aoliva/heads/strub)] handle unresolved aliases
@ 2021-07-26  9:02 Alexandre Oliva
  0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Oliva @ 2021-07-26  9:02 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:4161047eae313f0285b0b21eb5460b457653a98a

commit 4161047eae313f0285b0b21eb5460b457653a98a
Author: Alexandre Oliva <oliva@adacore.com>
Date:   Mon Jul 26 05:38:27 2021 -0300

    handle unresolved aliases

Diff:
---
 gcc/doc/extend.texi |  3 ++-
 gcc/ipa-strub.c     | 19 +++++++++++++------
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 7c1b3037699..020bb1aa808 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -77,6 +77,7 @@ extensions, accepted by GCC in C90 mode and in C++.
 * Function Names::      Printable strings which are the name of the current
                         function.
 * Return Address::      Getting the return or frame address of a function.
+* Stack Scrubbing::     Stack scrubbing interfaces.
 * Vector Extensions::   Using vector instructions through built-in functions.
 * Offsetof::            Special syntax for implementing @code{offsetof}.
 * __sync Builtins::     Legacy built-in functions for atomic memory access.
@@ -11708,7 +11709,7 @@ situations.
 This function returns the value of the stack pointer register.
 @end deftypefn
 
-@node Stack scrubbing
+@node Stack Scrubbing
 @section Stack scrubbing interfaces
 
 Stack scrubbing involves cooperation between a strub context, i.e., a
diff --git a/gcc/ipa-strub.c b/gcc/ipa-strub.c
index d634681f16f..7ee12ed9350 100644
--- a/gcc/ipa-strub.c
+++ b/gcc/ipa-strub.c
@@ -677,10 +677,11 @@ set_strub_mode_to (cgraph_node *node, enum strub_mode mode)
 	  if (node->alias)
 	    {
 	      cgraph_node *target = node->ultimate_alias_target ();
-	      error_at (DECL_SOURCE_LOCATION (target->decl),
-			"the incompatible selection was determined"
-			" by ultimate alias target %qD",
-			target->decl);
+	      if (target != node)
+		error_at (DECL_SOURCE_LOCATION (target->decl),
+			  "the incompatible selection was determined"
+			  " by ultimate alias target %qD",
+			  target->decl);
 	    }
 
 	  /* Report any incompatibilities with explicitly-requested strub.  */
@@ -730,8 +731,11 @@ set_strub_mode (cgraph_node *node)
 {
   tree attr = get_strub_attr_from_decl (node->decl);
 
-  enum strub_mode mode = (node->alias
-			  ? get_strub_mode (node->ultimate_alias_target ())
+  cgraph_node *xnode = node;
+  if (node->alias)
+    xnode = node->ultimate_alias_target ();
+  enum strub_mode mode = (!xnode->alias
+			  ? get_strub_mode (xnode)
 			  : compute_strub_mode (node, attr));
 
   set_strub_mode_to (node, mode);
@@ -1542,6 +1546,9 @@ pass_ipa_strub::execute (function *)
 	    gcall *ocall = e->call_stmt;
 	    gimple_stmt_iterator gsi = gsi_for_stmt (ocall);
 
+	    /* ??? If it's a (tail?) call within a strub context, maybe pass on
+	       the strub watermark instead of wrapping the call.  */
+
 	    /* Initialize the watermark before the call.  */
 	    tree swm = create_tmp_var (ptr_type_node, ".strub.watermark");
 	    TREE_ADDRESSABLE (swm) = true;


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-07-26 10:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-26 10:06 [gcc(refs/users/aoliva/heads/strub)] handle unresolved aliases Alexandre Oliva
  -- strict thread matches above, loose matches on Subject: below --
2021-07-26  9:02 Alexandre Oliva

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).