[Mesa-dev] [PATCH 3/9] glsl: Add ir_function_signature::is_intrinsic() method

Ian Romanick idr at freedesktop.org
Thu Sep 1 18:10:38 UTC 2016


From: Ian Romanick <ian.d.romanick at intel.com>

This necessetated renaming the is_intrinsic field to _is_intrinsic.  The
next commit will remove the field.

No change in "size."

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 src/compiler/glsl/builtin_functions.cpp      | 4 ++--
 src/compiler/glsl/glsl_to_nir.cpp            | 6 +++---
 src/compiler/glsl/ir.cpp                     | 2 +-
 src/compiler/glsl/ir.h                       | 8 +++++++-
 src/compiler/glsl/link_functions.cpp         | 4 ++--
 src/compiler/glsl/lower_shared_reference.cpp | 6 +++---
 src/compiler/glsl/lower_ubo_reference.cpp    | 6 +++---
 7 files changed, 21 insertions(+), 15 deletions(-)

diff --git a/src/compiler/glsl/builtin_functions.cpp b/src/compiler/glsl/builtin_functions.cpp
index 338c7d6..163cae7 100644
--- a/src/compiler/glsl/builtin_functions.cpp
+++ b/src/compiler/glsl/builtin_functions.cpp
@@ -3282,7 +3282,7 @@ builtin_builder::new_sig(const glsl_type *return_type,
 #define MAKE_INTRINSIC(return_type, id, avail, ...)  \
    ir_function_signature *sig =                      \
       new_sig(return_type, avail, __VA_ARGS__);      \
-   sig->is_intrinsic = true;                         \
+   sig->_is_intrinsic = true;                        \
    sig->intrinsic_id = id;
 
 ir_function_signature *
@@ -5623,7 +5623,7 @@ builtin_builder::_image(image_prototype_ctr prototype,
       sig->is_defined = true;
 
    } else {
-      sig->is_intrinsic = true;
+      sig->_is_intrinsic = true;
       sig->intrinsic_id = id;
    }
 
diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp
index 7ecbfe0..eecd905 100644
--- a/src/compiler/glsl/glsl_to_nir.cpp
+++ b/src/compiler/glsl/glsl_to_nir.cpp
@@ -449,7 +449,7 @@ nir_function_visitor::visit_enter(ir_function *ir)
 void
 nir_visitor::create_function(ir_function_signature *ir)
 {
-   if (ir->is_intrinsic)
+   if (ir->is_intrinsic())
       return;
 
    nir_function *func = nir_function_create(shader, ir->function_name());
@@ -470,7 +470,7 @@ nir_visitor::visit(ir_function *ir)
 void
 nir_visitor::visit(ir_function_signature *ir)
 {
-   if (ir->is_intrinsic)
+   if (ir->is_intrinsic())
       return;
 
    struct hash_entry *entry =
@@ -607,7 +607,7 @@ nir_visitor::visit(ir_return *ir)
 void
 nir_visitor::visit(ir_call *ir)
 {
-   if (ir->callee->is_intrinsic) {
+   if (ir->callee->is_intrinsic()) {
       nir_intrinsic_op op;
 
       switch (ir->callee->intrinsic_id) {
diff --git a/src/compiler/glsl/ir.cpp b/src/compiler/glsl/ir.cpp
index e633018..e576f9b 100644
--- a/src/compiler/glsl/ir.cpp
+++ b/src/compiler/glsl/ir.cpp
@@ -1617,7 +1617,7 @@ ir_variable::get_extension_warning() const
 ir_function_signature::ir_function_signature(const glsl_type *return_type,
                                              builtin_available_predicate b)
    : ir_instruction(ir_type_function_signature),
-     return_type(return_type), is_defined(false), is_intrinsic(false),
+     return_type(return_type), is_defined(false), _is_intrinsic(false),
      intrinsic_id(ir_intrinsic_invalid), builtin_avail(b), _function(NULL)
 {
    this->origin = NULL;
diff --git a/src/compiler/glsl/ir.h b/src/compiler/glsl/ir.h
index 7333a53..241d31f 100644
--- a/src/compiler/glsl/ir.h
+++ b/src/compiler/glsl/ir.h
@@ -1187,11 +1187,17 @@ public:
    /** Whether or not this function signature is a built-in. */
    bool is_builtin() const;
 
+   /** Whehter or not this function signautre is an intrinsic. */
+   inline bool is_intrinsic() const
+   {
+      return _is_intrinsic;
+   }
+
    /**
     * Whether or not this function is an intrinsic to be implemented
     * by the driver.
     */
-   bool is_intrinsic;
+   bool _is_intrinsic;
 
    /** Indentifier for this intrinsic. */
    enum ir_intrinsic_id intrinsic_id;
diff --git a/src/compiler/glsl/link_functions.cpp b/src/compiler/glsl/link_functions.cpp
index d914ea4..fe8cbed 100644
--- a/src/compiler/glsl/link_functions.cpp
+++ b/src/compiler/glsl/link_functions.cpp
@@ -159,7 +159,7 @@ public:
 
       linked_sig->replace_parameters(&formal_parameters);
 
-      linked_sig->is_intrinsic = sig->is_intrinsic;
+      linked_sig->_is_intrinsic = sig->_is_intrinsic;
       linked_sig->intrinsic_id = sig->intrinsic_id;
 
       if (sig->is_defined) {
@@ -321,7 +321,7 @@ find_matching_signature(const char *name, const exec_list *actual_parameters,
       ir_function_signature *sig =
          f->matching_signature(NULL, actual_parameters, use_builtin);
 
-      if (sig && (sig->is_defined || sig->is_intrinsic)) {
+      if (sig && (sig->is_defined || sig->is_intrinsic())) {
          /* If this function expects to bind to a built-in function and the
           * signature that we found isn't a built-in, keep looking.  Also keep
           * looking if we expect a non-built-in but found a built-in.
diff --git a/src/compiler/glsl/lower_shared_reference.cpp b/src/compiler/glsl/lower_shared_reference.cpp
index a7e738e..8f134b6 100644
--- a/src/compiler/glsl/lower_shared_reference.cpp
+++ b/src/compiler/glsl/lower_shared_reference.cpp
@@ -284,7 +284,7 @@ lower_shared_reference_visitor::shared_store(void *mem_ctx,
       ir_function_signature(glsl_type::void_type, compute_shader_enabled);
    assert(sig);
    sig->replace_parameters(&sig_params);
-   sig->is_intrinsic = true;
+   sig->_is_intrinsic = true;
    sig->intrinsic_id = ir_intrinsic_shared_store;
 
    ir_function *f = new(mem_ctx) ir_function("__intrinsic_store_shared");
@@ -312,7 +312,7 @@ lower_shared_reference_visitor::shared_load(void *mem_ctx,
       new(mem_ctx) ir_function_signature(type, compute_shader_enabled);
    assert(sig);
    sig->replace_parameters(&sig_params);
-   sig->is_intrinsic = true;
+   sig->_is_intrinsic = true;
    sig->intrinsic_id = ir_intrinsic_shared_load;
 
    ir_function *f = new(mem_ctx) ir_function("__intrinsic_load_shared");
@@ -406,7 +406,7 @@ lower_shared_reference_visitor::lower_shared_atomic_intrinsic(ir_call *ir)
                                          compute_shader_enabled);
    assert(sig);
    sig->replace_parameters(&sig_params);
-   sig->is_intrinsic = true;
+   sig->_is_intrinsic = true;
 
    assert(ir->callee->intrinsic_id >= ir_intrinsic_generic_load);
    assert(ir->callee->intrinsic_id <= ir_intrinsic_generic_atomic_comp_swap);
diff --git a/src/compiler/glsl/lower_ubo_reference.cpp b/src/compiler/glsl/lower_ubo_reference.cpp
index 276e77f..71919fb 100644
--- a/src/compiler/glsl/lower_ubo_reference.cpp
+++ b/src/compiler/glsl/lower_ubo_reference.cpp
@@ -453,7 +453,7 @@ lower_ubo_reference_visitor::ssbo_store(void *mem_ctx,
       ir_function_signature(glsl_type::void_type, shader_storage_buffer_object);
    assert(sig);
    sig->replace_parameters(&sig_params);
-   sig->is_intrinsic = true;
+   sig->_is_intrinsic = true;
    sig->intrinsic_id = ir_intrinsic_ssbo_store;
 
    ir_function *f = new(mem_ctx) ir_function("__intrinsic_store_ssbo");
@@ -491,7 +491,7 @@ lower_ubo_reference_visitor::ssbo_load(void *mem_ctx,
       new(mem_ctx) ir_function_signature(type, shader_storage_buffer_object);
    assert(sig);
    sig->replace_parameters(&sig_params);
-   sig->is_intrinsic = true;
+   sig->_is_intrinsic = true;
    sig->intrinsic_id = ir_intrinsic_ssbo_load;
 
    ir_function *f = new(mem_ctx) ir_function("__intrinsic_load_ssbo");
@@ -1018,7 +1018,7 @@ lower_ubo_reference_visitor::lower_ssbo_atomic_intrinsic(ir_call *ir)
                                          shader_storage_buffer_object);
    assert(sig);
    sig->replace_parameters(&sig_params);
-   sig->is_intrinsic = true;
+   sig->_is_intrinsic = true;
 
    assert(ir->callee->intrinsic_id >= ir_intrinsic_generic_load);
    assert(ir->callee->intrinsic_id <= ir_intrinsic_generic_atomic_comp_swap);
-- 
2.5.5



More information about the mesa-dev mailing list