public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* egcs-980129, warning patches to alpha.c
@ 1998-02-05 17:44 Kaveh R. Ghazi
  1998-02-06  0:57 ` Mike Simons
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Kaveh R. Ghazi @ 1998-02-05 17:44 UTC (permalink / raw)
  To: egcs

	Here's a few fixes for warnings from config/alpha/alpha.c.

		--Kaveh


Thu Feb  5 14:53:05 1998  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * alpha.c (alpha_return_addr): Remove unused variable `first'.
        (alpha_ra_ever_killed): Remove unused variables `ra' and `i'.
        (add_long_const): Use HOST_WIDE_INT_PRINT_DEC as needed.
        (output_prolog): Likewise.
        (output_epilog): Likewise.  Remove unused variable
        `frame_size_from_reg_save'.
 

--- gcc/config/alpha/alpha.c~	Wed Jan 28 19:47:06 1998
+++ gcc/config/alpha/alpha.c	Thu Feb  5 14:35:19 1998
@@ -2058,7 +2058,7 @@
      int count;
      rtx frame;
 {
-  rtx init, first;
+  rtx init;
 
   if (count != 0)
     return const0_rtx;
@@ -2082,8 +2082,6 @@
 static int
 alpha_ra_ever_killed ()
 {
-  rtx i, ra;
-
   if (!alpha_return_addr_rtx)
     return regs_ever_live[REG_RA];
 
@@ -2710,9 +2708,17 @@
       int result_reg = (extra == 0 && high == 0) ? out_reg : temp_reg;
 
       if (low >= 0 && low < 255)
-	fprintf (file, "\taddq $%d,%d,$%d\n", in_reg, low, result_reg);
+	{
+	  fprintf (file, "\taddq $%d,", in_reg);
+	  fprintf (file, HOST_WIDE_INT_PRINT_DEC, low);
+	  fprintf (file, ",$%d\n", result_reg);
+	}
       else
-	fprintf (file, "\tlda $%d,%d($%d)\n", result_reg, low, in_reg);
+	{
+	  fprintf (file, "\tlda $%d,", result_reg);
+	  fprintf (file, HOST_WIDE_INT_PRINT_DEC, low);
+	  fprintf (file, "($%d)\n", in_reg);
+	}
 
       in_reg = result_reg;
     }
@@ -2721,12 +2727,18 @@
     {
       int result_reg = (high == 0) ? out_reg : temp_reg;
 
-      fprintf (file, "\tldah $%d,%d($%d)\n", result_reg, extra, in_reg);
+      fprintf (file, "\tldah $%d,", result_reg);
+      fprintf (file, HOST_WIDE_INT_PRINT_DEC, extra);
+      fprintf (file, "($%d)\n", in_reg);
       in_reg = result_reg;
     }
 
   if (high)
-    fprintf (file, "\tldah $%d,%d($%d)\n", out_reg, high, in_reg);
+    {
+      fprintf (file, "\tldah $%d,", out_reg);
+      fprintf (file, HOST_WIDE_INT_PRINT_DEC, high);
+      fprintf (file, "($%d)\n", in_reg);
+    }
 }
 
 /* Write function prologue.  */
@@ -3176,11 +3188,19 @@
 
 	  /* We only have to do this probe if we aren't saving registers.  */
 	  if (sa_size == 0 && probed + 4096 < frame_size)
-	    fprintf (file, "\tstq $31,-%d($30)\n", frame_size);
+	    {
+	      fprintf (file, "\tstq $31,-");
+	      fprintf (file, HOST_WIDE_INT_PRINT_DEC, frame_size);
+	      fprintf (file, "($30)\n");
+	    }
 	}
 
       if (frame_size != 0)
-	fprintf (file, "\tlda $30,-%d($30)\n", frame_size);
+	{
+	  fprintf (file, "\tlda $30,-");
+	  fprintf (file, HOST_WIDE_INT_PRINT_DEC, frame_size);
+	  fprintf (file, "($30)\n");
+	}
     }
   else
     {
@@ -3210,18 +3230,25 @@
       fprintf (file, "..sc\n");
 
       if (leftover > 4096 && sa_size == 0)
-	fprintf (file, "\tstq $31,-%d($4)\n", leftover);
+	{
+	  fprintf (file, "\tstq $31,-");
+	  fprintf (file, HOST_WIDE_INT_PRINT_DEC, leftover);
+	  fprintf (file, "($4)\n");
+	}
 
-      fprintf (file, "\tlda $30,-%d($4)\n", leftover);
+      fprintf (file, "\tlda $30,-");
+      fprintf (file, HOST_WIDE_INT_PRINT_DEC, leftover);
+      fprintf (file, "($4)\n");
     }
 
   /* Describe our frame.  */
   if (!flag_inhibit_size_directive)
     {
-      fprintf (file, "\t.frame $%d,%d,$26,%d\n", 
+      fprintf (file, "\t.frame $%d,",
 	       (frame_pointer_needed
-	        ? HARD_FRAME_POINTER_REGNUM : STACK_POINTER_REGNUM),
-	       frame_size, current_function_pretend_args_size);
+	        ? HARD_FRAME_POINTER_REGNUM : STACK_POINTER_REGNUM));
+      fprintf (file, HOST_WIDE_INT_PRINT_DEC, frame_size);
+      fprintf (file, ",$26,%d\n", current_function_pretend_args_size);
     }
 
   /* Cope with very large offsets to the register save area.  */
@@ -3246,7 +3273,9 @@
   if (sa_size != 0)
     {
       reg_mask |= 1 << REG_RA;
-      fprintf (file, "\tstq $26,%d($%d)\n", reg_offset, sa_reg);
+      fprintf (file, "\tstq $26,");
+      fprintf (file, HOST_WIDE_INT_PRINT_DEC, reg_offset);
+      fprintf (file, "($%d)\n", sa_reg);
       reg_offset += 8;
       int_reg_save_area_size += 8;
     }
@@ -3257,15 +3286,21 @@
 	&& regs_ever_live[i] && i != REG_RA)
       {
 	reg_mask |= 1 << i;
-	fprintf (file, "\tstq $%d,%d($%d)\n", i, reg_offset, sa_reg);
+	fprintf (file, "\tstq $%d,", i);
+	fprintf (file, HOST_WIDE_INT_PRINT_DEC, reg_offset);
+	fprintf (file, "($%d)\n", sa_reg);
 	reg_offset += 8;
 	int_reg_save_area_size += 8;
       }
 
   /* Print the register mask and do floating-point saves.  */
   if (reg_mask && !flag_inhibit_size_directive)
-    fprintf (file, "\t.mask 0x%x,%d\n", reg_mask,
-	     actual_start_reg_offset - frame_size);
+    {
+      fprintf (file, "\t.mask 0x%x,", reg_mask);
+      fprintf (file, HOST_WIDE_INT_PRINT_DEC,
+	       actual_start_reg_offset - frame_size);
+      fprintf (file, "\n");
+    }
 
   start_reg_offset = reg_offset;
   reg_mask = 0;
@@ -3275,14 +3310,20 @@
 	&& regs_ever_live[i + 32])
       {
 	reg_mask |= 1 << i;
-	fprintf (file, "\tstt $f%d,%d($%d)\n", i, reg_offset, sa_reg);
+	fprintf (file, "\tstt $f%d,", i);
+	fprintf (file, HOST_WIDE_INT_PRINT_DEC, reg_offset);
+	fprintf (file, "($%d)\n", sa_reg);
 	reg_offset += 8;
       }
 
   /* Print the floating-point mask, if we've saved any fp register.  */
   if (reg_mask && !flag_inhibit_size_directive)
-    fprintf (file, "\t.fmask 0x%x,%d\n", reg_mask,
-	     actual_start_reg_offset - frame_size + int_reg_save_area_size);
+    {
+      fprintf (file, "\t.fmask 0x%x,", reg_mask);
+      fprintf (file, HOST_WIDE_INT_PRINT_DEC,
+	       actual_start_reg_offset - frame_size + int_reg_save_area_size);
+      fprintf (file, "\n");
+    }
 
   /* If we need a frame pointer, set it from the stack pointer.  Note that
      this must always be the last instruction in the prologue.  */
@@ -3309,7 +3350,6 @@
     = (out_args_size + sa_size
        + ALPHA_ROUND (size + current_function_pretend_args_size));
   HOST_WIDE_INT reg_offset = out_args_size;
-  HOST_WIDE_INT frame_size_from_reg_save = frame_size - reg_offset;
   int restore_fp
     = frame_pointer_needed && regs_ever_live[HARD_FRAME_POINTER_REGNUM];
   int i;
@@ -3349,7 +3389,9 @@
 	 register.  */
       if (sa_size != 0)
 	{
-	  fprintf (file, "\tldq $26,%d($%d)\n", reg_offset, sa_reg);
+	  fprintf (file, "\tldq $26,");
+	  fprintf (file, HOST_WIDE_INT_PRINT_DEC, reg_offset);
+	  fprintf (file, "($%d)\n", sa_reg);
 	  reg_offset += 8;
 	}
 
@@ -3364,7 +3406,11 @@
 	    if (i == HARD_FRAME_POINTER_REGNUM && frame_pointer_needed)
 	      fp_offset = reg_offset;
 	    else
-	      fprintf (file, "\tldq $%d,%d($%d)\n", i, reg_offset, sa_reg);
+	      {
+		fprintf (file, "\tldq $%d,", i);
+		fprintf (file, HOST_WIDE_INT_PRINT_DEC, reg_offset);
+		fprintf (file, "($%d)\n", sa_reg);
+	      }
 	    reg_offset += 8;
 	  }
 
@@ -3372,7 +3418,9 @@
 	if (! fixed_regs[i + 32] && ! call_used_regs[i + 32]
 	    && regs_ever_live[i + 32])
 	  {
-	    fprintf (file, "\tldt $f%d,%d($%d)\n", i, reg_offset, sa_reg);
+	    fprintf (file, "\tldt $f%d,", i);
+	    fprintf (file, HOST_WIDE_INT_PRINT_DEC, reg_offset);
+	    fprintf (file, "($%d)\n", sa_reg);
 	    reg_offset += 8;
 	  }
 
--
Kaveh R. Ghazi			Project Manager / Custom Development
ghazi@caip.rutgers.edu		ICon CMT Corp.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: egcs-980129, warning patches to alpha.c
  1998-02-05 17:44 egcs-980129, warning patches to alpha.c Kaveh R. Ghazi
@ 1998-02-06  0:57 ` Mike Simons
  1998-02-06  3:01   ` Andreas Schwab
                     ` (2 more replies)
  1998-02-06  5:56 ` John Carr
  1998-02-09  1:37 ` Jeffrey A Law
  2 siblings, 3 replies; 8+ messages in thread
