aboutsummaryrefslogtreecommitdiff
path: root/gcc/gcov-io.h
AgeCommit message (Collapse)AuthorFilesLines
2024-04-04Add condition coverage (MC/DC)Jørgen Kvalsvik1-0/+3
This patch adds support in gcc+gcov for modified condition/decision coverage (MC/DC) with the -fcondition-coverage flag. MC/DC is a type of test/code coverage and it is particularly important for safety-critical applicaitons in industries like aviation and automotive. Notably, MC/DC is required or recommended by: * DO-178C for the most critical software (Level A) in avionics. * IEC 61508 for SIL 4. * ISO 26262-6 for ASIL D. From the SQLite webpage: Two methods of measuring test coverage were described above: "statement" and "branch" coverage. There are many other test coverage metrics besides these two. Another popular metric is "Modified Condition/Decision Coverage" or MC/DC. Wikipedia defines MC/DC as follows: * Each decision tries every possible outcome. * Each condition in a decision takes on every possible outcome. * Each entry and exit point is invoked. * Each condition in a decision is shown to independently affect the outcome of the decision. In the C programming language where && and || are "short-circuit" operators, MC/DC and branch coverage are very nearly the same thing. The primary difference is in boolean vector tests. One can test for any of several bits in bit-vector and still obtain 100% branch test coverage even though the second element of MC/DC - the requirement that each condition in a decision take on every possible outcome - might not be satisfied. https://sqlite.org/testing.html#mcdc MC/DC comes in different flavors, the most important being unique cause MC/DC and masking MC/DC. This patch implements masking MC/DC, which is works well with short circuiting semantics, and according to John Chilenski's "An Investigation of Three Forms of the Modified Condition Decision Coverage (MCDC) Criterion" (2001) is as good as unique cause at catching bugs. Whalen, Heimdahl, and De Silva "Efficient Test Coverage Measurement for MC/DC" describes an algorithm for finding the masking table from an AST walk, but my algorithm figures this out by analyzing the control flow graph. The CFG is considered a reduced ordered binary decision diagram and an input vector a path through the BDD, which is recorded. Specific edges will mask ("null out") the contribution from earlier path segments, which can be determined by finding short circuit endpoints. Masking is most easily understood as circuiting of terms in the reverse-ordered Boolean function, and the masked conditions do not affect the decision like short-circuited conditions do not affect the decision. A tag/discriminator mapping from gcond->uid is created during gimplification and made available through the function struct. The values are unimportant as long as basic conditions constructed from a single Boolean expression are given the same identifier. This happens in the breaking down of ANDIF/ORIF trees, so the coverage generally works well for frontends that create such trees. Like Whalen et al this implementation records coverage in fixed-size bitsets which gcov knows how to interpret. Recording conditions only requires a few bitwise operations per condition and is very fast, but comes with a limit on the number of terms in a single boolean expression; the number of bits in a gcov_unsigned_type (which is usually typedef'd to uint64_t). For most practical purposes this is acceptable, and by default a warning will be issued if gcc cannot instrument the expression. This is a practical limitation in the implementation, and not a limitation of the algorithm, so support for more conditions can be supported by introducing arbitrary-sized bitsets. In action it looks pretty similar to the branch coverage. The -g short opt carries no significance, but was chosen because it was an available option with the upper-case free too. gcov --conditions: 3: 17:void fn (int a, int b, int c, int d) { 3: 18: if ((a && (b || c)) && d) conditions covered 3/8 condition 0 not covered (true false) condition 1 not covered (true) condition 2 not covered (true) condition 3 not covered (true) 1: 19: x = 1; -: 20: else 2: 21: x = 2; 3: 22:} gcov --conditions --json-format: "conditions": [ { "not_covered_false": [ 0 ], "count": 8, "covered": 3, "not_covered_true": [ 0, 1, 2, 3 ] } ], Expressions with constants may be heavily rewritten before it reaches the gimplification, so constructs like int x = a ? 0 : 1 becomes _x = (_a == 0). From source you would expect coverage, but it gets neither branch nor condition coverage. The same applies to expressions like int x = 1 || a which are simply replaced by a constant. The test suite contains a lot of small programs and functions. Some of these were designed by hand to test for specific behaviours and graph shapes, and some are previously-failed test cases in other programs adapted into the test suite. gcc/ChangeLog: * builtins.cc (expand_builtin_fork_or_exec): Check condition_coverage_flag. * collect2.cc (main): Add -fno-condition-coverage to OBSTACK. * common.opt: Add new options -fcondition-coverage and -Wcoverage-too-many-conditions. * doc/gcov.texi: Add --conditions documentation. * doc/invoke.texi: Add -fcondition-coverage documentation. * function.cc (free_after_compilation): Free cond_uids. * function.h (struct function): Add cond_uids. * gcc.cc: Link gcov on -fcondition-coverage. * gcov-counter.def (GCOV_COUNTER_CONDS): New. * gcov-dump.cc (tag_conditions): New. * gcov-io.h (GCOV_TAG_CONDS): New. (GCOV_TAG_CONDS_LENGTH): New. (GCOV_TAG_CONDS_NUM): New. * gcov.cc (class condition_info): New. (condition_info::condition_info): New. (condition_info::popcount): New. (struct coverage_info): New. (add_condition_counts): New. (output_conditions): New. (print_usage): Add -g, --conditions. (process_args): Likewise. (output_intermediate_json_line): Output conditions. (read_graph_file): Read condition counters. (read_count_file): Likewise. (file_summary): Print conditions. (accumulate_line_info): Accumulate conditions. (output_line_details): Print conditions. * gimplify.cc (next_cond_uid): New. (reset_cond_uid): New. (shortcut_cond_r): Set condition discriminator. (tag_shortcut_cond): New. (gimple_associate_condition_with_expr): New. (shortcut_cond_expr): Set condition discriminator. (gimplify_cond_expr): Likewise. (gimplify_function_tree): Call reset_cond_uid. * ipa-inline.cc (can_early_inline_edge_p): Check condition_coverage_flag. * ipa-split.cc (pass_split_functions::gate): Likewise. * passes.cc (finish_optimization_passes): Likewise. * profile.cc (struct condcov): New declaration. (cov_length): Likewise. (cov_blocks): Likewise. (cov_masks): Likewise. (cov_maps): Likewise. (cov_free): Likewise. (instrument_decisions): New. (read_thunk_profile): Control output to file. (branch_prob): Call find_conditions, instrument_decisions. (init_branch_prob): Add total_num_conds. (end_branch_prob): Likewise. * tree-core.h (struct tree_exp): Add condition_uid. * tree-profile.cc (struct conds_ctx): New. (CONDITIONS_MAX_TERMS): New. (EDGE_CONDITION): New. (topological_cmp): New. (index_of): New. (single_p): New. (single_edge): New. (contract_edge_up): New. (struct outcomes): New. (conditional_succs): New. (condition_index): New. (condition_uid): New. (masking_vectors): New. (emit_assign): New. (emit_bitwise_op): New. (make_top_index_visit): New. (make_top_index): New. (paths_between): New. (struct condcov): New. (cov_length): New. (cov_blocks): New. (cov_masks): New. (cov_maps): New. (cov_free): New. (find_conditions): New. (struct counters): New. (find_counters): New. (resolve_counter): New. (resolve_counters): New. (instrument_decisions): New. (tree_profiling): Check condition_coverage_flag. (pass_ipa_tree_profile::gate): Likewise. * tree.h (SET_EXPR_UID): New. (EXPR_COND_UID): New. libgcc/ChangeLog: * libgcov-merge.c (__gcov_merge_ior): New. gcc/testsuite/ChangeLog: * lib/gcov.exp: Add condition coverage test function. * g++.dg/gcov/gcov-18.C: New test. * gcc.misc-tests/gcov-19.c: New test. * gcc.misc-tests/gcov-20.c: New test. * gcc.misc-tests/gcov-21.c: New test. * gcc.misc-tests/gcov-22.c: New test. * gcc.misc-tests/gcov-23.c: New test.
2024-01-03Update copyright years.Jakub Jelinek1-1/+1
2023-10-24gcc: fix typo in comment in gcov-io.hJose E. Marchesi1-1/+1
gcc/ChangeLog: * gcov-io.h: Fix record length encoding in comment.
2023-01-02Update copyright years.Jakub Jelinek1-1/+1
2022-10-12gcov: rename gcov_write_summaryMartin Liska1-1/+1
gcc/ChangeLog: * gcov-io.cc (gcov_write_summary): Rename to ... (gcov_write_object_summary): ... this. * gcov-io.h (GCOV_TAG_OBJECT_SUMMARY_LENGTH): Rename from ... (GCOV_TAG_SUMMARY_LENGTH): ... this. libgcc/ChangeLog: * libgcov-driver.c: Use new function. * libgcov.h (gcov_write_summary): Rename to ... (gcov_write_object_summary): ... this.
2022-04-28gcov: Add __gcov_filename_to_gcfn()Sebastian Huber1-8/+16
gcc/ * doc/invoke.texi (fprofile-info-section): Mention __gcov_filename_to_gcfn(). Use "freestanding" to match with C11 standard language. Fix minor example code issues. * gcov-io.h (GCOV_FILENAME_MAGIC): Define and document. gcc/testsuite/ * gcc.dg/gcov-info-to-gcda.c: Test __gcov_filename_to_gcfn(). libgcc/ * gcov.h (__gcov_info_to_gcda): Mention __gcov_filename_to_gcfn(). (__gcov_filename_to_gcfn): Declare and document. * libgcov-driver.c (dump_string): New. (__gcov_filename_to_gcfn): Likewise. (__gcov_info_to_gcda): Adjust comment to match C11 standard language.
2022-04-28gcov: Make gcov_seek() staticSebastian Huber1-3/+3
This function is only used by gcov_write_length() in the gcov-io.cc file. gcc/ * gcov-io.cc (gcov_seek): Make it static. * gcov-io.h (struct gcov_summary): Do not mention gcov_seek(). libgcc/ * libgcov.h (gcov_seek): Remove define and declaration.
2022-04-28gcov: Add mode to all gcov_open()Sebastian Huber1-4/+1
gcc/ * gcov-io.cc (gcov_open): Always use the mode parameter. * gcov-io.h (gcov_open): Declare it unconditionally. libgcc/ * libgcov-driver-system.c (gcov_exit_open_gcda_file): Open file for reading and writing. * libgcov-util.c (read_gcda_file): Open file for reading. * libgcov.h (gcov_open): Delete declaration.
2022-01-03Update copyright years.Jakub Jelinek1-1/+1
2021-08-06gcov: Add __gcov_info_to_gdca()Sebastian Huber1-0/+1
Add __gcov_info_to_gcda() to libgcov to get the gcda data for a gcda info in a freestanding environment. It is intended to be used with the -fprofile-info-section option. A crude test program which doesn't use a linker script is (use "gcc -coverage -fprofile-info-section -lgcov test.c" to compile it): #include <gcov.h> #include <stdio.h> #include <stdlib.h> extern const struct gcov_info *my_info; static void filename (const char *f, void *arg) { printf("filename: %s\n", f); } static void dump (const void *d, unsigned n, void *arg) { const unsigned char *c = d; for (unsigned i = 0; i < n; ++i) printf ("%02x", c[i]); } static void * allocate (unsigned length, void *arg) { return malloc (length); } int main() { __asm__ volatile (".set my_info, .LPBX2"); __gcov_info_to_gcda (my_info, filename, dump, allocate, NULL); return 0; } With this patch, <stdint.h> is included in libgcov-driver.c even if inhibit_libc is defined. This header file should be also available for freestanding environments. If this is not the case, then we have to define intptr_t somehow. The patch removes one use of memset() which makes the <string.h> include superfluous. gcc/ * gcov-io.h (gcov_write): Declare. * gcov-io.c (gcov_write): New. (gcov_write_counter): Remove. (gcov_write_tag_length): Likewise. (gcov_write_summary): Replace gcov_write_tag_length() with calls to gcov_write_unsigned(). * doc/invoke.texi (fprofile-info-section): Mention __gcov_info_to_gdca(). gcc/testsuite/ * gcc.dg/gcov-info-to-gcda.c: New test. libgcc/ * Makefile.in (LIBGCOV_DRIVER): Add _gcov_info_to_gcda. * gcov.h (gcov_info): Declare. (__gcov_info_to_gdca): Likewise. * libgcov.h (gcov_write_counter): Remove. (gcov_write_tag_length): Likewise. * libgcov-driver.c (#include <stdint.h>): New. (#include <string.h>): Remove. (NEED_L_GCOV): Conditionally define. (NEED_L_GCOV_INFO_TO_GCDA): Likewise. (are_all_counters_zero): New. (gcov_dump_handler): Likewise. (gcov_allocate_handler): Likewise. (dump_unsigned): Likewise. (dump_counter): Likewise. (write_topn_counters): Add dump_fn, allocate_fn, and arg parameters. Use dump_unsigned() and dump_counter(). (write_one_data): Add dump_fn, allocate_fn, and arg parameters. Use dump_unsigned(), dump_counter(), and are_all_counters_zero(). (__gcov_info_to_gcda): New.
2021-06-22gcov: update comment about paddingMartin Liska1-2/+1
gcc/ChangeLog: * gcov-io.h: Remove padding entries.
2021-06-17gcov: update documentation entry about string formatMartin Liska1-4/+3
gcc/ChangeLog: * gcov-io.h: Update documentation entry about string format.
2021-05-13gcov: Use system IO bufferingmarxin1-7/+10
gcc/ChangeLog: * gcov-io.c (gcov_write_block): Remove. (gcov_write_words): Likewise. (gcov_read_words): Re-implement using gcov_read_bytes. (gcov_allocate): Remove. (GCOV_BLOCK_SIZE): Likewise. (struct gcov_var): Remove most of the fields. (gcov_position): Implement with ftell. (gcov_rewrite): Remove setting of start and offset fields. (from_file): Re-format. (gcov_open): Remove setbuf call. It should not be needed. (gcov_close): Remove internal buffer handling. (gcov_magic): Use __builtin_bswap32. (gcov_write_counter): Use directly gcov_write_unsigned. (gcov_write_string): Use direct fwrite and do not round to 4 bytes. (gcov_seek): Use directly fseek. (gcov_write_tag): Use gcov_write_unsigned directly. (gcov_write_length): Likewise. (gcov_write_tag_length): Likewise. (gcov_read_bytes): Use directly fread. (gcov_read_unsigned): Use gcov_read_words. (gcov_read_counter): Likewise. (gcov_read_string): Use gcov_read_bytes. * gcov-io.h (GCOV_WORD_SIZE): Adjust to reflect that size is not in bytes, but words (4B). (GCOV_TAG_FUNCTION_LENGTH): Likewise. (GCOV_TAG_ARCS_LENGTH): Likewise. (GCOV_TAG_ARCS_NUM): Likewise. (GCOV_TAG_COUNTER_LENGTH): Likewise. (GCOV_TAG_COUNTER_NUM): Likewise. (GCOV_TAG_SUMMARY_LENGTH): Likewise. libgcc/ChangeLog: * libgcov-driver.c: Fix GNU coding style.
2021-05-10Use genversion to generate version.h.Martin Liska1-5/+1
c++tools/ChangeLog: * Makefile.in: Include also ../gcc folder. gcc/ChangeLog: * Makefile.in: Rename gcov-iov to genversion and depend on version.h (instead of gcov-iov.h). * gcov-io.h: Include version.h instread of gcov-iov.h. * gengtype-state.c (read_state_version): Likewise. * gcov-iov.c: Moved to... * genversion.c: ...here. * lto-streamer.h (LTO_major_version): Define it with GCC_major_version. * version.c: Removed. * version.h: Removed. libgcc/ChangeLog: * libgcov-driver.c (gcov_version): Use different name that does not clash with newly introduced macro.
2021-04-29Add parallelism support to gcov for MinGW platformsEric Botcazou1-0/+6
If you attempt a profiled bootstrap on the MinGW platforms with -jN, N > 1, it miserably fails because of profile mismatches all over the place, the reason being that gcov has no support for parallelism on these platforms. libgcc/ * libgcov.h: For the target, define GCOV_LOCKED_WITH_LOCKING if __MSVCRT__ and, for the host, define it if HOST_HAS_LK_LOCK. * libgcov-driver.c: Add directives if GCOV_LOCKED_WITH_LOCKING. gcc/ * configure.ac: Check for the presence of sys/locking.h header and for whether _LK_LOCK is supported by _locking. * configure: Regenerate. * config.in: Likewise. * gcov-io.h: Define GCOV_LOCKED_WITH_LOCKING if HOST_HAS_LK_LOCK. * gcov-io.c (gcov_open): Add support for GCOV_LOCKED_WITH_LOCKING. * system.h: Include <sys/locking.h> if HAVE_SYS_LOCKING_H.
2021-03-03gcov: use mmap pools for KVP.Martin Liska1-3/+0
gcc/ChangeLog: PR gcov-profile/97461 * gcov-io.h (GCOV_PREALLOCATED_KVP): Remove. libgcc/ChangeLog: PR gcov-profile/97461 * config.in: Regenerate. * configure: Likewise. * configure.ac: Check sys/mman.h header file * libgcov-driver.c (struct gcov_kvp): Remove static pre-allocated pool and use a dynamic one. * libgcov.h (MMAP_CHUNK_SIZE): New. (gcov_counter_add): Use mmap to allocate pool for struct gcov_kvp.
2021-01-04Update copyright years.Jakub Jelinek1-1/+1
2020-10-27gcov-profile: use static pool for TOPN firstMartin Liska1-1/+1
gcc/ChangeLog: PR gcov-profile/97461 * gcov-io.h (GCOV_PREALLOCATED_KVP): Pre-allocate 64 static counters. libgcc/ChangeLog: PR gcov-profile/97461 * libgcov.h (gcov_counter_add): Use first static counters as it should help to have malloc wrappers set up. gcc/testsuite/ChangeLog: PR gcov-profile/97461 * gcc.dg/tree-prof/pr97461.c: New test.
2020-07-31libgcov: support overloaded mallocMartin Liska1-0/+3
gcc/ChangeLog: * gcov-io.h (GCOV_PREALLOCATED_KVP): New. libgcc/ChangeLog: * libgcov-driver.c: Add __gcov_kvp_pool and __gcov_kvp_pool_index variables. * libgcov.h (allocate_gcov_kvp): New. (gcov_topn_add_value): Use it. gcc/testsuite/ChangeLog: * gcc.dg/tree-prof/indir-call-prof-malloc.c: New test.
2020-06-02Make TOPN counter dynamically allocated.Martin Liska1-4/+18
gcc/ChangeLog: * coverage.c (get_coverage_counts): Skip sanity check for TOP N counters as they have variable number of counters. * gcov-dump.c (main): Add new option -r. (print_usage): Likewise. (tag_counters): All new raw format. * gcov-io.h (struct gcov_kvp): New. (GCOV_TOPN_VALUES): Remove. (GCOV_TOPN_VALUES_COUNTERS): Likewise. (GCOV_TOPN_MEM_COUNTERS): New. (GCOV_TOPN_DISK_COUNTERS): Likewise. (GCOV_TOPN_MAXIMUM_TRACKED_VALUES): Likewise. * ipa-profile.c (ipa_profile_generate_summary): Use GCOV_TOPN_MAXIMUM_TRACKED_VALUES. (ipa_profile_write_edge_summary): Likewise. (ipa_profile_read_edge_summary): Likewise. (ipa_profile): Remove usage of GCOV_TOPN_VALUES. * profile.c (sort_hist_values): Sort variable number of counters. (compute_value_histograms): Special case for TOP N counters that have dynamic number of key-value pairs. * value-prof.c (dump_histogram_value): Dump variable number of key-value pairs. (stream_in_histogram_value): Stream in variable number of key-value pairs for TOP N counter. (get_nth_most_common_value): Deal with variable number of key-value pairs. (dump_ic_profile): Use GCOV_TOPN_MAXIMUM_TRACKED_VALUES for loop iteration. (gimple_find_values_to_profile): Set GCOV_TOPN_MEM_COUNTERS to n_counters. * doc/gcov-dump.texi: Document new -r option. libgcc/ChangeLog: * libgcov-driver.c (prune_topn_counter): Remove. (prune_counters): Likewise. (merge_one_data): Special case TOP N counters as they have variable length. (write_top_counters): New. (write_one_data): Special case TOP N. (dump_one_gcov): Do not prune TOP N counters. * libgcov-merge.c (merge_topn_values_set): Remove. (__gcov_merge_topn): Use gcov_topn_add_value. * libgcov-profiler.c (__gcov_topn_values_profiler_body): Likewise here. * libgcov.h (gcov_counter_add): New. (gcov_counter_set_if_null): Likewise. (gcov_topn_add_value): New.
2020-05-28gcov-tool: Flexible endian adjustment for merging coverage dataMartin Liska1-0/+3
gcc/ChangeLog: 2020-05-27 Dong JianQiang <dongjianqiang2@huawei.com> PR gcov-profile/95332 * gcov-io.c (gcov_var::endian): Move field. (from_file): Add IN_GCOV_TOOL check. * gcov-io.h (gcov_magic): Ditto. libgcc/ChangeLog: 2020-05-27 Dong JianQiang <dongjianqiang2@huawei.com> PR gcov-profile/95332 * libgcov-util.c (read_gcda_file): Call gcov_magic. * libgcov.h (gcov_magic): Disable GCC poison.
2020-05-11Add caveat about parsing of .gcda and .gcno files.Martin Liska1-1/+7
PR gcov-profile/94928 * gcov-io.h: Add caveat about coverage format parsing and possible outdated documentation.
2020-01-01Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r279813
2019-07-03Rename SINGE_VALUE to TOPN_VALUES counters.Martin Liska1-4/+3
2019-07-03 Martin Liska <mliska@suse.cz> * gcov-counter.def (GCOV_COUNTER_V_SINGLE): Remove. (GCOV_COUNTER_V_TOPN): New. (GCOV_COUNTER_V_INDIR): Use _topn. * gcov-io.h (GCOV_DISK_SINGLE_VALUES): Remove. (GCOV_TOPN_VALUES): New. (GCOV_SINGLE_VALUE_COUNTERS): Remove. (GCOV_TOPN_VALUES_COUNTERS): New. * profile.c (instrument_values): Use HIST_TYPE_TOPN_VALUES. * tree-profile.c: (gimple_init_gcov_profiler): Rename variables from one_value to topn_values. (gimple_gen_one_value_profiler): Remove. (gimple_gen_topn_values_profiler): New function. * value-prof.c (dump_histogram_value): Use TOPN_VALUES names instead of SINGLE_VALUE. (stream_out_histogram_value): Likewise. (stream_in_histogram_value): Likewise. (get_most_common_single_value): Likewise. (gimple_divmod_fixed_value_transform): Likewise. (gimple_stringops_transform): Likewise. (gimple_divmod_values_to_profile): Likewise. (gimple_stringops_values_to_profile): Likewise. (gimple_find_values_to_profile): Likewise. * value-prof.h (enum hist_type): Rename to TOPN. (gimple_gen_one_value_profiler): Remove. (gimple_gen_topn_values_profiler): New. 2019-07-03 Martin Liska <mliska@suse.cz> * Makefile.in: Use topn_values instead of one_value names. * libgcov-merge.c (__gcov_merge_single): Move to ... (__gcov_merge_topn): ... this. (merge_single_value_set): Move to ... (merge_topn_values_set): ... this. * libgcov-profiler.c (__gcov_one_value_profiler_body): Move to ... (__gcov_topn_values_profiler_body): ... this. (__gcov_one_value_profiler_v2): Move to ... (__gcov_topn_values_profiler): ... this. (__gcov_one_value_profiler_v2_atomic): Move to ... (__gcov_topn_values_profiler_atomic): ... this. (__gcov_indirect_call_profiler_v4): Remove. * libgcov-util.c (__gcov_single_counter_op): Move to ... (__gcov_topn_counter_op): ... this. * libgcov.h (L_gcov_merge_single): Remove. (L_gcov_merge_topn): New. (__gcov_merge_single): Remove. (__gcov_merge_topn): New. (__gcov_one_value_profiler_v2): Move to .. (__gcov_topn_values_profiler): ... this. (__gcov_one_value_profiler_v2_atomic): Move to ... (__gcov_topn_values_profiler_atomic): ... this. From-SVN: r273005
2019-06-10Implement N disk counters for single value and indirect call counters.Martin Liska1-0/+7
2019-06-10 Martin Liska <mliska@suse.cz> * gcov-io.h (GCOV_DISK_SINGLE_VALUES): New. (GCOV_SINGLE_VALUE_COUNTERS): Likewise. * ipa-profile.c (ipa_profile_generate_summary): Use get_most_common_single_value. * tree-profile.c (gimple_init_gcov_profiler): Instrument with __gcov_one_value_profiler_v2 and __gcov_indirect_call_profiler_v4. * value-prof.c (dump_histogram_value): Print all values for HIST_TYPE_SINGLE_VALUE. (stream_out_histogram_value): Update assert for N values. (stream_in_histogram_value): Set number of counters for HIST_TYPE_SINGLE_VALUE. (get_most_common_single_value): New. (gimple_divmod_fixed_value_transform): Use get_most_common_single_value. (gimple_ic_transform): Likewise. (gimple_stringops_transform): Likewise. (gimple_find_values_to_profile): Set number of counters for HIST_TYPE_SINGLE_VALUE. * value-prof.h (get_most_common_single_value): New. 2019-06-10 Martin Liska <mliska@suse.cz> * Makefile.in: Add __gcov_one_value_profiler_v2, __gcov_one_value_profiler_v2_atomic and __gcov_indirect_call_profiler_v4. * libgcov-merge.c (__gcov_merge_single): Change function signature. (merge_single_value_set): New. * libgcov-profiler.c (__gcov_one_value_profiler_body): Update functionality. (__gcov_one_value_profiler): Remove. (__gcov_one_value_profiler_v2): ... this. (__gcov_one_value_profiler_atomic): Rename to ... (__gcov_one_value_profiler_v2_atomic): this. (__gcov_indirect_call_profiler_v3): Rename to ... (__gcov_indirect_call_profiler_v4): ... this. * libgcov.h (__gcov_one_value_profiler): Remove. (__gcov_one_value_profiler_atomic): Remove. (__gcov_one_value_profiler_v2_atomic): New. (__gcov_indirect_call_profiler_v3): Remove. (__gcov_one_value_profiler_v2): New. (__gcov_indirect_call_profiler_v4): New. (gcov_get_counter_ignore_scaling): New function. From-SVN: r272106
2019-06-07Remove indirect call top N counter type.Martin Liska1-6/+0
2019-06-07 Martin Liska <mliska@suse.cz> * doc/invoke.texi: Remove param. * gcov-counter.def (GCOV_COUNTER_ICALL_TOPNV): Remove. * gcov-io.h (GCOV_ICALL_TOPN_VAL): Likewise. (GCOV_ICALL_TOPN_NCOUNTS): Likewise. * params.def (PARAM_INDIR_CALL_TOPN_PROFILE): Likewise. * profile.c (instrument_values): Remove HIST_TYPE_INDIR_CALL_TOPN. * tree-profile.c (init_ic_make_global_vars): Always build __gcov_indirect_call only. (gimple_init_gcov_profiler): Remove usage of PARAM_INDIR_CALL_TOPN_PROFILE. (gimple_gen_ic_profiler): Likewise. * value-prof.c (dump_histogram_value): Likewise. (stream_in_histogram_value): Likewise. (gimple_indirect_call_to_profile): Likewise. (gimple_find_values_to_profile): Likewise. * value-prof.h (enum hist_type): Likewise. 2019-06-07 Martin Liska <mliska@suse.cz> * Makefile.in: Remove usage of _gcov_merge_icall_topn. * libgcov-driver.c (gcov_sort_n_vals): Remove. (gcov_sort_icall_topn_counter): Likewise. (gcov_sort_topn_counter_arrays): Likewise. (dump_one_gcov): Remove call to gcov_sort_topn_counter_arrays. * libgcov-merge.c (__gcov_merge_icall_topn): Remove. * libgcov-profiler.c (__gcov_topn_value_profiler_body): Likewise. (GCOV_ICALL_COUNTER_CLEAR_THRESHOLD): Remove. (struct indirect_call_tuple): Remove. (__gcov_indirect_call_topn_profiler): Remove. * libgcov-util.c (__gcov_icall_topn_counter_op): Remove. * libgcov.h (gcov_sort_n_vals): Remove. (L_gcov_merge_icall_topn): Likewise. (__gcov_merge_icall_topn): Likewise. (__gcov_indirect_call_topn_profiler): Likewise. From-SVN: r272030
2019-01-01Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r267494
2018-09-21Remove arc profile histogram in non-LTO mode.Martin Liska1-64/+7
2018-09-21 Martin Liska <mliska@suse.cz> * auto-profile.c (autofdo_source_profile::read): Do not set sum_all. (read_profile): Do not add working sets. (read_autofdo_file): Remove sum_all. (afdo_callsite_hot_enough_for_early_inline): Remove const qualifier. * coverage.c (struct counts_entry): Remove gcov_summary. (read_counts_file): Read new GCOV_TAG_OBJECT_SUMMARY, do not support GCOV_TAG_PROGRAM_SUMMARY. (get_coverage_counts): Remove summary and expected arguments. * coverage.h (get_coverage_counts): Likewise. * doc/gcov-dump.texi: Remove -w option. * gcov-dump.c (dump_working_sets): Remove. (main): Do not support '-w' option. (print_usage): Likewise. (tag_summary): Likewise. * gcov-io.c (gcov_write_summary): Do not dump histogram. (gcov_read_summary): Likewise. (gcov_histo_index): Remove. (gcov_histogram_merge): Likewise. (compute_working_sets): Likewise. * gcov-io.h (GCOV_TAG_OBJECT_SUMMARY): Mark it not obsolete. (GCOV_TAG_PROGRAM_SUMMARY): Mark it obsolete. (GCOV_TAG_SUMMARY_LENGTH): Adjust. (GCOV_HISTOGRAM_SIZE): Remove. (GCOV_HISTOGRAM_BITVECTOR_SIZE): Likewise. (struct gcov_summary): Simplify rapidly just to runs and sum_max fields. (gcov_histo_index): Remove. (NUM_GCOV_WORKING_SETS): Likewise. (compute_working_sets): Likewise. * gcov-tool.c (print_overlap_usage_message): Remove trailing empty line. * gcov.c (read_count_file): Read GCOV_TAG_OBJECT_SUMMARY. (output_lines): Remove program related line. * ipa-profile.c (ipa_profile): Do not consider GCOV histogram. * lto-cgraph.c (output_profile_summary): Do not stream GCOV histogram. (input_profile_summary): Do not read it. (merge_profile_summaries): And do not merge it. (input_symtab): Do not call removed function. * modulo-sched.c (sms_schedule): Do not print sum_max. * params.def (HOT_BB_COUNT_FRACTION): Reincarnate param that was removed when histogram method was invented. (HOT_BB_COUNT_WS_PERMILLE): Mention that it's used only in LTO mode. * postreload-gcse.c (eliminate_partially_redundant_load): Fix GCOV coding style. * predict.c (get_hot_bb_threshold): Use HOT_BB_COUNT_FRACTION and dump selected value. * profile.c (add_working_set): Remove. (get_working_sets): Likewise. (find_working_set): Likewise. (get_exec_counts): Do not work with working sets. (read_profile_edge_counts): Do not inform as sum_max is removed. (compute_branch_probabilities): Likewise. (compute_value_histograms): Remove argument for call of get_coverage_counts. * profile.h: Do not make gcov_summary const. 2018-09-21 Martin Liska <mliska@suse.cz> * libgcov-driver.c (crc32_unsigned): Remove. (gcov_histogram_insert): Likewise. (gcov_compute_histogram): Likewise. (compute_summary): Simplify rapidly. (merge_one_data): Do not handle PROGRAM_SUMMARY tag. (merge_summary): Rapidly simplify. (dump_one_gcov): Ignore gcov_summary. (gcov_do_dump): Do not handle program summary, it's not used. * libgcov-util.c (tag_summary): Remove. (read_gcda_finalize): Fix coding style. (read_gcda_file): Initialize curr_object_summary. (compute_summary): Remove. (calculate_overlap): Remove settings of run_max. From-SVN: r264462
2018-06-29When using -fprofile-generate=/some/path mangle absolute path of file (PR ↵Martin Liska1-0/+1
lto/85759). 2018-06-29 Martin Liska <mliska@suse.cz> PR lto/85759 * coverage.c (coverage_init): Mangle full path name. * doc/invoke.texi: Document the change. * gcov-io.c (mangle_path): New. * gcov-io.h (mangle_path): Likewise. * gcov.c (mangle_name): Use mangle_path for path mangling. From-SVN: r262251
2018-06-05Simplify gcov_histogram as it's used only for ARCS counters.Martin Liska1-24/+14
2018-06-05 Martin Liska <mliska@suse.cz> * auto-profile.c (read_autofdo_file): Do not use gcov_ctr_summary struct. (afdo_callsite_hot_enough_for_early_inline): Likewise. * coverage.c (struct counts_entry): Likewise. (read_counts_file): Read just single summary entry. (get_coverage_counts): Use gcov_summary struct. * coverage.h (get_coverage_counts): Likewise. * gcov-dump.c (dump_working_sets): Likewise. (tag_summary): Dump just single summary. * gcov-io.c (gcov_write_summary): Write just histogram summary. (gcov_read_summary): Read just single summary. (compute_working_sets): Use gcov_summary struct. * gcov-io.h (GCOV_TAG_SUMMARY_LENGTH): Remove usage of GCOV_COUNTERS_SUMMABLE. (GCOV_COUNTERS_SUMMABLE): Remove. (GCOV_FIRST_VALUE_COUNTER): Replace with GCOV_COUNTER_V_INTERVAL. (struct gcov_ctr_summary): Remove. (struct gcov_summary): Directly use fields of former gcov_ctr_summary. (compute_working_sets): Use gcov_summary struct. * gcov.c (read_count_file): Do not use ctrs fields. * lto-cgraph.c (merge_profile_summaries): Use gcov_summary struct. * lto-streamer.h (struct GTY): Make profile_info gcov_summary struct. * profile.c: Likewise. * profile.h: Likewise. 2018-06-05 Martin Liska <mliska@suse.cz> * libgcov-driver.c (gcov_compute_histogram): Remove usage of gcov_ctr_summary. (compute_summary): Do it just for a single summary. (merge_one_data): Likewise. (merge_summary): Simplify as we read just single summary. (dump_one_gcov): Pass proper argument. * libgcov-util.c (compute_one_gcov): Simplify as we have just single summary. (gcov_info_count_all_cold): Likewise. (calculate_overlap): Likewise. From-SVN: r261189
2018-03-08Document gcov-io (PR gcov-profile/84735).Martin Liska1-2/+6
2018-03-08 Martin Liska <mliska@suse.cz> PR gcov-profile/84735 * doc/gcov.texi: Document usage of profile files. * gcov-io.h: Document changes in the format. From-SVN: r258360
2018-01-03Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r256169
2017-06-05invoke.texi: Document the -fprofile-abs-path option.Bernd Edlinger1-0/+1
2017-06-05 Bernd Edlinger <bernd.edlinger@hotmail.de> * doc/invoke.texi: Document the -fprofile-abs-path option. * common.opt (fprofile-abs-path): New option. * gcov-io.h (gcov_write_filename): Declare. * gcov-io.c (gcov_write_filename): New function. * coverage.c (coverage_begin_function): Use gcov_write_filename. * profile.c (output_location): Likewise. gcc/testsuite: 2017-06-05 Bernd Edlinger <bernd.edlinger@hotmail.de> * gcc.misc-tests/gcov-1a.c: New test. From-SVN: r248894
2017-04-28gcno file: do not stream block flags (PR gcov-profile/80031).Martin Liska1-1/+0
2017-04-28 Martin Liska <mliska@suse.cz> PR gcov-profile/80031 * gcov-dump.c (tag_blocks): Just print number of basic blocks. * gcov-io.h (GCOV_TAG_BLOCKS_NUM): Remove unused macro. * gcov.c (read_graph_file): Read just number of blocks. * profile.c (branch_prob): Do not stream 0 flags per a basic block. From-SVN: r247370
2017-01-01Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r243994
2016-08-17Do not use LONG_LONG_TYPE_SIZE in #if macro conditionMartin Liska1-10/+0
* coverage.c (get_gcov_type): Replace GCOV_TYPE_SIZE with a LONG_LONG_TYPE_SIZE comparison. * gcov-io.h: Remove macro definitions. * tree-profile.c (gimple_gen_edge_profiler): Replace usage of GCOV_TYPE_ATOMIC_FETCH_ADD with a LONG_LONG_TYPE_SIZE comparison. From-SVN: r239522
2016-08-10Cherry-pick fprofile-generate-atomic from google/gcc-4_9Martin Liska1-0/+8
Cherry picked (and modified) from google-4_7 branch 2012-12-26 Rong Xu <xur@google.com> * common.opt (fprofile-update): Add new flag. * coretypes.h: Define enum profile_update. * doc/invoke.texi: Document -fprofile-update. * gcov-io.h: Declare GCOV_TYPE_ATOMIC_FETCH_ADD and GCOV_TYPE_ATOMIC_FETCH_ADD_FN. * tree-profile.c (gimple_init_edge_profiler): Generate also atomic profiler update. (gimple_gen_edge_profiler): Likewise. * g++.dg/gcov/gcov-threads-1.C: New test. From-SVN: r239323
2016-07-25Adapt the numbering scheme (PR gcov-profile/64874)Martin Liska1-9/+9
PR gcov-profile/64874 * gcov-io.h: Update command about file format. * gcov-iov.c (main): Adapt the numbering scheme. From-SVN: r238702
2016-01-04Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r232055
2015-01-30Always pass explicit location to fatal_error.Joseph Myers1-1/+1
The patch <https://gcc.gnu.org/ml/gcc-patches/2014-11/msg00698.html> adding an overload for fatal_error that passes an explicit location broke gcc.pot regeneration because xgettext cannot handle function overloads with the diagnostic string argument in different positions. As the desired direction is for all diagnostics to have explicit locations, this patch addresses the regression by removing the version of fatal_error that does not pass a location, passing explicit input_location everywhere (in the hope that those will incrementally be changed to other locations, much as with the addition of a location argument to pedwarn some time ago - a lot of cases aren't meaningfully associated with a source file so UNKNOWN_LOCATION may be better). Note that this patch does not attempt to fix any existing issues with these diagnostics (such as wrongly starting with capital letters or ending with '.' or '\n'); it just adds the input_location argument. Bootstrapped with no regressions for x86_64-unknown-linux-gnu (Go excluded). gcc: * diagnostic.c (fatal_error (const char *, ...)): Remove function. * diagnostic-core.h (fatal_error (const char *, ...)): Remove prototype. * toplev.h (init_asm_output): Update comment on use of UNKNOWN_LOCATION with fatal_error. * cgraph.c, collect-utils.c, collect2.c, config/arc/arc.c, config/arc/arc.md, config/avr/avr.c, config/c6x/c6x.h, config/darwin.c, config/host-darwin.c, config/i386/host-cygwin.c, config/i386/intelmic-mkoffload.c, config/nios2/nios2.c, config/nvptx/mkoffload.c, config/nvptx/nvptx.h, config/rs6000/host-darwin.c, config/rs6000/rs6000.c, config/s390/s390.c, gcc.c, gcov-io.h, gcov-tool.c, ggc-common.c, ggc-page.c, graph.c, ipa-inline-analysis.c, ipa-reference.c, lto-cgraph.c, lto-section-in.c, lto-streamer-in.c, lto-streamer.c, lto-wrapper.c, objc/objc-act.c, opts.c, passes.c, plugin.c, tlink.c, toplev.c, tree-streamer-in.c, varpool.c: All callers of fatal_error changed to pass input_location as first argument. gcc/c-family: * c-opts.c, c-pch.c, cppspec.c: All callers of fatal_error changed to pass input_location as first argument. gcc/cp: * class.c, except.c, parser.c, pt.c: All callers of fatal_error changed to pass input_location as first argument. gcc/fortran: * f95-lang.c, gfortranspec.c, trans-const.c, trans-expr.c: All callers of fatal_error changed to pass input_location as first argument. gcc/java: * class.c, expr.c, jcf-parse.c, jvspec.c: All callers of fatal_error changed to pass input_location as first argument. gcc/lto: * lto-object.c, lto-symtab.c, lto.c: All callers of fatal_error changed to pass input_location as first argument. libcc1: * plugin.cc: All callers of fatal_error changed to pass input_location as first argument. From-SVN: r220293
2015-01-05Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r219188
2014-10-21Add AutoFDO.Dehao Chen1-0/+3
gcc/ChangeLog: 2014-10-21 Dehao Chen <dehao@google.com> * auto-profile.c: New file. * auto-profile.h: New file. * basic-block.h (maybe_hot_count_p): New export func. (add_working_set): New export func. * gcov-io.h (GCOV_TAG_AFDO_FILE_NAMES): New tag. (GCOV_TAG_AFDO_FUNCTION): Likewise. (GCOV_TAG_AFDO_WORKING_SET): Likewise. * opts.c (enable_fdo_optimizations): New func. (common_handle_option): Handle -fauto-profile flag. * ipa-inline.c (want_early_inline_function_p): Iterative-einline. (class pass_early_inline): Export early_inliner. (early_inliner): Likewise. (pass_early_inline::execute): Likewise. * ipa-inline.h (early_inliner): Likewise. * predict.c (maybe_hot_count_p): New export func. (counts_to_freqs): AutoFDO logic. (rebuild_frequencies): Likewise. * tree-profile.c (pass_ipa_tree_profile::gate): Likewise. * profile.c (add_working_set): New func. * Makefile.in (auto-profile.o): New object file. * passes.def (pass_ipa_auto_profile): New pass. * tree-ssa-live.c (remove_unused_scope_block_p): AutoFDO logic. * tree-pass.h (make_pass_ipa_auto_profile): New pass. * toplev.c (compile_file): AutoFDO logic. * doc/invoke.texi (-fauto-profile): New doc. * coverage.c (coverage_init): AutoFDO logic. * common.opt (-fauto-profile): New flag. * timevar.def (TV_IPA_AUTOFDO): New tag. * value-prof.c (gimple_alloc_histogram_value): New export func. (check_ic_target): Likewise. * value-prof.h (gimple_alloc_histogram_value): Likewise. (check_ic_target): Likewise. From-SVN: r216523
2014-10-07Makefile.in: Fix dependence.Rong Xu1-0/+6
2014-10-06 Rong Xu <xur@google.com> * gcc/Makefile.in: Fix dependence. * gcc/gcov-counter.def (GCOV_COUNTER_ICALL_TOPNV): Add indirect call topn profiler. * gcc/gcov-io.h: Ditto. * libgcc/Makefile.in: Ditto. * libgcc/libgcov-driver.c (gcov_sort_n_vals): New utility function. (gcov_sort_icall_topn_counter): Ditto. (gcov_sort_topn_counter_arrays): Ditto. (dump_one_gcov): Sort indirect_call topn counters. * libgcc/libgcov-merge.c (__gcov_merge_icall_topn): New merge function. * libgcc/libgcov-profiler.c (__gcov_topn_value_profiler_body): New utility function. (__gcov_indirect_call_topn_profiler): New profiler function. * libgcc/libgcov-util.c (__gcov_icall_topn_counter_op): New. * libgcc/libgcov.h: New decls. From-SVN: r215962
2014-07-11Add gcov-tool: an offline gcda profile processing tool Support.Rong Xu1-39/+18
2014-07-10 Rong Xu <xur@google.com> Add gcov-tool: an offline gcda profile processing tool Support. * gcc/gcov-io.c (gcov_position): Make avaialble to gcov-tool. (gcov_is_error): Ditto. (gcov_read_string): Ditto. (gcov_read_sync): Ditto. * gcc/gcov-io.h: Move counter defines to gcov-counter.def. * gcc/gcov-dump.c (tag_counters): Use gcov-counter.def. * gcc/coverage.c: Ditto. * gcc/gcov-tool.c: Offline gcda profile processing tool. (unlink_gcda_file): Remove one gcda file. (unlink_profile_dir): Remove gcda files from the profile path. (gcov_output_files): Output gcda files to an output dir. (profile_merge): Merge two profiles in directory. (print_merge_usage_message): Print merge usage. (merge_usage): Print merge usage and exit. (do_merge): Driver for profile merge sub-command. (profile_rewrite): Rewrite profile. (print_rewrite_usage_message): Print rewrite usage. (rewrite_usage): Print rewrite usage and exit. (do_rewrite): Driver for profile rewrite sub-command. (print_usage): Print gcov-info usage and exit. (print_version): Print gcov-info version. (process_args): Process arguments. (main): Main routine for gcov-tool. * gcc/Makefile.in: Build and install gcov-tool. * gcc/gcov-counter.def: New file split from gcov-io.h. * libgcc/libgcov-driver.c (gcov_max_filename): Make available to gcov-tool. * libgcc/libgcov-merge.c (__gcov_merge_add): Replace gcov_read_counter() with a Macro. (__gcov_merge_ior): Ditto. (__gcov_merge_time_profile): Ditto. (__gcov_merge_single): Ditto. (__gcov_merge_delta): Ditto. * libgcc/libgcov-util.c (void gcov_set_verbose): Set the verbose flag in the utility functions. (set_fn_ctrs): Utility function for reading gcda files to in-memory gcov_list object link lists. (tag_function): Ditto. (tag_blocks): Ditto. (tag_arcs): Ditto. (tag_lines): Ditto. (tag_counters): Ditto. (tag_summary): Ditto. (read_gcda_finalize): Ditto. (read_gcda_file): Ditto. (ftw_read_file): Ditto. (read_profile_dir_init): Ditto. (gcov_read_profile_dir): Ditto. (gcov_read_counter_mem): Ditto. (gcov_get_merge_weight): Ditto. (merge_wrapper): A wrapper function that calls merging handler. (gcov_merge): Merge two gcov_info objects with weights. (find_match_gcov_info): Find the matched gcov_info in the list. (gcov_profile_merge): Merge two gcov_info object lists. (__gcov_add_counter_op): Process edge profile counter values. (__gcov_ior_counter_op): Process IOR profile counter values. (__gcov_delta_counter_op): Process delta profile counter values. (__gcov_single_counter_op): Process single profile counter values. (fp_scale): Callback function for float-point scaling. (int_scale): Callback function for integer fraction scaling. (gcov_profile_scale): Scaling profile counters. (gcov_profile_normalize): Normalize profile counters. * libgcc/libgcov.h: Add headers and functions for gcov-tool use. (gcov_get_counter): New. (gcov_get_counter_target): Ditto. (struct gcov_info): Make the functions field mutable in gcov-tool compilation. * gcc/doc/gcc.texi: Include gcov-tool.texi. * gcc/doc/gcov-tool.texi: Document for gcov-tool. From-SVN: r212448
2014-05-26system.h: Define __STDC_FORMAT_MACROS before including inttypes.h.Richard Biener1-2/+2
2014-05-23 Richard Biener <rguenther@suse.de> * system.h: Define __STDC_FORMAT_MACROS before including inttypes.h. * hwint.h (HOST_WIDEST_INT, HOST_BITS_PER_WIDEST_INT, HOST_WIDEST_INT_PRINT, HOST_WIDEST_INT_PRINT_DEC, HOST_WIDEST_INT_PRINT_DEC_C, HOST_WIDEST_INT_PRINT_UNSIGNED, HOST_WIDEST_INT_PRINT_HEX, HOST_WIDEST_INT_PRINT_DOUBLE_HEX, HOST_WIDEST_INT_C): Remove. (PRId64, PRIi64, PRIo64, PRIu64, PRIx64, PRIX64): Define if C99 inttypes.h is not available. * coretypes.h (gcov_type, gcov_type_unsigned): Use [u]int64_t. * gcov-io.h (gcov_type, gcov_type_unsigned): Likewise. * gcov-io.c (gcov_histo_index): Drop non-64bit hwi case. * cfgloop.h (struct niter_desc): Use uint64_t for niter field. * bitmap.c (struct bitmap_descriptor_d): Use uint64_t for counters. (struct output_info): Likewise. (print_statistics): Adjust. (dump_bitmap_statistics): Likewise. * bt-load.c (migrate_btr_defs): Print with PRId64. * cfg.c (dump_edge_info, dump_bb_info): Likewise. (MAX_SAFE_MULTIPLIER): Adjust. * cfghooks.c (dump_bb_for_graph): Print with PRId64. * cgraph.c (cgraph_redirect_edge_call_stmt_to_callee, dump_cgraph_node): Likewise. * final.c (dump_basic_block_info): Likewise. * gcov-dump.c (tag_counters, tag_summary, dump_working_sets): Likewise. * gcov.c (format_gcov): Likewise. * ipa-cp.c (good_cloning_opportunity_p): Likewise. Use int64_t for calculation. (get_clone_agg_value): Use HOST_WIDE_INT for offset. * ipa-inline.c (compute_max_insns): Use int64_t for calcuation. (inline_small_functions, dump_overall_stats, dump_inline_stats): Use PRId64 for dumping. * ipa-profile.c (dump_histogram, ipa_profile): Likewise. * ira-color.c (struct allocno_hard_regs): Use int64_t for cost. (add_allocno_hard_regs): Adjust. * loop-doloop.c (doloop_modify): Print using PRId64. * loop-iv.c (inverse): Compute in uint64_t. (determine_max_iter, iv_number_of_iterations): Likewise. * loop-unroll.c (decide_peel_completely, decide_peel_simple): Print using PRId64. * lto-streamer-out.c (write_symbol): Use uint64_t. * mcf.c (CAP_INFINITY): Use int64_t maximum. (dump_fixup_edge, create_fixup_graph, cancel_negative_cycle, find_max_flow, adjust_cfg_counts): Use int64_t and dump with PRId64. * modulo-sched.c (const_iteration_count): Use int64_t. (sms_schedule): Dump using PRId64. * predict.c (dump_prediction): Likewise. * pretty-print.h (pp_widest_integer): Remove. * profile.c (get_working_sets, is_edge_inconsistent, is_inconsistent, read_profile_edge_counts): Dump using PRId64. * tree-pretty-print.c (pp_double_int): Remove case handling HOST_BITS_PER_DOUBLE_INT == HOST_BITS_PER_WIDEST_INT. * tree-ssa-math-opts.c (struct symbolic_number): Use uint64_t and adjust users. (pass_optimize_bswap::execute): Remove restriction on hosts. * tree-streamer-in.c (streamer_alloc_tree): Use HOST_WIDE_INT. * tree-streamer-out.c (streamer_write_tree_header): Likewise. * tree.c (widest_int_cst_value): Remove. * tree.h (widest_int_cst_value): Likewise. * value-prof.c (dump_histogram_value): Print using PRId64. * gengtype.c (main): Also inject int64_t. * ggc-page.c (struct max_alignment): Use int64_t. * alloc-pool.c (struct allocation_object_def): Likewise. * ira-conflicts.c (build_conflict_bit_table): Use uint64_t for computation. * doc/tm.texi.in: Remove reference to HOST_WIDEST_INT. * doc/tm.texi: Regenerated. * gengtype-lex.l (IWORD): Handle [u]int64_t. * config/sh/sh.c (expand_cbranchdi4): Use gcov_type. * config/mmix/mmix-protos.h (mmix_intval, mmix_shiftable_wyde_value, mmix_output_register_setting): Use [u]int64_t in prototypes. * config/mmix/mmix.c (mmix_print_operand, mmix_output_register_setting, mmix_shiftable_wyde_value, mmix_output_shiftvalue_op_from_str, mmix_output_octa, mmix_output_shifted_value): Adjust. (mmix_intval): Adjust. Remove unreachable case. * config/mmix/mmix.md (*nonlocal_goto_receiver_expanded): Use int64_t. lto/ * lto.c (lto_parse_hex): Use int64_t. (lto_resolution_read): Likewise. From-SVN: r210931
2014-05-22gcov-io.c (gcov_position): Use gcov_nonruntime_assert.Teresa Johnson1-0/+7
2014-05-22 Teresa Johnson <tejohnson@google.com> * gcov-io.c (gcov_position): Use gcov_nonruntime_assert. (gcov_is_error): Remove gcc_assert from IN_LIBGCOV code. (gcov_rewrite): Use gcov_nonruntime_assert. (gcov_open): Ditto. (gcov_write_words): Ditto. (gcov_write_length): Ditto. (gcov_read_words): Use gcov_nonruntime_assert, and remove gcc_assert from IN_LIBGCOV code. (gcov_read_summary): Use gcov_error to flag profile corruption. (gcov_sync): Use gcov_nonruntime_assert. (gcov_seek): Remove gcc_assert from IN_LIBGCOV code. (gcov_histo_index): Use gcov_nonruntime_assert. (static void gcov_histogram_merge): Ditto. (compute_working_sets): Ditto. * gcov-io.h (gcov_nonruntime_assert): Define. (gcov_error): Define for !IN_LIBGCOV * libgcov-driver.c (gcov_error): Move declaration before gcov-io.c include. From-SVN: r210805
2014-01-08gcov-io.c (gcov_var): Move from gcov-io.h.Rong Xu1-263/+7
2014-01-08 Rong Xu <xur@google.com> * gcc/gcov-io.c (gcov_var): Move from gcov-io.h. (gcov_position): Ditto. (gcov_is_error): Ditto. (gcov_rewrite): Ditto. * gcc/gcov-io.h: Refactor. Move gcov_var to gcov-io.h, and libgcov only part to libgcc/libgcov.h. * libgcc/libgcov-driver.c: Use libgcov.h. (buffer_fn_data): Use xmalloc instead of malloc. (gcov_exit_merge_gcda): Ditto. * libgcc/libgcov-driver-system.c (allocate_filename_struct): Ditto. * libgcc/libgcov.h: New common header files for libgcov-*.h. * libgcc/libgcov-interface.c: Use libgcov.h * libgcc/libgcov-merge.c: Ditto. * libgcc/libgcov-profiler.c: Ditto. * libgcc/Makefile.in: Add dependence to libgcov.h From-SVN: r206435
2014-01-02Update copyright years in gcc/Richard Sandiford1-1/+1
From-SVN: r206289
2013-12-10Put back typedef for gcov_working_set_t/gcov_bucket_typeH.J. Lu1-4/+4
* basic-block.h (gcov_working_set_t): Put back typedef. * gcov-io.h (gcov_bucket_type): Likewise. (gcov_working_set_info, gcov_working_set_t): Likewise. From-SVN: r205866
2013-12-10cgraph.h (cgraph_node_set_iterator, [...]): Remove typedef.Oleg Endo1-4/+4
* gcc/cgraph.h (cgraph_node_set_iterator, varpool_node_set_iterator): Remove typedef. (cgraph_inline_failed_enum, cgraph_inline_failed_t): Remove typedef and rename to cgraph_inline_failed_t. * gcc/tree-ssa-alias.h (ao_ref_s, ao_ref): Remove typedef and rename to ao_ref. * gcc/reload.h (reg_equivs_s, reg_equivs_t): Remove typedef and rename to reg_equivs_t. * gcc/conditions.h (CC_STATUS): Remove typedef. * gcc/bitmap.h (bitmap_obstack): Remove typedef. (bitmap_element_def, bitmap_element): Remove typedef and rename to bitmap_element. (bitmap_head_def, bitmap_head): Remove typedef and rename to bitmap_head. (bitmap_iterator): Remove typedef. * gcc/target.h (cumulative_args_t, print_switch_type, secondary_reload_info): Remove typedef. * gcc/dwarf2out.h (dw_cfi_oprnd_struct, dw_cfi_oprnd): Remove dw_cfi_oprnd_struct alias. (dw_cfi_struct, dw_cfi_node): Remove typedef and rename to dw_cfi_node. (dw_fde_struct, dw_fde_node): Remove typedef and rename to dw_fde_node. (cfa_loc, dw_cfa_location): Remove typedef and rename to dw_cfa_location. (dw_vec_struct, dw_vec_const): Remove typedef and rename to dw_vec_const. (dw_val_struct, dw_val_node): Remove typedef and rename to dw_val_node. (dw_loc_descr_struct, dw_loc_descr_node): Remove typedef and rename to dw_loc_descr_node. * gcc/params.h (param_info, compiler_param): Remove typedef. * gcc/opts.h (cl_deferred_param): Remove typedef. * gcc/sreal.h (sreal): Remove typedef. * gcc/ddg.h (dep_type, dep_data_type): Remove typedef. * gcc/graphite-clast-to-gimple.h (cloog_prog_clast, bb_pbb_def): Remove typedef. * gcc/lto-streamer.h (lto_decl_stream_e_t, lto_encoder_entry, lto_symtab_encoder_iterator, res_pair): Remove typedef. * gcc/tree-affine.h (affine_tree_combination, aff_tree): Remove typedef and rename to aff_tree. * gcc/sched-int.h (region): Remove typedef. * gcc/diagnostic.h (diagnostic_info, diagnostic_classification_change_t): Remove typedef. * gcc/tree-ssa-loop.h (affine_iv_d): Remove typedef and rename to affine_iv. * gcc/sbitmap.h (sbitmap_iterator): Remove typedef. * gcc/ssa-iterators.h (immediate_use_iterator_d, imm_use_iterator): Remove typedef and rename to imm_use_iterator. (ssa_operand_iterator_d, ssa_op_iter): Remove typedef and rename to ssa_op_iter. * gcc/ggc-internal.h (ggc_statistics): Remove typedef. * gcc/cselib.h (cselib_val_struct, cselib_val): Remove typedef and rename to cselib_val. * gcc/tree-core.h (alias_pair): Remove typedef. (constructor_elt_d, constructor_elt): Remove typedef and rename to constructor_elt. (ssa_use_operand_d, ssa_use_operand_t): Remove typedef and rename to ssa_use_operand_t. * gcc/graphite-sese-to-poly.h (base_alias_pair): Remove typedef. * gcc/tree-data-ref.h (conflict_function): Remove typedef. * gcc/tree-inline.h (copy_body_data): Remove typedef. * gcc/ipa-inline.h (condition, size_time_entry, inline_param_summary_t, edge_growth_cache_entry): Remove typedef. * gcc/regrename.h (operand_rr_info, insn_rr_info): Remove typedef. * gcc/gimple-iterator.h (gimple_stmt_iterator_d, gimple_stmt_iterator): Remove typedef and rename to gimple_stmt_iterator. * gcc/basic-block.h (ce_if_block, ce_if_block_t): Remove typedef and rename to ce_if_block. (edge_iterator): Remove typedef. * gcc/ipa-prop.h (ipa_agg_jf_item, ipa_agg_jf_item_t): Remove typedef and rename to ipa_agg_jf_item. (ipa_agg_jump_function_t, ipa_param_descriptor_t, ipa_node_params_t, ipa_parm_adjustment_t): Remove typedef. (ipa_jump_func, ipa_jump_func_t): Remove typedef and rename to ipa_jump_func. (ipa_edge_args, ipa_edge_args_t): Remove typedef and rename to ipa_edge_args. * gcc/gcov-io.h (gcov_bucket_type): Remove typedef. (gcov_working_set_info, gcov_working_set_t): Remove typedef and rename to gcov_working_set_t. * gcc/ira-int.h (minmax_set_iterator, ira_allocno_iterator, ira_object_iterator, ira_allocno_object_iterator, ira_pref_iterator, ira_copy_iterator, ira_object_conflict_iterator): Remove typedef. * gcc/tree-iterator.h (tree_stmt_iterator): Remove typedef. * gcc/rtl.h (addr_diff_vec_flags, mem_attrs, reg_attrs, replace_label_data): Remove typedef. (rtunion_def, rtunion): Remove typedef and rename to rtunion. * gcc/hard-reg-set.h (hard_reg_set_iterator): Remove typedef. * gcc/sel-sched-ir.h (_list_iterator, sel_global_bb_info_def, sel_region_bb_info_def, succ_iterator): Remove typedef. (deps_where_def, deps_where_t): Remove typedef and rename to deps_where_t. * gcc/coretypes.h: Adapt forward declarations. * gcc/tree-scalar-evolution.h: Likewise. * gcc/tree-ssa-address.h: Likewise. * gcc/tree-ssa-operands.h: Likewise. * gcc/function.h: Likewise. * gcc/config/frv/frv-protos.h: Likewise. * gcc/targhooks.h: Likewise. * gcc/basic_block.h: Likewise. * gcc/rtl.def: Adapt documentation. * gcc/doc/tm.texi: Likewise. * gcc/ipa-cp.c: Adapt uses. * gcc/bitmap.c: Likewise. * gcc/dwarf2out.c: Likewise. * gcc/target.def: Likewise. * gcc/ipa-inline-analysis.c: Likewise. * gcc/dwarf2cfi.c: Likewise. * gcc/tree-ssa-loop-ivopts.c: Likewise. * gcc/lto-cgraph.c: Likewise. * gcc/config/frv/frv.c: Likewise. * gcc/ifcvt.c: Likewise. * gcc/ipa-prop.c: Likewise. From-SVN: r205863