diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-12-07 14:08:47 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-07 21:05:35 -0700 |
commit | 2d8d9bda591831a9d0acc478f7d3b8fa35032b6e (patch) | |
tree | 3d14bcc9b65c1f94ad0036d45668ba9f89801862 /liveness.c | |
parent | Don't output code for static/toplevel symbols. (diff) | |
download | sparse-2d8d9bda591831a9d0acc478f7d3b8fa35032b6e.tar.gz sparse-2d8d9bda591831a9d0acc478f7d3b8fa35032b6e.tar.bz2 sparse-2d8d9bda591831a9d0acc478f7d3b8fa35032b6e.zip |
Make OP_PHISOURCE track the OP_PHI instructions that it defines.
This allows us to always see which pseudos are nonlocally affected
by the phi source.
We can only do this after the instruction flow is fixed, together
with the OP_DEATHNOTE phase.
Diffstat (limited to 'liveness.c')
-rw-r--r-- | liveness.c | 17 |
1 files changed, 16 insertions, 1 deletions
@@ -92,7 +92,7 @@ static void track_instruction_usage(struct basic_block *bb, struct instruction * * We don't care about the phi-source define, they get set * up and expanded by the OP_PHI */ - USES(src1); + USES(phi_src); break; case OP_CAST: @@ -272,6 +272,19 @@ static void merge_pseudo_list(struct pseudo_list *src, struct pseudo_list **dest } END_FOR_EACH_PTR(pseudo); } +static void track_phi_uses(struct instruction *insn) +{ + pseudo_t phi; + FOR_EACH_PTR(insn->phi_list, phi) { + struct instruction *def; + if (phi == VOID || !phi->def) + continue; + def = phi->def; + assert(def->opcode == OP_PHISOURCE); + add_ptr_list(&def->phi_users, insn); + } END_FOR_EACH_PTR(phi); +} + static struct pseudo_list **live_list; static struct pseudo_list *dead_list; @@ -301,6 +314,8 @@ static void track_pseudo_death_bb(struct basic_block *bb) FOR_EACH_PTR_REVERSE(bb->insns, insn) { if (!insn->bb) continue; + if (insn->opcode == OP_PHI) + track_phi_uses(insn); dead_list = NULL; track_instruction_usage(bb, insn, death_def, death_use); if (dead_list) { |