From: Mike Simons @ 1998-02-06  0:57 UTC (permalink / raw)
  To: Kaveh R. Ghazi; +Cc: egcs

> Thu Feb  5 14:53:05 1998  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
>  
>         (add_long_const): Use HOST_WIDE_INT_PRINT_DEC as needed.
[...]
> @@ -3246,7 +3273,9 @@
>    if (sa_size != 0)
>      {
>        reg_mask |= 1 << REG_RA;
> -      fprintf (file, "\tstq $26,%d($%d)\n", reg_offset, sa_reg);
> +      fprintf (file, "\tstq $26,");
> +      fprintf (file, HOST_WIDE_INT_PRINT_DEC, reg_offset);
> +      fprintf (file, "($%d)\n", sa_reg);
>        reg_offset += 8;
>        int_reg_save_area_size += 8;
>      }

Kaveh,

I just glanced at your patch, couldn't we do this:
  fprintf (file, "\tstq $26," HOST_WIDE_INT_PRINT_DEC "($%d)\n", 
           reg_offset, sa_reg);

  it is much more condensed, the compiler will merge the strings for us.  =)

--

    Thanks,
      Mike Simons
      Science Applications International Corporation
      msimons@saic1.com                  703-925-5674

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: egcs-980129, warning patches to alpha.c
  1998-02-06  0:57 ` Mike Simons
@ 1998-02-06  3:01   ` Andreas Schwab
  1998-02-06  3:14   ` Olivier Galibert
  1998-02-06  5:56   ` Manfred.Hollstein
  2 siblings, 0 replies; 8+ messages in thread
