public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: debug_reload output
@ 1997-10-17  5:58 Christian Iseli
  0 siblings, 0 replies; 11+ messages in thread
From: Christian Iseli @ 1997-10-17  5:58 UTC (permalink / raw)
  To: law; +Cc: amylaar, jfc, egcs

>> What I would suggest you do is have debug_reload_to_stream actually
>> have the real code to output the info.  debug_reload would then just
>> call debug_reload_to_stream with stderr as its argument.
>
>Just what I had in mind :-)  I should be sending you a new patch shortly,
>if there are no strong objections...
 
Well, here goes... a new proposed patch for debug_reload

					Christian

Fri Oct 17 12:29:48 1997  Christian Iseli  <Christian.Iseli@lslsun.epfl.ch>

	* reload.c (debug_reload_to_stream): New function.  Specify stream
 	into which to write debug info.
	(debug_reload): Modify to call debug_reload_to_stream with stderr.

*** reload.c.orig	Tue Oct  7 18:50:13 1997
--- reload.c	Fri Oct 17 10:43:49 1997
*************** static char *reload_when_needed_name[] =
*** 6108,6193 ****
  
  static char *reg_class_names[] = REG_CLASS_NAMES;
  
! /* This function is used to print the variables set by 'find_reloads' */
  
  void
! debug_reload ()
  {
    int r;
    char *prefix;
  
    for (r = 0; r < n_reloads; r++)
      {
!       fprintf (stderr, "Reload %d: ", r);
  
        if (reload_in[r] != 0)
  	{
! 	  fprintf (stderr, "reload_in (%s) = ",
  		   GET_MODE_NAME (reload_inmode[r]));
! 	  print_inline_rtx (stderr, reload_in[r], 24);
! 	  fprintf (stderr, "\n\t");
  	}
  
        if (reload_out[r] != 0)
  	{
! 	  fprintf (stderr, "reload_out (%s) = ",
  		   GET_MODE_NAME (reload_outmode[r]));
! 	  print_inline_rtx (stderr, reload_out[r], 24);
! 	  fprintf (stderr, "\n\t");
  	}
  
!       fprintf (stderr, "%s, ", reg_class_names[(int) reload_reg_class[r]]);
  
!       fprintf (stderr, "%s (opnum = %d)",
  	       reload_when_needed_name[(int) reload_when_needed[r]],
  	       reload_opnum[r]);
  
        if (reload_optional[r])
! 	fprintf (stderr, ", optional");
  
        if (reload_inc[r] != 0)
! 	fprintf (stderr, ", inc by %d", reload_inc[r]);
  
        if (reload_nocombine[r])
! 	fprintf (stderr, ", can't combine");
  
        if (reload_secondary_p[r])
! 	fprintf (stderr, ", secondary_reload_p");
  
        if (reload_in_reg[r] != 0)
  	{
! 	  fprintf (stderr, "\n\treload_in_reg: ");
! 	  print_inline_rtx (stderr, reload_in_reg[r], 24);
  	}
  
        if (reload_reg_rtx[r] != 0)
  	{
! 	  fprintf (stderr, "\n\treload_reg_rtx: ");
! 	  print_inline_rtx (stderr, reload_reg_rtx[r], 24);
  	}
  
        prefix = "\n\t";
        if (reload_secondary_in_reload[r] != -1)
  	{
! 	  fprintf (stderr, "%ssecondary_in_reload = %d",
  		   prefix, reload_secondary_in_reload[r]);
  	  prefix = ", ";
  	}
  
        if (reload_secondary_out_reload[r] != -1)
! 	fprintf (stderr, "%ssecondary_out_reload = %d\n",
  		 prefix, reload_secondary_out_reload[r]);
  
        prefix = "\n\t";
        if (reload_secondary_in_icode[r] != CODE_FOR_nothing)
  	{
! 	  fprintf (stderr, "%ssecondary_in_icode = %s", prefix, insn_name[r]);
  	  prefix = ", ";
  	}
  
        if (reload_secondary_out_icode[r] != CODE_FOR_nothing)
! 	fprintf (stderr, "%ssecondary_out_icode = %s", prefix, insn_name[r]);
  
!       fprintf (stderr, "\n");
      }
  }
--- 6108,6202 ----
  
  static char *reg_class_names[] = REG_CLASS_NAMES;
  
! /* These functions are used to print the variables set by 'find_reloads' */
  
  void
