Mesa (master): i965/fs: Use the new convenience interface for setting up reg conflicts.

Eric Anholt anholt at kemper.freedesktop.org
Wed Aug 10 18:16:51 UTC 2011


Module: Mesa
Branch: master
Commit: bbcf13adbe525bd389a65ba15dd7831a56b8b13c
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=bbcf13adbe525bd389a65ba15dd7831a56b8b13c

Author: Eric Anholt <eric at anholt.net>
Date:   Wed May  4 13:31:01 2011 -0700

i965/fs: Use the new convenience interface for setting up reg conflicts.

That code I wrote was impenetrable, and hard to write the first time.
This makes things a lot more obvious.

---

 src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp |   29 +++++----------------
 1 files changed, 7 insertions(+), 22 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp b/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp
index 78daa49..f246ac4 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp
@@ -157,29 +157,14 @@ fs_visitor::assign_regs()
       classes[i] = ra_alloc_reg_class(regs);
 
       for (int i_r = 0; i_r < class_reg_count[i]; i_r++) {
-	 ra_class_add_reg(regs, classes[i], class_base_reg[i] + i_r);
-      }
+	 int class_reg = class_base_reg[i] + i_r;
 
-      /* Add conflicts between our contiguous registers aliasing
-       * base regs and other register classes' contiguous registers
-       * that alias base regs, or the base regs themselves for classes[0].
-       */
-      for (int c = 0; c <= i; c++) {
-	 for (int i_r = 0; i_r < class_reg_count[i]; i_r++) {
-	    for (int c_r = MAX2(0, i_r - (class_sizes[c] - 1));
-		 c_r < MIN2(class_reg_count[c], i_r + class_sizes[i]);
-		 c_r++) {
-
-	       if (0) {
-		  printf("%d/%d conflicts %d/%d\n",
-			 class_sizes[i], first_assigned_grf + i_r,
-			 class_sizes[c], first_assigned_grf + c_r);
-	       }
-
-	       ra_add_reg_conflict(regs,
-				   class_base_reg[i] + i_r,
-				   class_base_reg[c] + c_r);
-	    }
+	 ra_class_add_reg(regs, classes[i], class_reg);
+
+	 for (int base_reg = i_r;
+	      base_reg < i_r + class_sizes[i];
+	      base_reg++) {
+	    ra_add_transitive_reg_conflict(regs, base_reg, class_reg);
 	 }
       }
    }




More information about the mesa-commit mailing list