From: Andreas Schwab @ 1998-02-06  3:01 UTC (permalink / raw)
  To: Mike Simons; +Cc: Kaveh R. Ghazi, egcs

Mike Simons <msimons@saic1.com> writes:

|> I just glanced at your patch, couldn't we do this:
|>   fprintf (file, "\tstq $26," HOST_WIDE_INT_PRINT_DEC "($%d)\n", 
|>            reg_offset, sa_reg);

|>   it is much more condensed, the compiler will merge the strings for us.  =)

That's not compatible with K&R C.

-- 
Andreas Schwab                                      "And now for something
schwab@issan.informatik.uni-dortmund.de              completely different"
schwab@gnu.org

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: egcs-980129, warning patches to alpha.c
  1998-02-06  0:57 ` Mike Simons
  1998-02-06  3:01   ` Andreas Schwab
@ 1998-02-06  3:14   ` Olivier Galibert
  1998-02-06  5:56   ` Manfred.Hollstein
  2 siblings, 0 replies; 8+ messages in thread
From: Olivier Galibert @ 1998-02-06  3:14 UTC (permalink / raw)
  To: egcs

On Fri, Feb 06, 1998 at 03:04:18AM -0500, Mike Simons wrote:
> I just glanced at your patch, couldn't we do this:
>   fprintf (file, "\tstq $26," HOST_WIDE_INT_PRINT_DEC "($%d)\n", 
>            reg_offset, sa_reg);
> 
>   it is much more condensed, the compiler will merge the strings for us.  =)

