This is the mail archive of the binutils@sources.redhat.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] Formatting fixes in gas/config/tc-mips.c


Hi All,

this patch does some formatting fixes and assorted cleanup in tc-mips.c.


Thiemo


2001-08-04  Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>

	/gas/ChangeLog
	* tc-mips.c (mips_abi_string): Initialize with NULL instead of 0.
	(RELAX_ENCODE): Replace bfd_vma by valueT.
	(load_address): Formatting.
	(macro): Likewise. Code cleanup. Typo.
	(macro2): Formatting.
	(md_parse_option): Typo.
	(s_mipsset): Reorder cases to look nicer.
	(md_estimate_size_before_relax): Formatting. Code cleanup.
	(mips_elf_final_processing): Check against NULL instead of 0.
	(md_obj_end): Remove ugly `' in message string.
	(s_mips_ent): Remove ugly `' in message string.


diff -BurpNX /bigdisk/src/binutils-exclude src-orig/gas/config/tc-mips.c src/gas/config/tc-mips.c
--- src-orig/gas/config/tc-mips.c	Fri Aug  3 13:26:20 2001
+++ src/gas/config/tc-mips.c	Sat Aug  4 14:14:13 2001
@@ -217,7 +217,7 @@ static int mips_arch = CPU_UNKNOWN;
 static int mips_tune = CPU_UNKNOWN;
 
 /* The argument of the -mabi= flag.  */
-static char * mips_abi_string = 0;
+static char * mips_abi_string = NULL;
 
 /* Whether we should mark the file EABI64 or EABI32.  */
 static int mips_eabi64 = 0;
@@ -601,8 +604,8 @@ static const unsigned int mips16_to_32_r
     | ((warn) ? 1 : 0)))
 #define RELAX_OLD(i) (((i) >> 23) & 0x7f)
 #define RELAX_NEW(i) (((i) >> 16) & 0x7f)
-#define RELAX_RELOC1(i) ((bfd_vma) (((i) >> 9) & 0x7f) - 64)
-#define RELAX_RELOC2(i) ((bfd_vma) (((i) >> 2) & 0x7f) - 64)
+#define RELAX_RELOC1(i) ((valueT) (((i) >> 9) & 0x7f) - 64)
+#define RELAX_RELOC2(i) ((valueT) (((i) >> 2) & 0x7f) - 64)
 #define RELAX_RELOC3(i) (((i) >> 1) & 1)
 #define RELAX_WARN(i) ((i) & 1)
 
@@ -3383,14 +3488,12 @@ load_address (counter, reg, ep)
 	  macro_build (p, counter, (expressionS *) NULL, "nop", "");
 	  p += 4;
 	}
-      macro_build (p, counter, ep,
-		   HAVE_32BIT_ADDRESSES ? "lw" : "ld",
+      macro_build (p, counter, ep, HAVE_32BIT_ADDRESSES ? "lw" : "ld",
 		   "t,o(b)", reg, (int) BFD_RELOC_MIPS_GOT16, GP);
       p += 4;
       macro_build (p, counter, (expressionS *) NULL, "nop", "");
       p += 4;
-      macro_build (p, counter, ep,
-		   HAVE_32BIT_ADDRESSES ? "addiu" : "daddiu",
+      macro_build (p, counter, ep, HAVE_32BIT_ADDRESSES ? "addiu" : "daddiu",
 		   "t,r,j", reg, reg, (int) BFD_RELOC_LO16);
       if (ex.X_add_number != 0)
 	{
@@ -3490,8 +3593,7 @@ macro (ip)
       else
 	macro_build ((char *) NULL, &icnt, NULL, "move", "d,s", dreg, sreg, 0);
       macro_build ((char *) NULL, &icnt, NULL,
-		   dbl ? "dsub" : "sub",
-		   "d,v,t", dreg, 0, sreg);
+		   dbl ? "dsub" : "sub", "d,v,t", dreg, 0, sreg);
 
       --mips_opts.noreorder;
       return;
@@ -3606,8 +3708,7 @@ macro (ip)
 	}
       macro_build ((char *) NULL, &icnt, NULL, "slt", "d,v,t", AT, sreg, treg);
       macro_build ((char *) NULL, &icnt, &offset_expr,
-		   likely ? "beql" : "beq",
-		   "s,t,p", AT, 0);
+		   likely ? "beql" : "beq", "s,t,p", AT, 0);
       break;
 
     case M_BGTL_I:
