fixed a bunch of warnings (in OPTIMIZE mode)
[libfirm] / ir / ana / callgraph.c
index 9928108..a4eba6c 100644 (file)
@@ -1,18 +1,35 @@
 /*
- * Project:     libFIRM
- * File name:   ir/ana/callgraph.c
- * Purpose:     Representation and computation of the callgraph.
- * Author:      Goetz Lindenmaier
- * Modified by:
- * Created:     21.7.2004
- * CVS-ID:      $Id$
- * Copyright:   (c) 2004-2007 Universität Karlsruhe
- * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
+ * Copyright (C) 1995-2007 University of Karlsruhe.  All right reserved.
+ *
+ * This file is part of libFirm.
+ *
+ * This file may be distributed and/or modified under the terms of the
+ * GNU General Public License version 2 as published by the Free Software
+ * Foundation and appearing in the file LICENSE.GPL included in the
+ * packaging of this file.
+ *
+ * Licensees holding valid libFirm Professional Edition licenses may use
+ * this file in accordance with the libFirm Commercial License.
+ * Agreement provided with the Software.
+ *
+ * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+ * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ */
+
+/**
+ * @file
+ * @brief       Representation and computation of the callgraph.
+ * @author      Goetz Lindenmaier
+ * @date        21.7.2004
+ * @version     $Id$
  */
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
 
+#ifdef INTERPROCEDURAL_VIEW
+
 #ifdef HAVE_STRING_H
 # include <string.h>
 #endif
@@ -64,6 +81,7 @@ ir_graph *get_irg_caller(ir_graph *irg, int pos) {
        return NULL;
 }
 
+#ifdef INTERPROCEDURAL_VIEW
 /* Returns non-zero if the caller at position pos is "a backedge", i.e. a recursion. */
 int is_irg_caller_backedge(ir_graph *irg, int pos) {
        assert (pos >= 0 && pos < get_irg_n_callers(irg));
@@ -95,6 +113,7 @@ int has_irg_caller_backedge(ir_graph *irg) {
        }
        return 0;
 }
+#endif
 
 /**
  * Find the reversion position of a caller.
@@ -157,6 +176,7 @@ int has_irg_callee_backedge(ir_graph *irg) {
        return 0;
 }
 
+#ifdef INTERPROCEDURAL_VIEW
 /**
  * Mark the callee at position pos as a backedge.
  */
@@ -170,6 +190,7 @@ static void set_irg_callee_backedge(ir_graph *irg, int pos) {
                irg->callee_isbe = xcalloc(n, sizeof(irg->callee_isbe[0]));
        irg->callee_isbe[pos] = 1;
 }
