diff options
| author | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-22 19:35:07 -0800 |
|---|---|---|
| committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-22 19:35:07 -0800 |
| commit | 7e58336770b4102d1dac4b90a6a8310e3b81e18e (patch) | |
| tree | babb3ef0c4737e51538940ef9996c489e95e8ef1 | |
| parent | 3108192d73f1912cee8afdcd328d7eb1d724da64 (diff) | |
| download | sparse-dev-7e58336770b4102d1dac4b90a6a8310e3b81e18e.tar.gz | |
example: OP_COPY must destroy any old pseudo state
Toto, I have a feeling We're not in SSA land any more.
(Not that it really helps. The example compiler not only had SSA
assumptions, it also depended on liveness information and insn->def
state, both of which are destroyed by the un-ssa phase. So this is
really a small bandage around a much larger problem, and doesn't really
fix anything fundamental).
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
| -rw-r--r-- | example.c | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -996,9 +996,33 @@ static void generate_load(struct instruction *insn, struct bb_state *state) output_insn(state, "mov.%d %s,%s", insn->size, input, dst->name); } +static void kill_pseudo(struct bb_state *state, pseudo_t pseudo) +{ + int i; + struct hardreg *reg; + + output_comment(state, "killing pseudo %s", show_pseudo(pseudo)); + for (i = 0; i < REGNO; i++) { + pseudo_t p; + + reg = hardregs + i; + FOR_EACH_PTR(reg->contains, p) { + if (p != pseudo) + continue; + if (CURRENT_TAG(p) & TAG_DEAD) + reg->dead--; + output_comment(state, "removing pseudo %s from reg %s", + show_pseudo(pseudo), reg->name); + DELETE_CURRENT_PTR(p); + } END_FOR_EACH_PTR(p); + PACK_PTR_LIST(®->contains); + } +} + static void generate_copy(struct bb_state *state, struct instruction *insn) { struct hardreg *src = getreg(state, insn->src, insn->target); + kill_pseudo(state, insn->target); add_pseudo_reg(state, insn->target, src); } |
