rename heights_t to ir_heights_t, improve docu a bit, rename to heights.[ch]
authorMatthias Braun <matze@braunis.de>
Mon, 6 Sep 2010 13:05:04 +0000 (13:05 +0000)
committerMatthias Braun <matze@braunis.de>
Mon, 6 Sep 2010 13:05:04 +0000 (13:05 +0000)
[r27970]

16 files changed:
include/libfirm/firm.h
include/libfirm/firm_types.h
include/libfirm/height.h [deleted file]
include/libfirm/heights.h [new file with mode: 0644]
ir/ana/height.c [deleted file]
ir/ana/heights.c [new file with mode: 0644]
ir/be/beabi.c
ir/be/beabihelper.c
ir/be/beilpsched.c
ir/be/beschedmris.c
ir/be/beschednormal.c
ir/be/beschedrss.c
ir/be/ia32/ia32_common_transform.c
ir/be/ia32/ia32_common_transform.h
ir/be/ia32/ia32_optimize.c
ir/be/ia32/ia32_transform.c

index 71d824e..56e7ddf 100644 (file)
@@ -71,7 +71,7 @@
 #include "firm_common.h"
 #include "firmstat.h"
 #include "firm_types.h"
-#include "height.h"
+#include "heights.h"
 #include "ident.h"
 #include "interval_analysis.h"
 #include "irarch.h"
index b58dccb..438bfdb 100644 (file)
@@ -39,6 +39,7 @@ typedef struct ir_node              ir_node,             *ir_node_ptr;
 typedef struct ir_op                ir_op,               *ir_op_ptr;
 typedef struct ir_mode              ir_mode,             *ir_mode_ptr;
 typedef struct ir_edge_t            ir_edge_t,           *ir_edge_ptr;
+typedef struct ir_heights_t         ir_heights_t;
 typedef struct tarval               tarval,              *ir_tarval_ptr;
 typedef struct ir_enum_const        ir_enum_const,       *ir_enum_const_ptr;
 typedef struct ir_type              ir_type,             *ir_type_ptr;
@@ -53,7 +54,6 @@ typedef struct ir_exec_freq         ir_exec_freq,        *ir_exec_freq_ptr;
 typedef struct ir_cdep              ir_cdep,             *ir_cdep_ptr;
 typedef struct sn_entry             *seqno_t;
 typedef struct arch_irn_ops_t       arch_irn_ops_t;
-typedef struct ident_if_t           ident_if_t;
 typedef struct type_identify_if_t   type_identify_if_t;
 typedef struct ir_graph_pass_t      ir_graph_pass_t;
 typedef struct ir_prog_pass_t       ir_prog_pass_t;
