This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

3.0 PATCH: --param support



The following patch includes the basic --param machinery as well as
Jeffrey's uses of it to throttle the n^2 delay slot filling routines.
This reduces the compile-time required on some test-cases very
substantially.  In addition, I anticipate using this machinery
elsewhere on the branch as we identify other hot spots.

Bootstrapped and tested on i686-pc-linux-gnu, committed on the branch.

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

2001-02-23  Jeffrey Oldham  <oldham@codesourcery.com>

	* Makefile.in (resource.o): Add params.h dependence.
	* params.def (MAX_DELAY_SLOT_LIVE_SEARCH): New parameter.
	* params.h (MAX_DELAY_SLOT_LIVE_SEARCH): Likewise.
	* resource.c: Add dependence on params.h.
	(current_live_regs): Fix explanatory comment.
	(find_basic_block): Add new parameter to permit limiting search
	for a BARRIER.
	(mark_target_live_regs): Add new argument to find_basic_block call.
	(incr_ticks_for_insn): Likewise.

2001-02-21  Jeffrey Oldham  <oldham@codesourcery.com>

	* Makefile.in (reorg.o): Add params.h dependence.
	* params.def: Fix typographical error in comment.
	(MAX_DELAY_SLOT_INSN_SEARCH): New parameter.
	* params.h: Modify introductory comment.
	(MAX_DELAY_SLOT_INSN_SEARCH): New parameter.
	* reorg.c: Add dependence on params.h.
	(redundant_insn): Add parameterized throttle for search.
	(fill_simple_delay_slots): Add a comment explaining a variable.
	Move conditional out of loop, simplifying code.
	(fill_eager_delay_slots): Fix typographical error in comment.

2001-02-21  Jeffrey Oldham  <oldham@codesourcery.com>

	* gcc.c (cc1_options): Add "-param".
	(DEFAULT_WORD_SWITCH_TAKES_ARG): Likewise.
	(option_map): Likewise.
	* toplev.c (display_help): Add entry for "--param".
	(independent_decode_option): Fix typographical error.

2001-02-14  Jeffrey Oldham  <oldham@codesourcery.com>

	* Makefile.in (OBJS): Add params.o.

2001-02-14  Mark Mitchell  <mark@codesourcery.com>

	* Makefile.in (toplev.o): Depend on params.h.
	(intergate.o): Likewise.
	(params.o): New target.
	* flags.h (inline_max_insns): Remove.
	* integrate.c: Include params.h.
	Use MAX_INLINE_INSNS instead of inline_max_insns.
	* params.c: New file.
	* params.h: Likewise.
	* params.def: Likewise.
	* toplev.c: Include params.h.
	(lang_independent_params): New variable.
	(decode_f_option): Use the param machinery instead of setting
	max_inline_insns.
	(independent_decode_option): Handle "--param name=value".
	(main): Register language-independent parameters.

Index: Makefile.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Makefile.in,v
retrieving revision 1.602.2.1
diff -c -p -r1.602.2.1 Makefile.in
*** Makefile.in	2001/02/19 00:01:33	1.602.2.1
--- Makefile.in	2001/03/01 16:50:45
*************** OBJS = diagnostic.o version.o tree.o pri
*** 745,751 ****
   mbchar.o splay-tree.o graph.o sbitmap.o resource.o hash.o predict.o	      \
   lists.o ggc-common.o $(GGC) stringpool.o simplify-rtx.o ssa.o bb-reorder.o   \
   sibcall.o conflict.o timevar.o ifcvt.o dominance.o dependence.o dce.o \
!  sched-vis.o sched-deps.o sched-rgn.o sched-ebb.o hashtab.o
  
  BACKEND = toplev.o libbackend.a
  
--- 745,751 ----
   mbchar.o splay-tree.o graph.o sbitmap.o resource.o hash.o predict.o	      \
   lists.o ggc-common.o $(GGC) stringpool.o simplify-rtx.o ssa.o bb-reorder.o   \
   sibcall.o conflict.o timevar.o ifcvt.o dominance.o dependence.o dce.o \
!  sched-vis.o sched-deps.o sched-rgn.o sched-ebb.o hashtab.o params.o
  
  BACKEND = toplev.o libbackend.a
  
*************** toplev.o : toplev.c $(CONFIG_H) system.h
*** 1340,1346 ****
     flags.h input.h $(INSN_ATTR_H) xcoffout.h output.h diagnostic.h \
     insn-codes.h insn-config.h intl.h $(RECOG_H) Makefile toplev.h dwarfout.h \
     dwarf2out.h sdbout.h dbxout.h $(EXPR_H) hard-reg-set.h $(BASIC_BLOCK_H) \
