#include "brw_fs.h"
#include "brw_cfg.h"
-/** @file brw_fs_cfg.cpp
+/** @file brw_cfg_t.cpp
*
* Walks the shader instructions generated and creates a set of basic
* blocks with successor/predecessor edges connecting them.
*/
-static fs_bblock *
+static bblock_t *
pop_stack(exec_list *list)
{
- fs_bblock_link *link = (fs_bblock_link *)list->get_tail();
- fs_bblock *block = link->block;
+ bblock_link *link = (bblock_link *)list->get_tail();
+ bblock_t *block = link->block;
link->remove();
return block;
}
-fs_bblock::fs_bblock()
+bblock_t::bblock_t()
{
start = NULL;
end = NULL;
}
void
-fs_bblock::add_successor(void *mem_ctx, fs_bblock *successor)
+bblock_t::add_successor(void *mem_ctx, bblock_t *successor)
{
successor->parents.push_tail(this->make_list(mem_ctx));
children.push_tail(successor->make_list(mem_ctx));
}
-fs_bblock_link *
-fs_bblock::make_list(void *mem_ctx)
+bblock_link *
+bblock_t::make_list(void *mem_ctx)
{
- return new(mem_ctx) fs_bblock_link(this);
+ return new(mem_ctx) bblock_link(this);
}
-fs_cfg::fs_cfg(fs_visitor *v)
+cfg_t::cfg_t(fs_visitor *v)
{
mem_ctx = ralloc_context(v->mem_ctx);
block_list.make_empty();
ip = 0;
cur = NULL;
- fs_bblock *entry = new_block();
- fs_bblock *cur_if = NULL, *cur_else = NULL, *cur_endif = NULL;
- fs_bblock *cur_do = NULL, *cur_while = NULL;
+ bblock_t *entry = new_block();
+ bblock_t *cur_if = NULL, *cur_else = NULL, *cur_endif = NULL;
+ bblock_t *cur_do = NULL, *cur_while = NULL;
exec_list if_stack, else_stack, endif_stack, do_stack, while_stack;
- fs_bblock *next;
+ bblock_t *next;
set_next_block(entry);
make_block_array();
}
-fs_cfg::~fs_cfg()
+cfg_t::~cfg_t()
{
ralloc_free(mem_ctx);
}
-fs_bblock *
-fs_cfg::new_block()
+bblock_t *
+cfg_t::new_block()
{
- fs_bblock *block = new(mem_ctx) fs_bblock();
+ bblock_t *block = new(mem_ctx) bblock_t();
return block;
}
void
-fs_cfg::set_next_block(fs_bblock *block)
+cfg_t::set_next_block(bblock_t *block)
{
if (cur) {
assert(cur->end->next == block->start);
}
void
-fs_cfg::make_block_array()
+cfg_t::make_block_array()
{
- blocks = ralloc_array(mem_ctx, fs_bblock *, num_blocks);
+ blocks = ralloc_array(mem_ctx, bblock_t *, num_blocks);
int i = 0;
foreach_list(block_node, &block_list) {
- fs_bblock_link *link = (fs_bblock_link *)block_node;
+ bblock_link *link = (bblock_link *)block_node;
blocks[i++] = link->block;
}
assert(i == num_blocks);
#include "brw_fs.h"
-class fs_bblock_link : public exec_node {
+class bblock_link : public exec_node {
public:
- fs_bblock_link(fs_bblock *block)
+ bblock_link(bblock_t *block)
: block(block)
{
}
- fs_bblock *block;
+ bblock_t *block;
};
-class fs_bblock {
+class bblock_t {
public:
static void* operator new(size_t size, void *ctx)
{
return node;
}
- fs_bblock_link *make_list(void *mem_ctx);
+ bblock_link *make_list(void *mem_ctx);
- fs_bblock();
+ bblock_t();
- void add_successor(void *mem_ctx, fs_bblock *successor);
+ void add_successor(void *mem_ctx, bblock_t *successor);
fs_inst *start;
fs_inst *end;
int block_num;
};
-class fs_cfg {
+class cfg_t {
public:
static void* operator new(size_t size, void *ctx)
{
return node;
}
- fs_cfg(fs_visitor *v);
- ~fs_cfg();
- fs_bblock *new_block();
- void set_next_block(fs_bblock *block);
+ cfg_t(fs_visitor *v);
+ ~cfg_t();
+ bblock_t *new_block();
+ void set_next_block(bblock_t *block);
void make_block_array();
/** @{
*
* Used while generating the block list.
*/
- fs_bblock *cur;
+ bblock_t *cur;
int ip;
/** @} */
/** Ordered list (by ip) of basic blocks */
exec_list block_list;
- fs_bblock **blocks;
+ bblock_t **blocks;
int num_blocks;
};
#include "glsl/glsl_types.h"
#include "glsl/ir.h"
-class fs_bblock;
+class bblock_t;
namespace {
class acp_entry;
}
void calculate_live_intervals();
bool opt_algebraic();
bool opt_cse();
- bool opt_cse_local(fs_bblock *block, exec_list *aeb);
+ bool opt_cse_local(bblock_t *block, exec_list *aeb);
bool opt_copy_propagate();
bool try_copy_propagate(fs_inst *inst, int arg, acp_entry *entry);
bool try_constant_propagate(fs_inst *inst, acp_entry *entry);
- bool opt_copy_propagate_local(void *mem_ctx, fs_bblock *block);
+ bool opt_copy_propagate_local(void *mem_ctx, bblock_t *block);
bool register_coalesce();
bool register_coalesce_2();
bool compute_to_mrf();
int force_uncompressed_stack;
int force_sechalf_stack;
- class fs_bblock *bblock;
+ class bblock_t *bblock;
};
bool brw_do_channel_expressions(struct exec_list *instructions);
* list.
*/
bool
-fs_visitor::opt_copy_propagate_local(void *mem_ctx, fs_bblock *block)
+fs_visitor::opt_copy_propagate_local(void *mem_ctx, bblock_t *block)
{
bool progress = false;
int acp_count = 16;
bool progress = false;
void *mem_ctx = ralloc_context(this->mem_ctx);
- fs_cfg cfg(this);
+ cfg_t cfg(this);
for (int b = 0; b < cfg.num_blocks; b++) {
- fs_bblock *block = cfg.blocks[b];
+ bblock_t *block = cfg.blocks[b];
progress = opt_copy_propagate_local(mem_ctx, block) || progress;
}
}
bool
-fs_visitor::opt_cse_local(fs_bblock *block, exec_list *aeb)
+fs_visitor::opt_cse_local(bblock_t *block, exec_list *aeb)
{
bool progress = false;
{
bool progress = false;
- fs_cfg cfg(this);
+ cfg_t cfg(this);
for (int b = 0; b < cfg.num_blocks; b++) {
- fs_bblock *block = cfg.blocks[b];
+ bblock_t *block = cfg.blocks[b];
exec_list aeb;
progress = opt_cse_local(block, &aeb) || progress;
}
}
- fs_cfg *cfg = NULL;
+ cfg_t *cfg = NULL;
if (unlikely(INTEL_DEBUG & DEBUG_WM))
- cfg = new(mem_ctx) fs_cfg(this);
+ cfg = new(mem_ctx) cfg_t(this);
foreach_list(node, &this->instructions) {
fs_inst *inst = (fs_inst *)node;
if (unlikely(INTEL_DEBUG & DEBUG_WM)) {
foreach_list(node, &cfg->block_list) {
- fs_bblock_link *link = (fs_bblock_link *)node;
- fs_bblock *block = link->block;
+ bblock_link *link = (bblock_link *)node;
+ bblock_t *block = link->block;
if (block->start == inst) {
printf(" START B%d", block->block_num);
foreach_list(predecessor_node, &block->parents) {
- fs_bblock_link *predecessor_link =
- (fs_bblock_link *)predecessor_node;
- fs_bblock *predecessor_block = predecessor_link->block;
+ bblock_link *predecessor_link =
+ (bblock_link *)predecessor_node;
+ bblock_t *predecessor_block = predecessor_link->block;
printf(" <-B%d", predecessor_block->block_num);
}
printf("\n");
last_native_insn_offset, p->next_insn_offset);
foreach_list(node, &cfg->block_list) {
- fs_bblock_link *link = (fs_bblock_link *)node;
- fs_bblock *block = link->block;
+ bblock_link *link = (bblock_link *)node;
+ bblock_t *block = link->block;
if (block->end == inst) {
printf(" END B%d", block->block_num);
foreach_list(successor_node, &block->children) {
- fs_bblock_link *successor_link =
- (fs_bblock_link *)successor_node;
- fs_bblock *successor_block = successor_link->block;
+ bblock_link *successor_link =
+ (bblock_link *)successor_node;
+ bblock_t *successor_block = successor_link->block;
printf(" ->B%d", successor_block->block_num);
}
printf("\n");
int ip = 0;
for (int b = 0; b < cfg->num_blocks; b++) {
- fs_bblock *block = cfg->blocks[b];
+ bblock_t *block = cfg->blocks[b];
assert(ip == block->start_ip);
if (b > 0)
/* Update liveout */
foreach_list(block_node, &cfg->blocks[b]->children) {
- fs_bblock_link *link = (fs_bblock_link *)block_node;
- fs_bblock *block = link->block;
+ bblock_link *link = (bblock_link *)block_node;
+ bblock_t *block = link->block;
for (int i = 0; i < num_vars; i++) {
if (bd[block->block_num].livein[i] && !bd[b].liveout[i]) {
}
}
-fs_live_variables::fs_live_variables(fs_visitor *v, fs_cfg *cfg)
+fs_live_variables::fs_live_variables(fs_visitor *v, cfg_t *cfg)
: v(v), cfg(cfg)
{
mem_ctx = ralloc_context(cfg->mem_ctx);
}
/* Now, extend those intervals using our analysis of control flow. */
- fs_cfg cfg(this);
+ cfg_t cfg(this);
fs_live_variables livevars(this, &cfg);
for (int b = 0; b < cfg.num_blocks; b++) {
return node;
}
- fs_live_variables(fs_visitor *v, fs_cfg *cfg);
+ fs_live_variables(fs_visitor *v, cfg_t *cfg);
~fs_live_variables();
void setup_def_use();
void compute_live_variables();
fs_visitor *v;
- fs_cfg *cfg;
+ cfg_t *cfg;
void *mem_ctx;
int num_vars;