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]

[Janitor] Get rid of INSN_CACHE_DEPTH, INSN_CACHE_SIZE,INSN_CACHE_LINE_WIDTH


The three macros are nowhere used.

Ok to commit the appended patch?  I'm now bootstrapping on
x86_64-linux,

Andreas

2003-05-31  Andreas Jaeger  <aj@suse.de>

	* system.h: Poison INSN_CACHE_DEPTH, INSN_CACHE_SIZE and
	INSN_CACHE_LINE_WIDTH.

	* libgcc2.c (INSN_CACHE_PLANE_SIZE): Removed.
	(__clear_cache): Remove code dependend on INSN_CACHE_DEPTH,
	INSN_CACHE_SIZE and INSN_CACHE_LINE_WIDTH.

	* config/d30v/d30v.h: Remove comments on INSN_CACHE_* macros.

	* doc/tm.texi (Trampolines): Remove INSN_CACHE_DEPTH,
	INSN_CACHE_SIZE and INSN_CACHE_LINE_WIDTH.

	
============================================================
Index: gcc/libgcc2.c
--- gcc/libgcc2.c	9 Feb 2003 18:35:22 -0000	1.164
+++ gcc/libgcc2.c	31 May 2003 13:56:56 -0000
@@ -1,7 +1,7 @@
 /* More subroutines needed by GCC output code on some machines.  */
 /* Compile this one with gcc.  */
 /* Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001, 2002  Free Software Foundation, Inc.
+   2000, 2001, 2002, 2003  Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -1436,113 +1436,12 @@ __eprintf (const char *string, const cha
 #ifdef L_clear_cache
 /* Clear part of an instruction cache.  */
 
