The patch re-factors libgcov.c to make it better modulelized.
authorRong Xu <xur@gcc.gnu.org>
Wed, 13 Nov 2013 00:24:49 +0000 (00:24 +0000)
committerRong Xu <xur@gcc.gnu.org>
Wed, 13 Nov 2013 00:24:49 +0000 (00:24 +0000)
commitd6d3f03341138d3918c71ce9fc6f05b81ebe004e
tree37fb2ef6bc9b218262b6180c7c04cd43556c7d23
parentef61907f9c6fe96eaf21ed7157ccc0e3e83c1bd1
The patch re-factors libgcov.c to make it better modulelized.

2013-11-12  Rong Xu  <xur@google.com>

The patch re-factors libgcov.c to make it better modulelized.
It contains two pieces of work:
1. break gcov_exit() into the following structure:
   gcov_exit()
      --> gcov_exit_compute_summary()
      --> allocate_filename_struct()
          for gi_ptr in gcov_list
            --> gcov_exit_dump_gcov()
                   --> gcov_exit_open_gcda_file()
                   --> gcov_exit_merge_gcda ()
                   --> gcov_exit_merge_summary ()
                   --> gcov_exit_write_gcda ()
2. split libgcov.c into the following files:
     libgcov-profiler.c
     libgcov-merge.c
     libgcov-interface.c
     libgcov-driver.c
       libgcov-driver-system.c (source included into libgcov-driver.c)

* libgcc/libgcov.c: Delete as part of re-factoring.
* gcc/gcov-io.h (__gcov_indirect_call_profiler): Add the decl to
        avoid warning.
* libgcc/libgcov-interface.c (init_mx): Moved from libgcov.c.
(init_mx_once): Ditto.
(__gcov_flush): Ditto.
(__gcov_reset): Ditto.
(__gcov_dump): Ditto.
(__gcov_fork): Ditto.
(__gcov_execl): Ditto.
(__gcov_execlp): Ditto.
(__gcov_execle): Ditto.
(__gcov_execv): Ditto.
(__gcov_execvp): Ditto.
(__gcov_execve): Ditto.
        * libgcc/libgcov-merge.c (__gcov_merge_time_profile): Moved from
        libgcov.c.
(__gcov_merge_add): Ditto.
(__gcov_merge_ior): Ditto.
(__gcov_merge_single): Ditto.
(__gcov_merge_delta): Ditto.
* libgcc/libgcov-profiler.c
(__gcov_interval_profiler): Ditto.
(__gcov_pow2_profiler): Ditto.
(__gcov_one_value_profiler_body): Ditto.
(__gcov_one_value_profiler): Ditto.
(__gcov_indirect_call_profiler): Ditto.
(__gcov_indirect_call_profiler_v2): Ditto.
(__gcov_time_profiler): Ditto.
(__gcov_average_profiler): Ditto.
(__gcov_ior_profiler): Ditto.
* libgcc/libgcov-driver.c (set_gcov_list): New.
(get_gcov_dump_complete): Ditto.
(set_gcov_dump_complete):Ditto.
(reset_gcov_dump_complete):Ditto.
(gcov_exit_compute_summary): New function split from gcov_exit().
(gcov_exit_merge_gcda): Ditto.
(gcov_exit_write_gcda): Ditto.
(gcov_exit_merge_summary): Ditto.
(gcov_exit_dump_gcov): Ditto.
(struct gcov_fn_buffer): Moved from libgcov.c
(struct gcov_summary_buffer): Ditto.
(free_fn_data): Ditto.
(buffer_fn_data): Ditto.
(crc32_unsigned): Ditto.
(gcov_version): Ditto.
(gcov_histogram_insert): Ditto.
(gcov_compute_histogram): Ditto.
(gcov_exit): Ditto.
(gcov_clear): Ditto.
(__gcov_init): Ditto.
        (this_prg): Make it file scope static variable.
        (all_prg): Ditto.
        (crc32): Ditto.
        (gi_filename): Ditto.
        (fn_buffer): Ditto.
        (sum_buffer): Ditto.
        (struct gcov_filename_aux): New types to store auxiliary information
        for gi_filename.
* libgcc/libgcov-driver-system.c (gcov_error): New utility function.
(allocate_filename_struct): New function split from gcov_exit().
(gcov_exit_open_gcda_file): Ditto.
(create_file_directory): Moved from libgcov.c
* libgcc/Makefile.in: Change to build newly added files.

From-SVN: r204730
gcc/gcov-io.h
libgcc/Makefile.in
libgcc/libgcov-driver-system.c [new file with mode: 0644]
libgcc/libgcov-driver.c [new file with mode: 0644]
libgcc/libgcov-interface.c [new file with mode: 0644]
libgcc/libgcov-merge.c [new file with mode: 0644]
libgcc/libgcov-profiler.c [new file with mode: 0644]
libgcc/libgcov.c [deleted file]