mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 11:48:06 +02:00
r600/sfn: Use static_cast when type is already known
In all these cases the type was tested before based, so don't use dynamic_casts. Closes #2566 Signed-off-by: Gert Wollny <gert.wollny@collabora.com> Tested-by: Mauro Rossi <issor.oruam@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3974>
This commit is contained in:
parent
7780b50b7e
commit
b66170b537
8 changed files with 12 additions and 12 deletions
|
|
@ -56,7 +56,7 @@ void IfInstruction::do_evalue_liveness(LiverangeEvaluator& eval) const
|
|||
bool IfInstruction::is_equal_to(const Instruction& lhs) const
|
||||
{
|
||||
assert(lhs.type() == cond_if);
|
||||
const IfInstruction& l = dynamic_cast<const IfInstruction&>(lhs);
|
||||
const IfInstruction& l = static_cast<const IfInstruction&>(lhs);
|
||||
return *l.m_pred == *m_pred;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ bool WriteScratchInstruction::is_equal_to(const Instruction& lhs) const
|
|||
{
|
||||
if (lhs.type() != Instruction::mem_wr_scratch)
|
||||
return false;
|
||||
const auto& other = dynamic_cast<const WriteScratchInstruction&>(lhs);
|
||||
const auto& other = static_cast<const WriteScratchInstruction&>(lhs);
|
||||
|
||||
if (m_address) {
|
||||
if (!other.m_address)
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ FetchInstruction::FetchInstruction(GPRVector dst, PValue src, int scratch_size):
|
|||
m_dest_swizzle({0,1,2,3})
|
||||
{
|
||||
if (src->type() == Value::literal) {
|
||||
const auto& lv = dynamic_cast<const LiteralValue&>(*src);
|
||||
const auto& lv = static_cast<const LiteralValue&>(*src);
|
||||
m_array_base = lv.value();
|
||||
m_indexed = false;
|
||||
m_src.reset(new GPRValue(0,0));
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ WaitAck::WaitAck(int nack):
|
|||
|
||||
bool WaitAck::is_equal_to(const Instruction& lhs) const
|
||||
{
|
||||
const auto& l = dynamic_cast<const WaitAck&>(lhs);
|
||||
const auto& l = static_cast<const WaitAck&>(lhs);
|
||||
return m_nack == l.m_nack;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -697,7 +697,7 @@ bool AssemblyFromShaderLegacyImpl::emit_vtx(const FetchInstruction& fetch_instr)
|
|||
|
||||
if (addr) {
|
||||
if (addr->type() == Value::literal) {
|
||||
const auto& boffs = dynamic_cast<const LiteralValue&>(*addr);
|
||||
const auto& boffs = static_cast<const LiteralValue&>(*addr);
|
||||
buffer_offset = boffs.value();
|
||||
} else {
|
||||
index_mode = bim_zero;
|
||||
|
|
@ -895,7 +895,7 @@ bool AssemblyFromShaderLegacyImpl::emit_gds(const GDSInstr& instr)
|
|||
m_bc->index_loaded[1] = true;
|
||||
}
|
||||
} else {
|
||||
const LiteralValue& addr_reg = dynamic_cast<const LiteralValue&>(*addr);
|
||||
const LiteralValue& addr_reg = static_cast<const LiteralValue&>(*addr);
|
||||
uav_idx = addr_reg.value() >> 2;
|
||||
}
|
||||
|
||||
|
|
@ -972,7 +972,7 @@ bool AssemblyFromShaderLegacyImpl::emit_rat(const RatInstruction& instr)
|
|||
|
||||
}
|
||||
} else {
|
||||
const LiteralValue& addr_reg = dynamic_cast<const LiteralValue&>(*addr);
|
||||
const LiteralValue& addr_reg = static_cast<const LiteralValue&>(*addr);
|
||||
rat_idx = addr_reg.value();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -517,7 +517,7 @@ bool ShaderFromNirProcessor::emit_store_scratch(nir_intrinsic_instr* instr)
|
|||
|
||||
WriteScratchInstruction *ir = nullptr;
|
||||
if (address->type() == Value::literal) {
|
||||
const auto& lv = dynamic_cast<const LiteralValue&>(*address);
|
||||
const auto& lv = static_cast<const LiteralValue&>(*address);
|
||||
ir = new WriteScratchInstruction(lv.value(), value, align, align_offset, writemask);
|
||||
} else {
|
||||
address = from_nir_with_fetch_constant(instr->src[1], 0);
|
||||
|
|
|
|||
|
|
@ -284,7 +284,7 @@ void GPRArray::do_print(std::ostream& os) const
|
|||
|
||||
bool GPRArray::is_equal_to(const Value& other) const
|
||||
{
|
||||
const GPRArray& o = dynamic_cast<const GPRArray&>(other);
|
||||
const GPRArray& o = static_cast<const GPRArray&>(other);
|
||||
return o.sel() == sel() &&
|
||||
o.m_values.size() == m_values.size() &&
|
||||
o.m_component_mask == m_component_mask;
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ PValue ValuePool::from_nir(const nir_src& v, unsigned component, unsigned swizzl
|
|||
auto reg = lookup_register(idx, swizzled, false);
|
||||
if (reg) {
|
||||
if (reg->type() == Value::gpr_vector) {
|
||||
auto& array = dynamic_cast<GPRArray&>(*reg);
|
||||
auto& array = static_cast<GPRArray&>(*reg);
|
||||
reg = array.get_indirect(v.reg.base_offset,
|
||||
v.reg.indirect ?
|
||||
from_nir(*v.reg.indirect, 0, 0) : nullptr,
|
||||
|
|
@ -216,7 +216,7 @@ PValue ValuePool::from_nir(const nir_dest& v, unsigned component)
|
|||
|
||||
if (retval->type() == Value::gpr_vector) {
|
||||
assert(!v.is_ssa);
|
||||
auto& array = dynamic_cast<GPRArray&>(*retval);
|
||||
auto& array = static_cast<GPRArray&>(*retval);
|
||||
retval = array.get_indirect(v.reg.base_offset,
|
||||
v.reg.indirect ?
|
||||
from_nir(*v.reg.indirect, 0, 0) : nullptr,
|
||||
|
|
@ -234,7 +234,7 @@ ValueMap ValuePool::get_temp_registers() const
|
|||
if (v.second->type() == Value::gpr)
|
||||
result.insert(v.second);
|
||||
else if (v.second->type() == Value::gpr_vector) {
|
||||
auto& array = dynamic_cast<GPRArray&>(*v.second);
|
||||
auto& array = static_cast<GPRArray&>(*v.second);
|
||||
array.collect_registers(result);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue