aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@looxix.net>2005-11-24 02:07:16 +0100
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-25 16:16:32 -0800
commit3ff22243cbc38719ab16d8c1f25605892337012b (patch)
treea8c02ef8e2bf78738e716bf0c1689805a8a43a4e /unssa.c
parent[PATCH] Made __GNUC__ et.al. weak defines, so that we could override them wit... (diff)
downloadsparse-3ff22243cbc38719ab16d8c1f25605892337012b.tar.gz
sparse-3ff22243cbc38719ab16d8c1f25605892337012b.tar.bz2
sparse-3ff22243cbc38719ab16d8c1f25605892337012b.zip
[PATCH] unssa: update the liveness info.
I'm not 100% sure it is done correctly, but at least it gives sensible results. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@looxix.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'unssa.c')
-rw-r--r--unssa.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/unssa.c b/unssa.c
index 8a8359c..bb0802d 100644
--- a/unssa.c
+++ b/unssa.c
@@ -28,13 +28,29 @@
#include "allocate.h"
#include <assert.h>
+
+static void remove_phisrc_defines(struct instruction *phisrc)
+{
+ struct instruction *phi;
+ struct basic_block *bb = phisrc->bb;
+
+ FOR_EACH_PTR(phisrc->phi_users, phi) {
+ remove_pseudo(&bb->defines, phi->target);
+ } END_FOR_EACH_PTR(phi);
+}
+
static void replace_phi_node(struct instruction *phi)
{
pseudo_t tmp;
tmp = alloc_pseudo(NULL);
tmp->type = phi->target->type;
+ tmp->ident = phi->target->ident;
tmp->def = NULL; // defined by all the phisrc
+
+ // update the current liveness
+ remove_pseudo(&phi->bb->needs, phi->target);
+ add_pseudo(&phi->bb->needs, tmp);
phi->opcode = OP_COPY;
phi->src = tmp;
@@ -97,6 +113,10 @@ static void rewrite_phisrc_bb(struct basic_block *bb)
INSERT_CURRENT(copy, insn);
}
+ // update the liveness info
+ remove_phisrc_defines(insn);
+ // FIXME: should really something like add_pseudo_exclusive()
+ add_pseudo(&bb->defines, tmp);
i++;
} END_FOR_EACH_PTR(phi);