}
void
-bblock_t::dump(backend_shader *s) const
+bblock_t::dump() const
{
+ const backend_shader *s = this->cfg->s;
+
int ip = this->start_ip;
foreach_inst_in_block(backend_instruction, inst, this) {
fprintf(stderr, "%5d: ", ip);
}
}
-cfg_t::cfg_t(exec_list *instructions)
+cfg_t::cfg_t(const backend_shader *s, exec_list *instructions) :
+ s(s)
{
mem_ctx = ralloc_context(NULL);
block_list.make_empty();
}
void
-cfg_t::dump(backend_shader *s)
+cfg_t::dump()
{
const idom_tree *idom = (s ? &s->idom_analysis.require() : NULL);
}
fprintf(stderr, "\n");
if (s != NULL)
- block->dump(s);
+ block->dump();
fprintf(stderr, "END B%d", block->num);
foreach_list_typed(bblock_link, link, link, &block->children) {
fprintf(stderr, " %c>B%d",
enum bblock_link_kind kind) const;
bool can_combine_with(const bblock_t *that) const;
void combine_with(bblock_t *that);
- void dump(backend_shader *s) const;
+ void dump() const;
backend_instruction *start();
const backend_instruction *start() const;
#ifdef __cplusplus
DECLARE_RALLOC_CXX_OPERATORS(cfg_t)
- cfg_t(exec_list *instructions);
+ cfg_t(const backend_shader *s, exec_list *instructions);
~cfg_t();
void remove_block(bblock_t *block);
void set_next_block(bblock_t **cur, bblock_t *block, int ip);
void make_block_array();
- void dump(backend_shader *s);
+ void dump();
void dump_cfg();
#endif
+ const struct backend_shader *s;
void *mem_ctx;
/** Ordered list (by ip) of basic blocks */
{
if (this->cfg)
return;
- cfg = new(mem_ctx) cfg_t(&this->instructions);
+ cfg = new(mem_ctx) cfg_t(this, &this->instructions);
}
void
if (print) {
fprintf(stderr, "= Before =\n");
- v->cfg->dump(v);
+ v->cfg->dump();
}
bool ret = v->opt_cmod_propagation();
if (print) {
fprintf(stderr, "\n= After =\n");
- v->cfg->dump(v);
+ v->cfg->dump();
}
return ret;
if (print) {
fprintf(stderr, "= Before =\n");
- v->cfg->dump(v);
+ v->cfg->dump();
}
bool ret = v->opt_copy_propagation();
if (print) {
fprintf(stderr, "\n= After =\n");
- v->cfg->dump(v);
+ v->cfg->dump();
}
return ret;
if (print) {
fprintf(stderr, "= Before =\n");
- v->cfg->dump(v);
+ v->cfg->dump();
}
bool ret = v->opt_saturate_propagation();
if (print) {
fprintf(stderr, "\n= After =\n");
- v->cfg->dump(v);
+ v->cfg->dump();
}
return ret;
if (print) {
fprintf(stderr, "= Before =\n");
- v->cfg->dump(v);
+ v->cfg->dump();
}
v->lower_scoreboard();
if (print) {
fprintf(stderr, "\n= After =\n");
- v->cfg->dump(v);
+ v->cfg->dump();
}
}