diff options
Diffstat (limited to 'src/gallium/drivers/r600/sb/sb_liveness.h')
-rw-r--r-- | src/gallium/drivers/r600/sb/sb_liveness.h | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/src/gallium/drivers/r600/sb/sb_liveness.h b/src/gallium/drivers/r600/sb/sb_liveness.h new file mode 100644 index 0000000000..6ba7cb59b5 --- /dev/null +++ b/src/gallium/drivers/r600/sb/sb_liveness.h @@ -0,0 +1,79 @@ +/* + * Copyright 2013 Vadim Girlin <vadimgirlin@gmail.com> + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Vadim Girlin + */ + +#ifndef SB_LIVENESS_H_ +#define SB_LIVENESS_H_ + +namespace r600_sb { + +class liveness : public rev_vpass { + using vpass::visit; + + val_set live; + bool live_changed; + +public: + + liveness(shader &s) : rev_vpass(s), live_changed(false) {} + + virtual int init(); + + virtual bool visit(node &n, bool enter); + virtual bool visit(bb_node &n, bool enter); + virtual bool visit(container_node &n, bool enter); + virtual bool visit(alu_group_node &n, bool enter); + virtual bool visit(cf_node &n, bool enter); + virtual bool visit(alu_node &n, bool enter); + virtual bool visit(alu_packed_node &n, bool enter); + virtual bool visit(fetch_node &n, bool enter); + virtual bool visit(region_node &n, bool enter); + virtual bool visit(repeat_node &n, bool enter); + virtual bool visit(depart_node &n, bool enter); + virtual bool visit(if_node &n, bool enter); + +private: + + void update_interferences(); + void process_op(node &n); + + bool remove_val(value *v); + bool remove_vec(vvec &v); + bool process_outs(node& n); + void process_ins(node& n); + + void process_phi_outs(container_node *phi); + void process_phi_branch(container_node *phi, unsigned id); + + bool process_maydef(value *v); + + bool add_vec(vvec &vv, bool src); + + void update_src_vec(vvec &vv, bool src); +}; + +} //namespace r600_sb + +#endif /* SB_LIVENESS_H_ */ |