- const arch_register_class_t *cls = arch_register_get_class(reg);
- int n_regs = arch_register_class_n_regs(cls);
- bitset_t *bs = bitset_alloca(n_regs);
-
- arch_get_allocatable_regs(env, irn, pos, cls, bs);
- return bitset_is_set(bs, arch_register_get_index(reg));
+ int res = 0;
+ arch_register_req_t req;
+
+ arch_get_register_req(env, &req, irn, pos);
+ switch(req.type) {
+ case arch_register_req_type_normal:
+ case arch_register_req_type_should_be_different:
+ case arch_register_req_type_should_be_same:
+ res = req.cls == reg->reg_class;
+ break;
+ case arch_register_req_type_limited:
+ {
+ bitset_t *bs = bitset_alloca(req.cls->n_regs);
+ req.limited(irn, pos, bs);
+ res = bitset_is_set(bs, arch_register_get_index(reg));
+ }
+ break;
+ default:
+ res = 0;
+ }
+
+ return res;