[Mesa-dev] [PATCH] tgsi: keep track of read vs written indirects

Rob Clark robdclark at gmail.com
Sun Jan 4 05:21:34 PST 2015


From: Rob Clark <robclark at freedesktop.org>

At least temporarily, I need to fallback to old compiler still for
relative dest (for freedreno), but I can do relative src temp.  Only
a temporary situation, but seems easy/reasonable for tgsi-scan to
track this.

Signed-off-by: Rob Clark <robclark at freedesktop.org>
---
I could always keep temp indirect support on a branch until the RA can
also handle indirect dest.  But I would at least like to keep things
split up into smaller patches (and still bisectable).

 src/gallium/auxiliary/tgsi/tgsi_scan.c | 2 ++
 src/gallium/auxiliary/tgsi/tgsi_scan.h | 6 ++++++
 2 files changed, 8 insertions(+)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c b/src/gallium/auxiliary/tgsi/tgsi_scan.c
index eb313e4..2b44271 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c
@@ -130,6 +130,7 @@ tgsi_scan_shader(const struct tgsi_token *tokens,
                /* check for indirect register reads */
                if (src->Register.Indirect) {
                   info->indirect_files |= (1 << src->Register.File);
+                  info->indirect_files_read |= (1 << src->Register.File);
                }
 
                /* MSAA samplers */
@@ -150,6 +151,7 @@ tgsi_scan_shader(const struct tgsi_token *tokens,
                const struct tgsi_full_dst_register *dst = &fullinst->Dst[i];
                if (dst->Register.Indirect) {
                   info->indirect_files |= (1 << dst->Register.File);
+                  info->indirect_files_written |= (1 << dst->Register.File);
                }
             }
 
diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.h b/src/gallium/auxiliary/tgsi/tgsi_scan.h
index 375f75a..93a9898 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.h
@@ -93,6 +93,12 @@ struct tgsi_shader_info
     * indirect addressing.  The bits are (1 << TGSI_FILE_x), etc.
     */
    unsigned indirect_files;
+   /**
+    * Bitmask indicating which register files are read / written with
+    * indirect addressing.  The bits are (1 << TGSI_FILE_x).
+    */
+   unsigned indirect_files_read;
+   unsigned indirect_files_written;
 
    unsigned properties[TGSI_PROPERTY_COUNT]; /* index with TGSI_PROPERTY_ */
 };
-- 
2.1.0



More information about the mesa-dev mailing list