i965/nir/fs: removed unneeded support for global variables
authorAlejandro Piñeiro <apinheiro@igalia.com>
Fri, 17 Jul 2015 09:54:34 +0000 (11:54 +0200)
committerIago Toral Quiroga <itoral@igalia.com>
Mon, 20 Jul 2015 07:50:04 +0000 (09:50 +0200)
As functions are inlined, and nir_lower_global_vars_to_local gets
run, all global variables are lowered to local variables.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/brw_fs.h
src/mesa/drivers/dri/i965/brw_fs_nir.cpp
src/mesa/drivers/dri/i965/brw_fs_visitor.cpp

index c00566667e02ba13ac53f1d66609a2e93d3023ba..283ee361d17bbb92231ef6dc56afef389a75b094 100644 (file)
@@ -371,7 +371,6 @@ public:
 
    fs_reg *nir_locals;
    fs_reg *nir_ssa_values;
-   fs_reg *nir_globals;
    fs_reg nir_inputs;
    fs_reg nir_outputs;
    fs_reg *nir_system_values;
index 3099dc447ec40b8148763ff0f6e1e40b4cc22eac..12cd4530c37c4ca062bc6e6d5284a61db4688521 100644 (file)
@@ -55,14 +55,6 @@ fs_visitor::emit_nir_code()
 
    nir_emit_system_values(nir);
 
-   nir_globals = ralloc_array(mem_ctx, fs_reg, nir->reg_alloc);
-   foreach_list_typed(nir_register, reg, node, &nir->registers) {
-      unsigned array_elems =
-         reg->num_array_elems == 0 ? 1 : reg->num_array_elems;
-      unsigned size = array_elems * reg->num_components;
-      nir_globals[reg->index] = bld.vgrf(BRW_REGISTER_TYPE_F, size);
-   }
-
    /* get the main function and emit it */
    nir_foreach_overload(nir, overload) {
       assert(strcmp(overload->function->name, "main") == 0);
@@ -1159,10 +1151,10 @@ fs_reg_for_nir_reg(fs_visitor *v, nir_register *nir_reg,
                    unsigned base_offset, nir_src *indirect)
 {
    fs_reg reg;
-   if (nir_reg->is_global)
-      reg = v->nir_globals[nir_reg->index];
-   else
-      reg = v->nir_locals[nir_reg->index];
+
+   assert(!nir_reg->is_global);
+
+   reg = v->nir_locals[nir_reg->index];
 
    reg = offset(reg, v->bld, base_offset * nir_reg->num_components);
    if (indirect) {
index d6a60a7cff70686a0eed56b70664984343b5bfcc..47dc92546649e69da8636943a03e4653e7774ddb 100644 (file)
@@ -2029,7 +2029,6 @@ fs_visitor::fs_visitor(const struct brw_compiler *compiler, void *log_data,
 
    this->nir_locals = NULL;
    this->nir_ssa_values = NULL;
-   this->nir_globals = NULL;
 
    memset(&this->payload, 0, sizeof(this->payload));
    memset(this->outputs, 0, sizeof(this->outputs));