where is variable dump_file assigned?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

where is variable dump_file assigned?

gcc - Help mailing list
Hello,
there are a lot of places to use dump_file, such as the following in ipa_inline.c:
 if(dump_file)  fprintf (dump_file, "\nFlattening functions:\n");
And I don't know where is the dump_file being assigned a file name.Can I directly assign the file name and do fprintf() to output data?Or, is there something, like the format, I need to pay attention for? 
Reply | Threaded
Open this post in threaded view
|

Re: where is variable dump_file assigned?

Segher Boessenkool
Hi,

On Fri, Nov 30, 2018 at 06:04:11AM +0000, wang tom via gcc-help wrote:
> there are a lot of places to use dump_file, such as the following in ipa_inline.c:
>  if(dump_file)  fprintf (dump_file, "\nFlattening functions:\n");
> And I don't know where is the dump_file being assigned a file name.Can I directly assign the file name and do fprintf() to output data?Or, is there something, like the format, I need to pay attention for? 

This is the dump file as you see with -fdump-combine-all or -fdump-rtl-tree
etc.  It magically switches to the correct pass for you.  If there is no
output file for your pass (like if the user did not use the -fdump-* things)
it will be NULL, so your code will be like
if (dump_file) fprintf (dump_file, "Hello there!\n");


Segher