aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/example.c
diff options
authorLinus Torvalds <torvalds@ppc970.osdl.org>2004-12-08 18:19:34 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-07 21:05:41 -0700
commita01ebd7c81e95f461736cf00f94fecabdcacac38 (patch)
tree7745940f4a8a58cc04e1f89bddbd9b0a251da74a /example.c
parent962279e898a2701f3f3b8acce30d2649055b55e3 (diff)
downloadsparse-dev-a01ebd7c81e95f461736cf00f94fecabdcacac38.tar.gz
If we don't have any pre-defined incoming storage, select
something. If we can try to go for a register, all the better.
Diffstat (limited to 'example.c')
-rw-r--r--example.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/example.c b/example.c
index cfc2452d..58fb30fc 100644
--- a/example.c
+++ b/example.c
@@ -15,7 +15,8 @@ struct hardreg {
const char *name;
pseudo_t contains;
unsigned busy:1,
- dirty:1;
+ dirty:1,
+ used:1;
};
static void output_bb(struct basic_block *bb, unsigned long generation);
@@ -97,6 +98,7 @@ static void flush_reg(struct bb_state *state, struct hardreg *hardreg)
return;
hardreg->busy = 0;
hardreg->dirty = 0;
+ hardreg->used = 1;
pseudo = hardreg->contains;
if (!pseudo)
return;
@@ -159,6 +161,14 @@ static struct hardreg *fill_reg(struct bb_state *state, struct hardreg *hardreg,
break;
}
}
+ if (src->storage->type == REG_UDEF) {
+ if (!hardreg->used) {
+ src->storage->type = REG_REG;
+ src->storage->regno = hardreg - hardregs;
+ break;
+ }
+ alloc_stack(state, src->storage);
+ }
printf("\tmov.%d %s,%s\n", 32, show_memop(src->storage), hardreg->name);
break;
default:
@@ -516,6 +526,7 @@ static void generate(struct basic_block *bb, struct bb_state *state)
hardregs[i].contains = NULL;
hardregs[i].busy = 0;
hardregs[i].dirty = 0;
+ hardregs[i].used = 0;
}
FOR_EACH_PTR(state->inputs, entry) {