Use be_emit_irprintf("%T", x) instead of be_emit_tarval().
[libfirm] / ir / be / betranshlp.c
index ab9c13e..5158d4d 100644 (file)
@@ -22,7 +22,6 @@
  * @brief       be transform helper extracted from the ia32 backend.
  * @author      Matthias Braun, Michael Beck
  * @date        14.06.2007
- * @version     $Id$
  */
 #include "config.h"
 
@@ -150,7 +149,7 @@ static ir_node *transform_end(ir_node *node)
 
 void be_start_transform_setup(void)
 {
-       clear_irp_opcodes_generic_func();
+       ir_clear_opcodes_generic_func();
 
        be_set_transform_function(op_Bad,         be_duplicate_node);
        be_set_transform_function(op_be_Copy,     be_duplicate_node);
@@ -211,7 +210,7 @@ ir_node *be_transform_node(ir_node *node)
        if (new_node != NULL)
                return new_node;
 
-       DEBUG_ONLY(be_set_transformed_node(node, NULL));
+       DEBUG_ONLY(be_set_transformed_node(node, NULL);)
 
        op = get_irn_op(node);
        if (op->ops.generic == NULL) {
@@ -318,15 +317,6 @@ static void pre_transform_anchor(ir_graph *irg, int anchor)
        set_irg_anchor(irg, anchor, transformed);
 }
 
-static void kill_unused_anchor(int anchor)
-{
-       ir_node *old_anchor_node = get_irn_n(env.old_anchor, anchor);
-       ir_node *old_bad         = get_irn_n(env.old_anchor, anchor_bad);
-       if (old_anchor_node != NULL && get_irn_n_edges(old_anchor_node) <= 1) {
-               set_irn_n(env.old_anchor, anchor, old_bad);
-       }
-}
-
 /**
  * Transforms all nodes. Deletes the old obstack and creates a new one.
  */
@@ -359,14 +349,12 @@ static void transform_nodes(ir_graph *irg, arch_pretrans_nodes *pre_transform)
 
        /* pre transform some anchors (so they are available in the other transform
         * functions) */
-       pre_transform_anchor(irg, anchor_bad);
        pre_transform_anchor(irg, anchor_no_mem);
        pre_transform_anchor(irg, anchor_end_block);
        pre_transform_anchor(irg, anchor_end);
        pre_transform_anchor(irg, anchor_start_block);
        pre_transform_anchor(irg, anchor_start);
        pre_transform_anchor(irg, anchor_frame);
-       kill_unused_anchor(anchor_tls);
 
        if (pre_transform)
                pre_transform();
@@ -377,10 +365,6 @@ static void transform_nodes(ir_graph *irg, arch_pretrans_nodes *pre_transform)
                be_transform_node(node);
        }
 
-       /* let beabi grab new nodes */
-       be_abi_transform_fixup(irg);
-       assert(waitq_empty(env.worklist)); // let's hope this didn't trigger new transforms
-
        /* fix loops and set new anchors*/
        inc_irg_visited(irg);
        for (i = get_irg_n_anchors(irg) - 1; i >= 0; --i) {
@@ -414,10 +398,7 @@ void be_transform_graph(ir_graph *irg, arch_pretrans_nodes *func)
        irg->obst = new_obst;
        irg->last_node_idx = 0;
 
-       /* invalidate phase info as (at least vrp info) is used inside the
-        * equivalent/compute_value functions and might replace our newly
-        * created nodes with middleend nodes */
-       irg_invalidate_phases(irg);
+       free_vrp_data(irg);
 
        /* create new value table for CSE */
        new_identities(irg);
@@ -437,73 +418,12 @@ void be_transform_graph(ir_graph *irg, arch_pretrans_nodes *func)
        free_irg_outs(irg);
        free_trouts();
        free_loop_information(irg);
-       set_irg_doms_inconsistent(irg);
+       clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_DOMINANCE);
 
-       be_liveness_invalidate(be_get_irg_liveness(irg));
-       /* Hack for now, something is buggy with invalidate liveness... */
-       be_birg_from_irg(irg)->lv = NULL;
+       be_invalidate_live_chk(irg);
        be_invalidate_dom_front(irg);
 
        /* recalculate edges */
        edges_deactivate(irg);
        edges_activate(irg);
 }
-
-int be_mux_is_abs(ir_node *sel, ir_node *mux_true, ir_node *mux_false)
-{
-       ir_node    *cmp_left;
-       ir_node    *cmp_right;
-       ir_mode    *mode;
-       ir_relation relation;
-
-       if (!is_Cmp(sel))
-               return 0;
-
-       /**
-        * Note further that these optimization work even for floating point
-        * with NaN's because -NaN == NaN.
-        * However, if +0 and -0 is handled differently, we cannot use the Abs/-Abs
-        * transformations.
-        */
-       mode = get_irn_mode(mux_true);
-       if (mode_honor_signed_zeros(mode))
-               return 0;
-
-       /* must be <, <=, >=, > */
-       relation = get_Cmp_relation(sel);
-       if ((relation & ir_relation_less_greater) == 0)
-               return 0;
-
-       if (!ir_is_negated_value(mux_true, mux_false))
-               return 0;
-
-       /* must be x cmp 0 */
-       cmp_right = get_Cmp_right(sel);
-       if (!is_Const(cmp_right) || !is_Const_null(cmp_right))
-               return 0;
-
-       cmp_left = get_Cmp_left(sel);
-       if (cmp_left == mux_false) {
-               if (relation & ir_relation_less) {
-                       return 1;
-               } else {
-                       assert(relation & ir_relation_greater);
-                       return -1;
-               }
-       } else if (cmp_left == mux_true) {
-               if (relation & ir_relation_less) {
-                       return -1;
-               } else {
-                       assert(relation & ir_relation_greater);
-                       return 1;
-               }
-       }
-
-       return 0;
-}
-
-ir_node *be_get_abs_op(ir_node *sel)
-{
-       ir_node *cmp_left = get_Cmp_left(sel);
-       return cmp_left;
-}