From 816aa2f422d57ebc0b513fa3ca66a90fa6058387 Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Wed, 6 Aug 2008 16:22:51 +0000 Subject: [PATCH] op_Min and op_Max always exists [r21018] --- include/libfirm/irop.h | 2 ++ ir/arch/archop.c | 26 +++++++------------------- ir/ir/irop.c | 6 ++++++ 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/include/libfirm/irop.h b/include/libfirm/irop.h index 607cce7b3..182c259fc 100644 --- a/include/libfirm/irop.h +++ b/include/libfirm/irop.h @@ -186,6 +186,8 @@ extern ir_op *op_EndExcept; ir_op *get_op_EndExcept (void); extern ir_op *op_NoMem; ir_op *get_op_NoMem (void); extern ir_op *op_Mux; ir_op *get_op_Mux (void); +extern ir_op *op_Min; ir_op *get_op_Min (void); +extern ir_op *op_Max; ir_op *get_op_Max (void); extern ir_op *op_CopyB; ir_op *get_op_CopyB (void); extern ir_op *op_InstOf; ir_op *get_op_InstOf (void); diff --git a/ir/arch/archop.c b/ir/arch/archop.c index 1bb4ce595..1264df948 100644 --- a/ir/arch/archop.c +++ b/ir/arch/archop.c @@ -40,6 +40,7 @@ #include "irvrfy_t.h" #include "iropt_dbg.h" #include "archop.h" +#include "irop.h" /* when we need verifying */ #ifdef NDEBUG @@ -57,15 +58,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 */ @@ -343,16 +335,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; } } diff --git a/ir/ir/irop.c b/ir/ir/irop.c index a1fe39d52..c9ea42cb3 100644 --- a/ir/ir/irop.c +++ b/ir/ir/irop.c @@ -108,6 +108,8 @@ ir_op *op_EndExcept; ir_op *get_op_EndExcept (void) { return op_EndExcept; } ir_op *op_NoMem; ir_op *get_op_NoMem (void) { return op_NoMem; } ir_op *op_Mux; ir_op *get_op_Mux (void) { return op_Mux; } +ir_op *op_Min; ir_op *get_op_Min (void) { return op_Max; } +ir_op *op_Max; ir_op *get_op_Max (void) { return op_Max; } ir_op *op_CopyB; ir_op *get_op_CopyB (void) { return op_CopyB; } ir_op *op_Raise; ir_op *get_op_Raise (void) { return op_Raise; } @@ -351,6 +353,8 @@ init_op(void) op_NoMem = new_ir_op(iro_NoMem, "NoMem", op_pin_state_pinned, N|NB|NI, oparity_zero, -1, 0, NULL); op_Mux = new_ir_op(iro_Mux, "Mux", op_pin_state_floats, N, oparity_trinary, -1, 0, NULL); + op_Min = new_ir_op(iro_Min, "Min", op_pin_state_floats, N, oparity_binary, -1, 0, NULL); + op_Max = new_ir_op(iro_Max, "Max", op_pin_state_floats, N, oparity_binary, -1, 0, NULL); op_CopyB = new_ir_op(iro_CopyB, "CopyB", op_pin_state_mem_pinned, F|H|M, oparity_trinary,-1, sizeof(copyb_attr), NULL); op_InstOf = new_ir_op(iro_InstOf, "InstOf", op_pin_state_mem_pinned, H, oparity_unary, -1, sizeof(io_attr), NULL); @@ -439,6 +443,8 @@ void finish_op(void) { free_ir_op (op_EndExcept); op_EndExcept = NULL; free_ir_op (op_NoMem ); op_NoMem = NULL; + free_ir_op (op_Max ); op_Max = NULL; + free_ir_op (op_Min ); op_Min = NULL; free_ir_op (op_Mux ); op_Mux = NULL; free_ir_op (op_CopyB ); op_CopyB = NULL; -- 2.20.1