/*
- * 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.
*/
/**
static void clear_defs(ir_node *node)
{
/* clear values defined */
- if (get_irn_mode(node) == mode_T) {
- foreach_out_edge(node, edge) {
- ir_node *proj = get_edge_src_irn(edge);
- clear_reg_value(proj);
- }
- } else {
- clear_reg_value(node);
- }
+ be_foreach_value(node, value,
+ clear_reg_value(value);
+ );
}
static void set_uses(ir_node *node)
}
}
-void be_peephole_new_node(ir_node * nw)
-{
- be_liveness_introduce(lv, nw);
-}
-
/**
* must be called from peephole optimisations before a node will be killed
* and its users will be redirected to new_node.
be_peephole_before_exchange(old, nw);
sched_remove(old);
exchange(old, nw);
- be_peephole_new_node(nw);
+ be_liveness_introduce(lv, nw);
}
/**
return false;
/* schedpoint must not overwrite registers of our inputs */
- unsigned n_outs = arch_get_irn_n_outs(schedpoint);
for (int i = 0; i < node_arity; ++i) {
ir_node *in = get_irn_n(node, i);
const arch_register_t *reg = arch_get_irn_register(in);
continue;
const arch_register_req_t *in_req
= arch_get_irn_register_req_in(node, i);
- for (unsigned o = 0; o < n_outs; ++o) {
+ be_foreach_out(schedpoint, o) {
const arch_register_t *outreg
= arch_get_irn_register_out(schedpoint, o);
const arch_register_req_t *outreq
bool be_can_move_up(ir_heights_t *heights, const ir_node *node,
const ir_node *after)
{
- unsigned n_outs = arch_get_irn_n_outs(node);
const ir_node *node_block = get_nodes_block(node);
const ir_node *after_block = get_block_const(after);
const ir_node *schedpoint;
be_lv_foreach(lv, succ, be_lv_state_in, live_node) {
const arch_register_t *reg = arch_get_irn_register(live_node);
const arch_register_req_t *req = arch_get_irn_register_req(live_node);
- for (unsigned o = 0; o < n_outs; ++o) {
+ be_foreach_out(node, o) {
const arch_register_t *outreg
= arch_get_irn_register_out(node, o);
const arch_register_req_t *outreq
break;
const arch_register_t *reg = arch_get_irn_register(phi);
const arch_register_req_t *req = arch_get_irn_register_req(phi);
- for (unsigned o = 0; o < n_outs; ++o) {
+ be_foreach_out(node, o) {
const arch_register_t *outreg
= arch_get_irn_register_out(node, o);
const arch_register_req_t *outreq
continue;
const arch_register_req_t *in_req
= arch_get_irn_register_req_in(schedpoint, i);
- for (unsigned o = 0; o < n_outs; ++o) {
+ be_foreach_out(node, o) {
const arch_register_t *outreg
= arch_get_irn_register_out(node, o);
const arch_register_req_t *outreq
void be_peephole_opt(ir_graph *irg)
{
-#if 0
- /* we sometimes find BadE nodes in float apps like optest_float.c or
- * kahansum.c for example... */
- be_invalidate_live_sets(irg);
-#endif
be_assure_live_sets(irg);
arch_env = be_get_irg_arch_env(irg);