! debug_reload_to_stream (f)
!      FILE *f;
  {
    int r;
    char *prefix;
  
+   if (! f)
+     f = stderr;
    for (r = 0; r < n_reloads; r++)
      {
!       fprintf (f, "Reload %d: ", r);
  
        if (reload_in[r] != 0)
  	{
! 	  fprintf (f, "reload_in (%s) = ",
  		   GET_MODE_NAME (reload_inmode[r]));
! 	  print_inline_rtx (f, reload_in[r], 24);
! 	  fprintf (f, "\n\t");
  	}
  
        if (reload_out[r] != 0)
  	{
! 	  fprintf (f, "reload_out (%s) = ",
  		   GET_MODE_NAME (reload_outmode[r]));
! 	  print_inline_rtx (f, reload_out[r], 24);
! 	  fprintf (f, "\n\t");
  	}
  
!       fprintf (f, "%s, ", reg_class_names[(int) reload_reg_class[r]]);
  
!       fprintf (f, "%s (opnum = %d)",
  	       reload_when_needed_name[(int) reload_when_needed[r]],
  	       reload_opnum[r]);
  
        if (reload_optional[r])
! 	fprintf (f, ", optional");
  
        if (reload_inc[r] != 0)
! 	fprintf (f, ", inc by %d", reload_inc[r]);
  
        if (reload_nocombine[r])
! 	fprintf (f, ", can't combine");
  
        if (reload_secondary_p[r])
! 	fprintf (f, ", secondary_reload_p");
  
        if (reload_in_reg[r] != 0)
  	{
! 	  fprintf (f, "\n\treload_in_reg: ");
! 	  print_inline_rtx (f, reload_in_reg[r], 24);
  	}
  
        if (reload_reg_rtx[r] != 0)
  	{
! 	  fprintf (f, "\n\treload_reg_rtx: ");
! 	  print_inline_rtx (f, reload_reg_rtx[r], 24);
  	}
  
        prefix = "\n\t";
        if (reload_secondary_in_reload[r] != -1)
  	{
! 	  fprintf (f, "%ssecondary_in_reload = %d",
  		   prefix, reload_secondary_in_reload[r]);
  	  prefix = ", ";
  	}
  
        if (reload_secondary_out_reload[r] != -1)
! 	fprintf (f, "%ssecondary_out_reload = %d\n",
  		 prefix, reload_secondary_out_reload[r]);
  
        prefix = "\n\t";
        if (reload_secondary_in_icode[r] != CODE_FOR_nothing)
  	{
! 	  fprintf (f, "%ssecondary_in_icode = %s", prefix, insn_name[r]);
  	  prefix = ", ";
  	}
  
        if (reload_secondary_out_icode[r] != CODE_FOR_nothing)
! 	fprintf (f, "%ssecondary_out_icode = %s", prefix, insn_name[r]);
  
!       fprintf (f, "\n");
      }
+ }
+ 
+ void
+ debug_reload ()
+ {
+   debug_reload_to_stream (stderr);
  }





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

* Re: debug_reload output
@ 1997-10-15  7:41 Christian Iseli
  0 siblings, 0 replies; 11+ messages in thread
From: Christian Iseli @ 1997-10-15  7:41 UTC (permalink / raw)
  To: law; +Cc: amylaar, jfc, egcs

>   In message < 199710150932.LAA17687@lslsun17.epfl.ch >you write:
>   > I agree that the two function thing is the best approach.  How about
>   > debug_reload_to_stream(FILE *) as the new function?
> That would be fine.
> 
> What I would suggest you do is have debug_reload_to_stream actually
> have the real code to output the info.  debug_reload would then just
> call debug_reload_to_stream with stderr as its argument.

Just what I had in mind :-)  I should be sending you a new patch shortly,
if there are no strong objections...

					Christian

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

* Re: debug_reload output
  1997-10-15  2:32 Christian Iseli
@ 1997-10-15  7:33 ` Jeffrey A Law
  0 siblings, 0 replies; 11+ messages in thread
From: Jeffrey A Law @ 1997-10-15  7:33 UTC (permalink / raw)
  To: Christian Iseli; +Cc: amylaar, jfc, egcs

  In message < 199710150932.LAA17687@lslsun17.epfl.ch >you write:
  > I agree that the two function thing is the best approach.  How about
  > debug_reload_to_stream(FILE *) as the new function?
That would be fine.

What I would suggest you do is have debug_reload_to_stream actually
have the real code to output the info.  debug_reload would then just
call debug_reload_to_stream with stderr as its argument.

jeff

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

* Re: debug_reload output
@ 1997-10-15  2:32 Christian Iseli
  1997-10-15  7:33 ` Jeffrey A Law
  0 siblings, 1 reply; 11+ messages in thread
