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]
Other format: [Raw text]

Re: [GCSE PATCH]: make complexity cut off less binary


Zack Weinberg wrote:


I'm afraid it's still not right; the sentences are still broken in
half. Consider a language with gender markers on the verb: "BYPASS disabled" and "GCSE disabled" might require different forms of
the verb "disabled".
this one?

nathan

--
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
         The voices in my head said this was stupid too
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk

2003-08-25  Nathan Sidwell  <nathan@codesourcery.com>

	* gcse.c: #include intl.h.
	(PASSES_DEF, PASS, PASS_STRING): New.
	(enum pass): New.
	* gcse.c (is_too_expensive): New function.
	(gcse_main, delete_null_pointer_checks, bypass_jumps): Use it.

Index: gcse.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gcse.c,v
retrieving revision 1.269
diff -r1.269 gcse.c
168c168
< 
---
> #include "intl.h"
549a550,565
> 
> /* local names and message substrings for the passes within this
>    file. See is_too_expensive for use.  */
> #define PASSES_DEF \
> 	PASS (GCSE,"GCSE"), \
> 	PASS (NULL_PTR, "NULL pointer checks"), \
> 	PASS (JUMP_BYPASS, "jump bypassing"),
> /* Enumerated names of the passes. */
> enum pass
> {
> #define PASS(N,S) PASS_##N
>   PASSES_DEF
> #undef PASS
>   PASS_HWM
> };
> #define PASS(N,S) N_(PASS_STRING(S))
705a722
> static bool is_too_expensive (enum pass);
706a724
> 
740,741c758,759
<   /* Return if there's nothing to do.  */
<   if (n_basic_blocks <= 1)
---
>   /* Return if there's nothing to do, or it is too expensive.  */
>   if (n_basic_blocks <= 1 || is_too_expensive (PASS_GCSE))
743,772c761
< 
<   /* Trying to perform global optimizations on flow graphs which have
<      a high connectivity will take a long time and is unlikely to be
<      particularly useful.
< 
<      In normal circumstances a cfg should have about twice as many edges
<      as blocks.  But we do not want to punish small functions which have
<      a couple switch statements.  So we require a relatively large number
<      of basic blocks and the ratio of edges to blocks to be high.  */
<   if (n_basic_blocks > 1000 && n_edges / n_basic_blocks >= 20)
<     {
<       if (warn_disabled_optimization)
< 	warning ("GCSE disabled: %d > 1000 basic blocks and %d >= 20 edges/basic block",
< 		 n_basic_blocks, n_edges / n_basic_blocks);
<       return 0;
<     }
< 
<   /* If allocating memory for the cprop bitmap would take up too much
<      storage it's better just to disable the optimization.  */
<   if ((n_basic_blocks
<        * SBITMAP_SET_SIZE (max_gcse_regno)
<        * sizeof (SBITMAP_ELT_TYPE)) > MAX_GCSE_MEMORY)
<     {
<       if (warn_disabled_optimization)
< 	warning ("GCSE disabled: %d basic blocks and %d registers",
< 		 n_basic_blocks, max_gcse_regno);
< 
<       return 0;
<     }
< 
---
>   
5948c5937
<   int max_reg;
---
>   int max_reg = max_reg_num ();
5952,5964c5941,5942
<   /* If we have only a single block, then there's nothing to do.  */
<   if (n_basic_blocks <= 1)
<     return 0;
< 
<   /* Trying to perform global optimizations on flow graphs which have
<      a high connectivity will take a long time and is unlikely to be
<      particularly useful.
< 
<      In normal circumstances a cfg should have about twice as many edges
<      as blocks.  But we do not want to punish small functions which have
<      a couple switch statements.  So we require a relatively large number
<      of basic blocks and the ratio of edges to blocks to be high.  */
<   if (n_basic_blocks > 1000 && n_edges / n_basic_blocks >= 20)
---
>   /* If we have only a single block, or it is too expensive, give up.  */
>   if (n_basic_blocks <= 1 || is_too_expensive (PASS_NULL_PTR))
5969d5946
<   max_reg = max_reg_num ();
7707,7708c7684,7685
<   /* Return if there's nothing to do.  */
<   if (n_basic_blocks <= 1)
---
>   /* Return if there's nothing to do, or it is too expensive  */
>   if (n_basic_blocks <= 1 || is_too_expensive (PASS_JUMP_BYPASS))
7711,7739d7687
<   /* Trying to perform global optimizations on flow graphs which have
<      a high connectivity will take a long time and is unlikely to be
<      particularly useful.
< 
<      In normal circumstances a cfg should have about twice as many edges
<      as blocks.  But we do not want to punish small functions which have
<      a couple switch statements.  So we require a relatively large number
<      of basic blocks and the ratio of edges to blocks to be high.  */
<   if (n_basic_blocks > 1000 && n_edges / n_basic_blocks >= 20)
<     {
<       if (warn_disabled_optimization)
<         warning ("BYPASS disabled: %d > 1000 basic blocks and %d >= 20 edges/basic block",
<                  n_basic_blocks, n_edges / n_basic_blocks);
<       return 0;
<     }
< 
<   /* If allocating memory for the cprop bitmap would take up too much
<      storage it's better just to disable the optimization.  */
<   if ((n_basic_blocks
<        * SBITMAP_SET_SIZE (max_gcse_regno)
<        * sizeof (SBITMAP_ELT_TYPE)) > MAX_GCSE_MEMORY)
<     {
<       if (warn_disabled_optimization)
<         warning ("GCSE disabled: %d basic blocks and %d registers",
<                  n_basic_blocks, max_gcse_regno);
< 
<       return 0;
<     }
< 
7777a7726,7778
> }
> 
> /* Return true if the graph is too expensive to optimize. PASS is the
>    optimization about to be performed.  */
> 
> static bool
> is_too_expensive (enum pass pass)
> {
>   /* Trying to perform global optimizations on flow graphs which have
>      a high connectivity will take a long time and is unlikely to be
>      particularly useful.
>      
>      In normal circumstances a cfg should have about twice as many
>      edges as blocks.  But we do not want to punish small functions
>      which have a couple switch statements.  Rather than simply
>      threshold the number of blocks, uses something with a more
>      graceful degradation.  */
>   if (n_edges > 20000 + n_basic_blocks * 4)
>     {
>       static const char *const pass_names[PASS_HWM] =
>       {
> 	#define PASS_STRING(S) \
> 	  S " disabled: %d basic blocks and %d edges/basic block"
> 	PASSES_DEF
> 	#undef PASS_STRING
>       };
>       
>       if (warn_disabled_optimization)
> 	warning (pass_names[pass], n_basic_blocks, n_edges / n_basic_blocks);
>       
>       return true;
>     }
> 
>   /* If allocating memory for the cprop bitmap would take up too much
>      storage it's better just to disable the optimization.  */
>   if ((n_basic_blocks
>        * SBITMAP_SET_SIZE (max_reg_num ())
>        * sizeof (SBITMAP_ELT_TYPE)) > MAX_GCSE_MEMORY)
>     {
>       static const char *const pass_names[PASS_HWM] =
>       {
> 	#define PASS_STRING(S) \
> 	  S " disabled: %d basic blocks and %d registers"
> 	PASSES_DEF
> 	#undef PASS_STRING
>       };
>       if (warn_disabled_optimization)
> 	warning (pass_names[pass], n_basic_blocks, max_reg_num ());
> 
>       return true;
>     }
> 
>   return false;

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