more warning fixes
[libfirm] / ir / ana / callgraph.h
index ad33346..514d749 100644 (file)
@@ -18,7 +18,7 @@
  *
  *  This file contains the representation of the callgraph.
  *  The nodes of the call graph are ir_graphs.  The edges between
- *  ghe nodes are calling relations.  I.e., if method a calls method
+ *  the nodes are calling relations.  I.e., if method a calls method
  *  b at some point, there is an edge between a and b.
  *
  *  Further this file contains an algorithm to construct the call
@@ -66,10 +66,12 @@ int       get_irg_callee_loop_depth(ir_graph *irg, int pos);
 /** Maximal loop depth of all paths from an external visible method to
     this irg. */
 int       get_irg_loop_depth(ir_graph *irg);
+
 /** Maximal recursion depth of all paths from an external visible method to
     this irg. */
 int       get_irg_recursion_depth(ir_graph *irg);
 
+double get_irg_method_execution_frequency (ir_graph *irg);
 
 /** Construct the callgraph. Expects callee information, i.e.,
     irg_callee_info_consistent must be set.  This can be computed with
@@ -84,16 +86,47 @@ typedef void callgraph_walk_func(ir_graph *g, void *env);
 
 void callgraph_walk(callgraph_walk_func *pre, callgraph_walk_func *post, void *env);
 
-/** Compute the backedges that represent recursions. */
+/** Compute the backedges that represent recursions and a looptree.
+ */
 void find_callgraph_recursions(void);
 
-
-/** Computes the loop nesting information.
+/** Compute interprocedural performance estimates.
+ *
+ *  Computes
+ *   - the loop depth of the method.
+ *     The loop depth of an edge between two methods is the
+ *     maximal loop depth of the Call nodes that call along this edge.
+ *     The loop depth of the method is the loop depth of the most expensive
+ *     path from main().
+ *   - The recursion depth.  The maximal number of recursions passed
+ *     on all paths reaching this method.
+ *   - The execution frequency.  As loop depth, but the edge weight is the sum
+ *     of the execution frequencies of all Calls along the edge.
+ **/
+void compute_performance_estimates(void);
+
+/** Computes the interprocedural loop nesting information.
+ *
+ * Computes two numbers for each irg:  the depth it is called in 'normal'
+ * loops and the depth of recursions it is in.
  *
  * Computes callee info and the callgraph if
  * this information is not available.
  */
 void analyse_loop_nesting_depth(void);
 
+/** State of loop nesting depth. */
+typedef enum {
+  loop_nesting_depth_none,             /**< Loop nesting depths are not computed, no memory is
+                                           allocated, access fails. */
+  loop_nesting_depth_consistent,       /**< Loop nesting depth information is computed and correct. */
+  loop_nesting_depth_inconsistent      /**< Loop nesting depth is computed but the graphs have been
+                                           changed since. */
+} loop_nesting_depth_state;
+
+loop_nesting_depth_state get_irp_loop_nesting_depth_state(void);
+void                     set_irp_loop_nesting_depth_state(loop_nesting_depth_state s);
+void                     set_irp_loop_nesting_depth_state_inconsistent(void);
+
 
 #endif /* _CALLGRAPH_H_ */