glsl: Add ir_function_signature::is_intrinsic() method
authorIan Romanick <ian.d.romanick@intel.com>
Thu, 1 Sep 2016 01:38:57 +0000 (18:38 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Tue, 4 Oct 2016 23:53:31 +0000 (16:53 -0700)
This necessetated renaming the is_intrinsic field to _is_intrinsic.  The
next commit will remove the field.

   text    data     bss     dec     hex filename
6036507  283160   28608 6348275  60ddf3 lib64/i965_dri.so before
6036491  283160   28608 6348259  60dde3 lib64/i965_dri.so after

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
src/compiler/glsl/builtin_functions.cpp
src/compiler/glsl/glsl_to_nir.cpp
src/compiler/glsl/ir.cpp
src/compiler/glsl/ir.h
src/compiler/glsl/link_functions.cpp
src/compiler/glsl/lower_shared_reference.cpp
src/compiler/glsl/lower_ubo_reference.cpp

index daaa3a69e6175b92d0744cbc85524a07dae2def4..84b416d3749c31a4c100516fd2d7472ad296c41c 100644 (file)
@@ -3266,7 +3266,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 *
@@ -5601,7 +5601,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;
    }
 
index 7ecbfe079a17b99111f7bdf8fbbe971fca777dcb..eecd9053fe5c67c48fae2fbfc706ccee81cbace0 100644 (file)
@@ -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) {
index e633018ff68dfddd1a527c0b6101cbfcbd1c8b02..e576f9b28737ac2cdd37d9fdd5ec6ae42def3f22 100644 (file)
@@ -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;
index 7333a53d2155c1a80e61b6db9b191dcecf7cb5a1..241d31f918f3e73448c0f74d3b8168290e2435b6 100644 (file)
@@ -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;
index 00dc345d751053728db5368b4f8affc1d4b6cec8..3b669cc9203a63b8aa0d7290fb3ebf3e72b3ee25 100644 (file)
@@ -75,7 +75,7 @@ public:
       const char *const name = callee->function_name();
 
       /* We don't actually need to find intrinsics; they're not real */
-      if (callee->is_intrinsic)
+      if (callee->is_intrinsic())
          return visit_continue;
 
       /* Determine if the requested function signature already exists in the
@@ -161,7 +161,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) {
@@ -323,7 +323,7 @@ find_matching_signature(const char *name, const exec_list *actual_parameters,
       ir_function_signature *sig =
          f->matching_signature(NULL, actual_parameters, false);
 
-      if (sig && (sig->is_defined || sig->is_intrinsic))
+      if (sig && (sig->is_defined || sig->is_intrinsic()))
          return sig;
    }
 
index a7e738e8fc4f64e7626f71d9001d4418d90334b2..8f134b6eda6306baca6d452028b27b6d98a86507 100644 (file)
@@ -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);
index 276e77fbc82ab4f9626bf67bb6e6df634ace46c0..71919fbb4ee72b2a94592c635eb0fff3981f5273 100644 (file)
@@ -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);