[Mesa-dev] [PATCH RFC 02/11] glsl: add as_loop_jump() method to ir_instruction

Connor Abbott cwabbott0 at gmail.com
Wed Jan 22 09:16:49 PST 2014


This will let us dynamically downcast to ir_loop_jump, which will be
needed later.
---
 src/glsl/ir.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/glsl/ir.h b/src/glsl/ir.h
index 19e8383..d1e790d 100644
--- a/src/glsl/ir.h
+++ b/src/glsl/ir.h
@@ -138,6 +138,7 @@ public:
    virtual class ir_constant *          as_constant()         { return NULL; }
    virtual class ir_discard *           as_discard()          { return NULL; }
    virtual class ir_jump *              as_jump()             { return NULL; }
+   virtual class ir_loop_jump *         as_loop_jump()        { return NULL; }
    /*@}*/
 
    /**
@@ -1617,6 +1618,11 @@ public:
 
    virtual ir_loop_jump *clone(void *mem_ctx, struct hash_table *) const;
 
+   virtual ir_loop_jump *as_loop_jump()
+   {
+      return this;
+   }
+
    virtual void accept(ir_visitor *v)
    {
       v->visit(this);
-- 
1.8.3.1



More information about the mesa-dev mailing list