diff options
author | Søren Sandmann Pedersen <ssp@redhat.com> | 2013-02-02 21:59:14 -0500 |
---|---|---|
committer | Søren Sandmann Pedersen <ssp@redhat.com> | 2013-02-02 21:59:14 -0500 |
commit | f8fc085b48c9f6e086a78d228aecd4d3af6abf76 (patch) | |
tree | 2f3f841dd50892b4399b838f12a72ca9b993f445 /simple-reg.c | |
parent | a204c0aceebdf9213a5e59087a6da50f12189787 (diff) |
various
Diffstat (limited to 'simple-reg.c')
-rw-r--r-- | simple-reg.c | 100 |
1 files changed, 49 insertions, 51 deletions
diff --git a/simple-reg.c b/simple-reg.c index e8d4911..a9eb75f 100644 --- a/simple-reg.c +++ b/simple-reg.c @@ -43,57 +43,55 @@ reg_context_init_internal (reg_context_t *ctx, return; } - else + + for (i = 0; i < pool->n_registers; ++i) { - for (i = 0; i < pool->n_registers; ++i) - { - ctx->info[i].reg = pool->registers[i]; + ctx->info[i].reg = pool->registers[i]; + + switch (parent->info[i].state) + { + case SPILLABLE: + if (preserved[i]) + { + /* Preserving a SPILLABLE register is nonsensical + * because SPILLABLE means the register was _never_ + * in use by the parent, and therefore can't have + * a meaningful value. + */ + fprintf (stderr, + "Asking to preserve a register that " + "was previously spilled"); + abort(); + } + ctx->info[i].state = SPILLABLE; + break; - switch (parent->info[i].state) - { - case SPILLABLE: - if (preserved[i]) - { - /* Preserving a SPILLABLE register is nonsensical - * because SPILLABLE means the register _never_ - * were in use by the parent, and therefore - * can't have a meaningful value. - */ - fprintf (stderr, - "Asking to preserve a register that " - "was previously spilled"); - abort(); - } - ctx->info[i].state = SPILLABLE; - break; - - case SPILLED: - case IN_USE: - if (preserved[i]) - ctx->info[i].state = IN_USE; - else - ctx->info[i].state = SPILLABLE; - break; - - case CLOBBERED: - case UNUSED: - if (preserved[i]) - { - /* Preserving an UNUSED or CLOBBERED - * register is not necessarily nonsensical. - * The user may know that the register in - * question was recently freed and not - * overwritten since. - */ - ctx->info[i].state = IN_USE; - } - else - { - ctx->info[i].state = UNUSED; - } - break; - } - } + case SPILLED: + case IN_USE: + if (preserved[i]) + ctx->info[i].state = IN_USE; + else + ctx->info[i].state = SPILLABLE; + break; + + case CLOBBERED: + case UNUSED: + if (preserved[i]) + { + /* Preserving an UNUSED or CLOBBERED + * register is not necessarily nonsensical. + * The user may know that the register in + * question was recently freed and not + * overwritten since. + */ + ctx->info[i].state = IN_USE; + } + else + { + ctx->info[i].state = UNUSED; + } + break; + } } } @@ -186,7 +184,7 @@ reg_context_alloc (reg_context_t *ctx, fragment_t *frag) } /* If that failed, we can't allocate a register */ - return (op_t)-1; + return (op_t)0; } /* When a register is freed, it doesn't become invalid @@ -328,7 +326,7 @@ reg_context_fini (reg_context_t *ctx, fragment_t *frag, op_t new_location; new_location = reg_context_alloc (parent, frag); - if (new_location == (op_t)-1) + if (new_location == (op_t)0) return FALSE; fragment_assemble ( |