+
+int get_irn_loop_call_depth(ir_node *n) {
+ ir_graph *irg = get_irn_irg(n);
+ return get_irg_loop_depth(irg);
+}
+
+int get_irn_loop_depth(ir_node *n) {
+ get_loop_depth(get_irn_loop(get_nodes_block(n)));
+}
+
+int get_irn_recursion_depth(ir_node *n) {
+ ir_graph *irg = get_irn_irg(n);
+ return get_irg_recursion_depth(irg);
+}
+
+
+/* *************************************************************************** */
+/* The heuristic */
+/* *************************************************************************** */
+
+int get_weighted_loop_depth(ir_node *n) {
+ int loop_call_depth = get_irn_loop_call_depth(n);
+ int loop_depth = get_irn_loop_depth(n);
+ int recursion_depth = get_irn_recursion_depth(n);
+
+ return loop_call_depth + loop_depth + recursion_depth;
+}
+