@@ -3656,15 +3757,13 @@ macro (ip)
       if (imm_expr.X_op == O_constant && imm_expr.X_add_number == 0)
 	{
 	  macro_build ((char *) NULL, &icnt, &offset_expr,
-		       likely ? "bgezl" : "bgez",
-		       "s,p", sreg);
+		       likely ? "bgezl" : "bgez", "s,p", sreg);
 	  return;
 	}
       if (imm_expr.X_op == O_constant && imm_expr.X_add_number == 1)
 	{
 	  macro_build ((char *) NULL, &icnt, &offset_expr,
-		       likely ? "bgtzl" : "bgtz",
-		       "s,p", sreg);
+		       likely ? "bgtzl" : "bgtz", "s,p", sreg);
 	  return;
 	}
       maxnum = 0x7fffffff;
@@ -3688,8 +3787,7 @@ macro (ip)
 	}
       set_at (&icnt, sreg, 0);
       macro_build ((char *) NULL, &icnt, &offset_expr,
-		   likely ? "beql" : "beq",
-		   "s,t,p", AT, 0);
+		   likely ? "beql" : "beq", "s,t,p", AT, 0);
       break;
 
     case M_BGEUL:
@@ -3700,15 +3798,13 @@ macro (ip)
       if (sreg == 0)
 	{
 	  macro_build ((char *) NULL, &icnt, &offset_expr,
-		       likely ? "beql" : "beq",
-		       "s,t,p", 0, treg);
+		       likely ? "beql" : "beq", "s,t,p", 0, treg);
 	  return;
 	}
       macro_build ((char *) NULL, &icnt, NULL, "sltu", "d,v,t", AT, sreg,
 		   treg);
       macro_build ((char *) NULL, &icnt, &offset_expr,
-		   likely ? "beql" : "beq",
-		   "s,t,p", AT, 0);
+		   likely ? "beql" : "beq", "s,t,p", AT, 0);
       break;
 
     case M_BGTUL_I:
@@ -3732,14 +3828,12 @@ macro (ip)
       if (imm_expr.X_op == O_constant && imm_expr.X_add_number == 1)
 	{
 	  macro_build ((char *) NULL, &icnt, &offset_expr,
-		       likely ? "bnel" : "bne",
-		       "s,t,p", sreg, 0);
+		       likely ? "bnel" : "bne", "s,t,p", sreg, 0);
 	  return;
 	}
       set_at (&icnt, sreg, 1);
       macro_build ((char *) NULL, &icnt, &offset_expr,
-		   likely ? "beql" : "beq",
-		   "s,t,p", AT, 0);
+		   likely ? "beql" : "beq", "s,t,p", AT, 0);
       break;
 
     case M_BGTL:
@@ -3748,21 +3842,18 @@ macro (ip)
       if (treg == 0)
 	{
 	  macro_build ((char *) NULL, &icnt, &offset_expr,
-		       likely ? "bgtzl" : "bgtz",
-		       "s,p", sreg);
+		       likely ? "bgtzl" : "bgtz", "s,p", sreg);
 	  return;
 	}
       if (sreg == 0)
 	{
 	  macro_build ((char *) NULL, &icnt, &offset_expr,
-		       likely ? "bltzl" : "bltz",
-		       "s,p", treg);
+		       likely ? "bltzl" : "bltz", "s,p", treg);
 	  return;
 	}
       macro_build ((char *) NULL, &icnt, NULL, "slt", "d,v,t", AT, treg, sreg);
       macro_build ((char *) NULL, &icnt, &offset_expr,
-		   likely ? "bnel" : "bne",
-		   "s,t,p", AT, 0);
+		   likely ? "bnel" : "bne", "s,t,p", AT, 0);
       break;
 
     case M_BGTUL:
@@ -3771,8 +3862,7 @@ macro (ip)
       if (treg == 0)
 	{
 	  macro_build ((char *) NULL, &icnt, &offset_expr,
-		       likely ? "bnel" : "bne",
-		       "s,t,p", sreg, 0);
+		       likely ? "bnel" : "bne", "s,t,p", sreg, 0);
 	  return;
 	}
       if (sreg == 0)
@@ -3780,8 +3870,7 @@ macro (ip)
       macro_build ((char *) NULL, &icnt, NULL, "sltu", "d,v,t", AT, treg,
 		   sreg);
       macro_build ((char *) NULL, &icnt, &offset_expr,
-		   likely ? "bnel" : "bne",
-		   "s,t,p", AT, 0);
+		   likely ? "bnel" : "bne", "s,t,p", AT, 0);
       break;
 
     case M_BLEL:
