4 * Copyright: (c) Universitaet Karlsruhe
5 * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
12 #include "irgraph_t.h"
19 #include "besched_t.h"
20 #include "beconstrperm.h"
22 static void walker_insert_constr_perms(ir_node *bl, void *env) {
24 be_chordal_env_t *cenv = env;
25 const be_main_env_t *menv = cenv->main_env;
26 const arch_env_t *aenv = menv->arch_env;
27 arch_register_req_t req;
30 sched_foreach(bl, irn) {
31 /* check for a restriction of the result (-1) or one of the operands (0..n) */
32 max = get_irn_arity(irn);
33 for(pos=-1; pos<max; ++pos) {
34 arch_get_register_req(aenv, &req, irn, pos);
35 /* if a restriction is found, insert a perm before the irn */
36 if (cenv->cls == arch_get_irn_reg_class(aenv, irn, pos) && req.type == arch_register_req_type_limited) {
37 insert_Perm_after(menv, cenv->cls, cenv->dom_front, sched_prev(irn));
38 /* TODO: Next line is overkill. Update_liveness would suffice. */
39 be_liveness(get_irn_irg(bl));
46 void be_insert_constr_perms(be_chordal_env_t *cenv) {
47 irg_block_walk_graph(cenv->irg, walker_insert_constr_perms, NULL, cenv);