3 * Copyright © 2010 Intel Corporation
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
37 #include "ir_visitor.h"
38 #include "ir_hierarchical_visitor.h"
41 #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
50 ir_type_dereference_array
,
51 ir_type_dereference_record
,
52 ir_type_dereference_variable
,
56 ir_type_function_signature
,
63 ir_type_max
, /**< maximum ir_type enum number, for validation */
67 * Base class of all IR instructions
69 class ir_instruction
: public exec_node
{
71 enum ir_node_type ir_type
;
72 const struct glsl_type
*type
;
74 class ir_constant
*constant_expression_value();
76 /** ir_print_visitor helper for debugging. */
77 void print(void) const;
79 virtual void accept(ir_visitor
*) = 0;
80 virtual ir_visitor_status
accept(ir_hierarchical_visitor
*) = 0;
81 virtual ir_instruction
*clone(struct hash_table
*ht
) const = 0;
84 * \name IR instruction downcast functions
86 * These functions either cast the object to a derived class or return
87 * \c NULL if the object's type does not match the specified derived class.
88 * Additional downcast functions will be added as needed.
91 virtual class ir_variable
* as_variable() { return NULL
; }
92 virtual class ir_function
* as_function() { return NULL
; }
93 virtual class ir_dereference
* as_dereference() { return NULL
; }
94 virtual class ir_dereference_array
* as_dereference_array() { return NULL
; }
95 virtual class ir_dereference_variable
*as_dereference_variable() { return NULL
; }
96 virtual class ir_expression
* as_expression() { return NULL
; }
97 virtual class ir_rvalue
* as_rvalue() { return NULL
; }
98 virtual class ir_loop
* as_loop() { return NULL
; }
99 virtual class ir_assignment
* as_assignment() { return NULL
; }
100 virtual class ir_call
* as_call() { return NULL
; }
101 virtual class ir_return
* as_return() { return NULL
; }
102 virtual class ir_if
* as_if() { return NULL
; }
103 virtual class ir_swizzle
* as_swizzle() { return NULL
; }
104 virtual class ir_constant
* as_constant() { return NULL
; }
110 ir_type
= ir_type_unset
;
115 class ir_rvalue
: public ir_instruction
{
117 virtual ir_rvalue
*clone(struct hash_table
*) const = 0;
119 virtual ir_rvalue
* as_rvalue()
124 virtual bool is_lvalue()
130 * Get the variable that is ultimately referenced by an r-value
132 virtual ir_variable
*variable_referenced()
139 * If an r-value is a reference to a whole variable, get that variable
142 * Pointer to a variable that is completely dereferenced by the r-value. If
143 * the r-value is not a dereference or the dereference does not access the
144 * entire variable (i.e., it's just one array element, struct field), \c NULL
147 virtual ir_variable
*whole_variable_referenced()
160 enum ir_variable_mode
{
168 enum ir_variable_interpolation
{
175 class ir_variable
: public ir_instruction
{
177 ir_variable(const struct glsl_type
*, const char *);
179 virtual ir_variable
*clone(struct hash_table
*ht
) const;
181 virtual ir_variable
*as_variable()
186 virtual void accept(ir_visitor
*v
)
191 virtual ir_visitor_status
accept(ir_hierarchical_visitor
*);
195 * Get the string value for the interpolation qualifier
198 * If none of \c shader_in or \c shader_out is set, an empty string will
199 * be returned. Otherwise the string that would be used in a shader to
200 * specify \c mode will be returned.
202 const char *interpolation_string() const;
205 * Calculate the number of slots required to hold this variable
207 * This is used to determine how many uniform or varying locations a variable
208 * occupies. The count is in units of floating point components.
210 unsigned component_slots() const;
215 * Highest element accessed with a constant expression array index
217 * Not used for non-array variables.
219 unsigned max_array_access
;
221 unsigned read_only
:1;
223 unsigned invariant
:1;
224 /** If the variable is initialized outside of the scope of the shader */
225 unsigned shader_in
:1;
227 * If the variable value is later used outside of the scope of the shader.
229 unsigned shader_out
:1;
232 unsigned interpolation
:2;
235 * Flag that the whole array is assignable
237 * In GLSL 1.20 and later whole arrays are assignable (and comparable for
238 * equality). This flag enables this behavior.
240 unsigned array_lvalue
:1;
243 * Storage location of the base of this variable
245 * The precise meaning of this field depends on the nature of the variable.
247 * - Vertex shader input: one of the values from \c gl_vert_attrib.
248 * - Vertex shader output: one of the values from \c gl_vert_result.
249 * - Fragment shader input: one of the values from \c gl_frag_attrib.
250 * - Fragment shader output: one of the values from \c gl_frag_result.
251 * - Uniforms: Per-stage uniform slot number.
252 * - Other: This field is not currently used.
254 * If the variable is a uniform, shader input, or shader output, and the
255 * slot has not been assigned, the value will be -1.
260 * Emit a warning if this variable is accessed.
262 const char *warn_extension
;
265 * Value assigned in the initializer of a variable declared "const"
267 ir_constant
*constant_value
;
273 * The representation of a function instance; may be the full definition or
274 * simply a prototype.
276 class ir_function_signature
: public ir_instruction
{
277 /* An ir_function_signature will be part of the list of signatures in
281 ir_function_signature(const glsl_type
*return_type
);
283 virtual ir_function_signature
*clone(struct hash_table
*ht
) const;
285 virtual void accept(ir_visitor
*v
)
290 virtual ir_visitor_status
accept(ir_hierarchical_visitor
*);
293 * Get the name of the function for which this is a signature
295 const char *function_name() const;
298 * Get a handle to the function for which this is a signature
300 * There is no setter function, this function returns a \c const pointer,
301 * and \c ir_function_signature::_function is private for a reason. The
302 * only way to make a connection between a function and function signature
303 * is via \c ir_function::add_signature. This helps ensure that certain
304 * invariants (i.e., a function signature is in the list of signatures for
305 * its \c _function) are met.
307 * \sa ir_function::add_signature
309 inline const class ir_function
*function() const
311 return this->_function
;
315 * Check whether the qualifiers match between this signature's parameters
316 * and the supplied parameter list. If not, returns the name of the first
317 * parameter with mismatched qualifiers (for use in error messages).
319 const char *qualifiers_match(exec_list
*params
);
322 * Replace the current parameter list with the given one. This is useful
323 * if the current information came from a prototype, and either has invalid
324 * or missing parameter names.
326 void replace_parameters(exec_list
*new_params
);
329 * Function return type.
331 * \note This discards the optional precision qualifier.
333 const struct glsl_type
*return_type
;
336 * List of ir_variable of function parameters.
338 * This represents the storage. The paramaters passed in a particular
339 * call will be in ir_call::actual_paramaters.
341 struct exec_list parameters
;
343 /** Whether or not this function has a body (which may be empty). */
344 unsigned is_defined
:1;
346 /** Whether or not this function signature is a built-in. */
347 unsigned is_built_in
:1;
349 /** Body of instructions in the function. */
350 struct exec_list body
;
353 /** Function of which this signature is one overload. */
354 class ir_function
*_function
;
356 friend class ir_function
;
361 * Header for tracking multiple overloaded functions with the same name.
362 * Contains a list of ir_function_signatures representing each of the
365 class ir_function
: public ir_instruction
{
367 ir_function(const char *name
);
369 virtual ir_function
*clone(struct hash_table
*ht
) const;
371 virtual ir_function
*as_function()
376 virtual void accept(ir_visitor
*v
)
381 virtual ir_visitor_status
accept(ir_hierarchical_visitor
*);
383 void add_signature(ir_function_signature
*sig
)
385 sig
->_function
= this;
386 this->signatures
.push_tail(sig
);
390 * Get an iterator for the set of function signatures
392 exec_list_iterator
iterator()
394 return signatures
.iterator();
398 * Find a signature that matches a set of actual parameters, taking implicit
399 * conversions into account.
401 ir_function_signature
*matching_signature(const exec_list
*actual_param
);
404 * Find a signature that exactly matches a set of actual parameters without
405 * any implicit type conversions.
407 ir_function_signature
*exact_matching_signature(const exec_list
*actual_ps
);
410 * Name of the function.
416 * List of ir_function_signature for each overloaded function with this name.
418 struct exec_list signatures
;
421 inline const char *ir_function_signature::function_name() const
423 return this->_function
->name
;
429 * IR instruction representing high-level if-statements
431 class ir_if
: public ir_instruction
{
433 ir_if(ir_rvalue
*condition
)
434 : condition(condition
)
436 ir_type
= ir_type_if
;
439 virtual ir_if
*clone(struct hash_table
*ht
) const;
441 virtual ir_if
*as_if()
446 virtual void accept(ir_visitor
*v
)
451 virtual ir_visitor_status
accept(ir_hierarchical_visitor
*);
453 ir_rvalue
*condition
;
454 /** List of ir_instruction for the body of the then branch */
455 exec_list then_instructions
;
456 /** List of ir_instruction for the body of the else branch */
457 exec_list else_instructions
;
462 * IR instruction representing a high-level loop structure.
464 class ir_loop
: public ir_instruction
{
466 ir_loop() : from(NULL
), to(NULL
), increment(NULL
), counter(NULL
)
468 ir_type
= ir_type_loop
;
471 virtual ir_loop
*clone(struct hash_table
*ht
) const;
473 virtual void accept(ir_visitor
*v
)
478 virtual ir_visitor_status
accept(ir_hierarchical_visitor
*);
480 virtual ir_loop
*as_loop()
486 * Get an iterator for the instructions of the loop body
488 exec_list_iterator
iterator()
490 return body_instructions
.iterator();
493 /** List of ir_instruction that make up the body of the loop. */
494 exec_list body_instructions
;
497 * \name Loop counter and controls
502 ir_rvalue
*increment
;
503 ir_variable
*counter
;
508 class ir_assignment
: public ir_rvalue
{
510 ir_assignment(ir_rvalue
*lhs
, ir_rvalue
*rhs
, ir_rvalue
*condition
);
512 virtual ir_assignment
*clone(struct hash_table
*ht
) const;
514 virtual void accept(ir_visitor
*v
)
519 virtual ir_visitor_status
accept(ir_hierarchical_visitor
*);
521 virtual ir_assignment
* as_assignment()
527 * Left-hand side of the assignment.
532 * Value being assigned
537 * Optional condition for the assignment.
539 ir_rvalue
*condition
;
542 /* Update ir_expression::num_operands() and operator_strs when
543 * updating this list.
545 enum ir_expression_operation
{
558 ir_unop_f2i
, /**< Float-to-integer conversion. */
559 ir_unop_i2f
, /**< Integer-to-float conversion. */
560 ir_unop_f2b
, /**< Float-to-boolean conversion */
561 ir_unop_b2f
, /**< Boolean-to-float conversion */
562 ir_unop_i2b
, /**< int-to-boolean conversion */
563 ir_unop_b2i
, /**< Boolean-to-int conversion */
564 ir_unop_u2f
, /**< Unsigned-to-float conversion. */
567 * \name Unary floating-point rounding operations.
577 * \name Trigonometric operations.
585 * \name Partial derivatives.
598 * Takes one of two combinations of arguments:
603 * Does not take integer types.
608 * \name Binary comparison operators
620 * \name Bit-wise binary operations.
642 class ir_expression
: public ir_rvalue
{
644 ir_expression(int op
, const struct glsl_type
*type
,
645 ir_rvalue
*, ir_rvalue
*);
647 virtual ir_expression
*as_expression()
652 virtual ir_expression
*clone(struct hash_table
*ht
) const;
654 static unsigned int get_num_operands(ir_expression_operation
);
655 unsigned int get_num_operands() const
657 return get_num_operands(operation
);
661 * Return a string representing this expression's operator.
663 const char *operator_string();
666 * Do a reverse-lookup to translate the given string into an operator.
668 static ir_expression_operation
get_operator(const char *);
670 virtual void accept(ir_visitor
*v
)
675 virtual ir_visitor_status
accept(ir_hierarchical_visitor
*);
677 ir_expression_operation operation
;
678 ir_rvalue
*operands
[2];
683 * IR instruction representing a function call
685 class ir_call
: public ir_rvalue
{
687 ir_call(ir_function_signature
*callee
, exec_list
*actual_parameters
)
690 ir_type
= ir_type_call
;
691 assert(callee
->return_type
!= NULL
);
692 type
= callee
->return_type
;
693 actual_parameters
->move_nodes_to(& this->actual_parameters
);
696 virtual ir_call
*clone(struct hash_table
*ht
) const;
698 virtual ir_call
*as_call()
703 virtual void accept(ir_visitor
*v
)
708 virtual ir_visitor_status
accept(ir_hierarchical_visitor
*);
711 * Get a generic ir_call object when an error occurs
713 * Any allocation will be performed with 'ctx' as talloc owner.
715 static ir_call
*get_error_instruction(void *ctx
);
718 * Get an iterator for the set of acutal parameters
720 exec_list_iterator
iterator()
722 return actual_parameters
.iterator();
726 * Get the name of the function being called.
728 const char *callee_name() const
730 return callee
->function_name();
733 ir_function_signature
*get_callee()
739 * Set the function call target
741 void set_callee(ir_function_signature
*sig
);
744 * Generates an inline version of the function before @ir,
745 * returning the return value of the function.
747 ir_rvalue
*generate_inline(ir_instruction
*ir
);
749 /* List of ir_rvalue of paramaters passed in this call. */
750 exec_list actual_parameters
;
756 this->ir_type
= ir_type_call
;
759 ir_function_signature
*callee
;
764 * \name Jump-like IR instructions.
766 * These include \c break, \c continue, \c return, and \c discard.
769 class ir_jump
: public ir_instruction
{
773 ir_type
= ir_type_unset
;
777 class ir_return
: public ir_jump
{
782 this->ir_type
= ir_type_return
;
785 ir_return(ir_rvalue
*value
)
788 this->ir_type
= ir_type_return
;
791 virtual ir_return
*clone(struct hash_table
*) const;
793 virtual ir_return
*as_return()
798 ir_rvalue
*get_value() const
803 virtual void accept(ir_visitor
*v
)
808 virtual ir_visitor_status
accept(ir_hierarchical_visitor
*);
815 * Jump instructions used inside loops
817 * These include \c break and \c continue. The \c break within a loop is
818 * different from the \c break within a switch-statement.
822 class ir_loop_jump
: public ir_jump
{
829 ir_loop_jump(jump_mode mode
)
831 this->ir_type
= ir_type_loop_jump
;
836 virtual ir_loop_jump
*clone(struct hash_table
*) const;
838 virtual void accept(ir_visitor
*v
)
843 virtual ir_visitor_status
accept(ir_hierarchical_visitor
*);
845 bool is_break() const
847 return mode
== jump_break
;
850 bool is_continue() const
852 return mode
== jump_continue
;
855 /** Mode selector for the jump instruction. */
858 /** Loop containing this break instruction. */
863 * IR instruction representing discard statements.
865 class ir_discard
: public ir_jump
{
869 this->ir_type
= ir_type_discard
;
870 this->condition
= NULL
;
873 ir_discard(ir_rvalue
*cond
)
875 this->condition
= cond
;
878 virtual ir_discard
*clone(struct hash_table
*ht
) const;
880 virtual void accept(ir_visitor
*v
)
885 virtual ir_visitor_status
accept(ir_hierarchical_visitor
*);
887 ir_rvalue
*condition
;
893 * Texture sampling opcodes used in ir_texture
895 enum ir_texture_opcode
{
896 ir_tex
, /* Regular texture look-up */
897 ir_txb
, /* Texture look-up with LOD bias */
898 ir_txl
, /* Texture look-up with explicit LOD */
899 ir_txd
, /* Texture look-up with partial derivatvies */
900 ir_txf
/* Texel fetch with explicit LOD */
905 * IR instruction to sample a texture
907 * The specific form of the IR instruction depends on the \c mode value
908 * selected from \c ir_texture_opcodes. In the printed IR, these will
912 * | Projection divisor
913 * | | Shadow comparitor
916 * (tex (sampler) (coordinate) (0 0 0) (1) ( ))
917 * (txb (sampler) (coordinate) (0 0 0) (1) ( ) (bias))
918 * (txl (sampler) (coordinate) (0 0 0) (1) ( ) (lod))
919 * (txd (sampler) (coordinate) (0 0 0) (1) ( ) (dPdx dPdy))
920 * (txf (sampler) (coordinate) (0 0 0) (lod))
922 class ir_texture
: public ir_rvalue
{
924 ir_texture(enum ir_texture_opcode op
)
925 : op(op
), projector(NULL
), shadow_comparitor(NULL
)
927 this->ir_type
= ir_type_texture
;
930 virtual ir_texture
*clone(struct hash_table
*) const;
932 virtual void accept(ir_visitor
*v
)
937 virtual ir_visitor_status
accept(ir_hierarchical_visitor
*);
940 * Return a string representing the ir_texture_opcode.
942 const char *opcode_string();
944 /** Set the sampler and infer the type. */
945 void set_sampler(ir_dereference
*sampler
);
948 * Do a reverse-lookup to translate a string into an ir_texture_opcode.
950 static ir_texture_opcode
get_opcode(const char *);
952 enum ir_texture_opcode op
;
954 /** Sampler to use for the texture access. */
955 ir_dereference
*sampler
;
957 /** Texture coordinate to sample */
958 ir_rvalue
*coordinate
;
961 * Value used for projective divide.
963 * If there is no projective divide (the common case), this will be
964 * \c NULL. Optimization passes should check for this to point to a constant
965 * of 1.0 and replace that with \c NULL.
967 ir_rvalue
*projector
;
970 * Coordinate used for comparison on shadow look-ups.
972 * If there is no shadow comparison, this will be \c NULL. For the
973 * \c ir_txf opcode, this *must* be \c NULL.
975 ir_rvalue
*shadow_comparitor
;
977 /** Explicit texel offsets. */
978 signed char offsets
[3];
981 ir_rvalue
*lod
; /**< Floating point LOD */
982 ir_rvalue
*bias
; /**< Floating point LOD bias */
984 ir_rvalue
*dPdx
; /**< Partial derivative of coordinate wrt X */
985 ir_rvalue
*dPdy
; /**< Partial derivative of coordinate wrt Y */
991 struct ir_swizzle_mask
{
998 * Number of components in the swizzle.
1000 unsigned num_components
:3;
1003 * Does the swizzle contain duplicate components?
1005 * L-value swizzles cannot contain duplicate components.
1007 unsigned has_duplicates
:1;
1011 class ir_swizzle
: public ir_rvalue
{
1013 ir_swizzle(ir_rvalue
*, unsigned x
, unsigned y
, unsigned z
, unsigned w
,
1016 ir_swizzle(ir_rvalue
*val
, const unsigned *components
, unsigned count
);
1018 ir_swizzle(ir_rvalue
*val
, ir_swizzle_mask mask
);
1020 virtual ir_swizzle
*clone(struct hash_table
*) const;
1022 virtual ir_swizzle
*as_swizzle()
1028 * Construct an ir_swizzle from the textual representation. Can fail.
1030 static ir_swizzle
*create(ir_rvalue
*, const char *, unsigned vector_length
);
1032 virtual void accept(ir_visitor
*v
)
1037 virtual ir_visitor_status
accept(ir_hierarchical_visitor
*);
1041 return val
->is_lvalue() && !mask
.has_duplicates
;
1045 * Get the variable that is ultimately referenced by an r-value
1047 virtual ir_variable
*variable_referenced();
1050 ir_swizzle_mask mask
;
1054 * Initialize the mask component of a swizzle
1056 * This is used by the \c ir_swizzle constructors.
1058 void init_mask(const unsigned *components
, unsigned count
);
1062 class ir_dereference
: public ir_rvalue
{
1064 virtual ir_dereference
*clone(struct hash_table
*) const = 0;
1066 virtual ir_dereference
*as_dereference()
1074 * Get the variable that is ultimately referenced by an r-value
1076 virtual ir_variable
*variable_referenced() = 0;
1080 class ir_dereference_variable
: public ir_dereference
{
1082 ir_dereference_variable(ir_variable
*var
);
1084 virtual ir_dereference_variable
*clone(struct hash_table
*) const;
1086 virtual ir_dereference_variable
*as_dereference_variable()
1092 * Get the variable that is ultimately referenced by an r-value
1094 virtual ir_variable
*variable_referenced()
1099 virtual ir_variable
*whole_variable_referenced()
1101 /* ir_dereference_variable objects always dereference the entire
1102 * variable. However, if this dereference is dereferenced by anything
1103 * else, the complete deferefernce chain is not a whole-variable
1104 * dereference. This method should only be called on the top most
1105 * ir_rvalue in a dereference chain.
1110 virtual void accept(ir_visitor
*v
)
1115 virtual ir_visitor_status
accept(ir_hierarchical_visitor
*);
1118 * Object being dereferenced.
1124 class ir_dereference_array
: public ir_dereference
{
1126 ir_dereference_array(ir_rvalue
*value
, ir_rvalue
*array_index
);
1128 ir_dereference_array(ir_variable
*var
, ir_rvalue
*array_index
);
1130 virtual ir_dereference_array
*clone(struct hash_table
*) const;
1132 virtual ir_dereference_array
*as_dereference_array()
1138 * Get the variable that is ultimately referenced by an r-value
1140 virtual ir_variable
*variable_referenced()
1142 return this->array
->variable_referenced();
1145 virtual void accept(ir_visitor
*v
)
1150 virtual ir_visitor_status
accept(ir_hierarchical_visitor
*);
1153 ir_rvalue
*array_index
;
1156 void set_array(ir_rvalue
*value
);
1160 class ir_dereference_record
: public ir_dereference
{
1162 ir_dereference_record(ir_rvalue
*value
, const char *field
);
1164 ir_dereference_record(ir_variable
*var
, const char *field
);
1166 virtual ir_dereference_record
*clone(struct hash_table
*) const;
1169 * Get the variable that is ultimately referenced by an r-value
1171 virtual ir_variable
*variable_referenced()
1173 return this->record
->variable_referenced();
1176 virtual void accept(ir_visitor
*v
)
1181 virtual ir_visitor_status
accept(ir_hierarchical_visitor
*);
1189 * Data stored in an ir_constant
1191 union ir_constant_data
{
1199 class ir_constant
: public ir_rvalue
{
1201 ir_constant(const struct glsl_type
*type
, const ir_constant_data
*data
);
1202 ir_constant(bool b
);
1203 ir_constant(unsigned int u
);
1205 ir_constant(float f
);
1208 * Construct an ir_constant from a list of ir_constant values
1210 ir_constant(const struct glsl_type
*type
, exec_list
*values
);
1213 * Construct an ir_constant from a scalar component of another ir_constant
1215 * The new \c ir_constant inherits the type of the component from the
1219 * In the case of a matrix constant, the new constant is a scalar, \b not
1222 ir_constant(const ir_constant
*c
, unsigned i
);
1224 virtual ir_constant
*clone(struct hash_table
*) const;
1226 virtual ir_constant
*as_constant()
1231 virtual void accept(ir_visitor
*v
)
1236 virtual ir_visitor_status
accept(ir_hierarchical_visitor
*);
1239 * Get a particular component of a constant as a specific type
1241 * This is useful, for example, to get a value from an integer constant
1242 * as a float or bool. This appears frequently when constructors are
1243 * called with all constant parameters.
1246 bool get_bool_component(unsigned i
) const;
1247 float get_float_component(unsigned i
) const;
1248 int get_int_component(unsigned i
) const;
1249 unsigned get_uint_component(unsigned i
) const;
1252 ir_constant
*get_record_field(const char *name
);
1255 * Determine whether a constant has the same value as another constant
1257 bool has_value(const ir_constant
*) const;
1260 * Value of the constant.
1262 * The field used to back the values supplied by the constant is determined
1263 * by the type associated with the \c ir_instruction. Constants may be
1264 * scalars, vectors, or matrices.
1266 union ir_constant_data value
;
1268 exec_list components
;
1272 * Parameterless constructor only used by the clone method
1278 visit_exec_list(exec_list
*list
, ir_visitor
*visitor
);
1280 void validate_ir_tree(exec_list
*instructions
);
1283 * Make a clone of each IR instruction in a list
1285 * \param in List of IR instructions that are to be cloned
1286 * \param out List to hold the cloned instructions
1289 clone_ir_list(exec_list
*out
, const exec_list
*in
);
1292 _mesa_glsl_initialize_variables(exec_list
*instructions
,
1293 struct _mesa_glsl_parse_state
*state
);
1296 _mesa_glsl_initialize_functions(exec_list
*instructions
,
1297 struct _mesa_glsl_parse_state
*state
);