fixed precedence constraint
[libfirm] / ir / be / beirgmod.c
index e08ad6d..28d86e1 100644 (file)
@@ -1,3 +1,17 @@
+/**
+ * This file contains the following IRG modifications for be routines:
+ * - backend dominance information
+ * - SSA construction for a set of nodes
+ * - insertion of Perm nodes
+ * - empty block elimination
+ * - a simple dead node elimination (set inputs of unreachable nodes to BAD)
+ *
+ * Author:      Sebastian Hack, Daniel Grund, Matthias Braun, Christian Wuerdig
+ * Date:        04.05.2005
+ * Copyright:   (c) Universitaet Karlsruhe
+ * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
+ * CVS-Id:      $Id$
+ */
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
@@ -362,9 +376,11 @@ static void fix_usages(pset *copies, pset *copy_blocks, pset *phi_blocks, pset *
        for (irn = pset_first(copies); irn; irn = pset_next(copies)) {
                const ir_edge_t *edge;
                foreach_out_edge(irn, edge) {
-                       if (!pset_find_ptr(ignore_uses, get_edge_src_irn(edge))) {
+                       ir_node *src = get_edge_src_irn(edge);
+                       /* ignore all users from ignore_uses or keep-alives (user is End node) */
+                       if (! pset_find_ptr(ignore_uses, src) && ! is_End(src)) {
                                struct out tmp;
-                               tmp.irn = get_edge_src_irn(edge);
+                               tmp.irn = src;
                                tmp.pos = get_edge_src_pos(edge);
                                obstack_grow(&obst, &tmp, sizeof(tmp));
                                n_outs++;
@@ -438,7 +454,7 @@ static void remove_odd_phis(pset *copies, pset *unused_copies)
                sched_remove(irn);
        }
 }
-#endif
+#endif /* if 0 */
 
 void be_ssa_constr_phis_ignore(be_dom_front_info_t *info, be_lv_t *lv, int n, ir_node *nodes[], pset *phis, pset *ignore_uses)
 {
@@ -656,7 +672,6 @@ void extreme_liverange_splitting(struct _be_chordal_env_t *cenv)
  * remove them.
  */
 static void remove_empty_block(ir_node *block, void *data) {
-       ir_graph *irg;
        const ir_edge_t *edge, *next;
        ir_node *node;
        int *changed = data;
@@ -695,7 +710,7 @@ static void remove_empty_block(ir_node *block, void *data) {
 }
 
 /* removes basic blocks that just contain a jump instruction */
-void be_remove_empty_blocks(ir_graph *irg) {
+int be_remove_empty_blocks(ir_graph *irg) {
        int changed = 0;
 
        irg_block_walk_graph(irg, remove_empty_block, NULL, &changed);
@@ -705,4 +720,5 @@ void be_remove_empty_blocks(ir_graph *irg) {
                set_irg_extblk_inconsistent(irg);
                set_irg_outs_inconsistent(irg);
        }
+       return changed;
 }