-static void handle_constraints_walker(ir_node *irn, void *env) {
- be_raext_env_t *raenv = env;
- arch_register_req_t req;
- int pos, max;
-
- /* handle output constraints
- * user -> irn becomes user -> cpy -> irn
- */
- arch_get_register_req(raenv->aenv, &req, irn, -1);
- if (arch_register_req_is(&req, limited)) {
- ir_node *cpy = be_new_Copy(req.cls, raenv->irg, get_nodes_block(irn), irn);
- const ir_edge_t *edge;
-
- /* all users of the irn use the copy instead */
- sched_add_after(irn, cpy);
- foreach_out_edge(irn, edge)
- set_irn_n(edge->src, edge->pos, cpy);
- }
-
-
- /* handle input constraints by converting them into output constraints
- * of copies of the former argument
- * irn -> arg becomes irn -> copy -> arg
- */
- for (pos = 0, max = get_irn_arity(irn); pos<max; ++pos) {
- arch_get_register_req(raenv->aenv, &req, irn, pos);
- if (arch_register_req_is(&req, limited)) {
- ir_node *arg = get_irn_n(irn, pos);
- ir_node *cpy = be_new_Copy(req.cls, raenv->irg, get_nodes_block(irn), arg);
-
- /* use the copy instead */
- sched_add_before(irn, cpy);
- set_irn_n(irn, pos, cpy);
-
- /* set an out constraint for the copy */
- arch_set_register_req(raenv->aenv, -1, &req); /* TODO */
- }
- }
-}
-
-static void handle_constraints(be_raext_env_t *raenv) {
- irg_block_walk_graph(raenv->irg, NULL, handle_constraints_walker, raenv);
-}
-
-
-/******************************************************************************
- _____ _____ _____ _
- / ____/ ____| /\ | __ \ | |
- | (___| (___ / \ ______| | | | ___ ___| |_ _ __
- \___ \\___ \ / /\ \______| | | |/ _ \/ __| __| '__|
- ____) |___) / ____ \ | |__| | __/\__ \ |_| |
- |_____/_____/_/ \_\ |_____/ \___||___/\__|_|
-
- *****************************************************************************/