@@ -3790,21 +3879,18 @@ macro (ip)
       if (treg == 0)
 	{
 	  macro_build ((char *) NULL, &icnt, &offset_expr,
-		       likely ? "blezl" : "blez",
-		       "s,p", sreg);
+		       likely ? "blezl" : "blez", "s,p", sreg);
 	  return;
 	}
       if (sreg == 0)
 	{
 	  macro_build ((char *) NULL, &icnt, &offset_expr,
-		       likely ? "bgezl" : "bgez",
-		       "s,p", treg);
+		       likely ? "bgezl" : "bgez", "s,p", treg);
 	  return;
 	}
       macro_build ((char *) NULL, &icnt, NULL, "slt", "d,v,t", AT, treg, sreg);
       macro_build ((char *) NULL, &icnt, &offset_expr,
-		   likely ? "beql" : "beq",
-		   "s,t,p", AT, 0);
+		   likely ? "beql" : "beq", "s,t,p", AT, 0);
       break;
 
     case M_BLEL_I:
@@ -3833,21 +3919,18 @@ macro (ip)
       if (imm_expr.X_op == O_constant && imm_expr.X_add_number == 0)
 	{
 	  macro_build ((char *) NULL, &icnt, &offset_expr,
-		       likely ? "bltzl" : "bltz",
-		       "s,p", sreg);
+		       likely ? "bltzl" : "bltz", "s,p", sreg);
 	  return;
 	}
       if (imm_expr.X_op == O_constant && imm_expr.X_add_number == 1)
 	{
 	  macro_build ((char *) NULL, &icnt, &offset_expr,
-		       likely ? "blezl" : "blez",
-		       "s,p", sreg);
+		       likely ? "blezl" : "blez", "s,p", sreg);
 	  return;
 	}
       set_at (&icnt, sreg, 0);
       macro_build ((char *) NULL, &icnt, &offset_expr,
-		   likely ? "bnel" : "bne",
-		   "s,t,p", AT, 0);
+		   likely ? "bnel" : "bne", "s,t,p", AT, 0);
       break;
 
     case M_BLEUL:
@@ -3856,8 +3939,7 @@ macro (ip)
       if (treg == 0)
 	{
 	  macro_build ((char *) NULL, &icnt, &offset_expr,
-		       likely ? "beql" : "beq",
-		       "s,t,p", sreg, 0);
+		       likely ? "beql" : "beq", "s,t,p", sreg, 0);
 	  return;
 	}
       if (sreg == 0)
@@ -3865,8 +3947,7 @@ macro (ip)
       macro_build ((char *) NULL, &icnt, NULL, "sltu", "d,v,t", AT, treg,
 		   sreg);
       macro_build ((char *) NULL, &icnt, &offset_expr,
-		   likely ? "beql" : "beq",
-		   "s,t,p", AT, 0);
+		   likely ? "beql" : "beq", "s,t,p", AT, 0);
       break;
 
     case M_BLEUL_I:
@@ -3896,8 +3977,7 @@ macro (ip)
 	}
       set_at (&icnt, sreg, 1);
       macro_build ((char *) NULL, &icnt, &offset_expr,
-		   likely ? "bnel" : "bne",
-		   "s,t,p", AT, 0);
+		   likely ? "bnel" : "bne", "s,t,p", AT, 0);
       break;
 
     case M_BLTL:
@@ -3906,21 +3986,18 @@ macro (ip)
       if (treg == 0)
 	{
 	  macro_build ((char *) NULL, &icnt, &offset_expr,
-		       likely ? "bltzl" : "bltz",
-		       "s,p", sreg);
+		       likely ? "bltzl" : "bltz", "s,p", sreg);
 	  return;
 	}
       if (sreg == 0)
 	{
 	  macro_build ((char *) NULL, &icnt, &offset_expr,
-		       likely ? "bgtzl" : "bgtz",
-		       "s,p", treg);
+		       likely ? "bgtzl" : "bgtz", "s,p", treg);
 	  return;
 	}
       macro_build ((char *) NULL, &icnt, NULL, "slt", "d,v,t", AT, sreg, treg);
       macro_build ((char *) NULL, &icnt, &offset_expr,
-		   likely ? "bnel" : "bne",
-		   "s,t,p", AT, 0);
+		   likely ? "bnel" : "bne", "s,t,p", AT, 0);
       break;
 
     case M_BLTUL:
