intel/brw: Use fs_inst in cfg_t

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27866>
This commit is contained in:
Caio Oliveira 2024-02-28 15:16:32 -08:00
parent d5ed82b97c
commit 692021cad7
2 changed files with 33 additions and 33 deletions

View file

@ -106,7 +106,7 @@ bblock_t::is_successor_of(const bblock_t *block,
}
static bool
ends_block(const backend_instruction *inst)
ends_block(const fs_inst *inst)
{
enum opcode op = inst->opcode;
@ -119,7 +119,7 @@ ends_block(const backend_instruction *inst)
}
static bool
starts_block(const backend_instruction *inst)
starts_block(const fs_inst *inst)
{
enum opcode op = inst->opcode;
@ -210,7 +210,7 @@ cfg_t::cfg_t(const fs_visitor *s, exec_list *instructions) :
set_next_block(&cur, entry, ip);
foreach_in_list_safe(backend_instruction, inst, instructions) {
foreach_in_list_safe(fs_inst, inst, instructions) {
/* set_next_block wants the post-incremented ip */
ip++;
@ -808,7 +808,7 @@ cfg_t::validate(const char *stage_abbrev)
}
}
backend_instruction *first_inst = block->start();
fs_inst *first_inst = block->start();
if (first_inst->opcode == BRW_OPCODE_DO) {
/* DO instructions both begin and end a block, so the DO instruction
* must be the only instruction in the block.

View file

@ -29,12 +29,12 @@
#define BRW_CFG_H
struct bblock_t;
struct backend_instruction;
#ifdef __cplusplus
#include "brw_ir.h"
#include "brw_ir_analysis.h"
#include "brw_ir_fs.h"
struct bblock_t;
@ -92,10 +92,10 @@ struct bblock_t {
void combine_with(bblock_t *that);
void dump(FILE *file = stderr) const;
backend_instruction *start();
const backend_instruction *start() const;
backend_instruction *end();
const backend_instruction *end() const;
fs_inst *start();
const fs_inst *start() const;
fs_inst *end();
const fs_inst *end() const;
bblock_t *next();
const bblock_t *next() const;
@ -105,8 +105,8 @@ struct bblock_t {
bool starts_with_control_flow() const;
bool ends_with_control_flow() const;
backend_instruction *first_non_control_flow_inst();
backend_instruction *last_non_control_flow_inst();
fs_inst *first_non_control_flow_inst();
fs_inst *last_non_control_flow_inst();
private:
/**
@ -142,28 +142,28 @@ public:
int num;
};
static inline struct backend_instruction *
static inline fs_inst *
bblock_start(struct bblock_t *block)
{
return (struct backend_instruction *)exec_list_get_head(&block->instructions);
return (fs_inst *)exec_list_get_head(&block->instructions);
}
static inline const struct backend_instruction *
static inline const fs_inst *
bblock_start_const(const struct bblock_t *block)
{
return (const struct backend_instruction *)exec_list_get_head_const(&block->instructions);
return (const fs_inst *)exec_list_get_head_const(&block->instructions);
}
static inline struct backend_instruction *
static inline fs_inst *
bblock_end(struct bblock_t *block)
{
return (struct backend_instruction *)exec_list_get_tail(&block->instructions);
return (fs_inst *)exec_list_get_tail(&block->instructions);
}
static inline const struct backend_instruction *
static inline const fs_inst *
bblock_end_const(const struct bblock_t *block)
{
return (const struct backend_instruction *)exec_list_get_tail_const(&block->instructions);
return (const fs_inst *)exec_list_get_tail_const(&block->instructions);
}
static inline struct bblock_t *
@ -220,51 +220,51 @@ bblock_ends_with_control_flow(const struct bblock_t *block)
op == BRW_OPCODE_CONTINUE;
}
static inline struct backend_instruction *
static inline fs_inst *
bblock_first_non_control_flow_inst(struct bblock_t *block)
{
struct backend_instruction *inst = bblock_start(block);
fs_inst *inst = bblock_start(block);
if (bblock_starts_with_control_flow(block))
#ifdef __cplusplus
inst = (struct backend_instruction *)inst->next;
inst = (fs_inst *)inst->next;
#else
inst = (struct backend_instruction *)inst->link.next;
inst = (fs_inst *)inst->link.next;
#endif
return inst;
}
static inline struct backend_instruction *
static inline fs_inst *
bblock_last_non_control_flow_inst(struct bblock_t *block)
{
struct backend_instruction *inst = bblock_end(block);
fs_inst *inst = bblock_end(block);
if (bblock_ends_with_control_flow(block))
#ifdef __cplusplus
inst = (struct backend_instruction *)inst->prev;
inst = (fs_inst *)inst->prev;
#else
inst = (struct backend_instruction *)inst->link.prev;
inst = (fs_inst *)inst->link.prev;
#endif
return inst;
}
inline backend_instruction *
inline fs_inst *
bblock_t::start()
{
return bblock_start(this);
}
inline const backend_instruction *
inline const fs_inst *
bblock_t::start() const
{
return bblock_start_const(this);
}
inline backend_instruction *
inline fs_inst *
bblock_t::end()
{
return bblock_end(this);
}
inline const backend_instruction *
inline const fs_inst *
bblock_t::end() const
{
return bblock_end_const(this);
@ -306,13 +306,13 @@ bblock_t::ends_with_control_flow() const
return bblock_ends_with_control_flow(this);
}
inline backend_instruction *
inline fs_inst *
bblock_t::first_non_control_flow_inst()
{
return bblock_first_non_control_flow_inst(this);
}
inline backend_instruction *
inline fs_inst *
bblock_t::last_non_control_flow_inst()
{
return bblock_last_non_control_flow_inst(this);