From: Christian Iseli @ 1997-10-15  2:32 UTC (permalink / raw)
  To: amylaar; +Cc: jfc, egcs

> > Ok, then how about having a global variable debug_reload_stream initialized
> > to stderr, instead of the parameter?  Does this sound like a better proposition?
> 
> This solves the practical problems, but why do you prefer adding a new global
> variable to adding a new function?  In general, adding global variables
> has a higher impact on subsequent maintenance than adding a new simple
> function.

'cause I get mails in shuffled order... :-)  As strange as it may seem, I get
my own mails back from the list later than some of the answers to them...

I agree that the two function thing is the best approach.  How about
debug_reload_to_stream(FILE *) as the new function?

					Christian

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

* Re: debug_reload output
  1997-10-14 12:55 Christian Iseli
  1997-10-14 11:01 ` Joern Rennecke
@ 1997-10-14 16:33 ` Jeffrey A Law
  1 sibling, 0 replies; 11+ messages in thread
From: Jeffrey A Law @ 1997-10-14 16:33 UTC (permalink / raw)
  To: Christian Iseli; +Cc: amylaar, jfc, egcs

  In message < 199710141534.RAA21975@lslsun17.epfl.ch >you write:
  > Ok, then how about having a global variable debug_reload_stream initialized
  > to stderr, instead of the parameter?  Does this sound like a better proposi
  > tion?
I would recommend against a global variable.

Either create two functions, or have debug_reload default to stderr if its
argument is null.
jeff

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

* Re: debug_reload output
@ 1997-10-14 12:55 Christian Iseli
  1997-10-14 11:01 ` Joern Rennecke
  1997-10-14 16:33 ` Jeffrey A Law
  0 siblings, 2 replies; 11+ messages in thread
From: Christian Iseli @ 1997-10-14 12:55 UTC (permalink / raw)
  To: amylaar, jfc; +Cc: egcs

> From amylaar@cygnus.co.uk Tue Oct 14 17:20 MET 1997
> From: Joern Rennecke <amylaar@cygnus.co.uk>
> Subject: Re: debug_reload output
> To: chris@lslsun.epfl.ch (Christian Iseli)
> > 
> > Hi,
> > 
> > I would like to be able to redirect the output of de debug_reload routine
> > to something else than stderr, e.g., the greg dump file...
> 
> That would be a considerable nuisance - instead of
> call debug_reload()
> you'd have to type
> call debug_reload(stderr)
> all the time in gdb - and if you forget it just once, the debugged
> process will crash and you have to start it all over again.
> If you must have a function that is like debug_reload but accepts an
> output stream as parameter, I'd prefer if you call it something else
> and have debug_reload calling it.

Ok, then how about having a global variable debug_reload_stream initialized
to stderr, instead of the parameter?  Does this sound like a better proposition?

					Christian

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

* Re: debug_reload output
  1997-10-14  1:39 Christian Iseli
  1997-10-14  8:20 ` John Carr
  1997-10-14  8:20 ` Joern Rennecke
@ 1997-10-14 11:01 ` Jeffrey A Law
  2 siblings, 0 replies; 11+ messages in thread
From: Jeffrey A Law @ 1997-10-14 11:01 UTC (permalink / raw)
  To: Christian Iseli; +Cc: egcs

  In message < 199710140839.KAA20719@lslsun17.epfl.ch >you write:
  > Hi,
  > 
  > I would like to be able to redirect the output of de debug_reload routine
  > to something else than stderr, e.g., the greg dump file...
  > 
  > So I'd like to suggest the following trivial patch be applied.
I think you want two functions.  One which accepts a stream parameter
and one which defaults to stderr.  Obviously, the one which defaults to
stderr can just call the one which accepts a stream parameter passing
"stderr" as the stream.

That way you can call the function from gdb without knowing what
stderr really is (since it's usually something gross like __iob[1].

jeff

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

* Re: debug_reload output
  1997-10-14 12:55 Christian Iseli
@ 1997-10-14 11:01 ` Joern Rennecke
  1997-10-14 16:33 ` Jeffrey A Law
  1 sibling, 0 replies; 11+ messages in thread
From: Joern Rennecke @ 1997-10-14 11:01 UTC (permalink / raw)
  To: Christian Iseli; +Cc: amylaar, jfc, egcs

> Ok, then how about having a global variable debug_reload_stream initialized
> to stderr, instead of the parameter?  Does this sound like a better proposition?

This solves the practical problems, but why do you prefer adding a new global
variable to adding a new function?  In general, adding global variables
has a higher impact on subsequent maintenance than adding a new simple
function.

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

* Re: debug_reload output
  1997-10-14  1:39 Christian Iseli
@ 1997-10-14  8:20 ` John Carr
  1997-10-14  8:20 ` Joern Rennecke
  1997-10-14 11:01 ` Jeffrey A Law
  2 siblings, 0 replies; 11+ messages in thread
