Revert "nir: const `nir_call_instr::callee`"
authorJason Ekstrand <jason.ekstrand@intel.com>
Tue, 19 Mar 2019 15:18:49 +0000 (10:18 -0500)
committerJason Ekstrand <jason.ekstrand@intel.com>
Tue, 19 Mar 2019 15:19:42 +0000 (10:19 -0500)
This reverts commit db57db5317e81fb4ce31bc294fdcc199db651542.  When
building IR, nothing is really immutable and, since C has no concept of
constness propagating beyond the first pointer, we have to be vary
careful with how we use it.  To just throw const into a function like
this is a lie.

Instead, we should just drop the unneeded const in spirv_to_nir which
this commit does along with the revert.

src/compiler/nir/nir.c
src/compiler/nir/nir.h
src/compiler/spirv/spirv_to_nir.c

index 62a80aa87ac1f9c6a11d5e245726d13fdc4db7b7..4a7c757db3a4f8190097087f625ea7ac6334d155 100644 (file)
@@ -515,7 +515,7 @@ nir_intrinsic_instr_create(nir_shader *shader, nir_intrinsic_op op)
 }
 
 nir_call_instr *
-nir_call_instr_create(nir_shader *shader, const nir_function *callee)
+nir_call_instr_create(nir_shader *shader, nir_function *callee)
 {
    const unsigned num_params = callee->num_params;
    nir_call_instr *instr =
index f85b4be5a536d47e28a62316a93a36aab8b924d3..067287fab1ce67a8da6338c6989281afa57a15a4 100644 (file)
@@ -1084,7 +1084,7 @@ unsigned nir_deref_instr_ptr_as_array_stride(nir_deref_instr *instr);
 typedef struct {
    nir_instr instr;
 
-   const struct nir_function *callee;
+   struct nir_function *callee;
 
    unsigned num_params;
    nir_src params[];
@@ -2435,7 +2435,7 @@ nir_intrinsic_instr *nir_intrinsic_instr_create(nir_shader *shader,
                                                 nir_intrinsic_op op);
 
 nir_call_instr *nir_call_instr_create(nir_shader *shader,
-                                      const nir_function *callee);
+                                      nir_function *callee);
 
 nir_tex_instr *nir_tex_instr_create(nir_shader *shader, unsigned num_srcs);
 
index 0ef8d67519a6d89fd891aadd426860ab356be96f..6d6aed287accbf992210d17373188fe5c35e3b25 100644 (file)
@@ -4492,7 +4492,7 @@ vtn_create_builder(const uint32_t *words, size_t word_count,
 
 static nir_function *
 vtn_emit_kernel_entry_point_wrapper(struct vtn_builder *b,
-                                    const nir_function *entry_point)
+                                    nir_function *entry_point)
 {
    vtn_assert(entry_point == b->entry_point->func->impl->function);
    vtn_fail_if(!entry_point->name, "entry points are required to have a name");