intel/compiler: Nest definition of live variables block_data structures
When this commit was originally written, these two structures had the
exact same name. Subsequently in commit 12a8f2616a
(intel/compiler:
Fix C++ one definition rule violations) they were renamed.
Original commit message:
> These two structures have exactly the same name which prevents the two
> files from being included at the same time and could cause serious
> trouble in the future if it ever leads to a (silent) violation of the
> C++ one definition rule.
Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4012>
This commit is contained in:

committed by
Matt Turner

parent
310aef6b59
commit
06c5c49646
@@ -53,7 +53,7 @@ using namespace brw;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
fs_live_variables::setup_one_read(struct fs_block_data *bd, fs_inst *inst,
|
fs_live_variables::setup_one_read(struct block_data *bd, fs_inst *inst,
|
||||||
int ip, const fs_reg ®)
|
int ip, const fs_reg ®)
|
||||||
{
|
{
|
||||||
int var = var_from_reg(reg);
|
int var = var_from_reg(reg);
|
||||||
@@ -71,7 +71,7 @@ fs_live_variables::setup_one_read(struct fs_block_data *bd, fs_inst *inst,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
fs_live_variables::setup_one_write(struct fs_block_data *bd, fs_inst *inst,
|
fs_live_variables::setup_one_write(struct block_data *bd, fs_inst *inst,
|
||||||
int ip, const fs_reg ®)
|
int ip, const fs_reg ®)
|
||||||
{
|
{
|
||||||
int var = var_from_reg(reg);
|
int var = var_from_reg(reg);
|
||||||
@@ -110,7 +110,7 @@ fs_live_variables::setup_def_use()
|
|||||||
if (block->num > 0)
|
if (block->num > 0)
|
||||||
assert(cfg->blocks[block->num - 1]->end_ip == ip - 1);
|
assert(cfg->blocks[block->num - 1]->end_ip == ip - 1);
|
||||||
|
|
||||||
struct fs_block_data *bd = &block_data[block->num];
|
struct block_data *bd = &block_data[block->num];
|
||||||
|
|
||||||
foreach_inst_in_block(fs_inst, inst, block) {
|
foreach_inst_in_block(fs_inst, inst, block) {
|
||||||
/* Set use[] for this instruction */
|
/* Set use[] for this instruction */
|
||||||
@@ -160,11 +160,11 @@ fs_live_variables::compute_live_variables()
|
|||||||
cont = false;
|
cont = false;
|
||||||
|
|
||||||
foreach_block_reverse (block, cfg) {
|
foreach_block_reverse (block, cfg) {
|
||||||
struct fs_block_data *bd = &block_data[block->num];
|
struct block_data *bd = &block_data[block->num];
|
||||||
|
|
||||||
/* Update liveout */
|
/* Update liveout */
|
||||||
foreach_list_typed(bblock_link, child_link, link, &block->children) {
|
foreach_list_typed(bblock_link, child_link, link, &block->children) {
|
||||||
struct fs_block_data *child_bd = &block_data[child_link->block->num];
|
struct block_data *child_bd = &block_data[child_link->block->num];
|
||||||
|
|
||||||
for (int i = 0; i < bitset_words; i++) {
|
for (int i = 0; i < bitset_words; i++) {
|
||||||
BITSET_WORD new_liveout = (child_bd->livein[i] &
|
BITSET_WORD new_liveout = (child_bd->livein[i] &
|
||||||
@@ -209,10 +209,10 @@ fs_live_variables::compute_live_variables()
|
|||||||
cont = false;
|
cont = false;
|
||||||
|
|
||||||
foreach_block (block, cfg) {
|
foreach_block (block, cfg) {
|
||||||
const struct fs_block_data *bd = &block_data[block->num];
|
const struct block_data *bd = &block_data[block->num];
|
||||||
|
|
||||||
foreach_list_typed(bblock_link, child_link, link, &block->children) {
|
foreach_list_typed(bblock_link, child_link, link, &block->children) {
|
||||||
struct fs_block_data *child_bd = &block_data[child_link->block->num];
|
struct block_data *child_bd = &block_data[child_link->block->num];
|
||||||
|
|
||||||
for (int i = 0; i < bitset_words; i++) {
|
for (int i = 0; i < bitset_words; i++) {
|
||||||
const BITSET_WORD new_def = bd->defout[i] & ~child_bd->defin[i];
|
const BITSET_WORD new_def = bd->defout[i] & ~child_bd->defin[i];
|
||||||
@@ -233,7 +233,7 @@ void
|
|||||||
fs_live_variables::compute_start_end()
|
fs_live_variables::compute_start_end()
|
||||||
{
|
{
|
||||||
foreach_block (block, cfg) {
|
foreach_block (block, cfg) {
|
||||||
struct fs_block_data *bd = &block_data[block->num];
|
struct block_data *bd = &block_data[block->num];
|
||||||
|
|
||||||
for (int w = 0; w < bitset_words; w++) {
|
for (int w = 0; w < bitset_words; w++) {
|
||||||
BITSET_WORD livedefin = bd->livein[w] & bd->defin[w];
|
BITSET_WORD livedefin = bd->livein[w] & bd->defin[w];
|
||||||
@@ -282,7 +282,7 @@ fs_live_variables::fs_live_variables(fs_visitor *v, const cfg_t *cfg)
|
|||||||
end[i] = -1;
|
end[i] = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
block_data = rzalloc_array(mem_ctx, struct fs_block_data, cfg->num_blocks);
|
block_data = rzalloc_array(mem_ctx, struct block_data, cfg->num_blocks);
|
||||||
|
|
||||||
bitset_words = BITSET_WORDS(num_vars);
|
bitset_words = BITSET_WORDS(num_vars);
|
||||||
for (int i = 0; i < cfg->num_blocks; i++) {
|
for (int i = 0; i < cfg->num_blocks; i++) {
|
||||||
|
@@ -35,46 +35,46 @@ struct cfg_t;
|
|||||||
|
|
||||||
namespace brw {
|
namespace brw {
|
||||||
|
|
||||||
struct fs_block_data {
|
|
||||||
/**
|
|
||||||
* Which variables are defined before being used in the block.
|
|
||||||
*
|
|
||||||
* Note that for our purposes, "defined" means unconditionally, completely
|
|
||||||
* defined.
|
|
||||||
*/
|
|
||||||
BITSET_WORD *def;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Which variables are used before being defined in the block.
|
|
||||||
*/
|
|
||||||
BITSET_WORD *use;
|
|
||||||
|
|
||||||
/** Which defs reach the entry point of the block. */
|
|
||||||
BITSET_WORD *livein;
|
|
||||||
|
|
||||||
/** Which defs reach the exit point of the block. */
|
|
||||||
BITSET_WORD *liveout;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Variables such that the entry point of the block may be reached from any
|
|
||||||
* of their definitions.
|
|
||||||
*/
|
|
||||||
BITSET_WORD *defin;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Variables such that the exit point of the block may be reached from any
|
|
||||||
* of their definitions.
|
|
||||||
*/
|
|
||||||
BITSET_WORD *defout;
|
|
||||||
|
|
||||||
BITSET_WORD flag_def[1];
|
|
||||||
BITSET_WORD flag_use[1];
|
|
||||||
BITSET_WORD flag_livein[1];
|
|
||||||
BITSET_WORD flag_liveout[1];
|
|
||||||
};
|
|
||||||
|
|
||||||
class fs_live_variables {
|
class fs_live_variables {
|
||||||
public:
|
public:
|
||||||
|
struct block_data {
|
||||||
|
/**
|
||||||
|
* Which variables are defined before being used in the block.
|
||||||
|
*
|
||||||
|
* Note that for our purposes, "defined" means unconditionally, completely
|
||||||
|
* defined.
|
||||||
|
*/
|
||||||
|
BITSET_WORD *def;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Which variables are used before being defined in the block.
|
||||||
|
*/
|
||||||
|
BITSET_WORD *use;
|
||||||
|
|
||||||
|
/** Which defs reach the entry point of the block. */
|
||||||
|
BITSET_WORD *livein;
|
||||||
|
|
||||||
|
/** Which defs reach the exit point of the block. */
|
||||||
|
BITSET_WORD *liveout;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Variables such that the entry point of the block may be reached from any
|
||||||
|
* of their definitions.
|
||||||
|
*/
|
||||||
|
BITSET_WORD *defin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Variables such that the exit point of the block may be reached from any
|
||||||
|
* of their definitions.
|
||||||
|
*/
|
||||||
|
BITSET_WORD *defout;
|
||||||
|
|
||||||
|
BITSET_WORD flag_def[1];
|
||||||
|
BITSET_WORD flag_use[1];
|
||||||
|
BITSET_WORD flag_livein[1];
|
||||||
|
BITSET_WORD flag_liveout[1];
|
||||||
|
};
|
||||||
|
|
||||||
DECLARE_RALLOC_CXX_OPERATORS(fs_live_variables)
|
DECLARE_RALLOC_CXX_OPERATORS(fs_live_variables)
|
||||||
|
|
||||||
fs_live_variables(fs_visitor *v, const cfg_t *cfg);
|
fs_live_variables(fs_visitor *v, const cfg_t *cfg);
|
||||||
@@ -110,13 +110,13 @@ public:
|
|||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/** Per-basic-block information on live variables */
|
/** Per-basic-block information on live variables */
|
||||||
struct fs_block_data *block_data;
|
struct block_data *block_data;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void setup_def_use();
|
void setup_def_use();
|
||||||
void setup_one_read(struct fs_block_data *bd, fs_inst *inst, int ip,
|
void setup_one_read(struct block_data *bd, fs_inst *inst, int ip,
|
||||||
const fs_reg ®);
|
const fs_reg ®);
|
||||||
void setup_one_write(struct fs_block_data *bd, fs_inst *inst, int ip,
|
void setup_one_write(struct block_data *bd, fs_inst *inst, int ip,
|
||||||
const fs_reg ®);
|
const fs_reg ®);
|
||||||
void compute_live_variables();
|
void compute_live_variables();
|
||||||
void compute_start_end();
|
void compute_start_end();
|
||||||
|
@@ -71,7 +71,7 @@ vec4_live_variables::setup_def_use()
|
|||||||
assert(cfg->blocks[block->num - 1]->end_ip == ip - 1);
|
assert(cfg->blocks[block->num - 1]->end_ip == ip - 1);
|
||||||
|
|
||||||
foreach_inst_in_block(vec4_instruction, inst, block) {
|
foreach_inst_in_block(vec4_instruction, inst, block) {
|
||||||
struct vec4_block_data *bd = &block_data[block->num];
|
struct block_data *bd = &block_data[block->num];
|
||||||
|
|
||||||
/* Set use[] for this instruction */
|
/* Set use[] for this instruction */
|
||||||
for (unsigned int i = 0; i < 3; i++) {
|
for (unsigned int i = 0; i < 3; i++) {
|
||||||
@@ -137,11 +137,11 @@ vec4_live_variables::compute_live_variables()
|
|||||||
cont = false;
|
cont = false;
|
||||||
|
|
||||||
foreach_block_reverse (block, cfg) {
|
foreach_block_reverse (block, cfg) {
|
||||||
struct vec4_block_data *bd = &block_data[block->num];
|
struct block_data *bd = &block_data[block->num];
|
||||||
|
|
||||||
/* Update liveout */
|
/* Update liveout */
|
||||||
foreach_list_typed(bblock_link, child_link, link, &block->children) {
|
foreach_list_typed(bblock_link, child_link, link, &block->children) {
|
||||||
struct vec4_block_data *child_bd = &block_data[child_link->block->num];
|
struct block_data *child_bd = &block_data[child_link->block->num];
|
||||||
|
|
||||||
for (int i = 0; i < bitset_words; i++) {
|
for (int i = 0; i < bitset_words; i++) {
|
||||||
BITSET_WORD new_liveout = (child_bd->livein[i] &
|
BITSET_WORD new_liveout = (child_bd->livein[i] &
|
||||||
@@ -187,7 +187,7 @@ vec4_live_variables::vec4_live_variables(const simple_allocator &alloc,
|
|||||||
mem_ctx = ralloc_context(NULL);
|
mem_ctx = ralloc_context(NULL);
|
||||||
|
|
||||||
num_vars = alloc.total_size * 8;
|
num_vars = alloc.total_size * 8;
|
||||||
block_data = rzalloc_array(mem_ctx, struct vec4_block_data, cfg->num_blocks);
|
block_data = rzalloc_array(mem_ctx, struct block_data, cfg->num_blocks);
|
||||||
|
|
||||||
bitset_words = BITSET_WORDS(num_vars);
|
bitset_words = BITSET_WORDS(num_vars);
|
||||||
for (int i = 0; i < cfg->num_blocks; i++) {
|
for (int i = 0; i < cfg->num_blocks; i++) {
|
||||||
@@ -288,7 +288,8 @@ vec4_visitor::calculate_live_intervals()
|
|||||||
this->live_intervals = new(mem_ctx) vec4_live_variables(alloc, cfg);
|
this->live_intervals = new(mem_ctx) vec4_live_variables(alloc, cfg);
|
||||||
|
|
||||||
foreach_block (block, cfg) {
|
foreach_block (block, cfg) {
|
||||||
struct vec4_block_data *bd = &live_intervals->block_data[block->num];
|
const struct vec4_live_variables::block_data *bd =
|
||||||
|
&live_intervals->block_data[block->num];
|
||||||
|
|
||||||
for (int i = 0; i < live_intervals->num_vars; i++) {
|
for (int i = 0; i < live_intervals->num_vars; i++) {
|
||||||
if (BITSET_TEST(bd->livein, i)) {
|
if (BITSET_TEST(bd->livein, i)) {
|
||||||
|
@@ -33,34 +33,34 @@
|
|||||||
|
|
||||||
namespace brw {
|
namespace brw {
|
||||||
|
|
||||||
struct vec4_block_data {
|
|
||||||
/**
|
|
||||||
* Which variables are defined before being used in the block.
|
|
||||||
*
|
|
||||||
* Note that for our purposes, "defined" means unconditionally, completely
|
|
||||||
* defined.
|
|
||||||
*/
|
|
||||||
BITSET_WORD *def;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Which variables are used before being defined in the block.
|
|
||||||
*/
|
|
||||||
BITSET_WORD *use;
|
|
||||||
|
|
||||||
/** Which defs reach the entry point of the block. */
|
|
||||||
BITSET_WORD *livein;
|
|
||||||
|
|
||||||
/** Which defs reach the exit point of the block. */
|
|
||||||
BITSET_WORD *liveout;
|
|
||||||
|
|
||||||
BITSET_WORD flag_def[1];
|
|
||||||
BITSET_WORD flag_use[1];
|
|
||||||
BITSET_WORD flag_livein[1];
|
|
||||||
BITSET_WORD flag_liveout[1];
|
|
||||||
};
|
|
||||||
|
|
||||||
class vec4_live_variables {
|
class vec4_live_variables {
|
||||||
public:
|
public:
|
||||||
|
struct block_data {
|
||||||
|
/**
|
||||||
|
* Which variables are defined before being used in the block.
|
||||||
|
*
|
||||||
|
* Note that for our purposes, "defined" means unconditionally, completely
|
||||||
|
* defined.
|
||||||
|
*/
|
||||||
|
BITSET_WORD *def;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Which variables are used before being defined in the block.
|
||||||
|
*/
|
||||||
|
BITSET_WORD *use;
|
||||||
|
|
||||||
|
/** Which defs reach the entry point of the block. */
|
||||||
|
BITSET_WORD *livein;
|
||||||
|
|
||||||
|
/** Which defs reach the exit point of the block. */
|
||||||
|
BITSET_WORD *liveout;
|
||||||
|
|
||||||
|
BITSET_WORD flag_def[1];
|
||||||
|
BITSET_WORD flag_use[1];
|
||||||
|
BITSET_WORD flag_livein[1];
|
||||||
|
BITSET_WORD flag_liveout[1];
|
||||||
|
};
|
||||||
|
|
||||||
DECLARE_RALLOC_CXX_OPERATORS(vec4_live_variables)
|
DECLARE_RALLOC_CXX_OPERATORS(vec4_live_variables)
|
||||||
|
|
||||||
vec4_live_variables(const simple_allocator &alloc, cfg_t *cfg);
|
vec4_live_variables(const simple_allocator &alloc, cfg_t *cfg);
|
||||||
@@ -70,7 +70,7 @@ public:
|
|||||||
int bitset_words;
|
int bitset_words;
|
||||||
|
|
||||||
/** Per-basic-block information on live variables */
|
/** Per-basic-block information on live variables */
|
||||||
struct vec4_block_data *block_data;
|
struct block_data *block_data;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void setup_def_use();
|
void setup_def_use();
|
||||||
|
Reference in New Issue
Block a user