!    graph.h $(LOOP_H) except.h $(REGS_H) $(TIMEVAR_H) $(lang_options_files) ssa.h
  	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(MAYBE_USE_COLLECT2) \
  	  -DTARGET_NAME=\"$(target_alias)\" \
  	  -c $(srcdir)/toplev.c
--- 1340,1347 ----
     flags.h input.h $(INSN_ATTR_H) xcoffout.h output.h diagnostic.h \
     insn-codes.h insn-config.h intl.h $(RECOG_H) Makefile toplev.h dwarfout.h \
     dwarf2out.h sdbout.h dbxout.h $(EXPR_H) hard-reg-set.h $(BASIC_BLOCK_H) \
!    graph.h $(LOOP_H) except.h $(REGS_H) $(TIMEVAR_H) $(lang_options_files) \
!    ssa.h params.h
  	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(MAYBE_USE_COLLECT2) \
  	  -DTARGET_NAME=\"$(target_alias)\" \
  	  -c $(srcdir)/toplev.c
*************** emit-rtl.o : emit-rtl.c $(CONFIG_H) syst
*** 1406,1412 ****
  real.o : real.c $(CONFIG_H) system.h $(TREE_H) toplev.h
  integrate.o : integrate.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \
     $(INTEGRATE_H) insn-flags.h insn-config.h $(EXPR_H) real.h $(REGS_H) \
!    intl.h function.h output.h $(RECOG_H) except.h toplev.h $(LOOP_H)
  jump.o : jump.c $(CONFIG_H) system.h $(RTL_H) flags.h hard-reg-set.h $(REGS_H) \
     insn-config.h insn-flags.h $(RECOG_H) $(EXPR_H) real.h except.h function.h \
     toplev.h $(INSN_ATTR_H)
--- 1407,1414 ----
  real.o : real.c $(CONFIG_H) system.h $(TREE_H) toplev.h
  integrate.o : integrate.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \
     $(INTEGRATE_H) insn-flags.h insn-config.h $(EXPR_H) real.h $(REGS_H) \
!    intl.h function.h output.h $(RECOG_H) except.h toplev.h $(LOOP_H) \
!    params.h
  jump.o : jump.c $(CONFIG_H) system.h $(RTL_H) flags.h hard-reg-set.h $(REGS_H) \
     insn-config.h insn-flags.h $(RECOG_H) $(EXPR_H) real.h except.h function.h \
     toplev.h $(INSN_ATTR_H)
*************** sibcall.o : sibcall.c $(CONFIG_H) system
*** 1424,1430 ****
     hard-reg-set.h flags.h insn-config.h $(RECOG_H) $(BASIC_BLOCK_H)
  resource.o : resource.c $(CONFIG_H) $(RTL_H) hard-reg-set.h system.h \
     $(BASIC_BLOCK_H) $(REGS_H) flags.h output.h resource.h function.h toplev.h \
!    $(INSN_ATTR_H) except.h
  lcm.o : lcm.c $(CONFIG_H) system.h $(RTL_H) $(REGS_H) hard-reg-set.h flags.h \
     real.h insn-config.h $(INSN_ATTR_H) $(RECOG_H) $(EXPR_H) $(BASIC_BLOCK_H)
  ssa.o : ssa.c $(CONFIG_H) system.h $(REGS_H) varray.h			\
--- 1426,1432 ----
     hard-reg-set.h flags.h insn-config.h $(RECOG_H) $(BASIC_BLOCK_H)
  resource.o : resource.c $(CONFIG_H) $(RTL_H) hard-reg-set.h system.h \
     $(BASIC_BLOCK_H) $(REGS_H) flags.h output.h resource.h function.h toplev.h \
!    $(INSN_ATTR_H) except.h params.h
  lcm.o : lcm.c $(CONFIG_H) system.h $(RTL_H) $(REGS_H) hard-reg-set.h flags.h \
     real.h insn-config.h $(INSN_ATTR_H) $(RECOG_H) $(EXPR_H) $(BASIC_BLOCK_H)
  ssa.o : ssa.c $(CONFIG_H) system.h $(REGS_H) varray.h			\
