summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/nv50/nv50_pc.c
diff options
context:
space:
mode:
authorChristoph Bumiller <e0425955@student.tuwien.ac.at>2010-07-25 22:21:38 +0200
committerChristoph Bumiller <e0425955@student.tuwien.ac.at>2010-07-26 11:20:28 +0200
commit5811c6926450c4aafd2f9c87a2c6fe73b517f2c6 (patch)
tree320dd61d777b5fbb36744955da1377eccc501e6f /src/gallium/drivers/nv50/nv50_pc.c
parentbb9d634730b7e97050e50d9238764a99099fbc7f (diff)
nv50: simple reload elimination and local CSE
Diffstat (limited to 'src/gallium/drivers/nv50/nv50_pc.c')
-rw-r--r--src/gallium/drivers/nv50/nv50_pc.c18
1 files changed, 18 insertions, 0 deletions
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)
{