public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch] comment updates - don't reference non-existing local-alloc.c and global.c
@ 2012-12-04 19:27 Steven Bosscher
  2012-12-05  9:20 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Steven Bosscher @ 2012-12-04 19:27 UTC (permalink / raw)
  To: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 137 bytes --]

Hello,

Just comment updates, and a bit of documentation.
Not sure if the comment changes need a ChangeLog.

OK for trunk?

Ciao!
Steven

[-- Attachment #2: ra_comments_janitor.diff --]
[-- Type: application/octet-stream, Size: 17852 bytes --]

	* doc/tm.texi.in (TARGET_CLASS_LIKELY_SPILLED_P): Update documentation.
	* doc/tm.texi: Regenerate.

Index: doc/tm.texi
===================================================================
--- doc/tm.texi	(revision 194156)
+++ doc/tm.texi	(working copy)
@@ -2834,15 +2834,13 @@ registers of @var{rclass} are needed for spill reg
 
 The default version of this target hook returns @code{true} if @var{rclass}
 has exactly one register and @code{false} otherwise.  On most machines, this
-default should be used.  Only use this target hook to some other expression
-if pseudos allocated by @file{local-alloc.c} end up in memory because their
-hard registers were needed for spill registers.  If this target hook returns
-@code{false} for those classes, those pseudos will only be allocated by
-@file{global.c}, which knows how to reallocate the pseudo to another
-register.  If there would not be another register available for reallocation,
-you should not change the implementation of this target hook since
-the only effect of such implementation would be to slow down register
-allocation.
+default should be used.  For generally register-starved machines, such as
+i386, or machines with right register constraints, such as SH, this hook
+can be used to avoid excessive spilling.
+
+This hook is also used by some of the global intra-procedural code
+transformations to throtle code motion, to avoid increasing register
+pressure.
 @end deftypefn
 
 @deftypefn {Target Hook} {unsigned char} TARGET_CLASS_MAX_NREGS (reg_class_t @var{rclass}, enum machine_mode @var{mode})
Index: doc/tm.texi.in
===================================================================
--- doc/tm.texi.in	(revision 194156)
+++ doc/tm.texi.in	(working copy)
@@ -2810,15 +2810,13 @@ registers of @var{rclass} are needed for spill reg
 
 The default version of this target hook returns @code{true} if @var{rclass}
 has exactly one register and @code{false} otherwise.  On most machines, this
-default should be used.  Only use this target hook to some other expression
-if pseudos allocated by @file{local-alloc.c} end up in memory because their
-hard registers were needed for spill registers.  If this target hook returns
-@code{false} for those classes, those pseudos will only be allocated by
-@file{global.c}, which knows how to reallocate the pseudo to another
-register.  If there would not be another register available for reallocation,
-you should not change the implementation of this target hook since
-the only effect of such implementation would be to slow down register
-allocation.
+default should be used.  For generally register-starved machines, such as
+i386, or machines with right register constraints, such as SH, this hook
+can be used to avoid excessive spilling.
+
+This hook is also used by some of the global intra-procedural code
+transformations to throtle code motion, to avoid increasing register
+pressure.
 @end deftypefn
 
 @hook TARGET_CLASS_MAX_NREGS
Index: regs.h
===================================================================
--- regs.h	(revision 194156)
+++ regs.h	(working copy)
@@ -176,22 +176,18 @@ extern size_t reg_info_p_size;
 
 #define REG_N_THROWING_CALLS_CROSSED(N) (reg_info_p[N].throw_calls_crossed)
 
-/* Total number of instructions at which (REG n) is live.  The larger
-   this is, the less priority (REG n) gets for allocation in a hard
-   register (in global-alloc).  This is set in df-problems.c whenever
-   register info is requested and remains valid for the rest of the
-   compilation of the function; it is used to control register
-   allocation.
+/* Total number of instructions at which (REG n) is live.
+   
+   This is set in regstat.c whenever register info is requested and
+   remains valid for the rest of the compilation of the function; it is
+   used to control register allocation.  The larger this is, the less
+   priority (REG n) gets for allocation in a hard register (in IRA in
+   priority-coloring mode).
 
-   local-alloc.c may alter this number to change the priority.
+   Negative values are special: -1 is used to mark a pseudo reg that
+   should not be allocated to a hard register, because it crosses a
+   setjmp call.  */
 
-   Negative values are special.
-   -1 is used to mark a pseudo reg which has a constant or memory equivalent
-   and is used infrequently enough that it should not get a hard register.
-   -2 is used to mark a pseudo reg for a parameter, when a frame pointer
-   is not required.  global.c makes an allocno for this but does
-   not try to assign a hard register to it.  */
-
 #define REG_LIVE_LENGTH(N)  (reg_info_p[N].live_length)
 
 /* Indexed by n, gives number of basic block that  (REG n) is used in.
Index: function.h
===================================================================
--- function.h	(revision 194156)
+++ function.h	(working copy)
@@ -389,7 +389,8 @@ struct GTY(()) rtl_data {
   bool arg_pointer_save_area_init;
 
   /* Nonzero if current function must be given a frame pointer.
-     Set in global.c if anything is allocated on the stack there.  */
+     Set in reload1.c or lra-eliminations.c if anything is allocated
+     on the stack there.  */
   bool frame_pointer_needed;
 
   /* When set, expand should optimize for speed.  */
Index: regmove.c
===================================================================
--- regmove.c	(revision 194156)
+++ regmove.c	(working copy)
@@ -616,10 +616,10 @@ copy_src_to_dest (rtx insn, rtx src, rtx dest)
   int src_regno;
   int dest_regno;
 
-  /* A REG_LIVE_LENGTH of -1 indicates the register is equivalent to a constant
-     or memory location and is used infrequently; a REG_LIVE_LENGTH of -2 is
-     parameter when there is no frame pointer that is not allocated a register.
-     For now, we just reject them, rather than incrementing the live length.  */
+  /* A REG_LIVE_LENGTH of -1 indicates the register must not go into
+     a hard register, e.g. because it crosses as setjmp.  See the
+     comment in regstat.c:regstat_bb_compute_ri.  Don't try to apply
+     any transformations to such regs.  */
 
   if (REG_P (src)
       && REG_LIVE_LENGTH (REGNO (src)) > 0
Index: ira-color.c
===================================================================
--- ira-color.c	(revision 194156)
+++ ira-color.c	(working copy)
@@ -2516,8 +2516,7 @@ improve_allocation (void)
     }
 }
 