-#define INSN_CACHE_PLANE_SIZE (INSN_CACHE_SIZE / INSN_CACHE_DEPTH)
-
 void
 __clear_cache (char *beg __attribute__((__unused__)),
 	       char *end __attribute__((__unused__)))
 {
 #ifdef CLEAR_INSN_CACHE
   CLEAR_INSN_CACHE (beg, end);
-#else
-#ifdef INSN_CACHE_SIZE
-  static char array[INSN_CACHE_SIZE + INSN_CACHE_PLANE_SIZE + INSN_CACHE_LINE_WIDTH];
-  static int initialized;
-  int offset;
-  void *start_addr
-  void *end_addr;
-  typedef (*function_ptr) (void);
-
-#if (INSN_CACHE_SIZE / INSN_CACHE_LINE_WIDTH) < 16
-  /* It's cheaper to clear the whole cache.
-     Put in a series of jump instructions so that calling the beginning
-     of the cache will clear the whole thing.  */
-
-  if (! initialized)
-    {
-      int ptr = (((int) array + INSN_CACHE_LINE_WIDTH - 1)
-		 & -INSN_CACHE_LINE_WIDTH);
-      int end_ptr = ptr + INSN_CACHE_SIZE;
-
-      while (ptr < end_ptr)
-	{
-	  *(INSTRUCTION_TYPE *)ptr
-	    = JUMP_AHEAD_INSTRUCTION + INSN_CACHE_LINE_WIDTH;
-	  ptr += INSN_CACHE_LINE_WIDTH;
-	}
-      *(INSTRUCTION_TYPE *) (ptr - INSN_CACHE_LINE_WIDTH) = RETURN_INSTRUCTION;
-
-      initialized = 1;
-    }
-
-  /* Call the beginning of the sequence.  */
-  (((function_ptr) (((int) array + INSN_CACHE_LINE_WIDTH - 1)
-		    & -INSN_CACHE_LINE_WIDTH))
-   ());
-
-#else /* Cache is large.  */
-
-  if (! initialized)
-    {
-      int ptr = (((int) array + INSN_CACHE_LINE_WIDTH - 1)
-		 & -INSN_CACHE_LINE_WIDTH);
-
-      while (ptr < (int) array + sizeof array)
-	{
-	  *(INSTRUCTION_TYPE *)ptr = RETURN_INSTRUCTION;
-	  ptr += INSN_CACHE_LINE_WIDTH;
-	}
-
-      initialized = 1;
-    }
-
-  /* Find the location in array that occupies the same cache line as BEG.  */
-
-  offset = ((int) beg & -INSN_CACHE_LINE_WIDTH) & (INSN_CACHE_PLANE_SIZE - 1);
-  start_addr = (((int) (array + INSN_CACHE_PLANE_SIZE - 1)
-		 & -INSN_CACHE_PLANE_SIZE)
-		+ offset);
-
-  /* Compute the cache alignment of the place to stop clearing.  */
-#if 0  /* This is not needed for gcc's purposes.  */
-  /* If the block to clear is bigger than a cache plane,
-     we clear the entire cache, and OFFSET is already correct.  */
-  if (end < beg + INSN_CACHE_PLANE_SIZE)
-#endif
-    offset = (((int) (end + INSN_CACHE_LINE_WIDTH - 1)
-	       & -INSN_CACHE_LINE_WIDTH)
-	      & (INSN_CACHE_PLANE_SIZE - 1));
-
-#if INSN_CACHE_DEPTH > 1
-  end_addr = (start_addr & -INSN_CACHE_PLANE_SIZE) + offset;
-  if (end_addr <= start_addr)
-    end_addr += INSN_CACHE_PLANE_SIZE;
-
-  for (plane = 0; plane < INSN_CACHE_DEPTH; plane++)
-    {
-      int addr = start_addr + plane * INSN_CACHE_PLANE_SIZE;
-      int stop = end_addr + plane * INSN_CACHE_PLANE_SIZE;
-
-      while (addr != stop)
-	{
-	  /* Call the return instruction at ADDR.  */
-	  ((function_ptr) addr) ();
-
-	  addr += INSN_CACHE_LINE_WIDTH;
-	}
-    }
-#else /* just one plane */
-  do
-    {
-      /* Call the return instruction at START_ADDR.  */
-      ((function_ptr) start_addr) ();
-
-      start_addr += INSN_CACHE_LINE_WIDTH;
-    }
-  while ((start_addr % INSN_CACHE_SIZE) != offset);
-#endif /* just one plane */
-#endif /* Cache is large */
-#endif /* Cache exists */
 #endif /* CLEAR_INSN_CACHE */
 }
 
============================================================
Index: gcc/system.h
--- gcc/system.h	30 May 2003 23:14:41 -0000	1.147
+++ gcc/system.h	31 May 2003 13:56:56 -0000
@@ -640,7 +640,11 @@ typedef char _Bool;
 	BLOCK_PROFILER BLOCK_PROFILER_CODE FUNCTION_BLOCK_PROFILER	   \
 	FUNCTION_BLOCK_PROFILER_EXIT MACHINE_STATE_SAVE			   \
 	MACHINE_STATE_RESTORE SCCS_DIRECTIVE SECTION_ASM_OP		   \
 	ASM_OUTPUT_DEFINE_LABEL_DIFFERENCE_SYMBOL ASM_OUTPUT_INTERNAL_LABEL \
+	INSN_CACHE_DEPTH INSN_CACHE_SIZE INSN_CACHE_LINE_WIDTH \
 	OBJC_PROLOGUE
 
 /* Hooks that are no longer used.  */
============================================================
Index: gcc/config/d30v/d30v.h
--- config/d30v/d30v.h	29 May 2003 21:13:34 -0000	1.82
+++ config/d30v/d30v.h	31 May 2003 13:56:59 -0000
@@ -1,5 +1,5 @@
 /* Definitions of target machine for Mitsubishi D30V.
-   Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
+   Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
    Free Software Foundation, Inc.
    Contributed by Cygnus Solutions.
 
@@ -2024,25 +2024,6 @@ typedef struct machine_function GTY(())
 #define INITIALIZE_TRAMPOLINE(ADDR, FNADDR, STATIC_CHAIN) \
   d30v_initialize_trampoline (ADDR, FNADDR, STATIC_CHAIN)
 
@@ -2055,30 +2036,12 @@ typedef struct machine_function GTY(())
    initialization faster.
 
    To clear the instruction cache when a trampoline is initialized, define the
-   following macros which describe the shape of the cache.  */
-
-/* The total size in bytes of the cache.  */
-/* #define INSN_CACHE_SIZE */
+   following macro.
 
