This is the mail archive of the binutils@sourceware.cygnus.com mailing list for the binutils project.


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

[patch]: Allow different register names in the MIPS disassembler



We are porting gas to a MIPS variant that uses slightly different
register names. The following patch, allows the dissasembler to
have different register name tables and makes the current set of
names the default.

Is the patch OK?

Thanks. Diego.

Fri May 19 12:29:27 EDT 2000	Diego Novillo <dnovillo@redhat.com>

	* mips-dis.c (REGISTER_NAMES): Rename to STD_REGISTER_NAMES.
	(STD_REGISTER_NAMES): New name for REGISTER_NAMES.
	(reg_names): Rename to std_reg_names. Change it to a char **
	static variable.
	(std_reg_names): New name for reg_names.
	(set_mips_isa_type): Set reg_names to point to std_reg_names by
	default.

Index: mips-dis.c
===================================================================
RCS file: /cvs/src/src/opcodes/mips-dis.c,v
retrieving revision 1.5
diff -d -c -p -r1.5 mips-dis.c
*** mips-dis.c	2000/05/11 07:10:19	1.5
--- mips-dis.c	2000/05/19 16:29:21
*************** static int _print_insn_mips PARAMS ((bfd
*** 50,56 ****
  
  
  /* FIXME: This should be shared with gdb somehow.  */
! #define REGISTER_NAMES 	\
      {	"zero",	"at",	"v0",	"v1",	"a0",	"a1",	"a2",	"a3", \
  	"t0",	"t1",	"t2",	"t3",	"t4",	"t5",	"t6",	"t7", \
  	"s0",	"s1",	"s2",	"s3",	"s4",	"s5",	"s6",	"s7", \
--- 50,56 ----
  
  
  /* FIXME: This should be shared with gdb somehow.  */
! #define STD_REGISTER_NAMES 	\
      {	"zero",	"at",	"v0",	"v1",	"a0",	"a1",	"a2",	"a3", \
  	"t0",	"t1",	"t2",	"t3",	"t4",	"t5",	"t6",	"t7", \
  	"s0",	"s1",	"s2",	"s3",	"s4",	"s5",	"s6",	"s7", \
*************** static int _print_insn_mips PARAMS ((bfd
*** 64,76 ****
  	"epc",  "prid"\
      }
  
! static CONST char * CONST reg_names[] = REGISTER_NAMES;
  
  /* The mips16 register names.  */
  static const char * const mips16_reg_names[] =
  {
    "s0", "s1", "v0", "v1", "a0", "a1", "a2", "a3"
  };
  
  /* subroutine */
  static void
--- 64,80 ----
  	"epc",  "prid"\
      }
  
! static CONST char * CONST std_reg_names[] = STD_REGISTER_NAMES;
  
  /* The mips16 register names.  */
  static const char * const mips16_reg_names[] =
  {
    "s0", "s1", "v0", "v1", "a0", "a1", "a2", "a3"
  };
+ 
+ /* Scalar register names. set_mips_isa_type() decides which register name
+    table to use.  */
+ static CONST char * CONST *reg_names = NULL;
  
  /* subroutine */
  static void
*************** set_mips_isa_type (mach, isa, cputype)
*** 254,259 ****
--- 258,266 ----
  {
    int target_processor = 0;
    int mips_isa = 0;
+ 
+   /* Use standard MIPS register names by default.  */
+   reg_names = std_reg_names;
  
    switch (mach)
      {


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