*************** caller-save.o : caller-save.c $(CONFIG_H
*** 1476,1482 ****
     $(RECOG_H) reload.h $(EXPR_H) toplev.h
  reorg.o : reorg.c $(CONFIG_H) system.h $(RTL_H) conditions.h hard-reg-set.h \
     $(BASIC_BLOCK_H) $(REGS_H) insn-config.h $(INSN_ATTR_H) insn-flags.h \
!    $(RECOG_H) function.h flags.h output.h $(EXPR_H) toplev.h
  alias.o : alias.c $(CONFIG_H) system.h $(RTL_H) flags.h hard-reg-set.h \
     $(BASIC_BLOCK_H) $(REGS_H) toplev.h output.h $(EXPR_H) insn-flags.h \
     $(GGC_H) function.h cselib.h $(TREE_H)
--- 1478,1484 ----
     $(RECOG_H) reload.h $(EXPR_H) toplev.h
  reorg.o : reorg.c $(CONFIG_H) system.h $(RTL_H) conditions.h hard-reg-set.h \
     $(BASIC_BLOCK_H) $(REGS_H) insn-config.h $(INSN_ATTR_H) insn-flags.h \
!    $(RECOG_H) function.h flags.h output.h $(EXPR_H) toplev.h params.h
  alias.o : alias.c $(CONFIG_H) system.h $(RTL_H) flags.h hard-reg-set.h \
     $(BASIC_BLOCK_H) $(REGS_H) toplev.h output.h $(EXPR_H) insn-flags.h \
     $(GGC_H) function.h cselib.h $(TREE_H)
*************** ifcvt.o : ifcvt.c $(CONFIG_H) system.h $
*** 1524,1529 ****
--- 1526,1532 ----
     output.h
  dependence.o : dependence.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) \
     $(C_COMMON_H) flags.h varray.h $(EXPR_H)
+ params.o : params.c $(CONFIG_H) system.h params.h toplev.h
  
  $(out_object_file): $(out_file) $(CONFIG_H) $(TREE_H) $(GGC_H) \
     $(RTL_H) $(REGS_H) hard-reg-set.h real.h insn-config.h conditions.h \
Index: flags.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/flags.h,v
retrieving revision 1.57
diff -c -p -r1.57 flags.h
*** flags.h	2001/01/15 22:45:32	1.57
--- flags.h	2001/03/01 16:50:46
*************** extern int flag_prefix_function_name;
*** 579,588 ****
  extern int g_switch_value;
  extern int g_switch_set;
  
- /* Value of the -finline-limit flag.  */
- 
- extern int inline_max_insns;
- 
  /* Values of the -falign-* flags: how much to align labels in code. 
     0 means `use default', 1 means `don't align'.  
     For each variable, there is an _log variant which is the power
--- 579,584 ----
Index: integrate.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/integrate.c,v
retrieving revision 1.126.4.2
diff -c -p -r1.126.4.2 integrate.c
*** integrate.c	2001/02/21 14:56:06	1.126.4.2
--- integrate.c	2001/03/01 16:50:48
*************** Boston, MA 02111-1307, USA.  */
*** 40,45 ****
--- 40,46 ----
  #include "toplev.h"
  #include "intl.h"
  #include "loop.h"
+ #include "params.h"
  
  #include "obstack.h"
  #define	obstack_chunk_alloc	xmalloc
*************** static void copy_insn_list              
*** 89,103 ****
  static int compare_blocks               PARAMS ((const PTR, const PTR));
  static int find_block                   PARAMS ((const PTR, const PTR));
  
- /* The maximum number of instructions accepted for inlining a
-    function.  Increasing values mean more agressive inlining.
-    This affects currently only functions explicitly marked as
-    inline (or methods defined within the class definition for C++).
-    The default value of 10000 is arbitrary but high to match the
-    previously unlimited gcc capabilities.  */
- 
- int inline_max_insns = 10000;
- 
  /* Used by copy_rtx_and_substitute; this indicates whether the function is
     called for the purpose of inlining or some other purpose (i.e. loop
     unrolling).  This affects how constant pool references are handled.
--- 90,95 ----
*************** function_cannot_inline_p (fndecl)
*** 135,145 ****
    tree last = tree_last (TYPE_ARG_TYPES (TREE_TYPE (fndecl)));
  
    /* For functions marked as inline increase the maximum size to
!      inline_max_insns (-finline-limit-<n>).  For regular functions
       use the limit given by INTEGRATE_THRESHOLD.  */
  
    int max_insns = (DECL_INLINE (fndecl))
! 		   ? (inline_max_insns
  		      + 8 * list_length (DECL_ARGUMENTS (fndecl)))
  		   : INTEGRATE_THRESHOLD (fndecl);
  
