- activated WITH_UNKNOWN
[libfirm] / ir / arch / archop.c
index 1bb4ce5..69c984f 100644 (file)
@@ -22,9 +22,7 @@
  * @brief     architecture dependent IR operations
  * @version   $Id$
  */
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #ifdef HAVE_STRING_H
 #include <string.h>
@@ -40,6 +38,8 @@
 #include "irvrfy_t.h"
 #include "iropt_dbg.h"
 #include "archop.h"
+#include "irop.h"
+#include "error.h"
 
 /* when we need verifying */
 #ifdef NDEBUG
@@ -57,15 +57,6 @@ static const arch_ops_info default_settings = {
        0
 };
 
-/** The Min operation */
-ir_op *op_Min = NULL;
-
-/** The Max operation */
-ir_op *op_Max = NULL;
-
-ir_op *get_op_Min(void)  { return op_Min; }
-ir_op *get_op_Max(void)  { return op_Max; }
-
 /*
  * construct a Min: Min(a,b) = a < b ? a : b
  */
@@ -77,8 +68,7 @@ new_rd_Min(dbg_info *db, ir_graph *irg, ir_node *block,
        ir_node *res;
 
        if (! op_Min) {
-               assert(0);
-               return NULL;
+               panic("cannot create Min node, not allowed");
        }
 
        in[0] = op1;
@@ -100,8 +90,7 @@ new_rd_Max(dbg_info *db, ir_graph *irg, ir_node *block,
        ir_node *res;
 
        if (! op_Max) {
-               assert(0);
-               return NULL;
+               panic("cannot create Max node, not allowed");
        }
 
        in[0] = op1;
@@ -248,7 +237,7 @@ ir_node *arch_transform_node_Mux(ir_node *n)
                        return n;
 
                cmp = get_Proj_pred(proj);
-               if (get_irn_op(cmp) == op_Cmp) {
+               if (is_Cmp(cmp)) {
                        ir_node *a = get_Cmp_left(cmp);
                        ir_node *b = get_Cmp_right(cmp);
                        ir_node *t = get_Mux_true(n);
@@ -343,16 +332,12 @@ void firm_archops_init(const arch_ops_info *info)
        if (info->enabled_ops & ARCH_OPS_MINMAX) {
                memset(&ops, 0, sizeof(ops));
 
-               ops.computed_value  = computed_value_Min;
-               ops.equivalent_node = equivalent_node_Min;
-               ops.verify_node     = verify_node_MinMax;
-
-               op_Min = new_ir_op(iro_Min, "Min",  op_pin_state_floats, irop_flag_commutative, oparity_binary, 0, 0, &ops);
-
-               ops.computed_value  = computed_value_Max;
-               ops.equivalent_node = equivalent_node_Max;
-               ops.verify_node     = verify_node_MinMax;
+               op_Min->ops.computed_value  = computed_value_Min;
+               op_Min->ops.equivalent_node = equivalent_node_Min;
+               op_Min->ops.verify_node     = verify_node_MinMax;
 
-               op_Max = new_ir_op(iro_Max, "Max",  op_pin_state_floats, irop_flag_commutative, oparity_binary, 0, 0, &ops);
+               op_Max->ops.computed_value  = computed_value_Max;
+               op_Max->ops.equivalent_node = equivalent_node_Max;
+               op_Max->ops.verify_node     = verify_node_MinMax;
        }
 }