An ANSI C compiler will. A K&R C compiler may choke, barf and puke.

  OG.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: egcs-980129, warning patches to alpha.c
  1998-02-05 17:44 egcs-980129, warning patches to alpha.c Kaveh R. Ghazi
  1998-02-06  0:57 ` Mike Simons
@ 1998-02-06  5:56 ` John Carr
  1998-02-09  1:37 ` Jeffrey A Law
  2 siblings, 0 replies; 8+ messages in thread
From: John Carr @ 1998-02-06  5:56 UTC (permalink / raw)
  To: Kaveh R. Ghazi; +Cc: egcs

The printf format string changes are not necessary.  The constants
being printed fit in an int (Alpha only has 16 bit offsets in memory
instructions).  Either cast them to int or change the variables to be
int.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: egcs-980129, warning patches to alpha.c
  1998-02-06  0:57 ` Mike Simons
  1998-02-06  3:01   ` Andreas Schwab
  1998-02-06  3:14   ` Olivier Galibert
@ 1998-02-06  5:56   ` Manfred.Hollstein
  2 siblings, 0 replies; 8+ messages in thread
From: Manfred.Hollstein @ 1998-02-06  5:56 UTC (permalink / raw)
  To: msimons; +Cc: ghazi, egcs

On Fri, 6 February 1998, 03:04:18, msimons@saic1.com wrote:

 > > Thu Feb  5 14:53:05 1998  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 > >  
 > >         (add_long_const): Use HOST_WIDE_INT_PRINT_DEC as needed.
 > [...]
 > > @@ -3246,7 +3273,9 @@
 > >    if (sa_size != 0)
 > >      {
 > >        reg_mask |= 1 << REG_RA;
 > > -      fprintf (file, "\tstq $26,%d($%d)\n", reg_offset, sa_reg);
 > > +      fprintf (file, "\tstq $26,");
 > > +      fprintf (file, HOST_WIDE_INT_PRINT_DEC, reg_offset);
 > > +      fprintf (file, "($%d)\n", sa_reg);
 > >        reg_offset += 8;
 > >        int_reg_save_area_size += 8;
 > >      }
 > 
 > Kaveh,
 > 
 > I just glanced at your patch, couldn't we do this:
 >   fprintf (file, "\tstq $26," HOST_WIDE_INT_PRINT_DEC "($%d)\n", 
 >            reg_offset, sa_reg);
 > 
 >   it is much more condensed, the compiler will merge the strings for us.  =)
 > 

This of course would only work with an ANSI C compiler; e.g. SunOS's old
K&R cc will fail to concatenate string literals :-(

Manfred

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: egcs-980129, warning patches to alpha.c
  1998-02-05 17:44 egcs-980129, warning patches to alpha.c Kaveh R. Ghazi
  1998-02-06  0:57 ` Mike Simons
  1998-02-06  5:56 ` John Carr
@ 1998-02-09  1:37 ` Jeffrey A Law
  2 siblings, 0 replies; 8+ messages in thread
