profile.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /* Header file for minimum-cost maximal flow routines used to smooth basic
  2. block and edge frequency counts.
  3. Copyright (C) 2008-2019 Free Software Foundation, Inc.
  4. Contributed by Paul Yuan (yingbo.com@gmail.com)
  5. and Vinodha Ramasamy (vinodha@google.com).
  6. This file is part of GCC.
  7. GCC is free software; you can redistribute it and/or modify it under
  8. the terms of the GNU General Public License as published by the Free
  9. Software Foundation; either version 3, or (at your option) any later
  10. version.
  11. GCC is distributed in the hope that it will be useful, but WITHOUT ANY
  12. WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  14. for more details.
  15. You should have received a copy of the GNU General Public License
  16. along with GCC; see the file COPYING3. If not see
  17. <http://www.gnu.org/licenses/>. */
  18. #ifndef PROFILE_H
  19. #define PROFILE_H
  20. /* Additional information about edges. */
  21. struct edge_profile_info
  22. {
  23. unsigned int count_valid:1;
  24. /* Is on the spanning tree. */
  25. unsigned int on_tree:1;
  26. /* Pretend this edge does not exist (it is abnormal and we've
  27. inserted a fake to compensate). */
  28. unsigned int ignore:1;
  29. };
  30. #define EDGE_INFO(e) ((struct edge_profile_info *) (e)->aux)
  31. /* Helpers annotating edges/basic blocks to GCOV counts. */
  32. extern vec<gcov_type> bb_gcov_counts;
  33. extern hash_map<edge,gcov_type> *edge_gcov_counts;
  34. inline gcov_type &
  35. edge_gcov_count (edge e)
  36. {
  37. bool existed;
  38. gcov_type &c = edge_gcov_counts->get_or_insert (e, &existed);
  39. if (!existed)
  40. c = 0;
  41. return c;
  42. }
  43. inline gcov_type &
  44. bb_gcov_count (basic_block bb)
  45. {
  46. return bb_gcov_counts[bb->index];
  47. }
  48. typedef struct gcov_working_set_info gcov_working_set_t;
  49. extern gcov_working_set_t *find_working_set (unsigned pct_times_10);
  50. extern void add_working_set (gcov_working_set_t *);
  51. /* Smoothes the initial assigned basic block and edge counts using
  52. a minimum cost flow algorithm. */
  53. extern void mcf_smooth_cfg (void);
  54. extern gcov_type sum_edge_counts (vec<edge, va_gc> *edges);
  55. extern void init_node_map (bool);
  56. extern void del_node_map (void);
  57. extern void get_working_sets (void);
  58. /* Counter summary from the last set of coverage counts read by
  59. profile.c. */
  60. extern struct gcov_summary *profile_info;
  61. #endif /* PROFILE_H */