diff --git a/include/libfirm/height.h b/include/libfirm/height.h
deleted file mode 100644 (file)
index acc000e..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (C) 1995-2008 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   Compute heights of nodes inside basic blocks
- * @author  Sebastian Hack
- * @date    19.04.2006
- * @version $Id$
- */
-#ifndef FIRM_ANA_HEIGHTS_H
-#define FIRM_ANA_HEIGHTS_H
-
-#include "firm_types.h"
-#include "begin.h"
-
-typedef struct heights_t heights_t;
-
-/**
- * Get the height of a node inside a basic block.
- * The height of the node is the maximal number of edges between a sink node in
- * that block and the node itself (plus 1).
- * @param h    The heights object.
- * @param irn  The node.
- * @return     The height of the node.
- */
-FIRM_API unsigned get_irn_height(const heights_t *h, const ir_node *irn);
-
-/**
- * Check, if a certain node is reachable according to data dependence edges from another node.
- * @param h The heights object.
- * @param n The first node.
- * @param m The other node.
- * @return  1, if n is data dependent on m, 0 if not.
- */
-FIRM_API int heights_reachable_in_block(heights_t *h, const ir_node *n,
-                                        const ir_node *m);
-
-/**
- * Recompute the height information.
- * This can be used to recompute the height information if the graph has changed since the last computation.
- * @param h The heights object.
- */
-FIRM_API void heights_recompute(heights_t *h);
-
-/**
- * Recompute the height information for a certain block.
- * This can be used to recompute the height information of a block.
- * @param h     The heights object.
- * @param block The block
- * @return The maximum over all heights in the block.
- */
-FIRM_API unsigned heights_recompute_block(heights_t *h, ir_node *block);
-
-/**
- * Make a new heights object.
- * This also computes the heights for each block in the graph.
- * @param irg The graph.
- */
-FIRM_API heights_t *heights_new(ir_graph *irg);
-
-/**
- * Free a heights object.
- * @param h The heights object.
- */
-FIRM_API void heights_free(heights_t *h);
-
-#include "end.h"
-
-#endif
diff --git a/include/libfirm/heights.h b/include/libfirm/heights.h
new file mode 100644 (file)
index 0000000..0b0fe7e
--- /dev/null
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 1995-2008 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   Compute heights of nodes inside basic blocks
+ * @author  Sebastian Hack
+ * @date    19.04.2006
+ * @version $Id$
+ *
+ * The height is a measure for the longest datadependencies path from a node to
+ * the end of a basic block. This is usefull for scheduling heuristics and can
+ * also be used to speedup reachability queries.
+ */
+#ifndef FIRM_ANA_HEIGHTS_H
+#define FIRM_ANA_HEIGHTS_H
+
+#include "firm_types.h"
+#include "begin.h"
+
+/**
+ * Get the height of a node inside a basic block.
+ * The height of the node is the maximal number of edges between a sink node in
+ * that block and the node itself (plus 1).
+ * @param h    The heights object.
+ * @param irn  The node.
+ * @return     The height of the node.
+ */
+FIRM_API unsigned get_irn_height(const ir_heights_t *h, const ir_node *irn);
+
+/**
+ * Check, if a certain node is reachable according to data dependence edges
+ * from another node. Both nodes must be in the same block.
+ * @param h The heights object.
+ * @param n The first node.
+ * @param m The other node.
+ * @return  1, if n is data dependent on m, 0 if not.
+ */
+FIRM_API int heights_reachable_in_block(ir_heights_t *h, const ir_node *n,
+                                        const ir_node *m);
+
+/**
+ * Recompute the height information.
+ * This can be used to recompute the height information if the graph has changed since the last computation.
+ * @param h The heights object.
+ */
+FIRM_API void heights_recompute(ir_heights_t *h);
+
+/**
+ * Recompute the height information for a certain block.
+ * This can be used to recompute the height information of a block.
+ * @param h     The heights object.
+ * @param block The block
+ * @return The maximum over all heights in the block.
+ */
+FIRM_API unsigned heights_recompute_block(ir_heights_t *h, ir_node *block);
+
+/**
+ * Make a new heights object.
+ * This also computes the heights for each block in the graph.
+ * @param irg The graph.
+ */
+FIRM_API ir_heights_t *heights_new(ir_graph *irg);
+
+/**
+ * Free a heights object.
+ * @param h The heights object.
+ */
+FIRM_API void heights_free(ir_heights_t *h);
+
+#include "end.h"
+
+#endif
diff --git a/ir/ana/height.c b/ir/ana/height.c
deleted file mode 100644 (file)
index bfe19bf..0000000
+++ /dev/null
@@ -1,272 +0,0 @@
-/*
- * Copyright (C) 1995-2008 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    Compute heights of nodes inside basic blocks
- * @author   Sebastian Hack
- * @date     19.04.2006
- * @version  $Id$
- */
-#include "config.h"
-
-#include "height.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdbool.h>
-
-#include "list.h"
-#include "irdump.h"
-#include "irgwalk.h"
-#include "irtools.h"
-#include "irphase_t.h"
-#include "iredges_t.h"
-
-struct heights_t {
-       ir_phase  phase;
-       unsigned  visited;
-       void     *dump_handle;
-};
-
-typedef struct {
-       unsigned height;
-       unsigned visited;
-} irn_height_t;
-
-static void *irn_height_init(ir_phase *phase, const ir_node *node)
-{
-       irn_height_t *h = phase_alloc(phase, sizeof(*h));
-       (void) node;
-       memset(h, 0, sizeof(*h));
-       return h;
-}
-
-static void *irn_height_reinit(ir_phase *phase, const ir_node *node,
-                               void *old_data)
-{
-       irn_height_t *h = (irn_height_t*) old_data;
-       (void) node;
-       (void) phase;
-       memset(h, 0, sizeof(*h));
-       return h;
-}
-
-static void height_dump_cb(void *data, FILE *f, const ir_node *irn)
-{
-       heights_t *heights = data;
-       irn_height_t *h    = phase_get_irn_data(&heights->phase, irn);
-
-       if (h)
-               fprintf(f, "height: %u\n", h->height);
-}
-
-/**
- * Check, if we can reach a target node from a given node inside one basic block.
- * @param h    The heights object.
- * @param curr The current node from which we tried to reach the other one.
- * @param tgt  The node we try to reach.
- * @return     1, one of tgt can be reached from curr, 0 else.
- */
-static bool search(const heights_t *h, const ir_node *curr, const ir_node *tgt)
-{
-       irn_height_t *h_curr;
-       irn_height_t *h_tgt;
-       int i, n;
-
-       /* if the current node is the one we were looking for, we're done. */
-       if (curr == tgt)
-               return true;
-
-       /* If we are in another block or at a phi we won't find our target. */
-       if (get_nodes_block(curr) != get_nodes_block(tgt))
-               return false;
-       if (is_Phi(curr))
-               return false;
-
-       /* Check, if we have already been here. Coming more often won't help :-) */
-       h_curr = phase_get_irn_data(&h->phase, curr);
-       if (h_curr->visited >= h->visited)
-               return false;
-
-       /* If we are too deep into the DAG we won't find the target either. */
-       h_tgt = phase_get_irn_data(&h->phase, tgt);
-       if (h_curr->height > h_tgt->height)
-               return false;
-
-       /* Mark this place as visited. */
-       h_curr->visited = h->visited;
-
-       /* Start a search from this node. */
-       for (i = 0, n = get_irn_ins_or_deps(curr); i < n; ++i) {
-               ir_node *op = get_irn_in_or_dep(curr, i);
-               if (search(h, op, tgt))
-                       return true;
-       }
-
-       return false;
-}
-
-/**
- * Check, if one node can be reached from another one, according to data
- * dependence.
- */
-int heights_reachable_in_block(heights_t *h, const ir_node *n,
-                               const ir_node *m)
-{
-       int res          = 0;
-       irn_height_t *hn = phase_get_irn_data(&h->phase, n);
-       irn_height_t *hm = phase_get_irn_data(&h->phase, m);
-
-       assert(get_nodes_block(n) == get_nodes_block(m));
-       assert(hn != NULL && hm != NULL);
-
-       if (hn->height <= hm->height) {
-               h->visited++;
-               res = search(h, n, m);
-       }
-
-       return res;
-}
-
-/**
- * Compute the height of a node in a block.
- * @param h   The heights object.
- * @param irn The node.
- * @param bl  The block.
- */
-static unsigned compute_height(heights_t *h, ir_node *irn, const ir_node *bl)
-{
-       irn_height_t *ih = phase_get_or_set_irn_data(&h->phase, irn);
-
-       const ir_edge_t *edge;
-
-       /* bail out if we already visited that node. */
-       if (ih->visited >= h->visited)
-               return ih->height;
-
-       ih->visited = h->visited;
-       ih->height  = 0;
-
-       foreach_out_edge(irn, edge) {
-               ir_node *dep = get_edge_src_irn(edge);
-
-               if (!is_Block(dep) && !is_Phi(dep) && get_nodes_block(dep) == bl) {
-                       unsigned dep_height = compute_height(h, dep, bl);
-                       ih->height          = MAX(ih->height, dep_height);
-               }
-
-               ih->height++;
-       }
-
-       foreach_out_edge_kind(irn, edge, EDGE_KIND_DEP) {
-               ir_node *dep = get_edge_src_irn(edge);
-
-               assert(!is_Phi(dep));
-               if (!is_Block(dep) && get_nodes_block(dep) == bl) {
-                       unsigned dep_height = compute_height(h, dep, bl);
-                       ih->height          = MAX(ih->height, dep_height);
-               }
-
-               ih->height++;
-       }
-
-       return ih->height;
-}
-
-static unsigned compute_heights_in_block(ir_node *bl, heights_t *h)
-{
-       int             max_height = -1;
-       const ir_edge_t *edge;
-
-       h->visited++;
-
-       foreach_out_edge(bl, edge) {
-               ir_node *dep = get_edge_src_irn(edge);
-               int     curh = compute_height(h, dep, bl);
-
-               max_height = MAX(curh, max_height);
-       }
-
-       foreach_out_edge_kind(bl, edge, EDGE_KIND_DEP) {
-               ir_node *dep = get_edge_src_irn(edge);
-               int     curh = compute_height(h, dep, bl);
-
-               max_height = MAX(curh, max_height);
-       }
-
-       return max_height;
-}
-
-static void compute_heights_in_block_walker(ir_node *block, void *data)
-{
-       heights_t *h = data;
-       compute_heights_in_block(block, h);
-}
-
-unsigned get_irn_height(const heights_t *heights, const ir_node *irn)
-{
-       const irn_height_t *h = phase_get_irn_data(&heights->phase, irn);
-       assert(h && "No height information for node");
-       return h->height;
-}
-
-unsigned heights_recompute_block(heights_t *h, ir_node *block)
-{
-       const ir_edge_t *edge;
-
-       edges_assure(phase_get_irg(&h->phase));
-
-       /* reset phase data for all nodes in the block */
-       foreach_out_edge(block, edge) {
-               ir_node      *irn = get_edge_src_irn(edge);
-               irn_height_t *ih  = phase_get_irn_data(&h->phase, irn);
-               memset(ih, 0, sizeof(*ih));
-       }
-
-       h->visited = 0;
-       return compute_heights_in_block(block, h);
-}
-
-void heights_recompute(heights_t *h)
-{
-       ir_graph *irg = phase_get_irg(&h->phase);
-
-       edges_assure(irg);
-       phase_reinit_irn_data(&h->phase, irn_height_reinit);
-       h->visited = 0;
-       irg_block_walk_graph(irg, compute_heights_in_block_walker, NULL, h);
-}
-
-heights_t *heights_new(ir_graph *irg)
-{
-       heights_t *res = XMALLOC(heights_t);
-       phase_init(&res->phase, irg, irn_height_init);
-       res->dump_handle = dump_add_node_info_callback(height_dump_cb, res);
-       heights_recompute(res);
-
-       return res;
-}
-
-void heights_free(heights_t *h)
-{
-       phase_deinit(&h->phase);
-       dump_remove_node_info_callback(h->dump_handle);
-       xfree(h);
-}
diff --git a/ir/ana/heights.c b/ir/ana/heights.c
new file mode 100644 (file)
index 0000000..a750f6c
--- /dev/null
@@ -0,0 +1,273 @@
+/*
+ * Copyright (C) 1995-2008 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    Compute heights of nodes inside basic blocks
+ * @author   Sebastian Hack
+ * @date     19.04.2006
+ * @version  $Id$
+ */
+#include "config.h"
+
+#include "heights.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdbool.h>
+
+#include "list.h"
+#include "irdump.h"
+#include "irgwalk.h"
+#include "irtools.h"
+#include "irphase_t.h"
+#include "iredges_t.h"
+
+struct ir_heights_t {
+       ir_phase  phase;
+       unsigned  visited;
+       void     *dump_handle;
+};
+
+typedef struct {
+       unsigned height;
+       unsigned visited;
+} irn_height_t;
+
+static void *irn_height_init(ir_phase *phase, const ir_node *node)
+{
+       irn_height_t *h = phase_alloc(phase, sizeof(*h));
+       (void) node;
+       memset(h, 0, sizeof(*h));
+       return h;
+}
+
+static void *irn_height_reinit(ir_phase *phase, const ir_node *node,
+                               void *old_data)
+{
+       irn_height_t *h = (irn_height_t*) old_data;
+       (void) node;
+       (void) phase;
+       memset(h, 0, sizeof(*h));
+       return h;
+}
+
+static void height_dump_cb(void *data, FILE *f, const ir_node *irn)
+{
+       ir_heights_t *heights = data;
+       irn_height_t *h       = phase_get_irn_data(&heights->phase, irn);
+
+       if (h)
+               fprintf(f, "height: %u\n", h->height);
+}
+
+/**
+ * Check, if we can reach a target node from a given node inside one basic block.
+ * @param h    The heights object.
+ * @param curr The current node from which we tried to reach the other one.
+ * @param tgt  The node we try to reach.
+ * @return     1, one of tgt can be reached from curr, 0 else.
+ */
+static bool search(const ir_heights_t *h, const ir_node *curr,
+                   const ir_node *tgt)
+{
+       irn_height_t *h_curr;
+       irn_height_t *h_tgt;
+       int i, n;
+
+       /* if the current node is the one we were looking for, we're done. */
+       if (curr == tgt)
+               return true;
+
+       /* If we are in another block or at a phi we won't find our target. */
+       if (get_nodes_block(curr) != get_nodes_block(tgt))
+               return false;
+       if (is_Phi(curr))
+               return false;
+
+       /* Check, if we have already been here. Coming more often won't help :-) */
+       h_curr = phase_get_irn_data(&h->phase, curr);
+       if (h_curr->visited >= h->visited)
+               return false;
+
+       /* If we are too deep into the DAG we won't find the target either. */
+       h_tgt = phase_get_irn_data(&h->phase, tgt);
+       if (h_curr->height > h_tgt->height)
+               return false;
+
+       /* Mark this place as visited. */
+       h_curr->visited = h->visited;
+
+       /* Start a search from this node. */
+       for (i = 0, n = get_irn_ins_or_deps(curr); i < n; ++i) {
+               ir_node *op = get_irn_in_or_dep(curr, i);
+               if (search(h, op, tgt))
+                       return true;
+       }
+
+       return false;
+}
+
+/**
+ * Check, if one node can be reached from another one, according to data
+ * dependence.
+ */
+int heights_reachable_in_block(ir_heights_t *h, const ir_node *n,
+                               const ir_node *m)
+{
+       int res          = 0;
+       irn_height_t *hn = phase_get_irn_data(&h->phase, n);
+       irn_height_t *hm = phase_get_irn_data(&h->phase, m);
+
+       assert(get_nodes_block(n) == get_nodes_block(m));
+       assert(hn != NULL && hm != NULL);
+
+       if (hn->height <= hm->height) {
+               h->visited++;
+               res = search(h, n, m);
+       }
+
+       return res;
+}
+
+/**
+ * Compute the height of a node in a block.
+ * @param h   The heights object.
+ * @param irn The node.
+ * @param bl  The block.
+ */
+static unsigned compute_height(ir_heights_t *h, ir_node *irn, const ir_node *bl)
+{
+       irn_height_t *ih = phase_get_or_set_irn_data(&h->phase, irn);
+
+       const ir_edge_t *edge;
+
+       /* bail out if we already visited that node. */
+       if (ih->visited >= h->visited)
+               return ih->height;
+
+       ih->visited = h->visited;
+       ih->height  = 0;
+
+       foreach_out_edge(irn, edge) {
+               ir_node *dep = get_edge_src_irn(edge);
+
+               if (!is_Block(dep) && !is_Phi(dep) && get_nodes_block(dep) == bl) {
+                       unsigned dep_height = compute_height(h, dep, bl);
+                       ih->height          = MAX(ih->height, dep_height);
+               }
+
+               ih->height++;
+       }
+
+       foreach_out_edge_kind(irn, edge, EDGE_KIND_DEP) {
+               ir_node *dep = get_edge_src_irn(edge);
+
+               assert(!is_Phi(dep));
+               if (!is_Block(dep) && get_nodes_block(dep) == bl) {
+                       unsigned dep_height = compute_height(h, dep, bl);
+                       ih->height          = MAX(ih->height, dep_height);
+               }
+
+               ih->height++;
+       }
+
+       return ih->height;
+}
+
+static unsigned compute_heights_in_block(ir_node *bl, ir_heights_t *h)
+{
+       int             max_height = -1;
+       const ir_edge_t *edge;
+
+       h->visited++;
+
+       foreach_out_edge(bl, edge) {
+               ir_node *dep = get_edge_src_irn(edge);
+               int     curh = compute_height(h, dep, bl);
+
+               max_height = MAX(curh, max_height);
+       }
+
+       foreach_out_edge_kind(bl, edge, EDGE_KIND_DEP) {
+               ir_node *dep = get_edge_src_irn(edge);
+               int     curh = compute_height(h, dep, bl);
+
+               max_height = MAX(curh, max_height);
+       }
+
+       return max_height;
+}
+
+static void compute_heights_in_block_walker(ir_node *block, void *data)
+{
+       ir_heights_t *h = data;
+       compute_heights_in_block(block, h);
+}
+
+unsigned get_irn_height(const ir_heights_t *heights, const ir_node *irn)
+{
+       const irn_height_t *h = phase_get_irn_data(&heights->phase, irn);
+       assert(h && "No height information for node");
+       return h->height;
+}
+
+unsigned heights_recompute_block(ir_heights_t *h, ir_node *block)
+{
+       const ir_edge_t *edge;
+
+       edges_assure(phase_get_irg(&h->phase));
+
+       /* reset phase data for all nodes in the block */
+       foreach_out_edge(block, edge) {
+               ir_node      *irn = get_edge_src_irn(edge);
+               irn_height_t *ih  = phase_get_irn_data(&h->phase, irn);
+               memset(ih, 0, sizeof(*ih));
+       }
+
+       h->visited = 0;
+       return compute_heights_in_block(block, h);
+}
+
+void heights_recompute(ir_heights_t *h)
+{
+       ir_graph *irg = phase_get_irg(&h->phase);
+
+       edges_assure(irg);
+       phase_reinit_irn_data(&h->phase, irn_height_reinit);
+       h->visited = 0;
+       irg_block_walk_graph(irg, compute_heights_in_block_walker, NULL, h);
+}
+
+ir_heights_t *heights_new(ir_graph *irg)
+{
+       ir_heights_t *res = XMALLOC(ir_heights_t);
+       phase_init(&res->phase, irg, irn_height_init);
+       res->dump_handle = dump_add_node_info_callback(height_dump_cb, res);
+       heights_recompute(res);
+
+       return res;
+}
+
+void heights_free(ir_heights_t *h)
+{
+       phase_deinit(&h->phase);
+       dump_remove_node_info_callback(h->dump_handle);
+       xfree(h);
+}
index a41be6d..984df6b 100644 (file)
@@ -39,7 +39,7 @@
 #include "irgopt.h"
 #include "irbitset.h"
 #include "iropt_t.h"
