This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB 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]

[commit] Zap some redundant MIPS macros


This eliminates a number of redundant mips macros. The intent is to reduce the size of MIPS's tm*.h files.

committed,
Andrew
2003-06-01  Andrew Cagney  <cagney@redhat.com>

	* mips-tdep.c (is_mips16_addr): New function.
	(make_mips16_addr, unmake_mips16_addr): New functions.
	(pc_is_mips16, mips_fetch_instruction): Use.
	(gdb_print_insn_mips, mips_breakpoint_from_pc): Use.
	(gdb_print_insn_mips): Eliminate TM_PRINT_INSN_MACH.
	(mips_dump_tdep): Delete print of TM_PRINT_INSN_MACH,
	UNMAKE_MIPS16_ADDR, MAKE_MIPS16_ADDR, IS_MIPS16_ADDR and
	TARGET_MIPS.
	* config/mips/tm-mips.h: Update copyright.
	(TARGET_MIPS, TM_PRINT_INSN_MACH): Delete.
	(DEPRECATED_REGISTER_SIZE, DEPRECATED_REGISTER_BYTES): Delete.
	(IS_MIPS16_ADDR, MAKE_MIPS16_ADDR, UNMAKE_MIPS16_ADDR): Delete.
	* config/mips/tm-irix6.h (DEPRECATED_REGISTER_BYTES): Delete.
	(TM_PRINT_INSN_MACH): Delete.
	* config/mips/tm-irix5.h (DEPRECATED_REGISTER_BYTES): Delete.

Index: mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.205
diff -u -r1.205 mips-tdep.c
--- mips-tdep.c	1 Jun 2003 01:36:34 -0000	1.205
+++ mips-tdep.c	1 Jun 2003 15:08:19 -0000
@@ -152,6 +152,27 @@
 
 #define MIPS_SAVED_REGSIZE (mips_saved_regsize())
 
+/* MIPS16 function addresses are odd (bit 0 is set).  Here are some
+   functions to test, set, or clear bit 0 of addresses.  */
+
+static CORE_ADDR
+is_mips16_addr (CORE_ADDR addr)
+{
+  return ((addr) & 1);
+}
+
+static CORE_ADDR
+make_mips16_addr (CORE_ADDR addr)
+{
+  return ((addr) | 1);
+}
+
+static CORE_ADDR
+unmake_mips16_addr (CORE_ADDR addr)
+{
+  return ((addr) & ~1);
+}
+
 /* Return the contents of register REGNUM as a signed integer.  */
 
 static LONGEST
@@ -789,7 +810,7 @@
   struct minimal_symbol *sym;
 
   /* If bit 0 of the address is set, assume this is a MIPS16 address. */
-  if (IS_MIPS16_ADDR (memaddr))
+  if (is_mips16_addr (memaddr))
     return 1;
 
   /* A flag indicating that this is a MIPS16 function is stored by elfread.c in
@@ -922,7 +943,7 @@
   if (pc_is_mips16 (addr))
     {
       instlen = MIPS16_INSTLEN;
-      addr = UNMAKE_MIPS16_ADDR (addr);
+      addr = unmake_mips16_addr (addr);
     }
   else
     instlen = MIPS_INSTLEN;
@@ -5108,7 +5129,7 @@
      the search would fail because the symbol table says the function
      starts at an odd address, i.e. 1 byte past the given address.  */
   memaddr = ADDR_BITS_REMOVE (memaddr);
-  proc_desc = non_heuristic_proc_desc (MAKE_MIPS16_ADDR (memaddr), NULL);
+  proc_desc = non_heuristic_proc_desc (make_mips16_addr (memaddr), NULL);
 
   /* Make an attempt to determine if this is a 16-bit function.  If
      the procedure descriptor exists and the address therein is odd,
@@ -5116,10 +5137,10 @@
      guess that if the address passed in is odd, it's 16-bits.  */
   if (proc_desc)
     info->mach = pc_is_mips16 (PROC_LOW_ADDR (proc_desc)) ?
-      bfd_mach_mips16 : TM_PRINT_INSN_MACH;
+      bfd_mach_mips16 : 0;
   else
     info->mach = pc_is_mips16 (memaddr) ?
-      bfd_mach_mips16 : TM_PRINT_INSN_MACH;
+      bfd_mach_mips16 : 0;
 
   /* Round down the instruction address to the appropriate boundary.  */
   memaddr &= (info->mach == bfd_mach_mips16 ? ~1 : ~3);
