intel/brw: Move idom_tree declaration to brw_analysis.h

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33048>
This commit is contained in:
Caio Oliveira 2024-12-06 20:29:20 -08:00 committed by Marge Bot
parent 0ebb75743d
commit 0f7eb96af8
2 changed files with 59 additions and 62 deletions

View file

@ -13,6 +13,65 @@
struct fs_visitor;
namespace brw {
/**
* Immediate dominator tree analysis of a shader.
*/
struct idom_tree {
idom_tree(const fs_visitor *s);
~idom_tree();
bool
validate(const fs_visitor *) const
{
/* FINISHME */
return true;
}
analysis_dependency_class
dependency_class() const
{
return DEPENDENCY_BLOCKS;
}
const bblock_t *
parent(const bblock_t *b) const
{
assert(unsigned(b->num) < num_parents);
return parents[b->num];
}
bblock_t *
parent(bblock_t *b) const
{
assert(unsigned(b->num) < num_parents);
return parents[b->num];
}
bblock_t *
intersect(bblock_t *b1, bblock_t *b2) const;
/**
* Returns true if block `a` dominates block `b`.
*/
bool
dominates(const bblock_t *a, const bblock_t *b) const
{
while (a != b) {
if (b->num == 0)
return false;
b = parent(b);
}
return true;
}
void dump(FILE *file = stderr) const;
private:
unsigned num_parents;
bblock_t **parents;
};
/**
* Register pressure analysis of a shader. Estimates how many registers
* are live at any point of the program in GRF units.

View file

@ -32,7 +32,6 @@ struct bblock_t;
#ifdef __cplusplus
#include "brw_inst.h"
#include "brw_ir_analysis.h"
struct bblock_t;
@ -471,65 +470,4 @@ cfg_t::adjust_block_ips()
}
}
namespace brw {
/**
* Immediate dominator tree analysis of a shader.
*/
struct idom_tree {
idom_tree(const fs_visitor *s);
~idom_tree();
bool
validate(const fs_visitor *) const
{
/* FINISHME */
return true;
}
analysis_dependency_class
dependency_class() const
{
return DEPENDENCY_BLOCKS;
}
const bblock_t *
parent(const bblock_t *b) const
{
assert(unsigned(b->num) < num_parents);
return parents[b->num];
}
bblock_t *
parent(bblock_t *b) const
{
assert(unsigned(b->num) < num_parents);
return parents[b->num];
}
bblock_t *
intersect(bblock_t *b1, bblock_t *b2) const;
/**
* Returns true if block `a` dominates block `b`.
*/
bool
dominates(const bblock_t *a, const bblock_t *b) const
{
while (a != b) {
if (b->num == 0)
return false;
b = parent(b);
}
return true;
}
void dump(FILE *file = stderr) const;
private:
unsigned num_parents;
bblock_t **parents;
};
}
#endif