r600/sfn: merge SpecialValue and InlineConstValue

The latter is the only child class of the former and no other use for
SpecialValue is needed.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8210>
This commit is contained in:
Gert Wollny 2020-12-23 15:25:23 +01:00 committed by Marge Bot
parent a7be48bdae
commit 2e7f35a8bc
2 changed files with 12 additions and 26 deletions

View file

@ -153,19 +153,18 @@ bool LiteralValue::is_equal_to(const Value& other) const
value() == rhs.value());
}
SpecialValue::SpecialValue(Type type, int value, int chan):
Value(type, chan),
InlineConstValue::InlineConstValue(int value, int chan):
Value(Value::cinline, chan),
m_value(static_cast<AluInlineConstants>(value))
{
}
uint32_t SpecialValue::sel() const
uint32_t InlineConstValue::sel() const
{
return m_value;
}
void SpecialValue::do_print(std::ostream& os) const
void InlineConstValue::do_print(std::ostream& os) const
{
auto sv_info = alu_src_const.find(m_value);
if (sv_info != alu_src_const.end()) {
@ -183,16 +182,6 @@ void SpecialValue::do_print(std::ostream& os) const
}
}
PValue Value::zero(new InlineConstValue(ALU_SRC_0, 0));
PValue Value::one_f(new InlineConstValue(ALU_SRC_1, 0));
PValue Value::one_i(new InlineConstValue(ALU_SRC_1_INT, 0));
PValue Value::zero_dot_5(new InlineConstValue(ALU_SRC_0_5, 0));
InlineConstValue::InlineConstValue(int value, int chan):
SpecialValue(Value::cinline, value, chan)
{
}
bool InlineConstValue::is_equal_to(const Value& other) const
{
assert(other.type() == Value::Type::cinline);
@ -200,6 +189,11 @@ bool InlineConstValue::is_equal_to(const Value& other) const
return sel() == rhs.sel();
}
PValue Value::zero(new InlineConstValue(ALU_SRC_0, 0));
PValue Value::one_f(new InlineConstValue(ALU_SRC_1, 0));
PValue Value::one_i(new InlineConstValue(ALU_SRC_1_INT, 0));
PValue Value::zero_dot_5(new InlineConstValue(ALU_SRC_0_5, 0));
UniformValue::UniformValue(uint32_t sel, uint32_t chan, uint32_t kcache_bank):
Value(Value::kconst, chan)
{

View file

@ -162,21 +162,13 @@ private:
} m_value;
};
class SpecialValue: public Value {
protected:
SpecialValue(Type type, int value, int chan);
class InlineConstValue: public Value {
public:
InlineConstValue(int value, int chan);
uint32_t sel() const override final;
private:
void do_print(std::ostream& os) const override;
AluInlineConstants m_value;
};
class InlineConstValue: public SpecialValue {
public:
InlineConstValue(int value, int chan);
bool is_equal_to(const Value& other) const override;
private:
AluInlineConstants m_value;
};