[Mesa-dev] [PATCH 1/7] nir: Use uint8_t instead of unsigned for nir_intrinsic_info fields

Jason Ekstrand jason at jlekstrand.net
Fri May 27 01:30:31 UTC 2016


This cuts the .data section of nir_intrinsics.o by 60%:

   text     data      bss      dec      hex  filename
   1845     8400        0    10245     2805  nir_intrinsics.o
   1845     3360        0     5205     1455  nir_intrinsics.o
---
 src/compiler/nir/nir.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index 2e1bdfb..263769c 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -996,14 +996,14 @@ typedef enum {
 typedef struct {
    const char *name;
 
-   unsigned num_srcs; /** < number of register/SSA inputs */
+   uint8_t num_srcs; /** < number of register/SSA inputs */
 
    /** number of components of each input register
     *
     * If this value is 0, the number of components is given by the
     * num_components field of nir_intrinsic_instr.
     */
-   unsigned src_components[NIR_INTRINSIC_MAX_INPUTS];
+   uint8_t src_components[NIR_INTRINSIC_MAX_INPUTS];
 
    bool has_dest;
 
@@ -1012,16 +1012,16 @@ typedef struct {
     * If this value is 0, the number of components is given by the
     * num_components field of nir_intrinsic_instr.
     */
-   unsigned dest_components;
+   uint8_t dest_components;
 
    /** the number of inputs/outputs that are variables */
-   unsigned num_variables;
+   uint8_t num_variables;
 
    /** the number of constant indices used by the intrinsic */
-   unsigned num_indices;
+   uint8_t num_indices;
 
    /** indicates the usage of intr->const_index[n] */
-   unsigned index_map[NIR_INTRINSIC_NUM_INDEX_FLAGS];
+   uint8_t index_map[NIR_INTRINSIC_NUM_INDEX_FLAGS];
 
    /** semantic flags for calls to this intrinsic */
    nir_intrinsic_semantic_flag flags;
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list