--- 127,137 ----
    tree last = tree_last (TYPE_ARG_TYPES (TREE_TYPE (fndecl)));
  
    /* For functions marked as inline increase the maximum size to
!      MAX_INLINE_INSNS (-finline-limit-<n>).  For regular functions
       use the limit given by INTEGRATE_THRESHOLD.  */
  
    int max_insns = (DECL_INLINE (fndecl))
! 		   ? (MAX_INLINE_INSNS
  		      + 8 * list_length (DECL_ARGUMENTS (fndecl)))
  		   : INTEGRATE_THRESHOLD (fndecl);
  
Index: invoke.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/invoke.texi,v
retrieving revision 1.273.2.5
diff -c -p -r1.273.2.5 invoke.texi
*** invoke.texi	2001/02/19 03:56:56	1.273.2.5
--- invoke.texi	2001/03/01 16:50:56
*************** in the following sections.
*** 255,260 ****
--- 255,261 ----
  -fsingle-precision-constant  -fssa @gol
  -fstrength-reduce  -fstrict-aliasing  -fthread-jumps  -ftrapv @gol
  -funroll-all-loops  -funroll-loops  @gol
+ --param @var{name}=@var{value}
  -O  -O0  -O1  -O2  -O3  -Os}
  
  @item Preprocessor Options
*************** of registers left over after register al
*** 3237,3242 ****
--- 3238,3261 ----
  will most benefit processors with lots of registers.  It can, however,
  make debugging impossible, since variables will no longer stay in
  a ``home register''.
+ 
+ @item --param @var{name}=@var{value}
+ In some places, GCC uses various constants to control the amount of
+ optimization that is done.  For example, GCC will not inline functions
+ that contain more that a certain number of instructions.  You can
+ control some of these constants on the command-line using the
+ @samp{--param} option.
+ 
+ In each case, the @var{value} is a integer.  The allowable choices for
+ @var{name} are given in the following table:
+ 
+ @table @gcctabopt
+ @item max-inline-insns
+ If an function contains more than this many instructions, it
+ will not be inlined.  This option is precisely equivalent to
+ @samp{-finline-limit}.
+ @end table
+ 
  @end table
  
  @node Preprocessor Options
Index: reorg.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/reorg.c,v
retrieving revision 1.56
diff -c -p -r1.56 reorg.c
*** reorg.c	2000/11/07 22:49:54	1.56
--- reorg.c	2001/03/01 16:50:58
*************** Boston, MA 02111-1307, USA.  */
*** 139,144 ****
--- 139,145 ----
  #include "obstack.h"
  #include "insn-attr.h"
  #include "resource.h"
+ #include "params.h"
  
  #ifdef DELAY_SLOTS
  
