[MIPS 11/30] Use asm_file_out consistently for MIPS16 stubs

Richard Sandiford rsandifo@nildram.co.uk
Fri Oct 19 08:48:00 GMT 2007


This patch just makes the MIPS16 stub code use asm_out_file consistently.
Some functions had a FILE argument and some didn't; some of those that did
used a mixture of the FILE argument and asm_out_file.

This doesn't achieve much in itself; it's just paving the way for the
next few patches.

Richard


gcc/
	* config/mips/mips.c (mips16_fp_args): Remove the FILE argument and
	use asm_out_file instead.
	(build_mips16_function_stub): Likewise.
	(build_mips16_call_stub, mips_output_function_prologue): Update
	accordingly.

Index: gcc/config/mips/mips.c
===================================================================
--- gcc/config/mips/mips.c	2007-10-18 11:07:08.000000000 +0100
+++ gcc/config/mips/mips.c	2007-10-18 11:07:08.000000000 +0100
@@ -5132,13 +5132,13 @@ mips16_call_stub_mode_suffix (enum machi
 }
 
 /* Write out code to move floating point arguments in or out of
-   general registers.  Output the instructions to FILE.  FP_CODE is
-   the code describing which arguments are present (see the comment at
-   the definition of CUMULATIVE_ARGS in mips.h).  FROM_FP_P is nonzero if
-   we are copying from the floating point registers.  */
+   general registers.  FP_CODE is the code describing which arguments
+   are present (see the comment at the definition of CUMULATIVE_ARGS in
+   mips.h).  FROM_FP_P is nonzero if we are copying from the floating
+   point registers.  */
 
 static void
