Discussion:
[PATCH 00/13] clang warning fixes
(too old to reply)
Matt Turner
2017-08-10 22:02:31 UTC
Permalink
Raw Message
Just a simple series cleaning up various bits of code that clang warns about.

The only real change is to "i965/vec4: Return float from spill_cost_for_type()" which fixes an obvious mistake. The rest just cleans things up like marking internal functions static.
Matt Turner
2017-08-10 22:02:32 UTC
Permalink
Raw Message
Previously clang would warn about redefinition of typedef EGLDisplay. Avoid
this by adding preprocessor guards to mesa_glinterop.h and including it
after EGL.h is indirectly included.
---
include/GL/mesa_glinterop.h | 4 ++++
src/egl/drivers/dri2/egl_dri2.c | 2 +-
src/egl/main/eglapi.c | 2 +-
3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/include/GL/mesa_glinterop.h b/include/GL/mesa_glinterop.h
index 173476a988..45fda93ca2 100644
--- a/include/GL/mesa_glinterop.h
+++ b/include/GL/mesa_glinterop.h
@@ -58,12 +58,16 @@ extern "C" {
#endif

/* Forward declarations to avoid inclusion of GL/glx.h */
+#ifndef GLX_H
struct _XDisplay;
struct __GLXcontextRec;
+#endif

/* Forward declarations to avoid inclusion of EGL/egl.h */
+#ifndef __egl_h_
typedef void *EGLDisplay;
typedef void *EGLContext;
+#endif

/** Returned error codes. */
enum {
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index f0d1ded408..07a2c4dede 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -46,7 +46,6 @@
#endif
#include <GL/gl.h>
#include <GL/internal/dri_interface.h>
-#include "GL/mesa_glinterop.h"
#include <sys/types.h>
#include <sys/stat.h>

@@ -61,6 +60,7 @@
#endif

#include "egl_dri2.h"
+#include "GL/mesa_glinterop.h"
#include "loader/loader.h"
#include "util/u_atomic.h"
#include "util/u_vector.h"
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index 7f04218104..060705a5ec 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -88,7 +88,6 @@
#include <string.h>
#include "c99_compat.h"
#include "c11/threads.h"
-#include "GL/mesa_glinterop.h"
#include "util/macros.h"

#include "eglglobals.h"
@@ -102,6 +101,7 @@
#include "eglimage.h"
#include "eglsync.h"

+#include "GL/mesa_glinterop.h"

/**
* Macros to help return an API entrypoint.
--
2.13.0
Matt Turner
2017-08-10 22:02:33 UTC
Permalink
Raw Message
Quiets a number of uninitialized variable warnings in clang.
---
src/compiler/spirv/spirv_to_nir.c | 24 ++++++++++++------------
src/compiler/spirv/vtn_variables.c | 10 +++++-----
2 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c
index 7b34dad30c..870dda0314 100644
--- a/src/compiler/spirv/spirv_to_nir.c
+++ b/src/compiler/spirv/spirv_to_nir.c
@@ -262,7 +262,7 @@ vtn_handle_extension(struct vtn_builder *b, SpvOp opcode,
if (strcmp((const char *)&w[2], "GLSL.std.450") == 0) {
val->ext_handler = vtn_handle_glsl450_instruction;
} else {
- assert(!"Unsupported extension");
+ unreachable("Unsupported extension");
}
break;
}
@@ -724,7 +724,7 @@ translate_image_format(SpvImageFormat format)
case SpvImageFormatR16ui: return 0x8234; /* GL_R16UI */
case SpvImageFormatR8ui: return 0x8232; /* GL_R8UI */
default:
- assert(!"Invalid image format");
+ unreachable("Invalid image format");
return 0;
}
}
@@ -785,7 +785,7 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode,
val->type->type = glsl_matrix_type(glsl_get_base_type(base->type),
glsl_get_vector_elements(base->type),
columns);
- assert(!glsl_type_is_error(val->type->type));
+ unreachable(glsl_type_is_error(val->type->type));
val->type->length = columns;
val->type->array_element = base;
val->type->row_major = false;
@@ -919,7 +919,7 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode,
else if (dim == GLSL_SAMPLER_DIM_SUBPASS)
dim = GLSL_SAMPLER_DIM_SUBPASS_MS;
else
- assert(!"Unsupported multisampled image type");
+ unreachable("Unsupported multisampled image type");
}

val->type->image_format = translate_image_format(format);
@@ -929,12 +929,12 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode,
val->type->type = glsl_sampler_type(dim, is_shadow, is_array,
glsl_get_base_type(sampled_type));
} else if (sampled == 2) {
- assert(!is_shadow);
+ unreachable(is_shadow);
val->type->sampled = false;
val->type->type = glsl_image_type(dim, is_array,
glsl_get_base_type(sampled_type));
} else {
- assert(!"We need to know if the image will be sampled");
+ unreachable("We need to know if the image will be sampled");
}
break;
}
@@ -1378,7 +1378,7 @@ vtn_handle_constant(struct vtn_builder *b, SpvOp opcode,
break;

case SpvOpConstantSampler:
- assert(!"OpConstantSampler requires Kernel Capability");
+ unreachable("OpConstantSampler requires Kernel Capability");
break;

default:
@@ -2626,7 +2626,7 @@ gl_primitive_from_spv_execution_mode(SpvExecutionMode mode)
case SpvExecutionModeOutputTriangleStrip:
return 5; /* GL_TRIANGLE_STRIP */
default:
- assert(!"Invalid primitive type");
+ unreachable("Invalid primitive type");
return 4;
}
}
@@ -2646,7 +2646,7 @@ vertices_in_from_spv_execution_mode(SpvExecutionMode mode)
case SpvExecutionModeInputTrianglesAdjacency:
return 6;
default:
- assert(!"Invalid GS input mode");
+ unreachable("Invalid GS input mode");
return 0;
}
}
@@ -2974,7 +2974,7 @@ vtn_handle_execution_mode(struct vtn_builder *b, struct vtn_value *entry_point,
break;

case SpvExecutionModeXfb:
- assert(!"Unhandled execution mode");
+ unreachable("Unhandled execution mode");
break;

case SpvExecutionModeVecTypeHint:
@@ -3008,7 +3008,7 @@ vtn_handle_variable_or_type_instruction(struct vtn_builder *b, SpvOp opcode,
case SpvOpMemberDecorate:
case SpvOpGroupDecorate:
case SpvOpGroupMemberDecorate:
- assert(!"Invalid opcode types and variables section");
+ unreachable("Invalid opcode types and variables section");
break;

case SpvOpTypeVoid:
@@ -3348,7 +3348,7 @@ spirv_to_nir(const uint32_t *words, size_t word_count,
vtn_handle_preamble_instruction);

if (b->entry_point == NULL) {
- assert(!"Entry point not found");
+ unreachable("Entry point not found");
ralloc_free(b);
return NULL;
}
diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c
index 4432e72e54..077ad7bb1c 100644
--- a/src/compiler/spirv/vtn_variables.c
+++ b/src/compiler/spirv/vtn_variables.c
@@ -172,7 +172,7 @@ vtn_ssa_offset_pointer_dereference(struct vtn_builder *b,
}

/* This is the first access chain so we also need an offset */
- assert(!offset);
+ unreachable(offset);
offset = nir_imm_int(&b->nb, 0);
}
assert(offset);
@@ -599,7 +599,7 @@ vtn_type_block_size(struct vtn_type *type)
return type->stride * glsl_get_length(type->type);

default:
- assert(!"Invalid block type");
+ unreachable("Invalid block type");
return 0;
}
}
@@ -825,7 +825,7 @@ vtn_block_load(struct vtn_builder *b, struct vtn_pointer *src)
&access_offset, &access_size);
break;
default:
- assert(!"Invalid block variable mode");
+ unreachable("Invalid block variable mode");
}