*************** redundant_insn (insn, target, delay_list
*** 1635,1640 ****
--- 1636,1642 ----
    rtx trial, pat;
    struct resources needed, set;
    int i;
+   unsigned insns_to_search;
  
    /* If INSN has any REG_UNUSED notes, it can't match anything since we
       are allowed to not actually assign to such a register.  */
*************** redundant_insn (insn, target, delay_list
*** 1642,1648 ****
      return 0;
  
    /* Scan backwards looking for a match.  */
!   for (trial = PREV_INSN (target); trial; trial = PREV_INSN (trial))
      {
        if (GET_CODE (trial) == CODE_LABEL)
  	return 0;
--- 1644,1653 ----
      return 0;
  
    /* Scan backwards looking for a match.  */
!   for (trial = PREV_INSN (target),
!        insns_to_search = MAX_DELAY_SLOT_INSN_SEARCH;
!        trial && insns_to_search > 0;
!        trial = PREV_INSN (trial), --insns_to_search)
      {
        if (GET_CODE (trial) == CODE_LABEL)
  	return 0;
*************** redundant_insn (insn, target, delay_list
*** 1743,1751 ****
    /* Scan backwards until we reach a label or an insn that uses something
       INSN sets or sets something insn uses or sets.  */
  
!   for (trial = PREV_INSN (target);
!        trial && GET_CODE (trial) != CODE_LABEL;
!        trial = PREV_INSN (trial))
      {
        if (GET_CODE (trial) != INSN && GET_CODE (trial) != CALL_INSN
  	  && GET_CODE (trial) != JUMP_INSN)
--- 1748,1757 ----
    /* Scan backwards until we reach a label or an insn that uses something
       INSN sets or sets something insn uses or sets.  */
  
!   for (trial = PREV_INSN (target),
!        insns_to_search = MAX_DELAY_SLOT_INSN_SEARCH;
!        trial && GET_CODE (trial) != CODE_LABEL && insns_to_search > 0;
!        trial = PREV_INSN (trial), --insns_to_search)
      {
        if (GET_CODE (trial) != INSN && GET_CODE (trial) != CALL_INSN
  	  && GET_CODE (trial) != JUMP_INSN)
*************** fill_simple_delay_slots (non_jumps_p)
*** 2223,2231 ****
  		  && ! simplejump_p (insn)
  		  && JUMP_LABEL (insn) != 0)))
  	{
  	  rtx target = 0;
  	  int maybe_never = 0;
! 	  struct resources needed_at_jump;
  
  	  CLEAR_RESOURCE (&needed);
  	  CLEAR_RESOURCE (&set);
--- 2229,2239 ----
  		  && ! simplejump_p (insn)
  		  && JUMP_LABEL (insn) != 0)))
  	{
+ 	  /* Invariant: If insn is a JUMP_INSN, the insn's jump
+ 	     label.  Otherwise, zero.  */
  	  rtx target = 0;
  	  int maybe_never = 0;
! 	  rtx pat, trial_delay;
  
  	  CLEAR_RESOURCE (&needed);
  	  CLEAR_RESOURCE (&set);
*************** fill_simple_delay_slots (non_jumps_p)
*** 2243,2335 ****
  	      if (GET_CODE (insn) == JUMP_INSN)
  		target = JUMP_LABEL (insn);
  	    }
- 
- 	  for (trial = next_nonnote_insn (insn); trial; trial = next_trial)
- 	    {
- 	      rtx pat, trial_delay;
- 
- 	      next_trial = next_nonnote_insn (trial);
  
! 	      if (GET_CODE (trial) == CODE_LABEL
! 		  || GET_CODE (trial) == BARRIER)
! 		break;
  
! 	      /* We must have an INSN, JUMP_INSN, or CALL_INSN.  */
! 	      pat = PATTERN (trial);
  
! 	      /* Stand-alone USE and CLOBBER are just for flow.  */
! 	      if (GET_CODE (pat) == USE || GET_CODE (pat) == CLOBBER)
! 		continue;
! 
! 	      /* If this already has filled delay slots, get the insn needing
! 		 the delay slots.  */
! 	      if (GET_CODE (pat) == SEQUENCE)
! 		trial_delay = XVECEXP (pat, 0, 0);
! 	      else
! 		trial_delay = trial;
! 
! 	      /* If this is a jump insn to our target, indicate that we have
! 		 seen another jump to it.  If we aren't handling a conditional
! 		 jump, stop our search. Otherwise, compute the needs at its
! 		 target and add them to NEEDED.  */
! 	      if (GET_CODE (trial_delay) == JUMP_INSN)
! 		{
! 		  if (target == 0)
! 		    break;
! 		  else if (JUMP_LABEL (trial_delay) != target)
! 		    {
! 		      rtx ninsn =
! 			next_active_insn (JUMP_LABEL (trial_delay));
! 
! 		      mark_target_live_regs (get_insns (), ninsn,
! 					     &needed_at_jump);
! 		      needed.memory |= needed_at_jump.memory;
! 		      needed.unch_memory |= needed_at_jump.unch_memory;
! 		      IOR_HARD_REG_SET (needed.regs, needed_at_jump.regs);
! 		    }
! 		}
  
! 	      /* See if we have a resource problem before we try to
! 		 split.   */
! 	      if (target == 0
! 		  && GET_CODE (pat) != SEQUENCE
! 		  && ! insn_references_resource_p (trial, &set, 1)
! 		  && ! insn_sets_resource_p (trial, &set, 1)
! 		  && ! insn_sets_resource_p (trial, &needed, 1)
  #ifdef HAVE_cc0
! 		  && ! (reg_mentioned_p (cc0_rtx, pat) && ! sets_cc0_p (pat))
  #endif
! 		  && ! (maybe_never && may_trap_p (pat))
! 		  && (trial = try_split (pat, trial, 0))
! 		  && eligible_for_delay (insn, slots_filled, trial, flags))
! 		{
! 		  next_trial = next_nonnote_insn (trial);
! 		  delay_list = add_to_delay_list (trial, delay_list);
  
  #ifdef HAVE_cc0
! 		  if (reg_mentioned_p (cc0_rtx, pat))
! 		    link_cc0_insns (trial);
  #endif
  
! 		  delete_insn (trial);
! 		  if (slots_to_fill == ++slots_filled)
! 		    break;
! 		  continue;
! 		}
  
! 	      mark_set_resources (trial, &set, 0, MARK_SRC_DEST_CALL);
! 	      mark_referenced_resources (trial, &needed, 1);
  
! 	      /* Ensure we don't put insns between the setting of cc and the
! 		 comparison by moving a setting of cc into an earlier delay
! 		 slot since these insns could clobber the condition code.  */
! 	      set.cc = 1;
! 
! 	      /* If this is a call or jump, we might not get here.  */
! 	      if (GET_CODE (trial_delay) == CALL_INSN
! 		  || GET_CODE (trial_delay) == JUMP_INSN)
! 		maybe_never = 1;
! 	    }
  
  	  /* If there are slots left to fill and our search was stopped by an
  	     unconditional branch, try the insn at the branch target.  We can
--- 2251,2324 ----
  	      if (GET_CODE (insn) == JUMP_INSN)
  		target = JUMP_LABEL (insn);
  	    }
  
! 	  if (target == 0)
! 	    for (trial = next_nonnote_insn (insn); trial; trial = next_trial)
! 	      {
! 		next_trial = next_nonnote_insn (trial);
! 
! 		if (GET_CODE (trial) == CODE_LABEL
! 		    || GET_CODE (trial) == BARRIER)
! 		  break;
  
! 		/* We must have an INSN, JUMP_INSN, or CALL_INSN.  */
! 		pat = PATTERN (trial);
  
! 		/* Stand-alone USE and CLOBBER are just for flow.  */
! 		if (GET_CODE (pat) == USE || GET_CODE (pat) == CLOBBER)
! 		  continue;
  
! 		/* If this already has filled delay slots, get the insn needing
! 		   the delay slots.  */
! 		if (GET_CODE (pat) == SEQUENCE)
! 		  trial_delay = XVECEXP (pat, 0, 0);
! 		else
! 		  trial_delay = trial;
! 
! 		/* Stop our search when seeing an unconditional jump.  */
! 		if (GET_CODE (trial_delay) == JUMP_INSN)
! 		  break;
! 
! 		/* See if we have a resource problem before we try to
! 		   split.   */
! 		if (GET_CODE (pat) != SEQUENCE
! 		    && ! insn_references_resource_p (trial, &set, 1)
! 		    && ! insn_sets_resource_p (trial, &set, 1)
! 		    && ! insn_sets_resource_p (trial, &needed, 1)
  #ifdef HAVE_cc0
! 		    && ! (reg_mentioned_p (cc0_rtx, pat) && ! sets_cc0_p (pat))
  #endif
! 		    && ! (maybe_never && may_trap_p (pat))
! 		    && (trial = try_split (pat, trial, 0))
! 		    && eligible_for_delay (insn, slots_filled, trial, flags))
! 		  {
! 		    next_trial = next_nonnote_insn (trial);
! 		    delay_list = add_to_delay_list (trial, delay_list);
  
  #ifdef HAVE_cc0
! 		    if (reg_mentioned_p (cc0_rtx, pat))
! 		      link_cc0_insns (trial);
  #endif
  
! 		    delete_insn (trial);
! 		    if (slots_to_fill == ++slots_filled)
! 		      break;
! 		    continue;
! 		  }
  
! 		mark_set_resources (trial, &set, 0, MARK_SRC_DEST_CALL);
! 		mark_referenced_resources (trial, &needed, 1);
  
! 		/* Ensure we don't put insns between the setting of cc and the
! 		   comparison by moving a setting of cc into an earlier delay
! 		   slot since these insns could clobber the condition code.  */
! 		set.cc = 1;
! 
! 		/* If this is a call or jump, we might not get here.  */
! 		if (GET_CODE (trial_delay) == CALL_INSN
! 		    || GET_CODE (trial_delay) == JUMP_INSN)
! 		  maybe_never = 1;
! 	      }
  
  	  /* If there are slots left to fill and our search was stopped by an
  	     unconditional branch, try the insn at the branch target.  We can
*************** fill_eager_delay_slots ()
*** 2982,2988 ****
  	}
  
        /* If this insn is expected to branch, first try to get insns from our
! 	 target, then our fallthrough insns.  If it is not, expected to branch,
  	 try the other order.  */
  
        if (prediction > 0)
--- 2971,2977 ----
  	}
  
        /* If this insn is expected to branch, first try to get insns from our
! 	 target, then our fallthrough insns.  If it is not expected to branch,
  	 try the other order.  */
  
        if (prediction > 0)
