X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fbearch.c;h=942e7f51d0ad78969c769e80cd35a0a0cbf324f9;hb=dd4cd761ab637d4488c7e29f49843b1b02366acf;hp=8aeb0c617573d9b3cf74a439c73570b13f3e35e4;hpb=c23b55879df97f49fc6f1e95651f9f28a980b620;p=libfirm diff --git a/ir/be/bearch.c b/ir/be/bearch.c index 8aeb0c617..942e7f51d 100644 --- a/ir/be/bearch.c +++ b/ir/be/bearch.c @@ -42,23 +42,25 @@ #include "irprintf.h" /* Initialize the architecture environment struct. */ -arch_env_t *arch_env_init(arch_env_t *env, const arch_isa_if_t *isa_if, FILE *file_handle, be_main_env_t *main_env) +arch_env_t *arch_env_init(const arch_isa_if_t *isa_if, FILE *file_handle, be_main_env_t *main_env) { - memset(env, 0, sizeof(*env)); - env->isa = isa_if->init(file_handle); - env->isa->main_env = main_env; - return env; + arch_env_t *arch_env = isa_if->init(file_handle); + arch_env->main_env = main_env; + return arch_env; } -int arch_register_class_put(const arch_register_class_t *cls, bitset_t *bs) +/** + * Put all registers in a class into a bitset. + * @param cls The class. + * @param bs The bitset. + * @return The number of registers in the class. + */ +static int arch_register_class_put(const arch_register_class_t *cls, bitset_t *bs) { - if(bs) { - int i, n; - for(i = 0, n = cls->n_regs; i < n; ++i) - bitset_set(bs, i); - } - - return cls->n_regs; + int i, n = cls->n_regs; + for (i = n - 1; i >= 0; --i) + bitset_set(bs, i); + return n; } /** @@ -333,7 +335,7 @@ extern char *arch_register_req_format(char *buf, size_t len, } } - if(arch_register_req_is(req, should_be_different)) { + if (arch_register_req_is(req, must_be_different)) { const unsigned other = req->other_different; int i;