From: John Carr @ 1997-10-14  8:20 UTC (permalink / raw)
  To: Christian Iseli; +Cc: egcs

If debug_reload takes a FILE * argument it should permit NULL and use
stderr in that case.  That would make it possible to call the function
from a debugger; on most systems it is inconvenient to compute the
value of stdout or stderr in a debugger.


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

* Re: debug_reload output
  1997-10-14  1:39 Christian Iseli
  1997-10-14  8:20 ` John Carr
@ 1997-10-14  8:20 ` Joern Rennecke
  1997-10-14 11:01 ` Jeffrey A Law
  2 siblings, 0 replies; 11+ messages in thread
From: Joern Rennecke @ 1997-10-14  8:20 UTC (permalink / raw)
  To: Christian Iseli; +Cc: egcs

> 
> Hi,
> 
> I would like to be able to redirect the output of de debug_reload routine
> to something else than stderr, e.g., the greg dump file...

That would be a considerable nuisance - instead of
call debug_reload()
you'd have to type
call debug_reload(stderr)
all the time in gdb - and if you forget it just once, the debugged
process will crash and you have to start it all over again.
If you must have a function that is like debug_reload but accepts an
output stream as parameter, I'd prefer if you call it something else
and have debug_reload calling it.

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

* debug_reload output
@ 1997-10-14  1:39 Christian Iseli
  1997-10-14  8:20 ` John Carr
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Christian Iseli @ 1997-10-14  1:39 UTC (permalink / raw)
  To: egcs

Hi,

I would like to be able to redirect the output of de debug_reload routine
to something else than stderr, e.g., the greg dump file...

So I'd like to suggest the following trivial patch be applied.

Thanks,
					Christian

Tue Oct 14 10:34:11 1997  Christian Iseli  <Christian.Iseli@lslsun.epfl.ch>

	* reload.c (debug_reload): pass output stream as parameter instead
 	of forcing stderr.

*** reload.c.orig	Wed Aug 27 02:49:59 1997
--- reload.c	Fri Sep 26 13:46:58 1997
*************** static char *reg_class_names[] = REG_CLA
*** 6110,6192 ****
  /* This function is used to print the variables set by 'find_reloads' */
  
  void
! debug_reload ()
  {
    int r;
    char *prefix;
  
    for (r = 0; r < n_reloads; r++)
      {
!       fprintf (stderr, "Reload %d: ", r);
  
        if (reload_in[r] != 0)
  	{
! 	  fprintf (stderr, "reload_in (%s) = ",
  		   GET_MODE_NAME (reload_inmode[r]));
! 	  print_inline_rtx (stderr, reload_in[r], 24);
! 	  fprintf (stderr, "\n\t");
  	}
  
        if (reload_out[r] != 0)
  	{
! 	  fprintf (stderr, "reload_out (%s) = ",
  		   GET_MODE_NAME (reload_outmode[r]));
! 	  print_inline_rtx (stderr, reload_out[r], 24);
! 	  fprintf (stderr, "\n\t");
  	}
  
!       fprintf (stderr, "%s, ", reg_class_names[(int) reload_reg_class[r]]);
  
!       fprintf (stderr, "%s (opnum = %d)",
  	       reload_when_needed_name[(int) reload_when_needed[r]],
  	       reload_opnum[r]);
  
        if (reload_optional[r])
! 	fprintf (stderr, ", optional");
  
        if (reload_inc[r] != 0)
! 	fprintf (stderr, ", inc by %d", reload_inc[r]);
  
        if (reload_nocombine[r])
! 	fprintf (stderr, ", can't combine");
  
        if (reload_secondary_p[r])
! 	fprintf (stderr, ", secondary_reload_p");
  
        if (reload_in_reg[r] != 0)
  	{
! 	  fprintf (stderr, "\n\treload_in_reg: ");
! 	  print_inline_rtx (stderr, reload_in_reg[r], 24);
  	}
  
        if (reload_reg_rtx[r] != 0)
  	{
! 	  fprintf (stderr, "\n\treload_reg_rtx: ");
! 	  print_inline_rtx (stderr, reload_reg_rtx[r], 24);
  	}
  
        prefix = "\n\t";
        if (reload_secondary_in_reload[r] != -1)
  	{
! 	  fprintf (stderr, "%ssecondary_in_reload = %d",
  		   prefix, reload_secondary_in_reload[r]);
  	  prefix = ", ";
  	}
  
        if (reload_secondary_out_reload[r] != -1)
! 	fprintf (stderr, "%ssecondary_out_reload = %d\n",
  		 prefix, reload_secondary_out_reload[r]);
  
        prefix = "\n\t";
        if (reload_secondary_in_icode[r] != CODE_FOR_nothing)
  	{
! 	  fprintf (stderr, "%ssecondary_in_icode = %s", prefix, insn_name[r]);
  	  prefix = ", ";
  	}
  
        if (reload_secondary_out_icode[r] != CODE_FOR_nothing)
! 	fprintf (stderr, "%ssecondary_out_icode = %s", prefix, insn_name[r]);
  
!       fprintf (stderr, "\n");
      }
  }