nir_ssa_def *offset, *index = NULL;
@@ -1422,7 +1422,7 @@ vtn_storage_class_to_mode(SpvStorageClass class,
mode = vtn_variable_mode_ssbo;
nir_mode = 0;
} else {
- assert(!"Invalid uniform variable type");
+ unreachable("Invalid uniform variable type");
}
break;
case SpvStorageClassStorageBuffer:
@@ -1437,7 +1437,7 @@ vtn_storage_class_to_mode(SpvStorageClass class,
mode = vtn_variable_mode_sampler;
nir_mode = nir_var_uniform;
} else {
- assert(!"Invalid uniform constant variable type");
+ unreachable("Invalid uniform constant variable type");
}
break;
case SpvStorageClassPushConstant:
--
2.13.0
Jordan Justen
2017-08-10 23:02:37 UTC
Permalink
Raw Message
Post by Matt Turner
Quiets a number of uninitialized variable warnings in clang.
---
src/compiler/spirv/spirv_to_nir.c | 24 ++++++++++++------------
src/compiler/spirv/vtn_variables.c | 10 +++++-----
2 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c
index 7b34dad30c..870dda0314 100644
--- a/src/compiler/spirv/spirv_to_nir.c
+++ b/src/compiler/spirv/spirv_to_nir.c
@@ -262,7 +262,7 @@ vtn_handle_extension(struct vtn_builder *b, SpvOp opcode,
if (strcmp((const char *)&w[2], "GLSL.std.450") == 0) {
val->ext_handler = vtn_handle_glsl450_instruction;
} else {
- assert(!"Unsupported extension");
+ unreachable("Unsupported extension");
}
break;
}
@@ -724,7 +724,7 @@ translate_image_format(SpvImageFormat format)
case SpvImageFormatR16ui: return 0x8234; /* GL_R16UI */
case SpvImageFormatR8ui: return 0x8232; /* GL_R8UI */
- assert(!"Invalid image format");
+ unreachable("Invalid image format");
return 0;
}
}
@@ -785,7 +785,7 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode,
val->type->type = glsl_matrix_type(glsl_get_base_type(base->type),
glsl_get_vector_elements(base->type),
columns);
- assert(!glsl_type_is_error(val->type->type));
+ unreachable(glsl_type_is_error(val->type->type));
I think we want assert here, right?
Post by Matt Turner
val->type->length = columns;
val->type->array_element = base;
val->type->row_major = false;
@@ -919,7 +919,7 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode,
else if (dim == GLSL_SAMPLER_DIM_SUBPASS)
dim = GLSL_SAMPLER_DIM_SUBPASS_MS;
else
- assert(!"Unsupported multisampled image type");
+ unreachable("Unsupported multisampled image type");
}
val->type->image_format = translate_image_format(format);
@@ -929,12 +929,12 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode,
val->type->type = glsl_sampler_type(dim, is_shadow, is_array,
glsl_get_base_type(sampled_type));
} else if (sampled == 2) {
- assert(!is_shadow);
+ unreachable(is_shadow);
and here ...
Post by Matt Turner
val->type->sampled = false;
val->type->type = glsl_image_type(dim, is_array,
glsl_get_base_type(sampled_type));
} else {
- assert(!"We need to know if the image will be sampled");
+ unreachable("We need to know if the image will be sampled");
}
break;
}
@@ -1378,7 +1378,7 @@ vtn_handle_constant(struct vtn_builder *b, SpvOp opcode,
break;
- assert(!"OpConstantSampler requires Kernel Capability");
+ unreachable("OpConstantSampler requires Kernel Capability");
break;
@@ -2626,7 +2626,7 @@ gl_primitive_from_spv_execution_mode(SpvExecutionMode mode)
return 5; /* GL_TRIANGLE_STRIP */
- assert(!"Invalid primitive type");
+ unreachable("Invalid primitive type");
return 4;
}
}
@@ -2646,7 +2646,7 @@ vertices_in_from_spv_execution_mode(SpvExecutionMode mode)
return 6;
- assert(!"Invalid GS input mode");
+ unreachable("Invalid GS input mode");
return 0;
}
}
@@ -2974,7 +2974,7 @@ vtn_handle_execution_mode(struct vtn_builder *b, struct vtn_value *entry_point,
break;
- assert(!"Unhandled execution mode");
+ unreachable("Unhandled execution mode");
break;
@@ -3008,7 +3008,7 @@ vtn_handle_variable_or_type_instruction(struct vtn_builder *b, SpvOp opcode,
- assert(!"Invalid opcode types and variables section");
+ unreachable("Invalid opcode types and variables section");
break;
@@ -3348,7 +3348,7 @@ spirv_to_nir(const uint32_t *words, size_t word_count,
vtn_handle_preamble_instruction);
if (b->entry_point == NULL) {
- assert(!"Entry point not found");
+ unreachable("Entry point not found");
ralloc_free(b);
return NULL;
}
diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c
index 4432e72e54..077ad7bb1c 100644
--- a/src/compiler/spirv/vtn_variables.c
+++ b/src/compiler/spirv/vtn_variables.c
@@ -172,7 +172,7 @@ vtn_ssa_offset_pointer_dereference(struct vtn_builder *b,
}
/* This is the first access chain so we also need an offset */
- assert(!offset);
+ unreachable(offset);
and here?

-Jordan
Post by Matt Turner
offset = nir_imm_int(&b->nb, 0);
}
assert(offset);
@@ -599,7 +599,7 @@ vtn_type_block_size(struct vtn_type *type)
return type->stride * glsl_get_length(type->type);
- assert(!"Invalid block type");
+ unreachable("Invalid block type");
return 0;
}
}
@@ -825,7 +825,7 @@ vtn_block_load(struct vtn_builder *b, struct vtn_pointer *src)
&access_offset, &access_size);
break;
- assert(!"Invalid block variable mode");
+ unreachable("Invalid block variable mode");
}
nir_ssa_def *offset, *index = NULL;
@@ -1422,7 +1422,7 @@ vtn_storage_class_to_mode(SpvStorageClass class,
mode = vtn_variable_mode_ssbo;
nir_mode = 0;
} else {
- assert(!"Invalid uniform variable type");
+ unreachable("Invalid uniform variable type");
}
break;
@@ -1437,7 +1437,7 @@ vtn_storage_class_to_mode(SpvStorageClass class,
mode = vtn_variable_mode_sampler;
nir_mode = nir_var_uniform;
} else {
- assert(!"Invalid uniform constant variable type");
+ unreachable("Invalid uniform constant variable type");
}
break;
--
2.13.0
_______________________________________________
mesa-dev mailing list
https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Matt Turner
2017-08-21 21:44:32 UTC
Permalink
Raw Message
On Thu, Aug 10, 2017 at 7:02 PM, Jordan Justen
Post by Jordan Justen
Post by Matt Turner
Quiets a number of uninitialized variable warnings in clang.
---
src/compiler/spirv/spirv_to_nir.c | 24 ++++++++++++------------
src/compiler/spirv/vtn_variables.c | 10 +++++-----
2 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c
index 7b34dad30c..870dda0314 100644
--- a/src/compiler/spirv/spirv_to_nir.c
+++ b/src/compiler/spirv/spirv_to_nir.c
@@ -262,7 +262,7 @@ vtn_handle_extension(struct vtn_builder *b, SpvOp opcode,
if (strcmp((const char *)&w[2], "GLSL.std.450") == 0) {
val->ext_handler = vtn_handle_glsl450_instruction;
} else {
- assert(!"Unsupported extension");
+ unreachable("Unsupported extension");
}
break;
}
@@ -724,7 +724,7 @@ translate_image_format(SpvImageFormat format)
case SpvImageFormatR16ui: return 0x8234; /* GL_R16UI */
case SpvImageFormatR8ui: return 0x8232; /* GL_R8UI */
- assert(!"Invalid image format");gl_primitive_from_spv_execution_mode
+ unreachable("Invalid image format");
return 0;
}
}
@@ -785,7 +785,7 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode,
val->type->type = glsl_matrix_type(glsl_get_base_type(base->type),
glsl_get_vector_elements(base->type),
columns);
- assert(!glsl_type_is_error(val->type->type));
+ unreachable(glsl_type_is_error(val->type->type));
I think we want assert here, right?
Yes. How sloppy. Thanks.