@@ -5146,7 +5167,7 @@
       if (pc_is_mips16 (*pcptr))
 	{
 	  static unsigned char mips16_big_breakpoint[] = {0xe8, 0xa5};
-	  *pcptr = UNMAKE_MIPS16_ADDR (*pcptr);
+	  *pcptr = unmake_mips16_addr (*pcptr);
 	  *lenptr = sizeof (mips16_big_breakpoint);
 	  return mips16_big_breakpoint;
 	}
@@ -5176,7 +5197,7 @@
       if (pc_is_mips16 (*pcptr))
 	{
 	  static unsigned char mips16_little_breakpoint[] = {0xa5, 0xe8};
-	  *pcptr = UNMAKE_MIPS16_ADDR (*pcptr);
+	  *pcptr = unmake_mips16_addr (*pcptr);
 	  *lenptr = sizeof (mips16_little_breakpoint);
 	  return mips16_little_breakpoint;
 	}
@@ -6164,8 +6185,6 @@
 		      "mips_dump_tdep: IN_SOLIB_RETURN_TRAMPOLINE # %s\n",
 		      XSTRING (IN_SOLIB_RETURN_TRAMPOLINE (PC, NAME)));
   fprintf_unfiltered (file,
-		      "mips_dump_tdep: IS_MIPS16_ADDR = FIXME!\n");
-  fprintf_unfiltered (file,
 		      "mips_dump_tdep: LAST_EMBED_REGNUM = %d\n",
 		      LAST_EMBED_REGNUM);
   fprintf_unfiltered (file,
@@ -6187,8 +6206,6 @@
 		      MACHINE_CPROC_SP_OFFSET);
 #endif
   fprintf_unfiltered (file,
-		      "mips_dump_tdep: MAKE_MIPS16_ADDR = FIXME!\n");
-  fprintf_unfiltered (file,
 		      "mips_dump_tdep: MIPS16_INSTLEN = %d\n",
 		      MIPS16_INSTLEN);
   fprintf_unfiltered (file,
@@ -6334,11 +6351,6 @@
   fprintf_unfiltered (file,
 		      "mips_dump_tdep: TARGET_HAS_HARDWARE_WATCHPOINTS # %s\n",
 		      XSTRING (TARGET_HAS_HARDWARE_WATCHPOINTS));
-  fprintf_unfiltered (file,
-		      "mips_dump_tdep: TARGET_MIPS = used?\n");
-  fprintf_unfiltered (file,
-		      "mips_dump_tdep: TM_PRINT_INSN_MACH # %s\n",
-		      XSTRING (TM_PRINT_INSN_MACH));
 #ifdef TRACE_CLEAR
   fprintf_unfiltered (file,
 		      "mips_dump_tdep: TRACE_CLEAR # %s\n",
@@ -6359,8 +6371,6 @@
 		      "mips_dump_tdep: TRACE_SET # %s\n",
 		      XSTRING (TRACE_SET (X,STATE)));
 #endif
-  fprintf_unfiltered (file,
-		      "mips_dump_tdep: UNMAKE_MIPS16_ADDR = function?\n");
 #ifdef UNUSED_REGNUM
   fprintf_unfiltered (file,
 		      "mips_dump_tdep: UNUSED_REGNUM = %d\n",
Index: config/mips/tm-irix5.h
===================================================================
RCS file: /cvs/src/src/gdb/config/mips/tm-irix5.h,v
retrieving revision 1.9
diff -u -r1.9 tm-irix5.h
--- config/mips/tm-irix5.h	17 May 2003 05:59:59 -0000	1.9
+++ config/mips/tm-irix5.h	1 Jun 2003 15:08:21 -0000
@@ -30,9 +30,6 @@
  * Irix 6 (n32 ABI) has 32-bit GP regs and 64-bit FP regs
  */
 
-#undef  DEPRECATED_REGISTER_BYTES
-#define DEPRECATED_REGISTER_BYTES (MIPS_NUMREGS * 8 + (NUM_REGS - MIPS_NUMREGS) * MIPS_REGSIZE)
-
 #undef  REGISTER_BYTE
 #define REGISTER_BYTE(N) \
      (((N) < FP0_REGNUM) ? (N) * MIPS_REGSIZE : \
Index: config/mips/tm-irix6.h
===================================================================
RCS file: /cvs/src/src/gdb/config/mips/tm-irix6.h,v
retrieving revision 1.12
diff -u -r1.12 tm-irix6.h
--- config/mips/tm-irix6.h	1 Jun 2003 14:45:28 -0000	1.12
+++ config/mips/tm-irix6.h	1 Jun 2003 15:08:21 -0000
@@ -62,9 +62,6 @@
 #define FCRIR_REGNUM 70		/* FP implementation/revision */
 
 
-#undef  DEPRECATED_REGISTER_BYTES
-#define DEPRECATED_REGISTER_BYTES (MIPS_NUMREGS * 8 + (NUM_REGS - MIPS_NUMREGS) * MIPS_REGSIZE)
-
 #undef  REGISTER_BYTE
 #define REGISTER_BYTE(N) \
      (((N) < FP0_REGNUM) ? (N) * MIPS_REGSIZE : \
@@ -95,10 +92,6 @@
 #undef SIGFRAME_FPREGSAVE_OFF
 #define SIGFRAME_FPREGSAVE_OFF	(SIGFRAME_BASE + 2 * 4 + 8 + 32 * 8 + 4)
 #define SIGFRAME_REG_SIZE	8
-
-/* Select the disassembler */
-#undef TM_PRINT_INSN_MACH
-#define TM_PRINT_INSN_MACH bfd_mach_mips8000
 
 /* Undefine those methods which have been multiarched.  */
 #undef REGISTER_VIRTUAL_TYPE
Index: config/mips/tm-mips.h
===================================================================
RCS file: /cvs/src/src/gdb/config/mips/tm-mips.h,v
retrieving revision 1.49
diff -u -r1.49 tm-mips.h
--- config/mips/tm-mips.h	17 May 2003 05:59:59 -0000	1.49
+++ config/mips/tm-mips.h	1 Jun 2003 15:08:21 -0000
@@ -1,7 +1,7 @@
 /* Definitions to make GDB run on a mips box under 4.3bsd.
 
    Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996,
-   1997, 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
+   1997, 1998, 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
 
    Contributed by Per Bothner (bothner@cs.wisc.edu) at U.Wisconsin
    and by Alessandro Forin (af@cs.cmu.edu) at CMU..
@@ -45,15 +45,7 @@
 #define STEP_SKIPS_DELAY_P (1)
 #define STEP_SKIPS_DELAY(pc) (mips_step_skips_delay (pc))
 
-/* Say how long (ordinary) registers are.  This is a piece of bogosity
-   used in push_word and a few other places; REGISTER_RAW_SIZE is the
-   real way to know how big a register is.  */
-
-#define DEPRECATED_REGISTER_SIZE 4
-
-/* The size of a register.  This is predefined in tm-mips64.h.  We
-   can't use DEPRECATED_REGISTER_SIZE because that is used for various other
-   things.  */
+/* The size of a register.  This is predefined in tm-mips64.h.  */
 
 #ifndef MIPS_REGSIZE
 #define MIPS_REGSIZE 4
@@ -103,11 +95,6 @@
 #define	PRID_REGNUM 89		/* Processor ID */
 #define	LAST_EMBED_REGNUM 89	/* Last one */
 
-/* Total amount of space needed to store our copies of the machine's
-   register state, the array `registers'.  */
-
-#define DEPRECATED_REGISTER_BYTES (NUM_REGS*MIPS_REGSIZE)
-
 /* Index within `registers' of the first byte of the space for
    register N.  */
 
@@ -182,10 +169,6 @@
 #define SETUP_ARBITRARY_FRAME(argc, argv) setup_arbitrary_frame (argc, argv)
 extern struct frame_info *setup_arbitrary_frame (int, CORE_ADDR *);
 
-/* Select the default mips disassembler */
-
-#define TM_PRINT_INSN_MACH 0
-
 /* These are defined in mdebugread.c and are used in mips-tdep.c  */
 extern CORE_ADDR sigtramp_address, sigtramp_end;
 extern void fixup_sigtramp (void);
@@ -197,21 +180,11 @@
 #define IGNORE_HELPER_CALL(pc)			mips_ignore_helper (pc)
 extern int mips_ignore_helper (CORE_ADDR pc);
 
-#ifndef TARGET_MIPS
-#define TARGET_MIPS
-#endif
-
 /* Definitions and declarations used by mips-tdep.c and remote-mips.c  */
 #define MIPS_INSTLEN 4		/* Length of an instruction */
 #define MIPS16_INSTLEN 2	/* Length of an instruction on MIPS16 */
 #define MIPS_NUMREGS 32		/* Number of integer or float registers */
 typedef unsigned long t_inst;	/* Integer big enough to hold an instruction */
-
-/* MIPS16 function addresses are odd (bit 0 is set).  Here are some
-   macros to test, set, or clear bit 0 of addresses.  */
-#define IS_MIPS16_ADDR(addr)	 ((addr) & 1)
-#define MAKE_MIPS16_ADDR(addr)	 ((addr) | 1)
-#define UNMAKE_MIPS16_ADDR(addr) ((addr) & ~1)
 
 #endif /* TM_MIPS_H */
 

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