-mips16_fp_args (FILE *file, int fp_code, int from_fp_p)
+mips16_fp_args (int fp_code, int from_fp_p)
 {
   const char *s;
   int gparg, fparg;
@@ -5172,14 +5172,14 @@ mips16_fp_args (FILE *file, int fp_code,
       fparg = mips_arg_regno (&info, true);
 
       if (mode == SFmode)
-	fprintf (file, "\t%s\t%s,%s\n", s,
+	fprintf (asm_out_file, "\t%s\t%s,%s\n", s,
 		 reg_names[gparg], reg_names[fparg]);
       else if (TARGET_64BIT)
-	fprintf (file, "\td%s\t%s,%s\n", s,
+	fprintf (asm_out_file, "\td%s\t%s,%s\n", s,
 		 reg_names[gparg], reg_names[fparg]);
       else if (ISA_HAS_MXHC1)
 	/* -mips32r2 -mfp64 */
-	fprintf (file, "\t%s\t%s,%s\n\t%s\t%s,%s\n",
+	fprintf (asm_out_file, "\t%s\t%s,%s\n\t%s\t%s,%s\n",
 		 s,
 		 reg_names[gparg + (WORDS_BIG_ENDIAN ? 1 : 0)],
 		 reg_names[fparg],
@@ -5187,11 +5187,11 @@ mips16_fp_args (FILE *file, int fp_code,
 		 reg_names[gparg + (WORDS_BIG_ENDIAN ? 0 : 1)],
 		 reg_names[fparg]);
       else if (TARGET_BIG_ENDIAN)
-	fprintf (file, "\t%s\t%s,%s\n\t%s\t%s,%s\n", s,
+	fprintf (asm_out_file, "\t%s\t%s,%s\n\t%s\t%s,%s\n", s,
 		 reg_names[gparg], reg_names[fparg + 1], s,
 		 reg_names[gparg + 1], reg_names[fparg]);
       else
-	fprintf (file, "\t%s\t%s,%s\n\t%s\t%s,%s\n", s,
+	fprintf (asm_out_file, "\t%s\t%s,%s\n\t%s\t%s,%s\n", s,
 		 reg_names[gparg], reg_names[fparg], s,
 		 reg_names[gparg + 1], reg_names[fparg + 1]);
 
@@ -5205,7 +5205,7 @@ mips16_fp_args (FILE *file, int fp_code,
    then jumps to the 16-bit code.  */
 
 static void
-build_mips16_function_stub (FILE *file)
+build_mips16_function_stub (void)
 {
   const char *fnname;
   char *secname, *stubname;
@@ -5225,42 +5225,44 @@ build_mips16_function_stub (FILE *file)
   DECL_SECTION_NAME (stubdecl) = build_string (strlen (secname), secname);
   DECL_RESULT (stubdecl) = build_decl (RESULT_DECL, NULL_TREE, void_type_node);
 
-  fprintf (file, "\t# Stub function for %s (", current_function_name ());
+  fprintf (asm_out_file, "\t# Stub function for %s (",
+	   current_function_name ());
   need_comma = 0;
   for (f = (unsigned int) current_function_args_info.fp_code; f != 0; f >>= 2)
     {
-      fprintf (file, "%s%s",
+      fprintf (asm_out_file, "%s%s",
 	       need_comma ? ", " : "",
 	       (f & 3) == 1 ? "float" : "double");
       need_comma = 1;
     }
-  fprintf (file, ")\n");
+  fprintf (asm_out_file, ")\n");
 
-  fprintf (file, "\t.set\tnomips16\n");
+  fprintf (asm_out_file, "\t.set\tnomips16\n");
   switch_to_section (function_section (stubdecl));
-  ASM_OUTPUT_ALIGN (file, floor_log2 (FUNCTION_BOUNDARY / BITS_PER_UNIT));
+  ASM_OUTPUT_ALIGN (asm_out_file,
+		    floor_log2 (FUNCTION_BOUNDARY / BITS_PER_UNIT));
 
   /* ??? If FUNCTION_NAME_ALREADY_DECLARED is defined, then we are
      within a .ent, and we cannot emit another .ent.  */
   if (!FUNCTION_NAME_ALREADY_DECLARED)
     {
-      fputs ("\t.ent\t", file);
-      assemble_name (file, stubname);
-      fputs ("\n", file);
+      fputs ("\t.ent\t", asm_out_file);
+      assemble_name (asm_out_file, stubname);
+      fputs ("\n", asm_out_file);
     }
 
-  assemble_name (file, stubname);
-  fputs (":\n", file);
+  assemble_name (asm_out_file, stubname);
+  fputs (":\n", asm_out_file);
 
   /* We don't want the assembler to insert any nops here.  */
-  fprintf (file, "\t.set\tnoreorder\n");
+  fprintf (asm_out_file, "\t.set\tnoreorder\n");
 
-  mips16_fp_args (file, current_function_args_info.fp_code, 1);
+  mips16_fp_args (current_function_args_info.fp_code, 1);
 
   fprintf (asm_out_file, "\t.set\tnoat\n");
   fprintf (asm_out_file, "\tla\t%s,", reg_names[GP_REG_FIRST + 1]);
-  assemble_name (file, fnname);
-  fprintf (file, "\n");
+  assemble_name (asm_out_file, fnname);
+  fprintf (asm_out_file, "\n");
   fprintf (asm_out_file, "\tjr\t%s\n", reg_names[GP_REG_FIRST + 1]);
   fprintf (asm_out_file, "\t.set\tat\n");
 
@@ -5269,15 +5271,15 @@ build_mips16_function_stub (FILE *file)
      available for one instruction, so if the very first instruction
      in the function refers to the register, it will see the wrong
      value.  */
-  fprintf (file, "\tnop\n");
+  fprintf (asm_out_file, "\tnop\n");
 
-  fprintf (file, "\t.set\treorder\n");
+  fprintf (asm_out_file, "\t.set\treorder\n");
 
   if (!FUNCTION_NAME_ALREADY_DECLARED)
     {
-      fputs ("\t.end\t", file);
-      assemble_name (file, stubname);
-      fputs ("\n", file);
+      fputs ("\t.end\t", asm_out_file);
+      assemble_name (asm_out_file, stubname);
+      fputs ("\n", asm_out_file);
     }
 
   switch_to_section (function_section (current_function_decl));
@@ -5514,7 +5516,7 @@ build_mips16_call_stub (rtx retval, rtx 
       /* We don't want the assembler to insert any nops here.  */
       fprintf (asm_out_file, "\t.set\tnoreorder\n");
 
-      mips16_fp_args (asm_out_file, fp_code, 0);
+      mips16_fp_args (fp_code, 0);
 
       if (! fpret)
 	{
@@ -8261,7 +8263,7 @@ mips_output_function_prologue (FILE *fil
   if (TARGET_MIPS16
       && TARGET_HARD_FLOAT_ABI
       && current_function_args_info.fp_code != 0)
-    build_mips16_function_stub (file);
+    build_mips16_function_stub ();
 
   /* Select the mips16 mode for this function.  */
   if (TARGET_MIPS16)



More information about the Gcc-patches mailing list