Index: resource.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/resource.c,v
retrieving revision 1.37
diff -c -p -r1.37 resource.c
*** resource.c	2001/01/01 00:43:16	1.37
--- resource.c	2001/03/01 16:50:59
***************
*** 1,5 ****
  /* Definitions for computing resource usage of specific insns.
!    Copyright (C) 1999, 2000 Free Software Foundation, Inc.
  
  This file is part of GNU CC.
  
--- 1,5 ----
  /* Definitions for computing resource usage of specific insns.
!    Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
  
  This file is part of GNU CC.
  
*************** Boston, MA 02111-1307, USA.  */
*** 32,37 ****
--- 32,38 ----
  #include "resource.h"
  #include "except.h"
  #include "insn-attr.h"
+ #include "params.h"
  
  /* This structure is used to record liveness information at the targets or
     fallthrough insns of branches.  We will most likely need the information
*************** static struct target_info **target_hash_
*** 66,72 ****
  static int *bb_ticks;
  
  /* Marks registers possibly live at the current place being scanned by
!    mark_target_live_regs.  Used only by next two function.    */
  
  static HARD_REG_SET current_live_regs;
  
--- 67,73 ----
  static int *bb_ticks;
  
  /* Marks registers possibly live at the current place being scanned by
!    mark_target_live_regs.  Also used by update_live_status.  */
  
  static HARD_REG_SET current_live_regs;
  
