diff options
| author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-12-17 11:38:21 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-07 21:06:10 -0700 |
| commit | a8b467d262da4b184018e864a322d69f2bd2ca49 (patch) | |
| tree | 451c88925a35ad38e38b8a3dca41dcb20b6372aa /example.c | |
| parent | b65b8dc1302cc334b14c3f532b7684db9c551a75 (diff) | |
| download | sparse-dev-a8b467d262da4b184018e864a322d69f2bd2ca49.tar.gz | |
Make "fill_reg" do somewhat the right thing when we take the
address of a symbol.
Not quite there..
Diffstat (limited to 'example.c')
| -rw-r--r-- | example.c | 29 |
1 files changed, 28 insertions, 1 deletions
@@ -526,6 +526,14 @@ static struct hardreg *find_in_reg(struct bb_state *state, pseudo_t pseudo) return NULL; } +static void flush_pseudo(struct bb_state *state, pseudo_t pseudo, struct storage *storage) +{ + struct hardreg *reg = find_in_reg(state, pseudo); + + if (reg) + flush_reg(state, reg); +} + static void flush_cc_cache_to_reg(struct bb_state *state, pseudo_t pseudo, struct hardreg *reg) { int opcode = state->cc_opcode; @@ -576,7 +584,26 @@ static struct hardreg *fill_reg(struct bb_state *state, struct hardreg *hardreg, output_insn(state, "movl $%lld,%s", pseudo->value, hardreg->name); break; case PSEUDO_SYM: - output_insn(state, "movl $<%s>,%s", show_pseudo(pseudo), hardreg->name); + src = find_pseudo_storage(state, pseudo, NULL); + /* Static thing? */ + if (!src) { + output_insn(state, "movl $<%s>,%s", show_pseudo(pseudo), hardreg->name); + break; + } + switch (src->storage->type) { + case REG_REG: + /* Aiaiaiaiaii! Need to flush it to temporary memory */ + src = find_or_create_hash(pseudo, &state->internal); + /* Fallthrough */ + default: + alloc_stack(state, src->storage); + /* Fallthrough */ + case REG_STACK: + case REG_FRAME: + flush_pseudo(state, pseudo, src->storage); + output_insn(state, "leal %s,%s", show_memop(src->storage), hardreg->name); + break; + } break; case PSEUDO_ARG: case PSEUDO_REG: |
