diff options
author | Ian Romanick <[email protected]> | 2015-03-24 08:55:15 -0700 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2015-03-25 10:34:59 -0700 |
commit | a284c6300665d4388dae14363807a57bb82e4cb5 (patch) | |
tree | a96a3b2166ef706f4c0c34e39c1f76d95a30ff04 /src/glsl/ir.h | |
parent | 25d6cdd2ff1f00e0eab532956c0ae17d4ffa42da (diff) |
glsl: Add is_rvalue, is_dereference, and is_jump methods
These functions deteremine when an IR node is one of the non-leaf
classes.
v2: Adjust indentation to line up. Suggested by Matt.
Signed-off-by: Ian Romanick <[email protected]>
Reviewed-by: Francisco Jerez <[email protected]>
Diffstat (limited to 'src/glsl/ir.h')
-rw-r--r-- | src/glsl/ir.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/glsl/ir.h b/src/glsl/ir.h index fdc22edf133..b3a98b88a1e 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -109,6 +109,31 @@ public: virtual ir_instruction *clone(void *mem_ctx, struct hash_table *ht) const = 0; + bool is_rvalue() const + { + return ir_type == ir_type_dereference_array || + ir_type == ir_type_dereference_record || + ir_type == ir_type_dereference_variable || + ir_type == ir_type_constant || + ir_type == ir_type_expression || + ir_type == ir_type_swizzle || + ir_type == ir_type_texture; + } + + bool is_dereference() const + { + return ir_type == ir_type_dereference_array || + ir_type == ir_type_dereference_record || + ir_type == ir_type_dereference_variable; + } + + bool is_jump() const + { + return ir_type == ir_type_loop_jump || + ir_type == ir_type_return || + ir_type == ir_type_discard; + } + /** * \name IR instruction downcast functions * |