--- 6110,6192 ----
  /* This function is used to print the variables set by 'find_reloads' */
  
  void
! debug_reload (FILE *f)
  {
    int r;
    char *prefix;
  
    for (r = 0; r < n_reloads; r++)
      {
!       fprintf (f, "Reload %d: ", r);
  
        if (reload_in[r] != 0)
  	{
! 	  fprintf (f, "reload_in (%s) = ",
  		   GET_MODE_NAME (reload_inmode[r]));
! 	  print_inline_rtx (f, reload_in[r], 24);
! 	  fprintf (f, "\n\t");
  	}
  
        if (reload_out[r] != 0)
  	{
! 	  fprintf (f, "reload_out (%s) = ",
  		   GET_MODE_NAME (reload_outmode[r]));
! 	  print_inline_rtx (f, reload_out[r], 24);
! 	  fprintf (f, "\n\t");
  	}
  
!       fprintf (f, "%s, ", reg_class_names[(int) reload_reg_class[r]]);
  
!       fprintf (f, "%s (opnum = %d)",
  	       reload_when_needed_name[(int) reload_when_needed[r]],
  	       reload_opnum[r]);
  
        if (reload_optional[r])
! 	fprintf (f, ", optional");
  
        if (reload_inc[r] != 0)
! 	fprintf (f, ", inc by %d", reload_inc[r]);
  
        if (reload_nocombine[r])
! 	fprintf (f, ", can't combine");
  
        if (reload_secondary_p[r])
! 	fprintf (f, ", secondary_reload_p");
  
        if (reload_in_reg[r] != 0)
  	{
! 	  fprintf (f, "\n\treload_in_reg: ");
! 	  print_inline_rtx (f, reload_in_reg[r], 24);
  	}
  
        if (reload_reg_rtx[r] != 0)
  	{
! 	  fprintf (f, "\n\treload_reg_rtx: ");
! 	  print_inline_rtx (f, reload_reg_rtx[r], 24);
  	}
  
        prefix = "\n\t";
        if (reload_secondary_in_reload[r] != -1)
  	{
! 	  fprintf (f, "%ssecondary_in_reload = %d",
  		   prefix, reload_secondary_in_reload[r]);
  	  prefix = ", ";
  	}
  
        if (reload_secondary_out_reload[r] != -1)
! 	fprintf (f, "%ssecondary_out_reload = %d\n",
  		 prefix, reload_secondary_out_reload[r]);
  
        prefix = "\n\t";
        if (reload_secondary_in_icode[r] != CODE_FOR_nothing)
  	{
! 	  fprintf (f, "%ssecondary_in_icode = %s", prefix, insn_name[r]);
  	  prefix = ", ";
  	}
  
        if (reload_secondary_out_icode[r] != CODE_FOR_nothing)
! 	fprintf (f, "%ssecondary_out_icode = %s", prefix, insn_name[r]);
  
!       fprintf (f, "\n");
      }
  }

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

end of thread, other threads:[~1997-10-17  5:58 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-10-17  5:58 debug_reload output Christian Iseli
  -- strict thread matches above, loose matches on Subject: below --
1997-10-15  7:41 Christian Iseli
1997-10-15  2:32 Christian Iseli
1997-10-15  7:33 ` Jeffrey A Law
1997-10-14 12:55 Christian Iseli
1997-10-14 11:01 ` Joern Rennecke
1997-10-14 16:33 ` Jeffrey A Law
1997-10-14  1:39 Christian Iseli
1997-10-14  8:20 ` John Carr
1997-10-14  8:20 ` Joern Rennecke
1997-10-14 11:01 ` Jeffrey A Law

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).