From: Jeffrey A Law @ 1998-02-09  1:37 UTC (permalink / raw)
  To: Kaveh R. Ghazi; +Cc: egcs

  In message < 199802052207.RAA21462@caip.rutgers.edu >you write:
  > 	Here's a few fixes for warnings from config/alpha/alpha.c.
  > 
  > 		--Kaveh
  > 
  > 
  > Thu Feb  5 14:53:05 1998  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
  >  
  >         * alpha.c (alpha_return_addr): Remove unused variable `first'.
  >         (alpha_ra_ever_killed): Remove unused variables `ra' and `i'.
  >         (add_long_const): Use HOST_WIDE_INT_PRINT_DEC as needed.
  >         (output_prolog): Likewise.
  >         (output_epilog): Likewise.  Remove unused variable
  >         `frame_size_from_reg_save'.
I installed the changes which removed the unused variables.  I'll let
Richard decide how he wants to handle the printf formatting issues since
we know the offsets will always fit in 16 bits...
  
jeff

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: egcs-980129, warning patches to alpha.c
@ 1998-02-06 17:06 Mike Stump
  0 siblings, 0 replies; 8+ messages in thread
From: Mike Stump @ 1998-02-06 17:06 UTC (permalink / raw)
  To: ghazi, msimons; +Cc: egcs

> From: Mike Simons <msimons@saic1.com>
> To: ghazi@caip.rutgers.edu (Kaveh R. Ghazi)
> Date: Fri, 6 Feb 1998 03:04:18 -0500 (EST)
> Cc: egcs@cygnus.com

> I just glanced at your patch, couldn't we do this:
>   fprintf (file, "\tstq $26," HOST_WIDE_INT_PRINT_DEC "($%d)\n", 
>            reg_offset, sa_reg);

>   it is much more condensed, the compiler will merge the strings for us.  =)

Your assumption that the compiler will do this is wrong.  Some C
compilers don't do this, in the past, we avoided this type of thing.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~1998-02-09  1:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-02-05 17:44 egcs-980129, warning patches to alpha.c Kaveh R. Ghazi
1998-02-06  0:57 ` Mike Simons
1998-02-06  3:01   ` Andreas Schwab
1998-02-06  3:14   ` Olivier Galibert
1998-02-06  5:56   ` Manfred.Hollstein
1998-02-06  5:56 ` John Carr
1998-02-09  1:37 ` Jeffrey A Law
1998-02-06 17:06 Mike Stump

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).