I was hoping I could get a comment from Jason. There seem to be vague
attempts to keep things going even after an assert (return 4 in
gl_primitive_from_spv_execution_mode for instance). Are you okay with
making these unreachables? If so, I'll respin the patch and drop that
now-dead code as well as fixing the still-should-be-asserts noted by
Jordan.
Jason Ekstrand
2017-08-21 23:18:38 UTC
Permalink
Raw Message
Post by Matt Turner
On Thu, Aug 10, 2017 at 7:02 PM, Jordan Justen
Post by Matt Turner
Post by Matt Turner
Quiets a number of uninitialized variable warnings in clang.
---
src/compiler/spirv/spirv_to_nir.c | 24 ++++++++++++------------
src/compiler/spirv/vtn_variables.c | 10 +++++-----
2 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/src/compiler/spirv/spirv_to_nir.c
b/src/compiler/spirv/spirv_to_nir.c
Post by Matt Turner
Post by Matt Turner
index 7b34dad30c..870dda0314 100644
--- a/src/compiler/spirv/spirv_to_nir.c
+++ b/src/compiler/spirv/spirv_to_nir.c
@@ -262,7 +262,7 @@ vtn_handle_extension(struct vtn_builder *b, SpvOp
opcode,
Post by Matt Turner
Post by Matt Turner
if (strcmp((const char *)&w[2], "GLSL.std.450") == 0) {
val->ext_handler = vtn_handle_glsl450_instruction;
} else {
- assert(!"Unsupported extension");
+ unreachable("Unsupported extension");
}
break;
}
@@ -724,7 +724,7 @@ translate_image_format(SpvImageFormat format)
case SpvImageFormatR16ui: return 0x8234; /* GL_R16UI */
case SpvImageFormatR8ui: return 0x8232; /* GL_R8UI */
- assert(!"Invalid image format");gl_primitive_from_
spv_execution_mode
Post by Matt Turner
Post by Matt Turner
+ unreachable("Invalid image format");
return 0;
}
}
@@ -785,7 +785,7 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode,
val->type->type = glsl_matrix_type(glsl_get_
base_type(base->type),
Post by Matt Turner
Post by Matt Turner
glsl_get_vector_elements(base-
type),
Post by Matt Turner
columns);
- assert(!glsl_type_is_error(val->type->type));
+ unreachable(glsl_type_is_error(val->type->type));
I think we want assert here, right?
Yes. How sloppy. Thanks.
I was hoping I could get a comment from Jason. There seem to be vague
attempts to keep things going even after an assert (return 4 in
gl_primitive_from_spv_execution_mode for instance). Are you okay with
making these unreachables? If so, I'll respin the patch and drop that
now-dead code as well as fixing the still-should-be-asserts noted by
Jordan.
I'm fine with it. I have some patches on the list to add a new vtn_fail
function which longjumps and then cleans up in which case, we'll replace
the unreachable() with vtn_fail(). However, it's marked __noreturn__ so
clang should also know that it's not a fall-through in that case as well.

--Jason

Matt Turner
2017-08-10 22:02:34 UTC
Permalink
Raw Message
The INTEL_performance_query spec says

"Performance counter id 0 is reserved as an invalid counter."

