[Mesa-dev] [PATCH 18.1/23] glsl: Add is_rvalue, is_dereference, and is_jump methods

Francisco Jerez currojerez at riseup.net
Wed Mar 25 05:14:34 PDT 2015


Ian Romanick <idr at freedesktop.org> writes:

> On 03/24/2015 02:14 PM, Matt Turner wrote:
>> On Tue, Mar 24, 2015 at 11:25 AM, Ian Romanick <idr at freedesktop.org> wrote:
>>> From: Ian Romanick <ian.d.romanick at intel.com>
>>>
>>> These functions deteremine when an IR node is one of the non-leaf
>>> classes.
>>>
>>> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
>>> Cc: Francisco Jerez <currojerez at riseup.net>
>>> ---
>>>  src/glsl/ir.h | 25 +++++++++++++++++++++++++
>>>  1 file changed, 25 insertions(+)
>>>
>>> diff --git a/src/glsl/ir.h b/src/glsl/ir.h
>>> index fdc22ed..b2b4822 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;
>> 
>> Indent these expressions to line up with the first one after the return.
>
> By any chance... Do you know a way to get emacs to do that automatically
> without putting extra parenthesis around the whole expression?
>
Heh, yeah, I tend to do the same to get automatic alignment in cases
like this, but apparently some people find the extra parenthesis
annoying.  I don't have a better solution.

Anyway,
Reviewed-by: Francisco Jerez <currojerez at riseup.net>


> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 212 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150325/2494ad3f/attachment.sig>


More information about the mesa-dev mailing list