pan/bi: Use canonical name for segments
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fri, 27 Nov 2020 18:28:33 +0000 (13:28 -0500)
committerMarge Bot <eric+marge@anholt.net>
Wed, 23 Dec 2020 17:06:57 +0000 (17:06 +0000)
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8213>

src/panfrost/bifrost/bi_print.c
src/panfrost/bifrost/bi_ra.c
src/panfrost/bifrost/bifrost_compile.c
src/panfrost/bifrost/compiler.h
src/panfrost/bifrost/gen_pack.py

index 0f3f14e..78bf455 100644 (file)
 #include "bi_print_common.h"
 
 static const char *
-bi_segment_name(enum bi_segment seg)
+bi_seg_name(enum bi_seg seg)
 {
         switch (seg) {
-        case BI_SEGMENT_NONE: return "global";
-        case BI_SEGMENT_WLS:  return "wls";
-        case BI_SEGMENT_UBO:  return "ubo";
-        case BI_SEGMENT_TLS:  return "tls";
+        case BI_SEG_NONE: return "global";
+        case BI_SEG_WLS:  return "wls";
+        case BI_SEG_UBO:  return "ubo";
+        case BI_SEG_TL:  return "tls";
         default: return "invalid";
         }
 }
@@ -335,7 +335,7 @@ bi_print_instruction(bi_instruction *ins, FILE *fp)
                 fprintf(fp, ".v%u", ins->vector_channels);
 
         if (ins->segment)
-                fprintf(fp, ".%s", bi_segment_name(ins->segment));
+                fprintf(fp, ".%s", bi_seg_name(ins->segment));
 
         if (ins->dest)
                 pan_print_alu_type(ins->dest_type, fp);
index 3936c47..3f12806 100644 (file)
@@ -193,7 +193,7 @@ bi_spill(unsigned node, uint64_t offset, unsigned channels)
 {
         bi_instruction store = {
                 .type = BI_STORE,
-                .segment = BI_SEGMENT_TLS,
+                .segment = BI_SEG_TL,
                 .vector_channels = channels,
                 .src = {
                         node,
@@ -216,7 +216,7 @@ bi_fill(unsigned node, uint64_t offset, unsigned channels)
 {
         bi_instruction load = {
                 .type = BI_LOAD,
-                .segment = BI_SEGMENT_TLS,
+                .segment = BI_SEG_TL,
                 .vector_channels = channels,
                 .dest = node,
                 .dest_type = nir_type_uint32,
@@ -329,7 +329,7 @@ bi_spill_register(bi_context *ctx, unsigned node, unsigned offset)
                         if (!bi_has_arg(ins, node)) continue;
 
                         /* Don't rewrite spills themselves */
-                        if (ins->segment == BI_SEGMENT_TLS) continue;
+                        if (ins->segment == BI_SEG_TL) continue;
 
                         unsigned index = bi_make_temp(ctx);
 
index 9030818..546d350 100644 (file)
@@ -500,7 +500,7 @@ bi_emit_ld_ubo(bi_context *ctx, nir_intrinsic_instr *instr)
 
         bi_instruction ld = {
                 .type = BI_LOAD_UNIFORM,
-                .segment = BI_SEGMENT_UBO,
+                .segment = BI_SEG_UBO,
                 .vector_channels = instr->num_components,
                 .src_types = { nir_type_uint32, nir_type_uint32 },
                 .dest = pan_dest_index(&instr->dest),
@@ -541,7 +541,7 @@ bi_emit_sysval(bi_context *ctx, nir_instr *instr,
 
         bi_instruction load = {
                 .type = BI_LOAD_UNIFORM,
-                .segment = BI_SEGMENT_UBO,
+                .segment = BI_SEG_UBO,
                 .vector_channels = nr_components,
                 .src = { BIR_INDEX_CONSTANT, BIR_INDEX_ZERO },
                 .src_types = { nir_type_uint32, nir_type_uint32 },
index 0f3a2b0..e356b01 100644 (file)
@@ -170,23 +170,23 @@ enum bi_cond {
  * instructions for address calculation, and directly in SEG_ADD/SEG_SUB
  * instructions. */
 
-enum bi_segment {
+enum bi_seg {
         /* No segment (use global addressing, offset from GPU VA 0x0) */
-        BI_SEGMENT_NONE = 1,
+        BI_SEG_NONE = 1,
 
         /* Within workgroup local memory (shared memory). Relative to
          * wls_base_pointer in the draw's thread storage descriptor */
-        BI_SEGMENT_WLS = 2,
+        BI_SEG_WLS = 2,
 
         /* Within one of the bound uniform buffers. Low 32-bits are the index
          * within the uniform buffer; high 32-bits are the index of the uniform
          * buffer itself. Relative to the uniform_array_pointer indexed within
          * the draw's uniform remap table indexed by the high 32-bits. */
-        BI_SEGMENT_UBO = 4,
+        BI_SEG_UBO = 4,
 
         /* Within thread local storage (for spilling). Relative to
          * tls_base_pointer in the draw's thread storage descriptor */
-        BI_SEGMENT_TLS = 7
+        BI_SEG_TL = 7
 };
 
 /* Opcodes within a class */
@@ -375,7 +375,7 @@ typedef struct {
         enum bi_cond cond;
 
         /* For memory ops, base address */
-        enum bi_segment segment;
+        enum bi_seg segment;
 
         /* Can we spill the value written here? Used to prevent
          * useless double fills */
index 3f188a0..af3b286 100644 (file)
@@ -204,8 +204,8 @@ def pack_seg(mod, opts, body, pack_exprs):
         body.append('assert(ins->segment);')
         return 'ins->segment'
     elif opts == ['none', 'wls']:
-        body.append('assert(ins->segment == BI_SEGMENT_NONE || ins->segment == BI_SEGMENT_WLS);')
-        return 'ins->segment == BI_SEGMENT_WLS ? 1 : 0'
+        body.append('assert(ins->segment == BI_SEG_NONE || ins->segment == BI_SEG_WLS);')
+        return 'ins->segment == BI_SEG_WLS ? 1 : 0'
     else:
         assert(False)