* @brief Spill module selection; Preparation steps
* @author Matthias Braun
* @date 29.09.2005
- * @version $Id$
*/
#include "config.h"
unsigned *tmp = NULL;
unsigned *def_constr = NULL;
int arity = get_irn_arity(node);
+ ir_node *def;
int i, i2;
*/
for (i = 0; i < arity; ++i) {
ir_node *op = get_irn_n(node, i);
- const arch_register_req_t *req = arch_get_register_req(node, i);
+ const arch_register_req_t *req = arch_get_irn_register_req_in(node, i);
const arch_register_t *reg;
ir_node *copy;
if (rbitset_is_set(req->limited, reg->index))
continue;
- copy = be_new_Copy(cls, block, op);
+ copy = be_new_Copy(block, op);
stat_ev_int("constr_copy", 1);
sched_add_before(node, copy);
set_irn_n(node, i, copy);
ir_node *copy;
const arch_register_req_t *req;
- req = arch_get_register_req(node, i);
+ req = arch_get_irn_register_req_in(node, i);
if (req->cls != cls)
continue;
ir_node *in2;
const arch_register_req_t *req2;
- req2 = arch_get_register_req(node, i2);
+ req2 = arch_get_irn_register_req_in(node, i2);
if (req2->cls != cls)
continue;
if (! (req2->type & arch_register_req_type_limited))
if (rbitsets_equal(req->limited, req2->limited, cls->n_regs))
continue;
- copy = be_new_Copy(cls, block, in);
+ copy = be_new_Copy(block, in);
stat_ev_int("constr_copy", 1);
sched_add_before(node, copy);
}
/* collect all registers occurring in out constraints. */
- if (get_irn_mode(node) == mode_T) {
- const ir_edge_t *edge;
-
- foreach_out_edge(node, edge) {
- ir_node *proj = get_edge_src_irn(edge);
- const arch_register_req_t *req = arch_get_register_req_out(proj);
- if (! (req->type & arch_register_req_type_limited))
- continue;
-
- if (def_constr == NULL) {
- rbitset_alloca(def_constr, cls->n_regs);
- }
- rbitset_or(def_constr, req->limited, cls->n_regs);
- }
- } else {
- const arch_register_req_t *req = arch_get_register_req_out(node);
- if (req->type & arch_register_req_type_limited) {
+ be_foreach_definition(node, cls, def,
+ if (! (req_->type & arch_register_req_type_limited))
+ continue;
+ if (def_constr == NULL) {
rbitset_alloca(def_constr, cls->n_regs);
- rbitset_or(def_constr, req->limited, cls->n_regs);
}
- }
+ rbitset_or(def_constr, req_->limited, cls->n_regs);
+ );
/* no output constraints => we're good */
if (def_constr == NULL) {
* 2) lives through the node.
* 3) is constrained to a register occurring in out constraints.
*/
- req = arch_get_register_req(node, i);
+ req = arch_get_irn_register_req_in(node, i);
if (req->cls != cls)
continue;
if (!(req->type & arch_register_req_type_limited))
if (be_is_Copy(in))
continue;
- copy = be_new_Copy(cls, block, in);
+ copy = be_new_Copy(block, in);
sched_add_before(node, copy);
set_irn_n(node, i, copy);
DBG((dbg, LEVEL_3, "inserting constr copy %+F for %+F pos %d\n",
env.irg = irg;
env.cls = cls;
- be_assure_liveness(irg);
+ be_assure_live_sets(irg);
irg_block_walk_graph(irg, pre_spill_prepare_constr_walker, NULL, &env);
}