nvc0: store only one value per basic block for TGSI regs
authorChristoph Bumiller <e0425955@student.tuwien.ac.at>
Mon, 7 Feb 2011 18:05:55 +0000 (19:05 +0100)
committerChristoph Bumiller <e0425955@student.tuwien.ac.at>
Wed, 9 Feb 2011 15:05:00 +0000 (16:05 +0100)
src/gallium/drivers/nvc0/nvc0_tgsi_to_nc.c

index f53af6c..8c0967d 100644 (file)
@@ -63,7 +63,13 @@ bld_register_access(struct bld_register *reg, unsigned i)
 static INLINE void
 bld_register_add_val(struct bld_register *reg, struct nv_value *val)
 {
-   util_dynarray_append(&reg->vals, struct nv_value *, val);
+   struct nv_basic_block *bb = val->insn->bb;
+
+   if (reg->vals.size &&
+       (util_dynarray_top(&reg->vals, struct nv_value *))->insn->bb == bb)
+      *(util_dynarray_top_ptr(&reg->vals, struct nv_value *)) = val;
+   else
+      util_dynarray_append(&reg->vals, struct nv_value *, val);
 }
 
 static INLINE boolean