/*
- * Project: libFIRM
- * File name: ir/opt/scalar_replace.c
- * Purpose: scalar replacement of arrays and compounds
- * Author: Beyhan Veliev
- * Modified by: Michael Beck
- * Created:
- * CVS-ID: $Id$
- * Copyright: (c) 1998-2005 Universität Karlsruhe
- * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
+ * Copyright (C) 1995-2007 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.
+ */
+
+/**
+ * @file
+ * @brief Scalar replacement of compounds.
+ * @author Beyhan Veliev, Michael Beck
+ * @version $Id$
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
-
-#ifdef HAVE_MALLOC_H
-#include <malloc.h>
-#endif
-
-#ifdef HAVE_STRING_H
#include <string.h>
-#endif
+#include "iroptimize.h"
#include "scalar_replace.h"
#include "irflag_t.h"
#include "irouts.h"
#include "irgmod.h"
#include "irnode_t.h"
#include "irtools.h"
+#include "xmalloc.h"
#define SET_VNUM(node, vnum) set_irn_link(node, INT_TO_PTR(vnum))
#define GET_VNUM(node) (unsigned)PTR_TO_INT(get_irn_link(node))
set_insert(pathes, key, PATH_SIZE(key), path_hash(key));
SET_VNUM(sel, key->vnum);
- ARR_EXTO(ir_mode *, *modes, (key->vnum + 15) & ~15);
+ ARR_EXTO(ir_mode *, *modes, (int)((key->vnum + 15) & ~15));
(*modes)[key->vnum] = get_type_mode(get_entity_type(get_Sel_entity(sel)));
val = new_d_Conv(get_irn_dbg_info(node), val, mode);
turn_into_tuple(node, pn_Load_max);
- set_Tuple_pred(node, pn_Load_M, mem);
- set_Tuple_pred(node, pn_Load_res, val);
- set_Tuple_pred(node, pn_Load_X_except, new_Bad());
+ set_Tuple_pred(node, pn_Load_M, mem);
+ set_Tuple_pred(node, pn_Load_res, val);
+ set_Tuple_pred(node, pn_Load_X_regular, new_r_Jmp(current_ir_graph, block));
+ set_Tuple_pred(node, pn_Load_X_except, new_Bad());
} else {
l = obstack_alloc(&env->obst, sizeof(*l));
l->node = node;
value_arr[vnum] = val;
mem = get_Store_mem(node);
+ block = get_nodes_block(node);
turn_into_tuple(node, pn_Store_max);
- set_Tuple_pred(node, pn_Store_M, mem);
- set_Tuple_pred(node, pn_Store_X_except, new_Bad());
+ set_Tuple_pred(node, pn_Store_M, mem);
+ set_Tuple_pred(node, pn_Store_X_regular, new_r_Jmp(current_ir_graph, block));
+ set_Tuple_pred(node, pn_Store_X_except, new_Bad());
} else if (op == op_Phi && get_irn_mode(node) == mode_M) {
/*
* found a memory Phi: Here, we must create new Phi nodes
val = new_Unknown(env->modes[l->vnum]);
}
- mem = get_Load_mem(load);
/* Beware: A Load can contain a hidden conversion in Firm.
Handle this here. */
mode = get_Load_mode(load);
if (mode != get_irn_mode(val))
val = new_d_Conv(get_irn_dbg_info(load), val, mode);
+ mem = get_Load_mem(load);
+
turn_into_tuple(load, pn_Load_max);
- set_Tuple_pred(load, pn_Load_M, mem);
- set_Tuple_pred(load, pn_Load_res, val);
- set_Tuple_pred(load, pn_Load_X_except, new_Bad());
+ set_Tuple_pred(load, pn_Load_M, mem);
+ set_Tuple_pred(load, pn_Load_res, val);
+ set_Tuple_pred(load, pn_Load_X_regular, new_r_Jmp(current_ir_graph, block));
+ set_Tuple_pred(load, pn_Load_X_except, new_Bad());
}
}