Message ID | 56BCA4E4.6030100@linux.vnet.ibm.com |
---|---|
State | New |
Headers | show |
On 02/11/2016 04:12 PM, Kelvin Nilsen wrote: > > * opts-global.c (handle_common_deferred_options): Introduce and > initialize two global variables to remember command-line options > specifying a stack-limiting register. > * opts.h: Add extern declarations of the two new global variables. > * emit-rtl.c (init_emit_once): Initialize the stack_limit_rtx > variable based on the values of the two new global variables. Make sure that when committed these all start with a tab character. > +void foo () > +{ > + int N = 2; > + int slots[N]; > + > +} > + Watch extra blank lines at the end of files. > @@ -442,3 +452,4 @@ handle_common_deferred_options (void) > } > } > } > + > Here too. Ok with these fixed. Bernd
On Feb 11 2016, Kelvin Nilsen <kdnilsen@linux.vnet.ibm.com> wrote: > * opts-global.c (handle_common_deferred_options): Introduce and > initialize two global variables to remember command-line options > specifying a stack-limiting register. > * opts.h: Add extern declarations of the two new global variables. > * emit-rtl.c (init_emit_once): Initialize the stack_limit_rtx > variable based on the values of the two new global variables. That breaks gcc.target/m68k/stack-limit-1.c: /daten/aranym/gcc/test/gcc/testsuite/gcc.target/m68k/stack-limit-1.c: In function 'dummy': /daten/aranym/gcc/test/gcc/testsuite/gcc.target/m68k/stack-limit-1.c:6:1: error: unrecognizable insn: (insn 10 9 11 (trap_if (ltu (cc0) (const_int 0 [0])) (const_int 1 [0x1])) /daten/aranym/gcc/test/gcc/testsuite/gcc.target/m68k/stack-limit-1.c:6 -1 (nil)) /daten/aranym/gcc/test/gcc/testsuite/gcc.target/m68k/stack-limit-1.c:6:1: internal compiler error: in extract_insn, at recog.c:2287 Andreas.
On 09/30/2016 10:02 PM, Andreas Schwab wrote: > On Feb 11 2016, Kelvin Nilsen <kdnilsen@linux.vnet.ibm.com> wrote: > >> * opts-global.c (handle_common_deferred_options): Introduce and >> initialize two global variables to remember command-line options >> specifying a stack-limiting register. >> * opts.h: Add extern declarations of the two new global variables. >> * emit-rtl.c (init_emit_once): Initialize the stack_limit_rtx >> variable based on the values of the two new global variables. > > That breaks gcc.target/m68k/stack-limit-1.c: > > /daten/aranym/gcc/test/gcc/testsuite/gcc.target/m68k/stack-limit-1.c: In function 'dummy': > /daten/aranym/gcc/test/gcc/testsuite/gcc.target/m68k/stack-limit-1.c:6:1: error: unrecognizable insn: > (insn 10 9 11 (trap_if (ltu (cc0) > (const_int 0 [0])) > (const_int 1 [0x1])) /daten/aranym/gcc/test/gcc/testsuite/gcc.target/m68k/stack-limit-1.c:6 -1 > (nil)) > /daten/aranym/gcc/test/gcc/testsuite/gcc.target/m68k/stack-limit-1.c:6:1: internal compiler error: in extract_insn, at recog.c:2287 > Please file a PR if this isn't fixed yet. Bernd
Index: gcc/testsuite/gcc.target/powerpc/pr48344-1.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/pr48344-1.c (revision 0) +++ gcc/testsuite/gcc.target/powerpc/pr48344-1.c (revision 232633) @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-fstack-limit-register=r2" } */ +void foo () +{ + int N = 2; + int slots[N]; + +} + Index: gcc/emit-rtl.c =================================================================== --- gcc/emit-rtl.c (revision 232135) +++ gcc/emit-rtl.c (working copy) @@ -57,6 +57,7 @@ along with GCC; see the file COPYING3. If not see #include "builtins.h" #include "rtl-iter.h" #include "stor-layout.h" +#include "opts.h" struct target_rtl default_target_rtl; #if SWITCHABLE_TARGET @@ -5895,6 +5896,13 @@ init_emit_once (void) /* Create the unique rtx's for certain rtx codes and operand values. */ + /* Process stack-limiting command-line options. */ + if (opt_fstack_limit_symbol_arg != NULL) + stack_limit_rtx + = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (opt_fstack_limit_symbol_arg)); + if (opt_fstack_limit_register_no >= 0) + stack_limit_rtx = gen_rtx_REG (Pmode, opt_fstack_limit_register_no); + /* Don't use gen_rtx_CONST_INT here since gen_rtx_CONST_INT in this case tries to use these variables. */ for (i = - MAX_SAVED_CONST_INT; i <= MAX_SAVED_CONST_INT; i++) Index: gcc/opts.h =================================================================== --- gcc/opts.h (revision 232135) +++ gcc/opts.h (working copy) @@ -296,6 +296,10 @@ struct cl_option_handlers struct cl_option_handler_func handlers[3]; }; +/* Hold command-line options associated with stack limitation. */ +extern const char *opt_fstack_limit_symbol_arg; +extern int opt_fstack_limit_register_no; + /* Input file names. */ extern const char **in_fnames; Index: gcc/opts-global.c =================================================================== --- gcc/opts-global.c (revision 232135) +++ gcc/opts-global.c (working copy) @@ -310,6 +310,10 @@ decode_options (struct gcc_options *opts, struct g finish_options (opts, opts_set, loc); } +/* Hold command-line options associated with stack limitation. */ +const char *opt_fstack_limit_symbol_arg = NULL; +int opt_fstack_limit_register_no = -1; + /* Process common options that have been deferred until after the handlers have been called for all options. */ @@ -417,12 +421,18 @@ handle_common_deferred_options (void) if (reg < 0) error ("unrecognized register name %qs", opt->arg); else - stack_limit_rtx = gen_rtx_REG (Pmode, reg); + { + /* Deactivate previous OPT_fstack_limit_symbol_ options. */ + opt_fstack_limit_symbol_arg = NULL; + opt_fstack_limit_register_no = reg; + } } break; case OPT_fstack_limit_symbol_: - stack_limit_rtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (opt->arg)); + /* Deactivate previous OPT_fstack_limit_register_ options. */ + opt_fstack_limit_register_no = -1; + opt_fstack_limit_symbol_arg = opt->arg; break; case OPT_fasan_shadow_offset_: @@ -442,3 +452,4 @@ handle_common_deferred_options (void) } } } +