aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorGert Wollny <[email protected]>2020-02-27 08:12:16 +0100
committerGert Wollny <[email protected]>2020-03-02 20:00:23 +0100
commitb66170b53785dea3bfc00901277273b7bde9b561 (patch)
treef646f19b62ddcabbd7856b757243ca8b8e356ffe /src/gallium
parent7780b50b7e7c29fef4065c1b3ba7f63edeed3028 (diff)
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 <[email protected]> Tested-by: Mauro Rossi <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3974>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/r600/sfn/sfn_instruction_cf.cpp2
-rw-r--r--src/gallium/drivers/r600/sfn/sfn_instruction_export.cpp2
-rw-r--r--src/gallium/drivers/r600/sfn/sfn_instruction_fetch.cpp2
-rw-r--r--src/gallium/drivers/r600/sfn/sfn_instruction_misc.cpp2
-rw-r--r--src/gallium/drivers/r600/sfn/sfn_ir_to_assembly.cpp6
-rw-r--r--src/gallium/drivers/r600/sfn/sfn_shader_base.cpp2
-rw-r--r--src/gallium/drivers/r600/sfn/sfn_value_gpr.cpp2
-rw-r--r--src/gallium/drivers/r600/sfn/sfn_valuepool.cpp6
8 files changed, 12 insertions, 12 deletions
diff --git a/src/gallium/drivers/r600/sfn/sfn_instruction_cf.cpp b/src/gallium/drivers/r600/sfn/sfn_instruction_cf.cpp
index 0c10e162bee..dc2b37a0df3 100644
--- a/src/gallium/drivers/r600/sfn/sfn_instruction_cf.cpp
+++ b/src/gallium/drivers/r600/sfn/sfn_instruction_cf.cpp
@@ -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;
}
diff --git a/src/gallium/drivers/r600/sfn/sfn_instruction_export.cpp b/src/gallium/drivers/r600/sfn/sfn_instruction_export.cpp
index b109846489f..a841eccdcbb 100644
--- a/src/gallium/drivers/r600/sfn/sfn_instruction_export.cpp
+++ b/src/gallium/drivers/r600/sfn/sfn_instruction_export.cpp
@@ -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)
diff --git a/src/gallium/drivers/r600/sfn/sfn_instruction_fetch.cpp b/src/gallium/drivers/r600/sfn/sfn_instruction_fetch.cpp
index 0fc4f26358d..09fd80776c6 100644
--- a/src/gallium/drivers/r600/sfn/sfn_instruction_fetch.cpp
+++ b/src/gallium/drivers/r600/sfn/sfn_instruction_fetch.cpp
@@ -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));
diff --git a/src/gallium/drivers/r600/sfn/sfn_instruction_misc.cpp b/src/gallium/drivers/r600/sfn/sfn_instruction_misc.cpp
index 0eac46abb2f..1c1a98c4034 100644
--- a/src/gallium/drivers/r600/sfn/sfn_instruction_misc.cpp
+++ b/src/gallium/drivers/r600/sfn/sfn_instruction_misc.cpp
@@ -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;
}
diff --git a/src/gallium/drivers/r600/sfn/sfn_ir_to_assembly.cpp b/src/gallium/drivers/r600/sfn/sfn_ir_to_assembly.cpp
index db75b908f5f..56a134c3e72 100644
--- a/src/gallium/drivers/r600/sfn/sfn_ir_to_assembly.cpp
+++ b/src/gallium/drivers/r600/sfn/sfn_ir_to_assembly.cpp
@@ -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();
}
}
diff --git a/src/gallium/drivers/r600/sfn/sfn_shader_base.cpp b/src/gallium/drivers/r600/sfn/sfn_shader_base.cpp
index 0e2d1a81350..25db8db8b16 100644
--- a/src/gallium/drivers/r600/sfn/sfn_shader_base.cpp
+++ b/src/gallium/drivers/r600/sfn/sfn_shader_base.cpp
@@ -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);
diff --git a/src/gallium/drivers/r600/sfn/sfn_value_gpr.cpp b/src/gallium/drivers/r600/sfn/sfn_value_gpr.cpp
index 4eb5bfb18c4..7dbf2871180 100644
--- a/src/gallium/drivers/r600/sfn/sfn_value_gpr.cpp
+++ b/src/gallium/drivers/r600/sfn/sfn_value_gpr.cpp
@@ -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;
diff --git a/src/gallium/drivers/r600/sfn/sfn_valuepool.cpp b/src/gallium/drivers/r600/sfn/sfn_valuepool.cpp
index 3c7d9d36c69..3ff386d5a0f 100644
--- a/src/gallium/drivers/r600/sfn/sfn_valuepool.cpp
+++ b/src/gallium/drivers/r600/sfn/sfn_valuepool.cpp
@@ -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);
}
}