@@ -3931,15 +4008,13 @@ macro (ip)
       if (sreg == 0)
 	{
 	  macro_build ((char *) NULL, &icnt, &offset_expr,
-		       likely ? "bnel" : "bne",
-		       "s,t,p", 0, treg);
+		       likely ? "bnel" : "bne", "s,t,p", 0, treg);
 	  return;
 	}
       macro_build ((char *) NULL, &icnt, NULL, "sltu", "d,v,t", AT, sreg,
 		   treg);
       macro_build ((char *) NULL, &icnt, &offset_expr,
-		   likely ? "bnel" : "bne",
-		   "s,t,p", AT, 0);
+		   likely ? "bnel" : "bne", "s,t,p", AT, 0);
       break;
 
     case M_DDIV_3:
@@ -3969,16 +4044,14 @@ macro (ip)
 	{
 	  macro_build ((char *) NULL, &icnt, NULL, "teq", "s,t", treg, 0);
 	  macro_build ((char *) NULL, &icnt, NULL,
-		       dbl ? "ddiv" : "div",
-		       "z,s,t", sreg, treg);
+		       dbl ? "ddiv" : "div", "z,s,t", sreg, treg);
 	}
       else
 	{
 	  expr1.X_add_number = 8;
 	  macro_build ((char *) NULL, &icnt, &expr1, "bne", "s,t,p", treg, 0);
 	  macro_build ((char *) NULL, &icnt, NULL,
-		       dbl ? "ddiv" : "div",
-		       "z,s,t", sreg, treg);
+		       dbl ? "ddiv" : "div", "z,s,t", sreg, treg);
 	  macro_build ((char *) NULL, &icnt, NULL, "break", "c", 7);
 	}
       expr1.X_add_number = -1;
@@ -4083,12 +4156,8 @@ macro (ip)
 	{
 	  if (strcmp (s2, "mflo") == 0)
 	    {
-	      if (dbl)
-		macro_build ((char *) NULL, &icnt, NULL, "dneg", "d,w", dreg,
-			     sreg);
-	      else
-		macro_build ((char *) NULL, &icnt, NULL, "neg", "d,w", dreg,
-			     sreg);
+	      macro_build ((char *) NULL, &icnt, NULL, dbl ? "dneg" : "neg",
+			   "d,w", dreg, sreg);
 	    }
 	  else
 	    macro_build ((char *) NULL, &icnt, NULL, "move", "d,s", dreg, 0);
@@ -5797,7 +6004,7 @@ macro (ip)
       R4000 uses interlocks to handle coproc delays.
       Other chips (like the R3000) require nops to be inserted for delays.
 
-      FIXME: Currently, we require that the user handle delays.
+      FIXME: Currently, we require that the user handles delays.
       In order to fill delay slots for non-interlocked chips,
       we must have a way to specify delays based on the coprocessor.
       Eg. 4 cycles if load coproc reg from memory, 1 if in cache, etc.
@@ -5907,8 +6114,7 @@ macro2 (ip)
 	 anyway.  */
       load_register (&icnt, AT, &imm_expr, dbl);
       macro_build ((char *) NULL, &icnt, NULL,
-		   dbl ? "dmult" : "mult",
-		   "s,t", sreg, AT);
+		   dbl ? "dmult" : "mult", "s,t", sreg, AT);
       macro_build ((char *) NULL, &icnt, NULL, "mflo", "d", dreg);
       break;
 
@@ -5928,12 +6134,10 @@ macro2 (ip)
       if (imm)
 	load_register (&icnt, AT, &imm_expr, dbl);
       macro_build ((char *) NULL, &icnt, NULL,
-		   dbl ? "dmult" : "mult",
-		   "s,t", sreg, imm ? AT : treg);
+		   dbl ? "dmult" : "mult", "s,t", sreg, imm ? AT : treg);
       macro_build ((char *) NULL, &icnt, NULL, "mflo", "d", dreg);
       macro_build ((char *) NULL, &icnt, NULL,
-		   dbl ? "dsra32" : "sra",
-		   "d,w,<", dreg, dreg, 31);
+		   dbl ? "dsra32" : "sra", "d,w,<", dreg, dreg, 31);
       macro_build ((char *) NULL, &icnt, NULL, "mfhi", "d", AT);
       if (mips_trap)
 	macro_build ((char *) NULL, &icnt, NULL, "tne", "s,t", dreg, AT);
@@ -6278,8 +6482,7 @@ macro2 (ip)
 	}
       load_register (&icnt, AT, &imm_expr, dbl);
       macro_build ((char *) NULL, &icnt, NULL,
-		   dbl ? "dsub" : "sub",
-		   "d,v,t", dreg, sreg, AT);
+		   dbl ? "dsub" : "sub", "d,v,t", dreg, sreg, AT);
       break;
 
     case M_DSUBU_I:
@@ -6297,8 +6500,7 @@ macro2 (ip)
 	}
       load_register (&icnt, AT, &imm_expr, dbl);
       macro_build ((char *) NULL, &icnt, NULL,
-		   dbl ? "dsubu" : "subu",
-		   "d,v,t", dreg, sreg, AT);
+		   dbl ? "dsubu" : "subu", "d,v,t", dreg, sreg, AT);
       break;
 
     case M_TEQ_I:
@@ -6655,8 +6863,7 @@ mips16_macro (ip)
       dbl = 1;
     case M_MUL:
       macro_build ((char *) NULL, &icnt, NULL,
-		   dbl ? "dmultu" : "multu",
-		   "x,y", xreg, yreg);
+		   dbl ? "dmultu" : "multu", "x,y", xreg, yreg);
       macro_build ((char *) NULL, &icnt, NULL, "mflo", "x", zreg);
       return;
 
@@ -6669,8 +6876,7 @@ mips16_macro (ip)
 	as_bad (_("Unsupported large constant"));
       imm_expr.X_add_number = -imm_expr.X_add_number;
       macro_build ((char *) NULL, &icnt, &imm_expr,
-		   dbl ? "daddiu" : "addiu",
-		   "y,x,4", yreg, xreg);
+		   dbl ? "daddiu" : "addiu", "y,x,4", yreg, xreg);
       break;
 
     case M_SUBU_I_2:
@@ -9224,7 +9525,7 @@ MIPS options:\n\
 -membedded-pic		generate embedded position independent code\n\
 -EB			generate big endian output\n\
 -EL			generate little endian output\n\
--g, -g2			do not remove uneeded NOPs or swap branches\n\
+-g, -g2			do not remove unneeded NOPs or swap branches\n\
 -G NUM			allow referencing objects up to NUM bytes\n\
 			implicitly with the gp register [default 8]\n"));
   fprintf (stream, _("\
@@ -10314,8 +10639,8 @@ s_mipsset (x)
       case  1: mips_opts.isa = ISA_MIPS1;       break;
       case  2: mips_opts.isa = ISA_MIPS2;       break;
       case  3: mips_opts.isa = ISA_MIPS3;       break;
-      case  5: mips_opts.isa = ISA_MIPS5;       break;
       case  4: mips_opts.isa = ISA_MIPS4;       break;
+      case  5: mips_opts.isa = ISA_MIPS5;       break;
       case 32: mips_opts.isa = ISA_MIPS32;      break;
       case 64: mips_opts.isa = ISA_MIPS64;      break;
       default: as_bad (_("unknown ISA level")); break;
@@ -11052,13 +11377,13 @@ md_estimate_size_before_relax (fragp, se
 			  + RELAX_RELOC1 (fragp->fr_subtype));
       /* FIXME: This really needs as_warn_where.  */
       if (RELAX_WARN (fragp->fr_subtype))
-	as_warn (_("AT used after \".set noat\" or macro used after \".set nomacro\""));
+	as_warn (_("AT used after \".set noat\" or macro used after "
+		   "\".set nomacro\""));
+
+      return RELAX_NEW (fragp->fr_subtype) - RELAX_OLD (fragp->fr_subtype);
     }
 
-  if (! change)
-    return 0;
-  else
-    return RELAX_NEW (fragp->fr_subtype) - RELAX_OLD (fragp->fr_subtype);
+  return 0;
 }
 
 /* This is called to see whether a reloc against a defined symbol
@@ -11556,7 +11881,7 @@ mips_elf_final_processing ()
     elf_elfheader (stdoutput)->e_flags |= EF_MIPS_PIC;
 
   /* Set the MIPS ELF ABI flags.  */
-  if (mips_abi_string == 0)
+  if (mips_abi_string == NULL)
     ;
   else if (strcmp (mips_abi_string, "32") == 0)
     elf_elfheader (stdoutput)->e_flags |= E_MIPS_ABI_O32;
@@ -11634,7 +11963,7 @@ md_obj_end ()
 {
   /* check for premature end, nesting errors, etc */
   if (cur_proc_ptr)
-    as_warn (_("missing `.end' at end of assembly"));
+    as_warn (_("missing .end at end of assembly"));
 }
 
 static long
@@ -11823,7 +12152,7 @@ s_mips_ent (aent)
     as_warn (_(".ent or .aent not in text section."));
 
   if (!aent && cur_proc_ptr)
-    as_warn (_("missing `.end'"));
+    as_warn (_("missing .end"));
 
   if (!aent)
     {


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