[Mesa-dev] [PATCH 12/13] glsl: Mark functions static

Matt Turner mattst88 at gmail.com
Thu Aug 10 22:02:43 UTC 2017


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



More information about the mesa-dev mailing list