diff options
author | Ian Romanick <ian.d.romanick@intel.com> | 2010-04-05 16:28:15 -0700 |
---|---|---|
committer | Ian Romanick <ian.d.romanick@intel.com> | 2010-04-07 11:42:30 -0700 |
commit | f8e31e00b1078dc28187a43a1ab8949e154e7533 (patch) | |
tree | 20feb0b6c04d81229896eb805ec461fb199e2657 /ir.h | |
parent | fad607a9be59056aecda50176b4d20a8b5319747 (diff) |
Add ir_loop_jump to represent 'break' and 'continue' in loops
Diffstat (limited to 'ir.h')
-rw-r--r-- | ir.h | 45 |
1 files changed, 45 insertions, 0 deletions
@@ -532,6 +532,51 @@ public: private: ir_rvalue *value; }; + + +/** + * Jump instructions used inside loops + * + * These include \c break and \c continue. The \c break within a loop is + * different from the \c break within a switch-statement. + * + * \sa ir_switch_jump + */ +class ir_loop_jump : public ir_jump { +public: + enum jump_mode { + jump_break, + jump_continue + }; + + ir_loop_jump(ir_loop *loop, jump_mode mode) + : loop(loop), mode(mode) + { + /* empty */ + } + + virtual void accept(ir_visitor *v) + { + v->visit(this); + } + + bool is_break() const + { + return mode == jump_break; + } + + bool is_continue() const + { + return mode == jump_continue; + } + +private: + /** Loop containing this break instruction. */ + ir_loop *loop; + + /** Mode selector for the jump instruction. */ + enum jump_mode mode; +}; /*@}*/ |