diff mbox series

Record edge true/false value for gcov

Message ID 20240604122602.1516309-1-j@lambda.is
State New
Headers show
Series Record edge true/false value for gcov | expand

Commit Message

Jørgen Kvalsvik June 4, 2024, 12:26 p.m. UTC
Make gcov aware which edges are the true/false to more accurately
reconstruct the CFG.  There are plenty of bits left in arc_info and it
opens up for richer reporting.

gcc/ChangeLog:

	* gcov-io.h (GCOV_ARC_TRUE): New.
	(GCOV_ARC_FALSE): New.
	* gcov.cc (struct arc_info): Add true_value, false_value.
	(read_graph_file): Read true_value, false_value.
---
 gcc/gcov-io.h | 2 ++
 gcc/gcov.cc   | 8 ++++++++
 2 files changed, 10 insertions(+)

Comments

Jeff Law June 5, 2024, 2:38 p.m. UTC | #1
On 6/4/24 6:26 AM, Jørgen Kvalsvik wrote:
> Make gcov aware which edges are the true/false to more accurately
> reconstruct the CFG.  There are plenty of bits left in arc_info and it
> opens up for richer reporting.
> 
> gcc/ChangeLog:
> 
> 	* gcov-io.h (GCOV_ARC_TRUE): New.
> 	(GCOV_ARC_FALSE): New.
> 	* gcov.cc (struct arc_info): Add true_value, false_value.
> 	(read_graph_file): Read true_value, false_value.
Going to trust you'll find this useful in the near future :-)  So OK for 
the trunk.

jeff
diff mbox series

Patch

diff --git a/gcc/gcov-io.h b/gcc/gcov-io.h
index 20f805598f0..5dc467c92b1 100644
--- a/gcc/gcov-io.h
+++ b/gcc/gcov-io.h
@@ -337,6 +337,8 @@  GCOV_COUNTERS
 #define GCOV_ARC_ON_TREE 	(1 << 0)
 #define GCOV_ARC_FAKE		(1 << 1)
 #define GCOV_ARC_FALLTHROUGH	(1 << 2)
+#define GCOV_ARC_TRUE		(1 << 3)
+#define GCOV_ARC_FALSE		(1 << 4)
 
 /* Object & program summary record.  */
 
diff --git a/gcc/gcov.cc b/gcc/gcov.cc
index 0d4ef14e6c9..b800c9bc939 100644
--- a/gcc/gcov.cc
+++ b/gcc/gcov.cc
@@ -117,6 +117,12 @@  struct arc_info
   /* Loop making arc.  */
   unsigned int cycle : 1;
 
+  /* Is a true arc.  */
+  unsigned int true_value : 1;
+
+  /* Is a false arc.  */
+  unsigned int false_value : 1;
+
   /* Links to next arc on src and dst lists.  */
   struct arc_info *succ_next;
   struct arc_info *pred_next;
@@ -2010,6 +2016,8 @@  read_graph_file (void)
 	      arc->on_tree = !!(flags & GCOV_ARC_ON_TREE);
 	      arc->fake = !!(flags & GCOV_ARC_FAKE);
 	      arc->fall_through = !!(flags & GCOV_ARC_FALLTHROUGH);
+	      arc->true_value = !!(flags & GCOV_ARC_TRUE);
+	      arc->false_value = !!(flags & GCOV_ARC_FALSE);
 
 	      arc->succ_next = src_blk->succ;
 	      src_blk->succ = arc;