public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH][RFA/RFC] Stack clash mitigation patch 03/08
@ 2017-07-11 21:20 Jeff Law
  2017-07-17 16:28 ` Segher Boessenkool
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff Law @ 2017-07-11 21:20 UTC (permalink / raw)
  To: gcc-patches

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

One of the painful aspects of all this code is the amount of target
dependent bits that have to be written and tested.

I didn't want to be scanning assembly code or RTL for prologues.  Each
target would have to have its own scanner which was too painful to
contemplate.

So instead I settled on having a routine that the target dependent
prologue expanders could call to dump information about what they were
doing.

This greatly simplifies the testing side of things by having a standard
way to dump decisions.  When combined with the dejagnu routines from
patch #1 which describe key attributes of the target's prologue
generation I can write tests in a fairly generic way.

This will be used by every target dependent prologue expander in this
series.

Comments/Questions?  OK for the trunk?

[-- Attachment #2: P3 --]
[-- Type: text/plain, Size: 2728 bytes --]


	* function.c (dump_stack_clash_frame_info): New function.
	* function.h (dump_stack_clash_frame_info): Prototype.
	(enum stack_clash_probes): New enum.
commit 3b09af4e78f3fdb40a913fbf99197a31315a47bc
Author: root <root@ibm-p8-rhevm-18.rhts.eng.bos.redhat.com>
Date:   Thu Jul 6 04:34:45 2017 -0400

    Generic logging routines

diff --git a/gcc/function.c b/gcc/function.c
index f625489..d78a266 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -5695,6 +5695,58 @@ get_arg_pointer_save_area (void)
   return ret;
 }
 \f
+
+/* If debugging dumps are requested, dump infomation about how the
+   target handled -fstack-check=clash for the prologue.
+
+   PROBES describes what if any probes were emitted.
+
+   RESIDUALS indicates if the prologue had any residual allocation
+   (ie total allocation was not a multiple of PROBE_INTERVAL.  */
+
+void
+dump_stack_clash_frame_info (enum stack_clash_probes probes, bool residuals)
+{
+  if (!dump_file)
+    return;
+
+  switch (probes)
+    {
+    case NO_PROBE_NO_FRAME:
+      fprintf (dump_file,
+	       "Stack clash no probe no stack adjustment in prologue.\n");
+      break;
+    case NO_PROBE_SMALL_FRAME:
+      fprintf (dump_file,
+	       "Stack clash no probe small stack adjustment in prologue.\n");
+      break;
+    case PROBE_INLINE:
+      fprintf (dump_file, "Stack clash inline probes in prologue.\n");
+      break;
+    case PROBE_LOOP:
+      fprintf (dump_file, "Stack clash probe loop in prologue.\n");
+      break;
+    }
+
+  if (residuals)
+    fprintf (dump_file, "Stack clash residual allocation in prologue.\n");
+  else
+    fprintf (dump_file, "Stack clash no residual allocation in prologue.\n");
+
+  if (frame_pointer_needed)
+    fprintf (dump_file, "Stack clash frame pointer needed.\n");
+  else
+    fprintf (dump_file, "Stack clash no frame pointer needed.\n");
+
+  if (TREE_THIS_VOLATILE (cfun->decl))
+    fprintf (dump_file,
+	     "Stack clash noreturn prologue, assuming no implicit"
+	     " probes in caller.\n");
+  else
+    fprintf (dump_file,
+	     "Stack clash not noreturn prologue.\n");
+}
+
 /* Add a list of INSNS to the hash HASHP, possibly allocating HASHP
    for the first time.  */
 
diff --git a/gcc/function.h b/gcc/function.h
index 0f34bcd..87dac80 100644
--- a/gcc/function.h
+++ b/gcc/function.h
@@ -553,6 +553,14 @@ do {								\
   ((TARGET_PTRMEMFUNC_VBIT_LOCATION == ptrmemfunc_vbit_in_pfn)	     \
    ? MAX (FUNCTION_BOUNDARY, 2 * BITS_PER_UNIT) : FUNCTION_BOUNDARY)
 
+enum stack_clash_probes {
+  NO_PROBE_NO_FRAME,
+  NO_PROBE_SMALL_FRAME,
+  PROBE_INLINE,
+  PROBE_LOOP
+};
+
+extern void dump_stack_clash_frame_info (enum stack_clash_probes, bool);
 \f
 
 extern void push_function_context (void);

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

* Re: [PATCH][RFA/RFC] Stack clash mitigation patch 03/08
  2017-07-11 21:20 [PATCH][RFA/RFC] Stack clash mitigation patch 03/08 Jeff Law
@ 2017-07-17 16:28 ` Segher Boessenkool
  2017-07-17 17:39   ` Jeff Law
  0 siblings, 1 reply; 3+ messages in thread
From: Segher Boessenkool @ 2017-07-17 16:28 UTC (permalink / raw)
  To: Jeff Law; +Cc: gcc-patches

Hi,

Just some typos:

On Tue, Jul 11, 2017 at 03:20:38PM -0600, Jeff Law wrote:
> +/* If debugging dumps are requested, dump infomation about how the

Typo ("information").

> +   target handled -fstack-check=clash for the prologue.
> +
> +   PROBES describes what if any probes were emitted.
> +
> +   RESIDUALS indicates if the prologue had any residual allocation
> +   (ie total allocation was not a multiple of PROBE_INTERVAL.  */

Missing closing paren; i.e.


Segher

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

* Re: [PATCH][RFA/RFC] Stack clash mitigation patch 03/08
  2017-07-17 16:28 ` Segher Boessenkool
@ 2017-07-17 17:39   ` Jeff Law
  0 siblings, 0 replies; 3+ messages in thread
From: Jeff Law @ 2017-07-17 17:39 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: gcc-patches

On 07/17/2017 10:28 AM, Segher Boessenkool wrote:
> Hi,
> 
> Just some typos:
> 
> On Tue, Jul 11, 2017 at 03:20:38PM -0600, Jeff Law wrote:
>> +/* If debugging dumps are requested, dump infomation about how the
> 
> Typo ("information").
> 
>> +   target handled -fstack-check=clash for the prologue.
>> +
>> +   PROBES describes what if any probes were emitted.
>> +
>> +   RESIDUALS indicates if the prologue had any residual allocation
>> +   (ie total allocation was not a multiple of PROBE_INTERVAL.  */
> 
> Missing closing paren; i.e.
THanks.  Fixed for next update.

I nearly posted V2 last night, but wanted to take a stab at the aarch64
bits again :-)

jeff

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

end of thread, other threads:[~2017-07-17 17:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-11 21:20 [PATCH][RFA/RFC] Stack clash mitigation patch 03/08 Jeff Law
2017-07-17 16:28 ` Segher Boessenkool
2017-07-17 17:39   ` Jeff Law

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