From 5811c6926450c4aafd2f9c87a2c6fe73b517f2c6 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Sun, 25 Jul 2010 22:21:38 +0200 Subject: nv50: simple reload elimination and local CSE --- src/gallium/drivers/nv50/nv50_pc.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/gallium/drivers/nv50/nv50_pc.c') diff --git a/src/gallium/drivers/nv50/nv50_pc.c b/src/gallium/drivers/nv50/nv50_pc.c index 89dbc7aa20..e09f94074d 100644 --- a/src/gallium/drivers/nv50/nv50_pc.c +++ b/src/gallium/drivers/nv50/nv50_pc.c @@ -163,6 +163,24 @@ nv_nvi_refcount(struct nv_instruction *nvi) return rc; } +int +nvcg_replace_value(struct nv_pc *pc, struct nv_value *old_val, + struct nv_value *new_val) +{ + int i, n; + + if (old_val == new_val) + return old_val->refc; + + for (i = 0, n = 0; i < pc->num_refs; ++i) { + if (pc->refs[i]->value == old_val) { + ++n; + nv_reference(pc, &pc->refs[i], new_val); + } + } + return n; +} + static void nv_pc_free_refs(struct nv_pc *pc) { -- cgit v1.2.3