+#endif
 
 /* Returns the maximal loop depth of call nodes that call along this edge. */
 int get_irg_callee_loop_depth(ir_graph *irg, int pos) {
@@ -214,6 +235,7 @@ double get_irg_caller_method_execution_frequency(ir_graph *irg, int pos) {
 static void ana_Call(ir_node *n, void *env) {
        int i, n_callees;
        ir_graph *irg;
+       (void) env;
 
        if (! is_Call(n)) return;
 
@@ -393,8 +415,10 @@ static ir_loop *current_loop;      /**< Current cfloop construction is working
 static int loop_node_cnt = 0;      /**< Counts the number of allocated cfloop nodes.
                                         Each cfloop node gets a unique number.
                                         What for? ev. remove. @@@ */
+#ifdef INTERPROCEDURAL_VIEW
 static int current_dfn = 1;        /**< Counter to generate depth first numbering
                                         of visited nodes.  */
+#endif
 
 
 /*-----------------*/
@@ -564,6 +588,7 @@ static INLINE void pop_scc_to_loop(ir_graph *irg) {
        } while(m != irg);
 }
 
+#ifdef INTERPROCEDURAL_VIEW
 /* GL ??? my last son is my grandson???  Removes cfloops with no
    ir_nodes in them.  Such loops have only another loop as son. (Why
    can't they have two loops as sons? Does it never get that far? ) */
@@ -589,6 +614,7 @@ static void close_loop(ir_loop *l) {
 
        current_loop = l;
 }
+#endif
 
 /**
  * Removes and unmarks all nodes up to n from the stack.
@@ -607,6 +633,7 @@ static INLINE void pop_scc_unmark_visit(ir_graph *n) {
 /* The loop data structure.                                          **/
 /**********************************************************************/
 
+#ifdef INTERPROCEDURAL_VIEW
 /**
  * Allocates a new loop as son of current_loop.  Sets current_loop
  * to the new loop and returns the father.
@@ -622,6 +649,7 @@ static ir_loop *new_loop(void) {
        son->children = NEW_ARR_F (loop_element, 0);
        son->n_nodes  = 0;
        son->n_sons   = 0;
+       son->link     = NULL;
        if (father) {
                son->outer_loop = father;
                add_loop_son(father, son);
@@ -633,7 +661,6 @@ static ir_loop *new_loop(void) {
 
 #ifdef DEBUG_libfirm
        son->loop_nr = get_irp_new_node_nr();
-       son->link    = NULL;
 #endif
 
        current_loop = son;
@@ -683,7 +710,6 @@ is_head(ir_graph *n, ir_graph *root)
                        some_outof_loop = 1;
                } else {
                        if (get_irg_uplink(pred) < get_irg_uplink(root))  {
-                               DDMG(pred); DDMG(root);
                                assert(get_irg_uplink(pred) >= get_irg_uplink(root));
                        }
                        some_in_loop = 1;
@@ -714,7 +740,6 @@ is_endless_head(ir_graph *n, ir_graph *root)
                        some_outof_loop = 1;
                } else {
                        if(get_irg_uplink(pred) < get_irg_uplink(root)) {
-                               DDMG(pred); DDMG(root);
                                assert(get_irg_uplink(pred) >= get_irg_uplink(root));
                        }
                        some_in_loop = 1;
@@ -724,7 +749,6 @@ is_endless_head(ir_graph *n, ir_graph *root)
        return !some_outof_loop & some_in_loop;
 }
 
-
 /**
  * Check whether there is a parallel edge in the ip control flow.
  * Only
@@ -932,7 +956,6 @@ find_tail(ir_graph *n) {
 }
 #endif
 
-
 /*-----------------------------------------------------------*
  *                   The core algorithm.                     *
  *-----------------------------------------------------------*/
@@ -1027,6 +1050,7 @@ static void reset_isbe(void) {
                irg->callee_isbe = NULL;
        }
 }
+#endif
 
 
 
@@ -1168,6 +1192,7 @@ static void compute_rec_depth (ir_graph *irg, void *env) {
 /* nodes to evaluate a callgraph edge.                                                 */
 /* ----------------------------------------------------------------------------------- */
 
+#ifdef INTERPROCEDURAL_VIEW
 /* Returns the method execution frequency of a graph. */
 double get_irg_method_execution_frequency (ir_graph *irg) {
        return irg->method_execution_frequency;
@@ -1189,6 +1214,7 @@ static void compute_method_execution_frequency(ir_graph *irg, void *env) {
        double freq;
        int    found_edge;
        int    n_callees;
+       (void) env;
 
        if (cg_irg_visited(irg)) return;
 
@@ -1361,6 +1387,7 @@ void compute_performance_estimates(void) {
                }
        }
 }
+#endif
 
 /* Returns the maximal loop depth of all paths from an external visible method to
    this irg. */
@@ -1409,3 +1436,5 @@ void set_irp_loop_nesting_depth_state_inconsistent(void) {
        if (irp->lnd_state == loop_nesting_depth_consistent)
                irp->lnd_state = loop_nesting_depth_inconsistent;
 }
+
+#endif