-#include "height.h"
+#include "heights.h"
 #include "pdeq.h"
 #include "irtools.h"
 #include "raw_bitset.h"
@@ -109,7 +109,7 @@ struct be_abi_irg_t {
        arch_register_req_t  *sp_req;
 };
 
-static heights_t *ir_heights;
+static ir_heights_t *ir_heights;
 
 /** Flag: if set, try to omit the frame pointer in all routines. */
 static int be_omit_fp = 1;
index ce6f98a..97547e3 100644 (file)
@@ -34,7 +34,7 @@
 #include "iredges.h"
 #include "irgwalk.h"
 #include "irphase_t.h"
-#include "height.h"
+#include "heights.h"
 
 typedef struct reg_flag_t {
        const arch_register_t *reg;   /**< register at an input position.
@@ -497,7 +497,7 @@ static void link_ops_in_block_walker(ir_node *node, void *data)
        }
 }
 
-static heights_t *heights;
+static ir_heights_t *heights;
 
 /**
  * Check if a node is somehow data dependent on another one.
index 5891902..e5e680a 100644 (file)
@@ -43,7 +43,7 @@
 #include "irgwalk.h"
 #include "irbitset.h"
 #include "irphase_t.h"
-#include "height.h"
+#include "heights.h"
 #include "iredges.h"
 #include "pdeq.h"
 #include "debug.h"
@@ -146,7 +146,7 @@ typedef struct {
 typedef struct {
        ir_phase             ph;            /**< The phase */
        ir_graph             *irg;          /**< The current irg */
-       heights_t            *height;       /**< The heights object of the irg */
+       ir_heights_t         *height;       /**< The heights object of the irg */
        void                 *irg_env;      /**< An environment for the irg scheduling, provided by the backend */
        void                 *block_env;    /**< An environment for scheduling a block, provided by the backend */
        const arch_env_t     *arch_env;
@@ -208,7 +208,7 @@ static const lc_opt_table_entry_t ilpsched_option_table[] = {
        We need this global variable as we compare nodes dependent on heights,
        but we cannot pass any information to the qsort compare function.
 */
-static heights_t *glob_heights;
+static ir_heights_t *glob_heights;
 
 /**
  * Check if irn is a Proj, which has no execution units assigned.
index 2c7a5bb..6239ffe 100644 (file)
@@ -46,7 +46,7 @@
 #include "irtools.h"
 #include "irbitset.h"
 #include "irnodeset.h"
-#include "height.h"
+#include "heights.h"
 
 #include "benode.h"
 #include "besched.h"
@@ -55,7 +55,7 @@
 
 struct mris_env_t {
        ir_phase          ph;
-       heights_t         *heights;
+       ir_heights_t      *heights;
        ir_graph          *irg;
        ir_node           *bl;
        int               visited;
index 68a6a55..9e095df 100644 (file)
@@ -30,7 +30,7 @@
 #include "belistsched.h"
 #include "belive_t.h"
 #include "beutil.h"
-#include "height.h"
+#include "heights.h"
 #include "irtools.h"
 #include "irgwalk.h"
 #include "benode.h"
@@ -312,7 +312,7 @@ static int root_cmp(const void* a, const void* b)
 static void normal_sched_block(ir_node* block, void* env)
 {
        ir_node**      roots = get_irn_link(block);
-       heights_t*     heights = env;
+       ir_heights_t*  heights = env;
        int            root_count;
        irn_cost_pair* root_costs;
        int i;
@@ -379,8 +379,8 @@ static void normal_sched_block(ir_node* block, void* env)
 static void *normal_init_graph(const list_sched_selector_t *vtab,
                                ir_graph *irg)
 {
-       instance_tinst = XMALLOC(instance_t);
-       heights_t*  heights;
+       instance_t   *inst = XMALLOC(instance_t);
+       ir_heights_t *heights;
 
        (void)vtab;
 
index 742e0d4..dec6453 100644 (file)
@@ -53,7 +53,7 @@
 #include "plist.h"
 #include "array_t.h"
 
-#include "height.h"
+#include "heights.h"
 
 #include "beabi.h"
 #include "bemodule.h"
@@ -149,7 +149,7 @@ typedef struct serialization {
 
 typedef struct rss {
        ir_phase          ph;              /**< Phase to hold some data */
-       heights_t        *h;              /**< The current height object */
+       ir_heights_t     *h;              /**< The current height object */
        ir_graph         *irg;            /**< The irg to preprocess */
        plist_t          *nodes;          /**< The list of interesting nodes */
        const arch_env_t *arch_env;       /**< The architecture environment */
index d48535e..ddcb1af 100644 (file)
@@ -31,6 +31,7 @@
 #include "irprintf.h"
 #include "typerep.h"
 #include "bitset.h"
+#include "heights.h"
 
 #include "../betranshlp.h"
 #include "../beirg.h"
@@ -46,7 +47,7 @@
 /** hold the current code generator during transformation */
 ia32_code_gen_t *env_cg = NULL;
 
-heights_t *heights = NULL;
+ir_heights_t *heights = NULL;
 
 static int check_immediate_constraint(long val, char immediate_constraint_type)
 {
index 0915fd0..21c2ac3 100644 (file)
@@ -27,8 +27,8 @@
 #ifndef FIRM_BE_IA32_IA32_COMMON_TRANSFORM_H
 #define FIRM_BE_IA32_IA32_COMMON_TRANSFORM_H
 
+#include "firm_types.h"
 #include "bearch_ia32_t.h"
-#include "height.h"
 
 /**
  * An assembler constraint.
@@ -44,8 +44,8 @@ struct constraint_t {
 };
 
 extern ia32_code_gen_t *env_cg;
-extern heights_t *heights;
-extern int        no_pic_adjust;
+extern ir_heights_t    *heights;
+extern int              no_pic_adjust;
 
 /**
  * Get an atomic entity that is initialized with a tarval forming
index acef65d..1e5dac6 100644 (file)
@@ -34,7 +34,7 @@
 #include "tv.h"
 #include "irgmod.h"
 #include "irgwalk.h"
-#include "height.h"
+#include "heights.h"
 #include "irbitset.h"
 #include "irprintf.h"
 #include "irdump.h"
index 12e844f..52bb6e8 100644 (file)
@@ -45,7 +45,7 @@
 #include "irdom.h"
 #include "error.h"
 #include "array_t.h"
-#include "height.h"
+#include "heights.h"
 
 #include "../benode.h"
 #include "../besched.h"