]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
function.c (dump_stack_clash_frame_info): New function.
authorJeff Law <law@redhat.com>
Wed, 20 Sep 2017 05:23:51 +0000 (23:23 -0600)
committerJeff Law <law@gcc.gnu.org>
Wed, 20 Sep 2017 05:23:51 +0000 (23:23 -0600)
        * function.c (dump_stack_clash_frame_info): New function.
        * function.h (dump_stack_clash_frame_info): Prototype.
        (enum stack_clash_probes): New enum.

From-SVN: r252997

gcc/ChangeLog
gcc/function.c
gcc/function.h

index 070692c5053c6ecf58d91a8425fb0b1fa8aaffe1..9783313093768fa5e01007583d178fe48b3ec887 100644 (file)
@@ -1,5 +1,9 @@
 2017-09-19  Jeff Law  <law@redhat.com>
 
+        * function.c (dump_stack_clash_frame_info): New function.
+        * function.h (dump_stack_clash_frame_info): Prototype.
+        (enum stack_clash_probes): New enum.
+
        * config/alpha/alpha.c (alpha_expand_prologue): Also check
        flag_stack_clash_protection.
        * config/arm/arm.c (arm_compute_static_chain_stack_bytes): Likewise.
index 3ae5a3afc0b4d2825d5992fdcf40ef87cddb07e0..c03e2ac514270e32da3c16439f6f38f169b40f1f 100644 (file)
@@ -5681,6 +5681,58 @@ get_arg_pointer_save_area (void)
   return ret;
 }
 \f
+
+/* If debugging dumps are requested, dump information 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
+   (i.e. 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.  */
 
index 91e0138325225aee045c63a8f788c56e32335382..76434cd59a50acf87493d433f88d7dfb4aa72d1e 100644 (file)
@@ -551,6 +551,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);