mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 21:50:12 +01:00
aco: Move is_dead to aco_ir.h to allow it to get inlined.
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com> Reviewed-by: Daniel Schürmann <daniel@schuermann.dev> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18103>
This commit is contained in:
parent
36bc3afb8b
commit
0cceab788e
2 changed files with 14 additions and 13 deletions
|
|
@ -80,18 +80,6 @@ process_block(dce_ctx& ctx, Block& block)
|
|||
|
||||
} /* end namespace */
|
||||
|
||||
bool
|
||||
is_dead(const std::vector<uint16_t>& uses, Instruction* instr)
|
||||
{
|
||||
if (instr->definitions.empty() || instr->isBranch() ||
|
||||
instr->opcode == aco_opcode::p_init_scratch)
|
||||
return false;
|
||||
if (std::any_of(instr->definitions.begin(), instr->definitions.end(),
|
||||
[&uses](const Definition& def) { return !def.isTemp() || uses[def.tempId()]; }))
|
||||
return false;
|
||||
return !(get_sync_info(instr).semantics & (semantic_volatile | semantic_acqrel));
|
||||
}
|
||||
|
||||
std::vector<uint16_t>
|
||||
dead_code_analysis(Program* program)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
|
||||
#include "nir.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <bitset>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
|
@ -1851,7 +1852,19 @@ is_phi(aco_ptr<Instruction>& instr)
|
|||
|
||||
memory_sync_info get_sync_info(const Instruction* instr);
|
||||
|
||||
bool is_dead(const std::vector<uint16_t>& uses, Instruction* instr);
|
||||
inline bool
|
||||
is_dead(const std::vector<uint16_t>& uses, const Instruction* instr)
|
||||
{
|
||||
if (instr->definitions.empty() || instr->isBranch() ||
|
||||
instr->opcode == aco_opcode::p_init_scratch)
|
||||
return false;
|
||||
|
||||
if (std::any_of(instr->definitions.begin(), instr->definitions.end(),
|
||||
[&uses](const Definition& def) { return !def.isTemp() || uses[def.tempId()]; }))
|
||||
return false;
|
||||
|
||||
return !(get_sync_info(instr).semantics & (semantic_volatile | semantic_acqrel));
|
||||
}
|
||||
|
||||
bool can_use_opsel(amd_gfx_level gfx_level, aco_opcode op, int idx);
|
||||
bool instr_is_16bit(amd_gfx_level gfx_level, aco_opcode op);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue