r600/sfn: Add a type for address registers
Signed-off-by: Gert Wollny <gert.wollny@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21347>
This commit is contained in:
@@ -648,15 +648,23 @@ split_register_string(const string& s,
|
||||
PRegister
|
||||
ValueFactory::dest_from_string(const std::string& s)
|
||||
{
|
||||
assert(s.length() >= 4);
|
||||
|
||||
assert(strchr("ARS_", s[0]));
|
||||
if (s == "AR") {
|
||||
return new AddressRegister(AddressRegister::addr);
|
||||
} else if (s == "IDX0") {
|
||||
return new AddressRegister(AddressRegister::idx0);
|
||||
} else if (s == "IDX1") {
|
||||
return new AddressRegister(AddressRegister::idx1);
|
||||
}
|
||||
|
||||
string index_str;
|
||||
string size_str;
|
||||
string swizzle_str;
|
||||
string pin_str;
|
||||
|
||||
assert(s.length() >= 4);
|
||||
|
||||
assert(strchr("ARS_", s[0]));
|
||||
|
||||
split_register_string(s, index_str, size_str, swizzle_str, pin_str);
|
||||
|
||||
int sel = 0;
|
||||
|
||||
@@ -263,6 +263,17 @@ Register::accept(ConstRegisterVisitor& visitor) const
|
||||
void
|
||||
Register::print(std::ostream& os) const
|
||||
{
|
||||
if (m_flags.test(addr_or_idx)) {
|
||||
switch (sel()) {
|
||||
case AddressRegister::addr: os << "AR"; break;
|
||||
case AddressRegister::idx0: os << "IDX0"; break;
|
||||
case AddressRegister::idx1: os << "IDX1"; break;
|
||||
default:
|
||||
unreachable("Wrong address ID");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
os << (m_flags.test(ssa) ? "S" : "R") << sel() << "." << chanchar[chan()];
|
||||
|
||||
if (pin() != pin_none)
|
||||
@@ -286,6 +297,14 @@ Register::from_string(const std::string& s)
|
||||
char chan = 0;
|
||||
std::string pinstr;
|
||||
|
||||
if (s == "AR") {
|
||||
return new AddressRegister(AddressRegister::addr);
|
||||
} else if (s == "IDX0") {
|
||||
return new AddressRegister(AddressRegister::idx0);
|
||||
} else if (s == "IDX1") {
|
||||
return new AddressRegister(AddressRegister::idx1);
|
||||
}
|
||||
|
||||
assert(s[0] == 'R' || s[0] == '_' || s[0] == 'S');
|
||||
|
||||
int type = 0;
|
||||
|
||||
@@ -163,6 +163,7 @@ public:
|
||||
ssa,
|
||||
pin_start,
|
||||
pin_end,
|
||||
addr_or_idx,
|
||||
flag_count
|
||||
};
|
||||
|
||||
@@ -223,6 +224,24 @@ private:
|
||||
};
|
||||
using PRegister = Register::Pointer;
|
||||
|
||||
class AddressRegister : public Register {
|
||||
public:
|
||||
enum Type {
|
||||
addr,
|
||||
idx0 = 2,
|
||||
idx1 = 3
|
||||
};
|
||||
AddressRegister(Type type) : Register(type, 0, pin_fully) {
|
||||
set_flag(addr_or_idx);
|
||||
}
|
||||
Register *as_register() override { return nullptr; }
|
||||
|
||||
protected:
|
||||
void do_set_chan(UNUSED int c) { unreachable("Address registers must have chan 0");}
|
||||
void set_sel_internal(UNUSED int sel) {unreachable("Address registers don't support sel override");}
|
||||
};
|
||||
|
||||
|
||||
inline std::ostream&
|
||||
operator<<(std::ostream& os, const Register& val)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user