*************** static HARD_REG_SET current_live_regs;
*** 76,82 ****
  static HARD_REG_SET pending_dead_regs;
  
  static void update_live_status		PARAMS ((rtx, rtx, void *));
! static int find_basic_block		PARAMS ((rtx));
  static rtx next_insn_no_annul		PARAMS ((rtx));
  static rtx find_dead_or_set_registers	PARAMS ((rtx, struct resources*,
  						rtx*, int, struct resources,
--- 77,83 ----
  static HARD_REG_SET pending_dead_regs;
  
  static void update_live_status		PARAMS ((rtx, rtx, void *));
! static int find_basic_block		PARAMS ((rtx, int));
  static rtx next_insn_no_annul		PARAMS ((rtx));
  static rtx find_dead_or_set_registers	PARAMS ((rtx, struct resources*,
  						rtx*, int, struct resources,
*************** update_live_status (dest, x, data)
*** 115,139 ****
  	CLEAR_HARD_REG_BIT (pending_dead_regs, i);
        }
  }
- /* Find the number of the basic block that starts closest to INSN.  Return -1
-    if we couldn't find such a basic block.  */
  
  static int
! find_basic_block (insn)
       rtx insn;
  {
    int i;
  
    /* Scan backwards to the previous BARRIER.  Then see if we can find a
       label that starts a basic block.  Return the basic block number.  */
- 
    for (insn = prev_nonnote_insn (insn);
!        insn && GET_CODE (insn) != BARRIER;
!        insn = prev_nonnote_insn (insn))
      ;
  
    /* The start of the function is basic block zero.  */
!   if (insn == 0)
      return 0;
  
    /* See if any of the upcoming CODE_LABELs start a basic block.  If we reach
--- 116,153 ----
  	CLEAR_HARD_REG_BIT (pending_dead_regs, i);
        }
  }
  
+ /* Find the number of the basic block with correct live register
+    information that starts closest to INSN.  Return -1 if we couldn't
+    find such a basic block or the beginning is more than
+    SEARCH_LIMIT instructions before INSN.  Use SEARCH_LIMIT = -1 for
+    an unlimited search.
+ 
+    The delay slot filling code destroys the control-flow graph so,
+    instead of finding the basic block containing INSN, we search
+    backwards toward a BARRIER where the live register information is
+    correct.  */
+ 
  static int
! find_basic_block (insn, search_limit)
       rtx insn;
+      int search_limit;
  {
    int i;
  
    /* Scan backwards to the previous BARRIER.  Then see if we can find a
       label that starts a basic block.  Return the basic block number.  */
    for (insn = prev_nonnote_insn (insn);
!        insn && GET_CODE (insn) != BARRIER && search_limit != 0;
!        insn = prev_nonnote_insn (insn), --search_limit)
      ;
  
+   /* The closest BARRIER is too far away.  */
+   if (search_limit == 0)
+     return -1;
+ 
    /* The start of the function is basic block zero.  */
!   else if (insn == 0)
      return 0;
  
    /* See if any of the upcoming CODE_LABELs start a basic block.  If we reach
*************** mark_target_live_regs (insns, target, re
*** 925,931 ****
      }
  
    if (b == -1)
!     b = find_basic_block (target);
  
    if (target_hash_table != NULL)
      {
--- 939,945 ----
      }
  
    if (b == -1)
!     b = find_basic_block (target, MAX_DELAY_SLOT_LIVE_SEARCH);
  
    if (target_hash_table != NULL)
      {
*************** void
*** 1294,1300 ****
  incr_ticks_for_insn (insn)
       rtx insn;
  {
!   int b = find_basic_block (insn);
  
    if (b != -1)
      bb_ticks[b]++;
--- 1308,1314 ----
  incr_ticks_for_insn (insn)
       rtx insn;
  {
!   int b = find_basic_block (insn, MAX_DELAY_SLOT_LIVE_SEARCH);
  
    if (b != -1)
      bb_ticks[b]++;
Index: toplev.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/toplev.c,v
retrieving revision 1.420.2.3
diff -c -p -r1.420.2.3 toplev.c
*** toplev.c	2001/02/21 14:56:07	1.420.2.3
--- toplev.c	2001/03/01 16:51:02
*************** Boston, MA 02111-1307, USA.  */
*** 63,68 ****
--- 63,69 ----
  #include "timevar.h"
  #include "diagnostic.h"
  #include "ssa.h"
+ #include "params.h"
  
  #ifndef ACCUMULATE_OUTGOING_ARGS
  #define ACCUMULATE_OUTGOING_ARGS 0
*************** int flag_leading_underscore = -1;
*** 958,963 ****
--- 959,972 ----
  /* The user symbol prefix after having resolved same.  */
  const char *user_label_prefix;
  
+ static const param_info lang_independent_params[] = {
+ #define DEFPARAM(ENUM, OPTION, HELP, DEFAULT) \
+   { OPTION, DEFAULT },
+ #include "params.def"
+ #undef DEFPARAM
+   { NULL, 0 }
+ };
+ 
  /* A default for same.  */
  #ifndef USER_LABEL_PREFIX
  #define USER_LABEL_PREFIX ""
*************** decode_f_option (arg)
*** 4088,4095 ****
  
    if ((option_value = skip_leading_substring (arg, "inline-limit-"))
        || (option_value = skip_leading_substring (arg, "inline-limit=")))
!     inline_max_insns =
!       read_integral_parameter (option_value, arg - 2, inline_max_insns);
  #ifdef INSN_SCHEDULING
    else if ((option_value = skip_leading_substring (arg, "sched-verbose=")))
      fix_sched_param ("verbose", option_value);
--- 4097,4108 ----
  
    if ((option_value = skip_leading_substring (arg, "inline-limit-"))
        || (option_value = skip_leading_substring (arg, "inline-limit=")))
!     {
!       int val =
!       read_integral_parameter (option_value, arg - 2,
!                                MAX_INLINE_INSNS);
!       set_param_value ("max-inline-insns", val);
!     }
  #ifdef INSN_SCHEDULING
    else if ((option_value = skip_leading_substring (arg, "sched-verbose=")))
      fix_sched_param ("verbose", option_value);
*************** independent_decode_option (argc, argv)
*** 4375,4380 ****
--- 4388,4427 ----
        exit (0);
      }
  
+   /* Handle '--param <name>=<value>'.  */
+   if (strcmp (arg, "-param") == 0)
+     {
+       char *equal;
+ 
+       if (argc == 1)
+       {
+         error ("-param option missing argument");
+         return 1;
+       }
+ 
+       /* Get the '<name>=<value' parameter.  */
+       arg = argv[1];
+       /* Look for the `='.  */
+       equal = strchr (arg, '=');
+       if (!equal)
+       error ("invalid --param option: %s", arg);
+       else
+       {
+         int val;
+ 
+         /* Zero out the `=' sign so that we get two separate strings.  */
+         *equal = '\0';
+         /* Figure out what value is specified.  */
+         val = read_integral_parameter (equal + 1, NULL, INVALID_PARAM_VAL);
+         if (val != INVALID_PARAM_VAL)
+           set_param_value (arg, val);
+         else
+           error ("invalid parameter value `%s'", equal + 1);
+       }
+ 
+       return 2;
+     }
+ 
    if (*arg == 'Y')
      arg++;
  
*************** main (argc, argv)
*** 4615,4620 ****
--- 4662,4670 ----
  
    /* Initialize the diagnostics reporting machinery.  */
    initialize_diagnostics ();
+ 
+   /* Register the language-independent parameters.  */
+   add_params (lang_independent_params, LAST_PARAM);
  
    /* Perform language-specific options intialization.  */
    if (lang_hooks.init_options)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]