aco: Format.
Manually adjusted some comments for more intuitive line breaks. Reviewed-by: Tony Wasserka <tony.wasserka@gmx.de> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11258>
This commit is contained in:
committed by
Marge Bot
parent
97ec360dc4
commit
1e2639026f
@@ -40,7 +40,8 @@ struct dce_ctx {
|
||||
std::vector<uint16_t> uses;
|
||||
std::vector<std::vector<bool>> live;
|
||||
|
||||
dce_ctx(Program* program) : current_block(program->blocks.size() - 1), uses(program->peekAllocationId())
|
||||
dce_ctx(Program* program)
|
||||
: current_block(program->blocks.size() - 1), uses(program->peekAllocationId())
|
||||
{
|
||||
live.reserve(program->blocks.size());
|
||||
for (Block& block : program->blocks)
|
||||
@@ -48,7 +49,8 @@ struct dce_ctx {
|
||||
}
|
||||
};
|
||||
|
||||
void process_block(dce_ctx& ctx, Block& block)
|
||||
void
|
||||
process_block(dce_ctx& ctx, Block& block)
|
||||
{
|
||||
std::vector<bool>& live = ctx.live[block.index];
|
||||
assert(live.size() == block.instructions.size());
|
||||
@@ -72,23 +74,26 @@ void process_block(dce_ctx& ctx, Block& block)
|
||||
|
||||
if (process_predecessors) {
|
||||
for (unsigned pred_idx : block.linear_preds)
|
||||
ctx.current_block = std::max(ctx.current_block, (int) pred_idx);
|
||||
ctx.current_block = std::max(ctx.current_block, (int)pred_idx);
|
||||
}
|
||||
}
|
||||
|
||||
} /* end namespace */
|
||||
|
||||
bool is_dead(const std::vector<uint16_t>& uses, Instruction *instr)
|
||||
bool
|
||||
is_dead(const std::vector<uint16_t>& uses, Instruction* instr)
|
||||
{
|
||||
if (instr->definitions.empty() || instr->isBranch())
|
||||
return false;
|
||||
if (std::any_of(instr->definitions.begin(), instr->definitions.end(),
|
||||
[&uses] (const Definition& def) { return !def.isTemp() || uses[def.tempId()];}))
|
||||
[&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) {
|
||||
std::vector<uint16_t>
|
||||
dead_code_analysis(Program* program)
|
||||
{
|
||||
|
||||
dce_ctx ctx(program);
|
||||
|
||||
@@ -105,5 +110,4 @@ std::vector<uint16_t> dead_code_analysis(Program *program) {
|
||||
return ctx.uses;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} // namespace aco
|
||||
|
||||
Reference in New Issue
Block a user