]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/basic-block.h
Correct a function pre/postcondition [PR102403].
[thirdparty/gcc.git] / gcc / basic-block.h
index c0c47784c02448b177acca538404d0493825b32e..0fdabf067b7e6a2efc6a64e949167c08dc962ffa 100644 (file)
@@ -1,5 +1,5 @@
 /* Define control flow data structures for the CFG.
-   Copyright (C) 1987-2017 Free Software Foundation, Inc.
+   Copyright (C) 1987-2021 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -23,7 +23,8 @@ along with GCC; see the file COPYING3.  If not see
 #include <profile-count.h>
 
 /* Control flow edge information.  */
-struct GTY((user)) edge_def {
+class GTY((user)) edge_def {
+public:
   /* The two blocks at the ends of the edge.  */
   basic_block src;
   basic_block dest;
@@ -46,8 +47,9 @@ struct GTY((user)) edge_def {
 
   int flags;                   /* see cfg-flags.def */
   profile_probability probability;
-  profile_count count;         /* Expected number of executions calculated
-                                  in profile.c  */
+
+  /* Return count of edge E.  */
+  inline profile_count count () const;
 };
 
 /* Masks for edge.flags.  */
@@ -121,7 +123,7 @@ struct GTY((chain_next ("%h.next_bb"), chain_prev ("%h.prev_bb"))) basic_block_d
   PTR GTY ((skip (""))) aux;
 
   /* Innermost loop containing the block.  */
-  struct loop *loop_father;
+  class loop *loop_father;
 
   /* The dominance and postdominance information node.  */
   struct et_node * GTY ((skip (""))) dom[2];
@@ -147,9 +149,6 @@ struct GTY((chain_next ("%h.next_bb"), chain_prev ("%h.prev_bb"))) basic_block_d
   /* Expected number of executions: calculated in profile.c.  */
   profile_count count;
 
-  /* Expected frequency.  Normalized to be in range 0 to BB_FREQ_MAX.  */
-  int frequency;
-
   /* The discriminator for this block.  The discriminator distinguishes
      among several basic blocks that share a common locus, allowing for
      more accurate sample-based profiling.  */
@@ -300,7 +299,7 @@ enum cfg_bb_flags
                                         ? EDGE_SUCC ((bb), 1) : EDGE_SUCC ((bb), 0))
 
 /* Return expected execution frequency of the edge E.  */
-#define EDGE_FREQUENCY(e)              e->probability.apply (e->src->frequency)
+#define EDGE_FREQUENCY(e)              e->count ().to_frequency (cfun)
 
 /* Compute a scale factor (or probability) suitable for scaling of
    gcov_type values via apply_probability() and apply_scale().  */
@@ -508,6 +507,9 @@ ei_cond (edge_iterator ei, edge *p)
                                           insns.  */
 #define CLEANUP_CFGLAYOUT      32      /* Do cleanup in cfglayout mode.  */
 #define CLEANUP_CFG_CHANGED    64      /* The caller changed the CFG.  */
+#define CLEANUP_NO_PARTITIONING        128     /* Do not try to fix partitions.  */
+#define CLEANUP_FORCE_FAST_DCE 0x100   /* Force run_fast_dce to be called
+                                          at least once.  */
 
 /* Return true if BB is in a transaction.  */
 
@@ -639,4 +641,10 @@ has_abnormal_call_or_eh_pred_edge_p (basic_block bb)
   return false;
 }
 
+/* Return count of edge E.  */
+inline profile_count edge_def::count () const
+{
+  return src->count.apply_probability (probability);
+}
+
 #endif /* GCC_BASIC_BLOCK_H */