lto-wrapper.c (run_gcc): In non-parallel mode remove ltrans inputs immediately after...
authorRichard Guenther <rguenther@suse.de>
Thu, 15 Dec 2011 14:50:25 +0000 (14:50 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 15 Dec 2011 14:50:25 +0000 (14:50 +0000)
2011-12-15  Richard Guenther  <rguenther@suse.de>

* lto-wrapper.c (run_gcc): In non-parallel mode remove
ltrans inputs immediately after processing them.  In parallel
mode truncate the ltrans inputs in the make rule that processes
them if temporary files are not to be preserved.

From-SVN: r182370

gcc/ChangeLog
gcc/lto-wrapper.c

index 3357e8fa806d28472996fead5f7458673fffd787..9ec882ddc19169192132abb6f088cb90bf8ef1cc 100644 (file)
@@ -1,3 +1,10 @@
+2011-12-15  Richard Guenther  <rguenther@suse.de>
+
+       * lto-wrapper.c (run_gcc): In non-parallel mode remove
+       ltrans inputs immediately after processing them.  In parallel
+       mode truncate the ltrans inputs in the make rule that processes
+       them if temporary files are not to be preserved.
+
 2011-12-15  Anatoly Sokolov  <aesok@post.ru>
 
        * config/arm/arm.h (REGISTER_MOVE_COST, MEMORY_MOVE_COST): Remove.
index 5fb37624810aa5b42235cb9689c2351b30820abf..1cc7bfb843dd6b99090c078389dada4b429f7abc 100644 (file)
@@ -811,9 +811,19 @@ cont:
              for (j = 1; new_argv[j] != NULL; ++j)
                fprintf (mstream, " '%s'", new_argv[j]);
              fprintf (mstream, "\n");
+             /* If we are not preserving the ltrans input files then
+                truncate them as soon as we have processed it.  This
+                reduces temporary disk-space usage.  */
+             if (! debug)
+               fprintf (mstream, "\t@-touch -r %s %s.tem > /dev/null 2>&1 "
+                        "&& mv %s.tem %s\n",
+                        input_name, input_name, input_name, input_name); 
            }
          else
-           fork_execute (CONST_CAST (char **, new_argv));
+           {
+             fork_execute (CONST_CAST (char **, new_argv));
+             maybe_unlink_file (input_name);
+           }
 
          output_names[i] = output_name;
        }
@@ -851,12 +861,13 @@ cont:
          collect_wait (new_argv[0], pex);
          maybe_unlink_file (makefile);
          makefile = NULL;
+         for (i = 0; i < nr; ++i)
+           maybe_unlink_file (input_names[i]);
        }
       for (i = 0; i < nr; ++i)
        {
          fputs (output_names[i], stdout);
          putc ('\n', stdout);
-         maybe_unlink_file (input_names[i]);
          free (input_names[i]);
        }
       nr = 0;