13f101
commit ea2b372d666ec1105abf4ef5418d92d612283e88
13f101
Author: law <law@138bc75d-0d04-0410-961f-82ee72b054a4>
13f101
Date:   Wed Sep 20 05:23:51 2017 +0000
13f101
13f101
            * function.c (dump_stack_clash_frame_info): New function.
13f101
            * function.h (dump_stack_clash_frame_info): Prototype.
13f101
            (enum stack_clash_probes): New enum.
13f101
    
13f101
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@252997 138bc75d-0d04-0410-961f-82ee72b054a4
13f101
13f101
diff --git a/gcc/function.c b/gcc/function.c
13f101
index 76baf307984..9b395aebcb3 100644
13f101
--- a/gcc/function.c
13f101
+++ b/gcc/function.c
13f101
@@ -5263,6 +5263,58 @@ get_arg_pointer_save_area (void)
13f101
   return ret;
13f101
 }
13f101
 
13f101
+
13f101
+/* If debugging dumps are requested, dump information about how the
13f101
+   target handled -fstack-check=clash for the prologue.
13f101
+
13f101
+   PROBES describes what if any probes were emitted.
13f101
+
13f101
+   RESIDUALS indicates if the prologue had any residual allocation
13f101
+   (i.e. total allocation was not a multiple of PROBE_INTERVAL).  */
13f101
+
13f101
+void
13f101
+dump_stack_clash_frame_info (enum stack_clash_probes probes, bool residuals)
13f101
+{
13f101
+  if (!dump_file)
13f101
+    return;
13f101
+
13f101
+  switch (probes)
13f101
+    {
13f101
+    case NO_PROBE_NO_FRAME:
13f101
+      fprintf (dump_file,
13f101
+	       "Stack clash no probe no stack adjustment in prologue.\n");
13f101
+      break;
13f101
+    case NO_PROBE_SMALL_FRAME:
13f101
+      fprintf (dump_file,
13f101
+	       "Stack clash no probe small stack adjustment in prologue.\n");
13f101
+      break;
13f101
+    case PROBE_INLINE:
13f101
+      fprintf (dump_file, "Stack clash inline probes in prologue.\n");
13f101
+      break;
13f101
+    case PROBE_LOOP:
13f101
+      fprintf (dump_file, "Stack clash probe loop in prologue.\n");
13f101
+      break;
13f101
+    }
13f101
+
13f101
+  if (residuals)
13f101
+    fprintf (dump_file, "Stack clash residual allocation in prologue.\n");
13f101
+  else
13f101
+    fprintf (dump_file, "Stack clash no residual allocation in prologue.\n");
13f101
+
13f101
+  if (frame_pointer_needed)
13f101
+    fprintf (dump_file, "Stack clash frame pointer needed.\n");
13f101
+  else
13f101
+    fprintf (dump_file, "Stack clash no frame pointer needed.\n");
13f101
+
13f101
+  if (TREE_THIS_VOLATILE (cfun->decl))
13f101
+    fprintf (dump_file,
13f101
+	     "Stack clash noreturn prologue, assuming no implicit"
13f101
+	     " probes in caller.\n");
13f101
+  else
13f101
+    fprintf (dump_file,
13f101
+	     "Stack clash not noreturn prologue.\n");
13f101
+}
13f101
+
13f101
 /* Add a list of INSNS to the hash HASHP, possibly allocating HASHP
13f101
    for the first time.  */
13f101
 
13f101
diff --git a/gcc/function.h b/gcc/function.h
13f101
index 89d71e592dd..ffea1e564ba 100644
13f101
--- a/gcc/function.h
13f101
+++ b/gcc/function.h
13f101
@@ -712,6 +712,16 @@ extern void instantiate_decl_rtl (rtx x);
13f101
    and create duplicate blocks.  */
13f101
 extern void reorder_blocks (void);
13f101
 
13f101
+enum stack_clash_probes {
13f101
+  NO_PROBE_NO_FRAME,
13f101
+  NO_PROBE_SMALL_FRAME,
13f101
+  PROBE_INLINE,
13f101
+  PROBE_LOOP
13f101
+};
13f101
+
13f101
+extern void dump_stack_clash_frame_info (enum stack_clash_probes, bool);
13f101
+
13f101
+
13f101
 /* Set BLOCK_NUMBER for all the blocks in FN.  */
13f101
 extern void number_blocks (tree);
13f101