GLuint counterid_to_index(GLuint counterid) just returns counterid - 1,
so with unsigned overflow rules, it will generate 0xFFFFFFFF given an
input of 0. 0xFFFFFFFF will trigger the counterIndex >= queryNumCounters
check, so the code worked as is. It just contained a useless comparison.
---
src/mesa/main/performance_query.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/main/performance_query.c b/src/mesa/main/performance_query.c
index 56f6a7da8b..b9e7cf9961 100644
--- a/src/mesa/main/performance_query.c
+++ b/src/mesa/main/performance_query.c
@@ -349,7 +349,7 @@ _mesa_GetPerfCounterInfoINTEL(GLuint queryId, GLuint counterId,

counterIndex = counterid_to_index(counterId);

- if (counterIndex < 0 || counterIndex >= queryNumCounters) {
+ if (counterIndex >= queryNumCounters) {
_mesa_error(ctx, GL_INVALID_VALUE,
"glGetPerfCounterInfoINTEL(invalid counterId)");
return;
--
2.13.0
Matt Turner
2017-08-10 22:02:36 UTC
Permalink
Raw Message
It's only used in the gen7_cmd_buffer_emit_scissor() function.
---
src/intel/vulkan/gen7_cmd_buffer.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/intel/vulkan/gen7_cmd_buffer.c b/src/intel/vulkan/gen7_cmd_buffer.c
index b1721c78ba..5f7b5a07e4 100644
--- a/src/intel/vulkan/gen7_cmd_buffer.c
+++ b/src/intel/vulkan/gen7_cmd_buffer.c
@@ -33,6 +33,7 @@
#include "genxml/gen_macros.h"
#include "genxml/genX_pack.h"

+#if GEN_GEN == 7 && !GEN_IS_HASWELL
static inline int64_t
clamp_int64(int64_t x, int64_t min, int64_t max)
{
@@ -44,7 +45,6 @@ clamp_int64(int64_t x, int64_t min, int64_t max)
return max;
}

-#if GEN_GEN == 7 && !GEN_IS_HASWELL
void
gen7_cmd_buffer_emit_scissor(struct anv_cmd_buffer *cmd_buffer)
{
--
2.13.0
Matt Turner
2017-08-10 22:02:35 UTC
Permalink
Raw Message
---
src/compiler/glsl/lower_int64.cpp | 4 +---
src/mesa/program/ir_to_mesa.cpp | 3 +--
2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/compiler/glsl/lower_int64.cpp b/src/compiler/glsl/lower_int64.cpp
index 9770d314af..aa2e1e063d 100644
--- a/src/compiler/glsl/lower_int64.cpp
+++ b/src/compiler/glsl/lower_int64.cpp
@@ -69,7 +69,7 @@ namespace {
class lower_64bit_visitor : public ir_rvalue_visitor {
public:
lower_64bit_visitor(void *mem_ctx, exec_list *instructions, unsigned lower)
- : progress(false), lower(lower), instructions(instructions),
+ : progress(false), lower(lower),
function_list(), added_functions(&function_list, mem_ctx)
{
functions = _mesa_hash_table_create(mem_ctx,
@@ -111,8 +111,6 @@ public:
private:
unsigned lower; /** Bitfield of which operations to lower */

- exec_list *instructions;
-
/** Hashtable containing all of the known functions in the IR */
struct hash_table *functions;

diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index ac12b59d07..67a4ad4a7c 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -2410,7 +2410,7 @@ class add_uniform_to_shader : public program_resource_visitor {
public:
add_uniform_to_shader(struct gl_shader_program *shader_program,
struct gl_program_parameter_list *params)
- : shader_program(shader_program), params(params), idx(-1)
+ : params(params), idx(-1)
{
/* empty */
}
@@ -2429,7 +2429,6 @@ private:
const enum glsl_interface_packing packing,
bool last_field);

- struct gl_shader_program *shader_program;
struct gl_program_parameter_list *params;
int idx;
ir_variable *var;
--
2.13.0
Matt Turner
2017-08-10 22:02:38 UTC
Permalink
Raw Message
Unless you have data, the compiler knows better than you whether a
function should be inlined.
---
src/intel/isl/isl_emit_depth_stencil.c | 2 +-
src/intel/isl/isl_format.c | 2 +-
src/intel/isl/isl_surface_state.c | 4 ++--
3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/intel/isl/isl_emit_depth_stencil.c b/src/intel/isl/isl_emit_depth_stencil.c
index 0d541fd1ce..36d75f03b9 100644
--- a/src/intel/isl/isl_emit_depth_stencil.c
+++ b/src/intel/isl/isl_emit_depth_stencil.c
@@ -26,7 +26,7 @@
#define __gen_address_type uint64_t
#define __gen_user_data void

-static inline uint64_t
+static uint64_t
__gen_combine_address(void *data, void *loc, uint64_t addr, uint32_t delta)
{
return addr + delta;
diff --git a/src/intel/isl/isl_format.c b/src/intel/isl/isl_format.c
index 435b0d003a..fba3ac5e1a 100644
--- a/src/intel/isl/isl_format.c
+++ b/src/intel/isl/isl_format.c
@@ -608,7 +608,7 @@ isl_formats_are_ccs_e_compatible(const struct gen_device_info *devinfo,
fmtl1->channels.a.bits == fmtl2->channels.a.bits;
}

-static inline bool
+static bool
isl_format_has_channel_type(enum isl_format fmt, enum isl_base_type type)
{
const struct isl_format_layout *fmtl = isl_format_get_layout(fmt);
diff --git a/src/intel/isl/isl_surface_state.c b/src/intel/isl/isl_surface_state.c
index e8bdb65962..f88af389cb 100644
--- a/src/intel/isl/isl_surface_state.c
+++ b/src/intel/isl/isl_surface_state.c
@@ -26,7 +26,7 @@
#define __gen_address_type uint64_t
#define __gen_user_data void

-static inline uint64_t
+static uint64_t
__gen_combine_address(void *data, void *loc, uint64_t addr, uint32_t delta)
{
return addr + delta;
@@ -134,7 +134,7 @@ get_surftype(enum isl_surf_dim dim, isl_surf_usage_flags_t usage)
* hardware. Note that this does NOT give you the actual hardware enum values
* but an index into the isl_to_gen_[hv]align arrays above.
*/
-static inline struct isl_extent3d
+static struct isl_extent3d
get_image_alignment(const struct isl_surf *surf)
{
if (GEN_GEN >= 9) {
--
2.13.0
Matt Turner
2017-08-10 22:02:37 UTC
Permalink
Raw Message
Unless you have data, the compiler knows better than you whether a
function should be inlined.
---
src/intel/vulkan/anv_batch_chain.c | 4 ++--
src/intel/vulkan/anv_blorp.c | 2 +-
src/intel/vulkan/gen7_cmd_buffer.c | 2 +-
src/intel/vulkan/gen8_cmd_buffer.c | 4 ++--
src/intel/vulkan/genX_gpu_memcpy.c | 2 +-
src/intel/vulkan/genX_pipeline.c | 18 +++++++++---------
src/intel/vulkan/genX_query.c | 2 +-
src/intel/vulkan/genX_state.c | 4 ++--
8 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/src/intel/vulkan/anv_batch_chain.c b/src/intel/vulkan/anv_batch_chain.c
index ad76dc1fc0..3726ad5dfd 100644
--- a/src/intel/vulkan/anv_batch_chain.c
+++ b/src/intel/vulkan/anv_batch_chain.c
@@ -441,7 +441,7 @@ anv_batch_bo_list_clone(const struct list_head *list,
* Functions related to anv_batch_bo
*-----------------------------------------------------------------------*/

-static inline struct anv_batch_bo *
+static struct anv_batch_bo *
anv_cmd_buffer_current_batch_bo(struct anv_cmd_buffer *cmd_buffer)
{
return LIST_ENTRY(struct anv_batch_bo, cmd_buffer->batch_bos.prev, link);
@@ -846,7 +846,7 @@ anv_cmd_buffer_end_batch_buffer(struct anv_cmd_buffer *cmd_buffer)
}
}

-static inline VkResult
+static VkResult
anv_cmd_buffer_add_seen_bbos(struct anv_cmd_buffer *cmd_buffer,
struct list_head *list)
{
diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c
index 860e50ac48..09d360e987 100644
--- a/src/intel/vulkan/anv_blorp.c
+++ b/src/intel/vulkan/anv_blorp.c
@@ -594,7 +594,7 @@ do_buffer_copy(struct blorp_batch *batch,
/**
* Returns the greatest common divisor of a and b that is a power of two.
*/
-static inline uint64_t
+static uint64_t
gcd_pow2_u64(uint64_t a, uint64_t b)
{
assert(a > 0 || b > 0);
diff --git a/src/intel/vulkan/gen7_cmd_buffer.c b/src/intel/vulkan/gen7_cmd_buffer.c
index 5f7b5a07e4..b05a0fd913 100644
--- a/src/intel/vulkan/gen7_cmd_buffer.c
+++ b/src/intel/vulkan/gen7_cmd_buffer.c
@@ -34,7 +34,7 @@
#include "genxml/genX_pack.h"

#if GEN_GEN == 7 && !GEN_IS_HASWELL
-static inline int64_t
+static int64_t
clamp_int64(int64_t x, int64_t min, int64_t max)
{
if (x < min)
diff --git a/src/intel/vulkan/gen8_cmd_buffer.c b/src/intel/vulkan/gen8_cmd_buffer.c
index a209d70161..f253b23ee2 100644
--- a/src/intel/vulkan/gen8_cmd_buffer.c
+++ b/src/intel/vulkan/gen8_cmd_buffer.c
@@ -167,7 +167,7 @@ genX(cmd_buffer_enable_pma_fix)(struct anv_cmd_buffer *cmd_buffer, bool enable)
}
}

-static inline bool
+static bool
want_depth_pma_fix(struct anv_cmd_buffer *cmd_buffer)
{
assert(GEN_GEN == 8);
@@ -256,7 +256,7 @@ want_depth_pma_fix(struct anv_cmd_buffer *cmd_buffer)
wm_prog_data->computed_depth_mode != PSCDEPTH_OFF;
}

-static inline bool
+static bool
want_stencil_pma_fix(struct anv_cmd_buffer *cmd_buffer)
{
assert(GEN_GEN == 9);
diff --git a/src/intel/vulkan/genX_gpu_memcpy.c b/src/intel/vulkan/genX_gpu_memcpy.c
index db723d4a52..6ed9ac7366 100644
--- a/src/intel/vulkan/genX_gpu_memcpy.c
+++ b/src/intel/vulkan/genX_gpu_memcpy.c
@@ -36,7 +36,7 @@
/**
* Returns the greatest common divisor of a and b that is a power of two.
*/
-static inline uint64_t
+static uint64_t
gcd_pow2_u64(uint64_t a, uint64_t b)
{
assert(a > 0 || b > 0);
diff --git a/src/intel/vulkan/genX_pipeline.c b/src/intel/vulkan/genX_pipeline.c
index 55db5339d6..6390bd4f6a 100644
--- a/src/intel/vulkan/genX_pipeline.c
+++ b/src/intel/vulkan/genX_pipeline.c
@@ -281,7 +281,7 @@ genX(emit_urb_setup)(struct anv_device *device, struct anv_batch *batch,
}
}

-static inline void
+static void
emit_urb_setup(struct anv_pipeline *pipeline)
{
unsigned entry_size[4];
@@ -1077,19 +1077,19 @@ emit_3dstate_streamout(struct anv_pipeline *pipeline,
}
}

-static inline uint32_t
+static uint32_t
get_sampler_count(const struct anv_shader_bin *bin)
{
return DIV_ROUND_UP(bin->bind_map.sampler_count, 4);
}

-static inline uint32_t
+static uint32_t
get_binding_table_entry_count(const struct anv_shader_bin *bin)
{
return DIV_ROUND_UP(bin->bind_map.surface_count, 32);
}

-static inline struct anv_address
+static struct anv_address
get_scratch_address(struct anv_pipeline *pipeline,
gl_shader_stage stage,
const struct anv_shader_bin *bin)
@@ -1102,20 +1102,20 @@ get_scratch_address(struct anv_pipeline *pipeline,
};
}

-static inline uint32_t
+static uint32_t
get_scratch_space(const struct anv_shader_bin *bin)
{
return ffs(bin->prog_data->total_scratch / 2048);
}

-static inline uint32_t
+static uint32_t
get_urb_output_offset()
{
/* Skip the VUE header and position slots */
return 1;
}

-static inline uint32_t
+static uint32_t
get_urb_output_length(const struct anv_shader_bin *bin)
{
const struct brw_vue_prog_data *prog_data =
@@ -1333,7 +1333,7 @@ emit_3dstate_gs(struct anv_pipeline *pipeline)
}
}

-static inline bool
+static bool
has_color_buffer_write_enabled(const struct anv_pipeline *pipeline)
{
const struct anv_shader_bin *shader_bin =
@@ -1418,7 +1418,7 @@ emit_3dstate_wm(struct anv_pipeline *pipeline, struct anv_subpass *subpass,
}
}

-static inline bool
+static bool
is_dual_src_blend_factor(VkBlendFactor factor)
{
return factor == VK_BLEND_FACTOR_SRC1_COLOR ||
diff --git a/src/intel/vulkan/genX_query.c b/src/intel/vulkan/genX_query.c
index 5102412e8f..5745fae8df 100644
--- a/src/intel/vulkan/genX_query.c
+++ b/src/intel/vulkan/genX_query.c
@@ -507,7 +507,7 @@ void genX(CmdWriteTimestamp)(

#if GEN_GEN > 7 || GEN_IS_HASWELL

-static inline uint32_t
+static uint32_t
mi_alu(uint32_t opcode, uint32_t operand1, uint32_t operand2)
{
struct GENX(MI_MATH_ALU_INSTRUCTION) instr = {
diff --git a/src/intel/vulkan/genX_state.c b/src/intel/vulkan/genX_state.c
index 3e6583289b..d016aff4a5 100644
--- a/src/intel/vulkan/genX_state.c
+++ b/src/intel/vulkan/genX_state.c
@@ -101,7 +101,7 @@ genX(init_device_state)(struct anv_device *device)
return anv_device_submit_simple_batch(device, &batch);
}

-static inline uint32_t
+static uint32_t
vk_to_gen_tex_filter(VkFilter filter, bool anisotropyEnable)
{
switch (filter) {
@@ -114,7 +114,7 @@ vk_to_gen_tex_filter(VkFilter filter, bool anisotropyEnable)
}
}

-static inline uint32_t
+static uint32_t
vk_to_gen_max_anisotropy(float ratio)
{
return (anv_clamp_f(ratio, 2, 16) - 2) / 2;
--
2.13.0
Matt Turner
2017-08-10 22:02:40 UTC
Permalink
Raw Message
---
src/intel/compiler/brw_vec4_reg_allocate.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/intel/compiler/brw_vec4_reg_allocate.cpp b/src/intel/compiler/brw_vec4_reg_allocate.cpp
index a0ba77b867..bbad46ee6c 100644
--- a/src/intel/compiler/brw_vec4_reg_allocate.cpp
+++ b/src/intel/compiler/brw_vec4_reg_allocate.cpp
@@ -369,7 +369,7 @@ can_use_scratch_for_source(const vec4_instruction *inst, unsigned i,
return prev_inst_read_scratch_reg;
}

-static inline unsigned
+static inline float
spill_cost_for_type(enum brw_reg_type type)
{
/* Spilling of a 64-bit register involves emitting 2 32-bit scratch
--
2.13.0
Iago Toral
2017-08-11 11:30:26 UTC
Permalink
Raw Message
Oops, sorry about that!
---
 src/intel/compiler/brw_vec4_reg_allocate.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/intel/compiler/brw_vec4_reg_allocate.cpp
b/src/intel/compiler/brw_vec4_reg_allocate.cpp
index a0ba77b867..bbad46ee6c 100644
--- a/src/intel/compiler/brw_vec4_reg_allocate.cpp
+++ b/src/intel/compiler/brw_vec4_reg_allocate.cpp
@@ -369,7 +369,7 @@ can_use_scratch_for_source(const vec4_instruction *inst, unsigned i,
    return prev_inst_read_scratch_reg;
 }
 
-static inline unsigned
+static inline float
 spill_cost_for_type(enum brw_reg_type type)
 {
    /* Spilling of a 64-bit register involves emitting 2 32-bit
scratch
Matt Turner
2017-08-10 22:02:41 UTC
Permalink
Raw Message
---
src/intel/compiler/brw_vec4.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/intel/compiler/brw_vec4.cpp b/src/intel/compiler/brw_vec4.cpp
index 410922c62b..45e918127d 100644
--- a/src/intel/compiler/brw_vec4.cpp
+++ b/src/intel/compiler/brw_vec4.cpp
@@ -1950,7 +1950,7 @@ vec4_visitor::convert_to_hw_regs()
{
foreach_block_and_inst(block, vec4_instruction, inst, cfg) {
for (int i = 0; i < 3; i++) {
- struct src_reg &src = inst->src[i];
+ class src_reg &src = inst->src[i];
struct brw_reg reg;
switch (src.file) {
case VGRF: {
--
2.13.0
Matt Turner
2017-08-10 22:02:39 UTC
Permalink
Raw Message
brw_texture_view_sane() is only used by an assert()...
---
src/mesa/drivers/dri/i965/genX_state_upload.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/genX_state_upload.c b/src/mesa/drivers/dri/i965/genX_state_upload.c
index 17fa1ce8fe..04ad4ce895 100644
--- a/src/mesa/drivers/dri/i965/genX_state_upload.c
+++ b/src/mesa/drivers/dri/i965/genX_state_upload.c
@@ -100,7 +100,7 @@ __gen_combine_address(struct brw_context *brw, void *location,
}
}

-static inline struct brw_address
+static struct brw_address
rw_bo(struct brw_bo *bo, uint32_t offset)
{
return (struct brw_address) {
@@ -110,7 +110,7 @@ rw_bo(struct brw_bo *bo, uint32_t offset)
};
}

-static inline struct brw_address
+static struct brw_address
ro_bo(struct brw_bo *bo, uint32_t offset)
{
return (struct brw_address) {
@@ -119,7 +119,7 @@ ro_bo(struct brw_bo *bo, uint32_t offset)
};
}

-static inline struct brw_address
+static struct brw_address
ggtt_bo(struct brw_bo *bo, uint32_t offset)
{
return (struct brw_address) {
@@ -130,13 +130,13 @@ ggtt_bo(struct brw_bo *bo, uint32_t offset)
}

#if GEN_GEN == 4
-static inline struct brw_address
+static struct brw_address
KSP(struct brw_context *brw, uint32_t offset)
{
return ro_bo(brw->cache.bo, offset);
}
#else
-static inline uint32_t
+static uint32_t
KSP(struct brw_context *brw, uint32_t offset)
{
return offset;
@@ -2201,7 +2201,7 @@ const struct brw_tracked_state genX(cc_vp) = {

/* ---------------------------------------------------------------------- */

-static inline void
+static void
set_scissor_bits(const struct gl_context *ctx, int i,
bool render_to_fbo, unsigned fb_width, unsigned fb_height,
struct GENX(SCISSOR_RECT) *sc)
@@ -3656,7 +3656,7 @@ genX(upload_3dstate_so_buffers)(struct brw_context *brw)
#endif
}

-static inline bool
+static bool
query_active(struct gl_query_object *q)
{
return q && q->Active;
--
2.13.0
Matt Turner
2017-08-10 22:02:44 UTC
Permalink
Raw Message
---
src/compiler/glsl/builtin_functions.h | 3 +++
1 file changed, 3 insertions(+)

diff --git a/src/compiler/glsl/builtin_functions.h b/src/compiler/glsl/builtin_functions.h
index 2053c82b74..89ec9b7d5d 100644
--- a/src/compiler/glsl/builtin_functions.h
+++ b/src/compiler/glsl/builtin_functions.h
@@ -64,6 +64,9 @@ umul64(void *mem_ctx, builtin_available_predicate avail);
ir_function_signature *
sign64(void *mem_ctx, builtin_available_predicate avail);

+ir_function_signature *
+udivmod64(void *mem_ctx, builtin_available_predicate avail);
+
}

#endif /* BULITIN_FUNCTIONS_H */
--
2.13.0
Matt Turner
2017-08-10 22:02:42 UTC
Permalink
Raw Message
Cuts 300 bytes of .text
---
src/intel/compiler/brw_fs_surface_builder.cpp | 30 ++++++++++++-------------
src/intel/compiler/brw_vec4_nir.cpp | 5 +++--
src/intel/compiler/brw_vec4_surface_builder.cpp | 6 ++---
3 files changed, 21 insertions(+), 20 deletions(-)

diff --git a/src/intel/compiler/brw_fs_surface_builder.cpp b/src/intel/compiler/brw_fs_surface_builder.cpp
index 8990a5ca71..d00d8920b2 100644
--- a/src/intel/compiler/brw_fs_surface_builder.cpp
+++ b/src/intel/compiler/brw_fs_surface_builder.cpp
@@ -169,7 +169,7 @@ namespace {
* they come in from SPIR-V or Vulkan. We need to turn them into an ISL
* enum before we can use them.
*/
- enum isl_format
+ static enum isl_format
isl_format_for_gl_format(uint32_t gl_format)
{
switch (gl_format) {
@@ -358,7 +358,7 @@ namespace {
/**
* Check whether the bound image is suitable for untyped access.
*/
- brw_predicate
+ static brw_predicate
emit_untyped_image_check(const fs_builder &bld, const fs_reg &image,
brw_predicate pred)
{
@@ -390,7 +390,7 @@ namespace {
* the comparison result to f0.0. Returns an appropriate predication
* mode to use on subsequent image operations.
*/
- brw_predicate
+ static brw_predicate
emit_typed_atomic_check(const fs_builder &bld, const fs_reg &image)
{
const gen_device_info *devinfo = bld.shader->devinfo;
@@ -420,7 +420,7 @@ namespace {
* and write the comparison result to f0.0. Returns an appropriate
* predication mode to use on subsequent image operations.
*/
- brw_predicate
+ static brw_predicate
emit_bounds_check(const fs_builder &bld, const fs_reg &image,
const fs_reg &addr, unsigned dims)
{
@@ -443,7 +443,7 @@ namespace {
* the surface, which may be more than the sum of \p surf_dims and \p
* arr_dims if padding is required.
*/
- unsigned
+ static unsigned
num_image_coordinates(const fs_builder &bld,
unsigned surf_dims, unsigned arr_dims,
isl_format format)
@@ -465,7 +465,7 @@ namespace {
* Transform image coordinates into the form expected by the
* implementation.
*/
- fs_reg
+ static fs_reg
emit_image_coordinates(const fs_builder &bld, const fs_reg &addr,
unsigned surf_dims, unsigned arr_dims,
isl_format format)
@@ -505,7 +505,7 @@ namespace {
* Section 4.5 "Address Tiling Function" of the IVB PRM for an in-depth
* explanation of the hardware tiling format.
*/
- fs_reg
+ static fs_reg
emit_address_calculation(const fs_builder &bld, const fs_reg &image,
const fs_reg &coord, unsigned dims)
{
@@ -679,7 +679,7 @@ namespace {
* shifts and widths. Note that bitfield components are not allowed to
* cross 32-bit boundaries.
*/
- fs_reg
+ static fs_reg
emit_pack(const fs_builder &bld, const fs_reg &src,
const color_u &shifts, const color_u &widths)
{
@@ -712,7 +712,7 @@ namespace {
* shifts and widths. Note that bitfield components are not allowed to
* cross 32-bit boundaries.
*/
- fs_reg
+ static fs_reg
emit_unpack(const fs_builder &bld, const fs_reg &src,
const color_u &shifts, const color_u &widths)
{
@@ -740,7 +740,7 @@ namespace {
* Convert an integer vector into another integer vector of the
* specified bit widths, properly handling overflow.
*/
- fs_reg
+ static fs_reg
emit_convert_to_integer(const fs_builder &bld, const fs_reg &src,
const color_u &widths, bool is_signed)
{
@@ -780,7 +780,7 @@ namespace {
* Convert a normalized fixed-point vector of the specified signedness
* and bit widths into a floating point vector.
*/
- fs_reg
+ static fs_reg
emit_convert_from_scaled(const fs_builder &bld, const fs_reg &src,
const color_u &widths, bool is_signed)
{
@@ -810,7 +810,7 @@ namespace {
* Convert a floating-point vector into a normalized fixed-point vector
* of the specified signedness and bit widths.
*/
- fs_reg
+ static fs_reg
emit_convert_to_scaled(const fs_builder &bld, const fs_reg &src,
const color_u &widths, bool is_signed)
{
@@ -859,7 +859,7 @@ namespace {
* Convert a floating point vector of the specified bit widths into a
* 32-bit floating point vector.
*/
- fs_reg
+ static fs_reg
emit_convert_from_float(const fs_builder &bld, const fs_reg &src,
const color_u &widths)
{
@@ -890,7 +890,7 @@ namespace {
* Convert a vector into a floating point vector of the specified bit
* widths.
*/
- fs_reg
+ static fs_reg
emit_convert_to_float(const fs_builder &bld, const fs_reg &src,
const color_u &widths)
{
@@ -927,7 +927,7 @@ namespace {
/**
* Fill missing components of a vector with 0, 0, 0, 1.
*/
- fs_reg
+ static fs_reg
emit_pad(const fs_builder &bld, const fs_reg &src,
const color_u &widths)
{
diff --git a/src/intel/compiler/brw_vec4_nir.cpp b/src/intel/compiler/brw_vec4_nir.cpp
index 0e8807c5b4..211682916f 100644
--- a/src/intel/compiler/brw_vec4_nir.cpp
+++ b/src/intel/compiler/brw_vec4_nir.cpp
@@ -2049,7 +2049,7 @@ vec4_visitor::nir_emit_jump(nir_jump_instr *instr)
}
}

-enum ir_texture_opcode
+static enum ir_texture_opcode
ir_texture_opcode_for_nir_texop(nir_texop texop)
{
enum ir_texture_opcode op;
@@ -2073,7 +2073,8 @@ ir_texture_opcode_for_nir_texop(nir_texop texop)

return op;
}
-const glsl_type *
+
+static const glsl_type *
glsl_type_for_nir_alu_type(nir_alu_type alu_type,
unsigned components)
{
diff --git a/src/intel/compiler/brw_vec4_surface_builder.cpp b/src/intel/compiler/brw_vec4_surface_builder.cpp
index 00c94fedca..5029cdce55 100644
--- a/src/intel/compiler/brw_vec4_surface_builder.cpp
+++ b/src/intel/compiler/brw_vec4_surface_builder.cpp
@@ -31,7 +31,7 @@ namespace {
* Copy one every \p src_stride logical components of the argument into
* one every \p dst_stride logical components of the result.
*/
- src_reg
+ static src_reg
emit_stride(const vec4_builder &bld, const src_reg &src, unsigned size,
unsigned dst_stride, unsigned src_stride)
{
@@ -57,7 +57,7 @@ namespace {
* left unmodified in SIMD4x2 form, otherwise it will be rearranged into
* a SIMD8 vector.
*/
- src_reg
+ static src_reg
emit_insert(const vec4_builder &bld, const src_reg &src,
unsigned n, bool has_simd4x2)
{
@@ -83,7 +83,7 @@ namespace {
* argument is left unmodified in SIMD4x2 form, otherwise it will be
* rearranged from SIMD8 form.
*/
- src_reg
+ static src_reg
emit_extract(const vec4_builder &bld, const src_reg src,
unsigned n, bool has_simd4x2)
{
--
2.13.0
Matt Turner
2017-08-10 22:02:43 UTC
Permalink
Raw Message
Cuts 3224 bytes of .text
---
src/compiler/glsl/ast_function.cpp | 10 +++++-----
src/compiler/glsl/ast_to_hir.cpp | 6 +++---
src/compiler/glsl/glsl_parser_extras.cpp | 2 +-
src/compiler/glsl/ir_validate.cpp | 2 +-
src/compiler/glsl/link_uniform_initializers.cpp | 10 +++++-----
src/compiler/glsl/link_varyings.cpp | 8 ++++----
src/compiler/glsl/linker.cpp | 20 ++++++++++----------
src/compiler/glsl/lower_if_to_cond_assign.cpp | 4 ++--
src/compiler/glsl/lower_vector.cpp | 2 +-
src/compiler/glsl/main.cpp | 2 +-
src/compiler/glsl/standalone.cpp | 6 +++---
11 files changed, 36 insertions(+), 36 deletions(-)

diff --git a/src/compiler/glsl/ast_function.cpp b/src/compiler/glsl/ast_function.cpp
index f7e90fba5b..51f188486c 100644
--- a/src/compiler/glsl/ast_function.cpp
+++ b/src/compiler/glsl/ast_function.cpp
@@ -1272,7 +1272,7 @@ process_array_constructor(exec_list *instructions,
/**
* Determine if a list consists of a single scalar r-value
*/
-bool
+static bool
single_scalar_parameter(exec_list *parameters)
{
const ir_rvalue *const p = (ir_rvalue *) parameters->get_head_raw();
@@ -1293,7 +1293,7 @@ single_scalar_parameter(exec_list *parameters)
* An \c ir_dereference_variable of the temprorary generated in the constructor
* body.
*/
-ir_rvalue *
+static ir_rvalue *
emit_inline_vector_constructor(const glsl_type *type,
exec_list *instructions,
exec_list *parameters,
@@ -1457,7 +1457,7 @@ emit_inline_vector_constructor(const glsl_type *type,
* \c src_base + \c count must be less than or equal to the number of
* components in the source vector.
*/
-ir_instruction *
+static ir_instruction *
assign_to_matrix_column(ir_variable *var, unsigned column, unsigned row_base,
ir_rvalue *src, unsigned src_base, unsigned count,
void *mem_ctx)
@@ -1497,7 +1497,7 @@ assign_to_matrix_column(ir_variable *var, unsigned column, unsigned row_base,
* An \c ir_dereference_variable of the temprorary generated in the constructor
* body.
*/
-ir_rvalue *
+static ir_rvalue *
emit_inline_matrix_constructor(const glsl_type *type,
exec_list *instructions,
exec_list *parameters,
@@ -1766,7 +1766,7 @@ emit_inline_matrix_constructor(const glsl_type *type,
}


-ir_rvalue *
+static ir_rvalue *
emit_inline_record_constructor(const glsl_type *type,
exec_list *instructions,
exec_list *parameters,
diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
index ee80605232..ef1b3002d8 100644
--- a/src/compiler/glsl/ast_to_hir.cpp
+++ b/src/compiler/glsl/ast_to_hir.cpp
@@ -1182,7 +1182,7 @@ do_comparison(void *mem_ctx, int operation, ir_rvalue *op0, ir_rvalue *op1)
* scalar booleans. If it isn't, emit an error and return a constant
* boolean to avoid triggering cascading error messages.
*/
-ir_rvalue *
+static ir_rvalue *
get_scalar_boolean_operand(exec_list *instructions,
struct _mesa_glsl_parse_state *state,
ast_expression *parent_expr,
@@ -4320,7 +4320,7 @@ get_variable_being_redeclared(ir_variable *var, YYLTYPE loc,
/**
* Generate the IR for an initializer in a variable declaration
*/
-ir_rvalue *
+static ir_rvalue *
process_initializer(ir_variable *var, ast_declaration *decl,
ast_fully_specified_type *type,
exec_list *initializer_instructions,
@@ -4714,7 +4714,7 @@ handle_geometry_shader_input_decl(struct _mesa_glsl_parse_state *state,
"geometry shader input");
}

-void
+static void
validate_identifier(const char *identifier, YYLTYPE loc,
struct _mesa_glsl_parse_state *state)
{
diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp
index 8f1651d494..cfb214e440 100644
--- a/src/compiler/glsl/glsl_parser_extras.cpp
+++ b/src/compiler/glsl/glsl_parser_extras.cpp
@@ -1079,7 +1079,7 @@ _mesa_ast_process_interface_block(YYLTYPE *locp,
}
}

-void
+static void
_mesa_ast_type_qualifier_print(const struct ast_type_qualifier *q)
{
if (q->is_subroutine_decl())
diff --git a/src/compiler/glsl/ir_validate.cpp b/src/compiler/glsl/ir_validate.cpp
index 6e2f3e5b50..f6503fb4e8 100644
--- a/src/compiler/glsl/ir_validate.cpp
+++ b/src/compiler/glsl/ir_validate.cpp
@@ -1035,7 +1035,7 @@ ir_validate::validate_ir(ir_instruction *ir, void *data)
_mesa_set_add(ir_set, ir);
}

-void
+static void
check_node_type(ir_instruction *ir, void *data)
{
(void) data;
diff --git a/src/compiler/glsl/link_uniform_initializers.cpp b/src/compiler/glsl/link_uniform_initializers.cpp
index e7f9c9d8ac..24b9ba5748 100644
--- a/src/compiler/glsl/link_uniform_initializers.cpp
+++ b/src/compiler/glsl/link_uniform_initializers.cpp
@@ -33,7 +33,7 @@
*/
namespace linker {

-gl_uniform_storage *
+static gl_uniform_storage *
get_storage(struct gl_shader_program *prog, const char *name)
{
unsigned id;
@@ -44,7 +44,7 @@ get_storage(struct gl_shader_program *prog, const char *name)
return NULL;
}

-void
+static void
copy_constant_to_storage(union gl_constant_value *storage,
const ir_constant *val,
const enum glsl_base_type base_type,
@@ -95,7 +95,7 @@ copy_constant_to_storage(union gl_constant_value *storage,
* qualifier specified in the shader. Atomic counters are different because
* they have no storage and should be handled elsewhere.
*/
-void
+static void
set_opaque_binding(void *mem_ctx, gl_shader_program *prog,
const ir_variable *var, const glsl_type *type,
const char *name, int *binding)
@@ -179,7 +179,7 @@ set_opaque_binding(void *mem_ctx, gl_shader_program *prog,
}
}

-void
+static void
set_block_binding(gl_shader_program *prog, const char *block_name,
unsigned mode, int binding)
{
@@ -199,7 +199,7 @@ set_block_binding(gl_shader_program *prog, const char *block_name,
unreachable("Failed to initialize block binding");
}

-void
+static void
set_uniform_initializer(void *mem_ctx, gl_shader_program *prog,
const char *name, const glsl_type *type,
ir_constant *val, unsigned int boolean_true)
diff --git a/src/compiler/glsl/link_varyings.cpp b/src/compiler/glsl/link_varyings.cpp
index de3754c423..764d9af1c1 100644
--- a/src/compiler/glsl/link_varyings.cpp
+++ b/src/compiler/glsl/link_varyings.cpp
@@ -1893,7 +1893,7 @@ private:

namespace linker {

-void
+static void
populate_consumer_input_sets(void *mem_ctx, exec_list *ir,
hash_table *consumer_inputs,
hash_table *consumer_interface_inputs,
@@ -1951,7 +1951,7 @@ populate_consumer_input_sets(void *mem_ctx, exec_list *ir,
* This function only finds inputs with names that match. There is no
* validation (here) that the types, etc. are compatible.
*/
-ir_variable *
+static ir_variable *
get_matching_input(void *mem_ctx,
const ir_variable *output_var,
hash_table *consumer_inputs,
@@ -2349,7 +2349,7 @@ assign_varying_locations(struct gl_context *ctx,
return true;
}

-bool
+static bool
check_against_output_limit(struct gl_context *ctx,
struct gl_shader_program *prog,
gl_linked_shader *producer,
@@ -2393,7 +2393,7 @@ check_against_output_limit(struct gl_context *ctx,
return true;
}

-bool
+static bool
check_against_input_limit(struct gl_context *ctx,
struct gl_shader_program *prog,
gl_linked_shader *consumer,
diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index b4784c5119..5fd38e86b2 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -682,7 +682,7 @@ analyze_clip_cull_usage(struct gl_shader_program *prog,
*
* \param shader Vertex shader executable to be verified
*/
-void
+static void
validate_vertex_shader_executable(struct gl_shader_program *prog,
struct gl_linked_shader *shader,
struct gl_context *ctx)
@@ -737,7 +737,7 @@ validate_vertex_shader_executable(struct gl_shader_program *prog,
&shader->Program->info.cull_distance_array_size);
}

-void
+static void
validate_tess_eval_shader_executable(struct gl_shader_program *prog,
struct gl_linked_shader *shader,
struct gl_context *ctx)
@@ -756,7 +756,7 @@ validate_tess_eval_shader_executable(struct gl_shader_program *prog,
*
* \param shader Fragment shader executable to be verified
*/
-void
+static void
validate_fragment_shader_executable(struct gl_shader_program *prog,
struct gl_linked_shader *shader)
{
@@ -782,7 +782,7 @@ validate_fragment_shader_executable(struct gl_shader_program *prog,
*
* \param shader Geometry shader executable to be verified
*/
-void
+static void
validate_geometry_shader_executable(struct gl_shader_program *prog,
struct gl_linked_shader *shader,
struct gl_context *ctx)
@@ -899,7 +899,7 @@ validate_intrastage_arrays(struct gl_shader_program *prog,
/**
* Perform validation of global variables used across multiple shaders
*/
-void
+static void
cross_validate_globals(struct gl_shader_program *prog,
struct exec_list *ir, glsl_symbol_table *variables,
bool uniforms_only)
@@ -1142,7 +1142,7 @@ cross_validate_globals(struct gl_shader_program *prog,
/**
* Perform validation of uniforms used across multiple shader stages
*/
-void
+static void
cross_validate_uniforms(struct gl_shader_program *prog)
{
glsl_symbol_table variables;
@@ -1299,7 +1299,7 @@ populate_symbol_table(gl_linked_shader *sh)
* \param instructions Instruction stream where new variable declarations
* should be added.
*/
-void
+static void
remap_variables(ir_instruction *inst, struct gl_linked_shader *target,
hash_table *temps)
{
@@ -1373,7 +1373,7 @@ remap_variables(ir_instruction *inst, struct gl_linked_shader *target,
* is suitable for use as the \c last parameter of a later call to this
* function.
*/
-exec_node *
+static exec_node *
move_non_declarations(exec_list *instructions, exec_node *last,
bool make_copies, gl_linked_shader *target)
{
@@ -2555,7 +2555,7 @@ resize_tes_inputs(struct gl_context *ctx,
* \return
* Base location of the available bits on success or -1 on failure.
*/
-int
+static int
find_available_slots(unsigned used_mask, unsigned needed_count)
{
unsigned needed_mask = (1 << needed_count) - 1;
@@ -2592,7 +2592,7 @@ find_available_slots(unsigned used_mask, unsigned needed_count)
* If locations are successfully assigned, true is returned. Otherwise an
* error is emitted to the shader link log and false is returned.
*/
-bool
+static bool
assign_attribute_or_color_locations(void *mem_ctx,
gl_shader_program *prog,
struct gl_constants *constants,
diff --git a/src/compiler/glsl/lower_if_to_cond_assign.cpp b/src/compiler/glsl/lower_if_to_cond_assign.cpp
index 37f1ec8600..54bcae75ec 100644
--- a/src/compiler/glsl/lower_if_to_cond_assign.cpp
+++ b/src/compiler/glsl/lower_if_to_cond_assign.cpp
@@ -115,7 +115,7 @@ lower_if_to_cond_assign(gl_shader_stage stage, exec_list *instructions,
return v.progress;
}

-void
+static void
check_ir_node(ir_instruction *ir, void *data)
{
ir_if_to_cond_assign_visitor *v = (ir_if_to_cond_assign_visitor *)data;
@@ -168,7 +168,7 @@ check_ir_node(ir_instruction *ir, void *data)
}
}

-void
+static void
move_block_to_cond_assign(void *mem_ctx,
ir_if *if_ir, ir_rvalue *cond_expr,
exec_list *instructions,
diff --git a/src/compiler/glsl/lower_vector.cpp b/src/compiler/glsl/lower_vector.cpp
index a658410ae6..9db530a230 100644
--- a/src/compiler/glsl/lower_vector.cpp
+++ b/src/compiler/glsl/lower_vector.cpp
@@ -58,7 +58,7 @@ public:
* Extended swizzles consist of access of a single vector source (with possible
* per component negation) and the constants -1, 0, or 1.
*/
-bool
+static bool
is_extended_swizzle(ir_expression *ir)
{
/* Track any variables that are accessed by this expression.
diff --git a/src/compiler/glsl/main.cpp b/src/compiler/glsl/main.cpp
index e0d3ab75d1..123e41f9dc 100644
--- a/src/compiler/glsl/main.cpp
+++ b/src/compiler/glsl/main.cpp
@@ -52,7 +52,7 @@ const struct option compiler_opts[] = {
/**
* \brief Print proper usage and exit with failure.
*/
-void
+static void
usage_fail(const char *name)
{

diff --git a/src/compiler/glsl/standalone.cpp b/src/compiler/glsl/standalone.cpp
index 8e5bc352fc..7e5c06d205 100644
--- a/src/compiler/glsl/standalone.cpp
+++ b/src/compiler/glsl/standalone.cpp
@@ -100,7 +100,7 @@ private:
set *variables;
};

-void
+static void
init_gl_program(struct gl_program *prog, GLenum target, bool is_arb_asm)
{
prog->RefCount = 1;
@@ -108,7 +108,7 @@ init_gl_program(struct gl_program *prog, GLenum target, bool is_arb_asm)
prog->is_arb_asm = is_arb_asm;
}

-struct gl_program *
+static struct gl_program *
new_program(struct gl_context *ctx, GLenum target, GLuint id, bool is_arb_asm)
{
switch (target) {
@@ -374,7 +374,7 @@ load_text_file(void *ctx, const char *file_name)
return text;
}

-void
+static void
compile_shader(struct gl_context *ctx, struct gl_shader *shader)
{
struct _mesa_glsl_parse_state *state =
--
2.13.0
Jordan Justen
2017-08-10 23:22:40 UTC
Permalink
Raw Message
Where's the patchlist on your cover letter? :)

1: Reviewed-by: Jordan Justen <***@intel.com>

2: If only changing the string calls:
Reviewed-by: Jordan Justen <***@intel.com>

3-5: Reviewed-by: Jordan Justen <***@intel.com>

6-8: Do you have data that removing the inlines doesn't hurt things?
;) I actually don't have an opinion on these, so I'll hold off
to see if anyone else chimes in.

9: Reviewed-by: Jordan Justen <***@intel.com>
(Noting that you are changing an inline function. ;)
Post by Matt Turner
Just a simple series cleaning up various bits of code that clang warns about.
The only real change is to "i965/vec4: Return float from spill_cost_for_type()" which fixes an obvious mistake. The rest just cleans things up like marking internal functions static.
_______________________________________________
mesa-dev mailing list
https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Loading...