-/* The length in bytes of each cache line.  The cache is divided into cache
-   lines which are disjoint slots, each holding a contiguous chunk of data
-   fetched from memory.  Each time data is brought into the cache, an entire
-   line is read at once.  The data loaded into a cache line is always aligned
-   on a boundary equal to the line size.  */
-/* #define INSN_CACHE_LINE_WIDTH */
-
-/* The number of alternative cache lines that can hold any particular memory
-   location.  */
-/* #define INSN_CACHE_DEPTH */
-
-/* Alternatively, if the machine has system calls or instructions to clear the
-   instruction cache directly, you can define the following macro.  */
-
-/* If defined, expands to a C expression clearing the *instruction cache* in
-   the specified interval.  If it is not defined, and the macro INSN_CACHE_SIZE
-   is defined, some generic code is generated to clear the cache.  The
-   definition of this macro would typically be a series of `asm' statements.
-   Both BEG and END are both pointer expressions.  */
+   If defined, expands to a C expression clearing the *instruction
+   cache* in the specified interval.  The definition of this macro
+   would typically be a series of `asm' statements.  Both BEG and END
+   are both pointer expressions.  */
 /* #define CLEAR_INSN_CACHE (BEG, END) */
 
 /* To use a standard subroutine, define the following macro.  In addition, you
============================================================
Index: gcc/doc/tm.texi
--- doc/tm.texi	29 May 2003 21:13:33 -0000	1.223
+++ doc/tm.texi	31 May 2003 13:57:04 -0000
@@ -4635,39 +4629,15 @@ subroutine.  The former technique makes 
 latter makes initialization faster.
 
 To clear the instruction cache when a trampoline is initialized, define
-the following macros which describe the shape of the cache.
-
-@table @code
-@findex INSN_CACHE_SIZE
-@item INSN_CACHE_SIZE
-The total size in bytes of the cache.
-
-@findex INSN_CACHE_LINE_WIDTH
-@item INSN_CACHE_LINE_WIDTH
-The length in bytes of each cache line.  The cache is divided into cache
-lines which are disjoint slots, each holding a contiguous chunk of data
-fetched from memory.  Each time data is brought into the cache, an
-entire line is read at once.  The data loaded into a cache line is
-always aligned on a boundary equal to the line size.
-
-@findex INSN_CACHE_DEPTH
-@item INSN_CACHE_DEPTH
-The number of alternative cache lines that can hold any particular memory
-location.
-@end table
-
-Alternatively, if the machine has system calls or instructions to clear
-the instruction cache directly, you can define the following macro.
+the following macro.
 
 @table @code
 @findex CLEAR_INSN_CACHE
 @item CLEAR_INSN_CACHE (@var{beg}, @var{end})
 If defined, expands to a C expression clearing the @emph{instruction
-cache} in the specified interval.  If it is not defined, and the macro
-@code{INSN_CACHE_SIZE} is defined, some generic code is generated to clear the
-cache.  The definition of this macro would typically be a series of
-@code{asm} statements.  Both @var{beg} and @var{end} are both pointer
-expressions.
+cache} in the specified interval.  The definition of this macro would
+typically be a series of @code{asm} statements.  Both @var{beg} and
+@var{end} are both pointer expressions.
 @end table
 
 To use a standard subroutine, define the following macro.  In addition,
-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj

Attachment: pgp00000.pgp
Description: PGP signature


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