commit ea2b372d666ec1105abf4ef5418d92d612283e88 Author: law Date: Wed Sep 20 05:23:51 2017 +0000 * function.c (dump_stack_clash_frame_info): New function. * function.h (dump_stack_clash_frame_info): Prototype. (enum stack_clash_probes): New enum. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@252997 138bc75d-0d04-0410-961f-82ee72b054a4 diff --git a/gcc/function.c b/gcc/function.c index 76baf307984..9b395aebcb3 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -5263,6 +5263,58 @@ get_arg_pointer_save_area (void) return ret; } + +/* 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. */ diff --git a/gcc/function.h b/gcc/function.h index 89d71e592dd..ffea1e564ba 100644 --- a/gcc/function.h +++ b/gcc/function.h @@ -712,6 +712,16 @@ extern void instantiate_decl_rtl (rtx x); and create duplicate blocks. */ extern void reorder_blocks (void); +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); + + /* Set BLOCK_NUMBER for all the blocks in FN. */ extern void number_blocks (tree);