-/* Sort allocnos according to their priorities which are calculated
-   analogous to ones in file `global.c'.  */
+/* Sort allocnos according to their priorities.  */
 static int
 allocno_priority_compare_func (const void *v1p, const void *v2p)
 {
Index: regstat.c
===================================================================
--- regstat.c	(revision 194156)
+++ regstat.c	(working copy)
@@ -389,7 +389,7 @@ regstat_compute_ri (void)
   BITMAP_FREE (local_processed);
   free (local_live_last_luid);
 
-  /* See the setjmp comment in regstat_ri_bb_compute.  */
+  /* See the setjmp comment in regstat_bb_compute_ri.  */
   EXECUTE_IF_SET_IN_BITMAP (setjmp_crosses, FIRST_PSEUDO_REGISTER, regno, bi)
     {
       REG_BASIC_BLOCK (regno) = REG_BLOCK_UNKNOWN;
Index: config/epiphany/epiphany.h
===================================================================
--- config/epiphany/epiphany.h	(revision 194156)
+++ config/epiphany/epiphany.h	(working copy)
@@ -407,7 +407,8 @@ extern enum reg_class epiphany_regno_reg_class[FIR
    They give nonzero only if REGNO is a hard reg of the suitable class
    or a pseudo reg currently allocated to a suitable hard reg.
    Since they use reg_renumber, they are safe only once reg_renumber
-   has been allocated, which happens in local-alloc.c.  */
+   has been allocated, which happens in reginfo.c during register
+   allocation.  */
 #define REGNO_OK_FOR_BASE_P(REGNO) \
 ((REGNO) < FIRST_PSEUDO_REGISTER || (unsigned) reg_renumber[REGNO] < FIRST_PSEUDO_REGISTER)
 #define REGNO_OK_FOR_INDEX_P(REGNO) \
Index: config/vax/vax.h
===================================================================
--- config/vax/vax.h	(revision 194156)
+++ config/vax/vax.h	(working copy)
@@ -385,7 +385,8 @@ enum reg_class { NO_REGS, ALL_REGS, LIM_REG_CLASSE
    They give nonzero only if REGNO is a hard reg of the suitable class
    or a pseudo reg currently allocated to a suitable hard reg.
    Since they use reg_renumber, they are safe only once reg_renumber
-   has been allocated, which happens in local-alloc.c.  */
+   has been allocated, which happens in reginfo.c during register
+   allocation.  */
 
 #define REGNO_OK_FOR_INDEX_P(regno)	\
   ((regno) < FIRST_PSEUDO_REGISTER || reg_renumber[regno] >= 0)
Index: config/cris/cris.h
===================================================================
--- config/cris/cris.h	(revision 194156)
+++ config/cris/cris.h	(working copy)
@@ -577,7 +577,8 @@ enum reg_class
 #define INDEX_REG_CLASS GENERAL_REGS
 
 /* Since it uses reg_renumber, it is safe only once reg_renumber
-   has been allocated, which happens in local-alloc.c.  */
+   has been allocated, which happens in reginfo.c during register
+   allocation.  */
 #define REGNO_OK_FOR_BASE_P(REGNO)					\
  ((REGNO) <= CRIS_LAST_GENERAL_REGISTER					\
   || (REGNO) == ARG_POINTER_REGNUM					\
Index: config/h8300/h8300.h
===================================================================
--- config/h8300/h8300.h	(revision 194156)
+++ config/h8300/h8300.h	(working copy)
@@ -498,7 +498,8 @@ struct cum_arg
    They give nonzero only if REGNO is a hard reg of the suitable class
    or a pseudo reg currently allocated to a suitable hard reg.
    Since they use reg_renumber, they are safe only once reg_renumber
-   has been allocated, which happens in local-alloc.c.  */
+   has been allocated, which happens in reginfo.c during register
+   allocation.  */
 
 #define REGNO_OK_FOR_INDEX_P(regno) 0
 
Index: config/alpha/alpha.h
===================================================================
--- config/alpha/alpha.h	(revision 194156)
+++ config/alpha/alpha.h	(working copy)
@@ -778,7 +778,8 @@ extern int alpha_memory_latency;
    They give nonzero only if REGNO is a hard reg of the suitable class
    or a pseudo reg currently allocated to a suitable hard reg.
    Since they use reg_renumber, they are safe only once reg_renumber
-   has been allocated, which happens in local-alloc.c.  */
+   has been allocated, which happens in reginfo.c during register
+   allocation.  */
 
 #define REGNO_OK_FOR_INDEX_P(REGNO) 0
 #define REGNO_OK_FOR_BASE_P(REGNO) \
Index: config/sparc/sparc.h
===================================================================
--- config/sparc/sparc.h	(revision 194156)
+++ config/sparc/sparc.h	(working copy)
@@ -1379,7 +1379,8 @@ do {									\
    They give nonzero only if REGNO is a hard reg of the suitable class
    or a pseudo reg currently allocated to a suitable hard reg.
    Since they use reg_renumber, they are safe only once reg_renumber
-   has been allocated, which happens in local-alloc.c.  */
+   has been allocated, which happens in reginfo.c during register
+   allocation.  */
 
 #define REGNO_OK_FOR_INDEX_P(REGNO) \
 (SPARC_INT_REG_P (REGNO) || SPARC_INT_REG_P (reg_renumber[REGNO]) \
Index: config/rs6000/rs6000.h
===================================================================
--- config/rs6000/rs6000.h	(revision 194156)
+++ config/rs6000/rs6000.h	(working copy)
@@ -1729,7 +1729,8 @@ typedef struct rs6000_args
    They give nonzero only if REGNO is a hard reg of the suitable class
    or a pseudo reg currently allocated to a suitable hard reg.
    Since they use reg_renumber, they are safe only once reg_renumber
-   has been allocated, which happens in local-alloc.c.  */
+   has been allocated, which happens in reginfo.c during register
+   allocation.  */
 
 #define REGNO_OK_FOR_INDEX_P(REGNO)				\
 ((REGNO) < FIRST_PSEUDO_REGISTER				\
Index: config/pdp11/pdp11.h
===================================================================
--- config/pdp11/pdp11.h	(revision 194156)
+++ config/pdp11/pdp11.h	(working copy)
@@ -400,7 +400,8 @@ extern int may_call_alloca;
    They give nonzero only if REGNO is a hard reg of the suitable class
    or a pseudo reg currently allocated to a suitable hard reg.
    Since they use reg_renumber, they are safe only once reg_renumber
-   has been allocated, which happens in local-alloc.c.  */
+   has been allocated, which happens in reginfo.c during register
+   allocation.  */
 
 #define REGNO_OK_FOR_BASE_P(REGNO)  \
   ((REGNO) <= PC_REGNUM || (unsigned) reg_renumber[REGNO] <= PC_REGNUM || \
Index: config/pa/pa.h
===================================================================
--- config/pa/pa.h	(revision 194156)
+++ config/pa/pa.h	(working copy)
@@ -750,7 +750,8 @@ extern int may_call_alloca;
    They give nonzero only if X is a hard reg of the suitable class
    or a pseudo reg currently allocated to a suitable hard reg.
    Since they use reg_renumber, they are safe only once reg_renumber
-   has been allocated, which happens in local-alloc.c.  */
+   has been allocated, which happens in reginfo.c during register
+   allocation.  */
 
 #define REGNO_OK_FOR_INDEX_P(X) \
   ((X) && ((X) < 32							\
Index: config/v850/v850.h
===================================================================
--- config/v850/v850.h	(revision 194156)
+++ config/v850/v850.h	(working copy)
@@ -354,7 +354,8 @@ enum reg_class
    They give nonzero only if REGNO is a hard reg of the suitable class
    or a pseudo reg currently allocated to a suitable hard reg.
    Since they use reg_renumber, they are safe only once reg_renumber
-   has been allocated, which happens in local-alloc.c.  */
+   has been allocated, which happens in reginfo.c during register
+   allocation.  */
  
 #define REGNO_OK_FOR_BASE_P(regno)             \
   (((regno) < FIRST_PSEUDO_REGISTER            \
Index: config/mn10300/mn10300.h
===================================================================
--- config/mn10300/mn10300.h	(revision 194156)
+++ config/mn10300/mn10300.h	(working copy)
@@ -347,7 +347,8 @@ enum reg_class
    They give nonzero only if REGNO is a hard reg of the suitable class
    or a pseudo reg currently allocated to a suitable hard reg.
    Since they use reg_renumber, they are safe only once reg_renumber
-   has been allocated, which happens in local-alloc.c.  */
+   has been allocated, which happens in reginfo.c during register
+   allocation.  */
 
 #ifndef REG_OK_STRICT
 # define REG_STRICT 0
Index: config/m32r/m32r.h
===================================================================
--- config/m32r/m32r.h	(revision 194156)
+++ config/m32r/m32r.h	(working copy)
@@ -501,7 +501,8 @@ extern enum reg_class m32r_regno_reg_class[FIRST_P
    They give nonzero only if REGNO is a hard reg of the suitable class
    or a pseudo reg currently allocated to a suitable hard reg.
    Since they use reg_renumber, they are safe only once reg_renumber
-   has been allocated, which happens in local-alloc.c.  */
+   has been allocated, which happens in reginfo.c during register
+   allocation.  */
 #define REGNO_OK_FOR_BASE_P(REGNO) \
   ((REGNO) < FIRST_PSEUDO_REGISTER			\
    ? GPR_P (REGNO) || (REGNO) == ARG_POINTER_REGNUM	\
Index: config/i386/i386.h
===================================================================
--- config/i386/i386.h	(revision 194156)
+++ config/i386/i386.h	(working copy)
@@ -1614,7 +1614,8 @@ typedef struct ix86_args {
    They give nonzero only if REGNO is a hard reg of the suitable class
    or a pseudo reg currently allocated to a suitable hard reg.
    Since they use reg_renumber, they are safe only once reg_renumber
-   has been allocated, which happens in local-alloc.c.  */
+   has been allocated, which happens in reginfo.c during register
+   allocation.  */
 
 #define REGNO_OK_FOR_INDEX_P(REGNO) 					\
   ((REGNO) < STACK_POINTER_REGNUM 					\
Index: config/mcore/mcore.h
===================================================================
--- config/mcore/mcore.h	(revision 194156)
+++ config/mcore/mcore.h	(working copy)
@@ -516,7 +516,8 @@ extern const enum reg_class regno_reg_class[FIRST_
    They give nonzero only if REGNO is a hard reg of the suitable class
    or a pseudo reg currently allocated to a suitable hard reg.
    Since they use reg_renumber, they are safe only once reg_renumber
-   has been allocated, which happens in local-alloc.c.  */
+   has been allocated, which happens in reginfo.c during register
+   allocation.  */
 #define REGNO_OK_FOR_BASE_P(REGNO)  \
   ((REGNO) < AP_REG || (unsigned) reg_renumber[(REGNO)] < AP_REG)
 
Index: config/sh/sh.h
===================================================================
--- config/sh/sh.h	(revision 194156)
+++ config/sh/sh.h	(working copy)
@@ -1618,7 +1618,8 @@ struct sh_args {
    They give nonzero only if REGNO is a hard reg of the suitable class
    or a pseudo reg currently allocated to a suitable hard reg.
    Since they use reg_renumber, they are safe only once reg_renumber
-   has been allocated, which happens in local-alloc.c.  */
+   has been allocated, which happens in reginfo.c during register
+   allocation.  */
 
 #define REGNO_OK_FOR_BASE_P(REGNO) \
   (GENERAL_OR_AP_REGISTER_P (REGNO) \
Index: config/arm/arm.h
===================================================================
--- config/arm/arm.h	(revision 194156)
+++ config/arm/arm.h	(working copy)
@@ -1730,7 +1730,8 @@ enum arm_auto_incmodes
    They give nonzero only if REGNO is a hard reg of the suitable class
    or a pseudo reg currently allocated to a suitable hard reg.
    Since they use reg_renumber, they are safe only once reg_renumber
-   has been allocated, which happens in local-alloc.c.  */
+   has been allocated, which happens in reginfo.c during register
+   allocation.  */
 #define TEST_REGNO(R, TEST, VALUE) \
   ((R TEST VALUE) || ((unsigned) reg_renumber[R] TEST VALUE))
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [patch] comment updates - don't reference non-existing local-alloc.c and global.c
  2012-12-04 19:27 [patch] comment updates - don't reference non-existing local-alloc.c and global.c Steven Bosscher
@ 2012-12-05  9:20 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2012-12-05  9:20 UTC (permalink / raw)
  To: Steven Bosscher; +Cc: GCC Patches

On Tue, Dec 4, 2012 at 8:26 PM, Steven Bosscher <stevenb.gcc@gmail.com> wrote:
> Hello,
>
> Just comment updates, and a bit of documentation.
> Not sure if the comment changes need a ChangeLog.

They do.

> OK for trunk?

Ok.

Thanks,
Richard.

> Ciao!
> Steven

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-12-05  9:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-04 19:27 [patch] comment updates - don't reference non-existing local-alloc.c and global.c Steven Bosscher
2012-12-05  9:20 ` Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).