beifg: Simplify the quite complicated way to divide a number by 2 in be_ifg_stat().
[libfirm] / ir / lower / lower_builtins.c
index 381ea97..a090876 100644 (file)
@@ -1,20 +1,6 @@
 /*
- * Copyright (C) 1995-2011 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.
+ * Copyright (C) 2012 University of Karlsruhe.
  */
 
 /**
@@ -34,6 +20,7 @@
 #include "irgwalk.h"
 #include "iroptimize.h"
 #include "error.h"
+#include "util.h"
 
 static pmap *entities;
 static bool dont_lower[ir_bk_last+1];
@@ -112,9 +99,11 @@ static void replace_with_call(ir_node *node)
        call_ress = new_r_Proj(call, mode_T, pn_Call_T_result);
        call_res  = new_r_Proj(call_ress, res_mode, 0);
 
-       turn_into_tuple(node, 2);
-       set_irn_n(node, pn_Builtin_M, call_mem);
-       set_irn_n(node, pn_Builtin_max+1, call_res);
+       ir_node *const in[] = {
+               [pn_Builtin_M]       = call_mem,
+               [pn_Builtin_max + 1] = call_res,
+       };
+       turn_into_tuple(node, ARRAY_SIZE(in), in);
 }
 
 static void lower_builtin(ir_node *node, void *env)
@@ -132,10 +121,11 @@ static void lower_builtin(ir_node *node, void *env)
        case ir_bk_prefetch: {
                /* just remove it */
                ir_node *mem = get_Builtin_mem(node);
-               turn_into_tuple(node, 1);
-               set_irn_n(node, pn_Builtin_M, mem);
+               ir_node *const in[] = { mem };
+               turn_into_tuple(node, ARRAY_SIZE(in), in);
                break;
        }
+
        case ir_bk_ffs:
        case ir_bk_clz:
        case ir_bk_ctz: