mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-03 14:48:46 +00:00
add missing microinstruction changes for debugprint
This commit is contained in:
parent
69b3eff9c9
commit
6b830f641c
1 changed files with 22 additions and 5 deletions
|
@ -14,6 +14,8 @@ namespace Shader::IR {
|
||||||
Inst::Inst(IR::Opcode op_, u32 flags_) noexcept : op{op_}, flags{flags_} {
|
Inst::Inst(IR::Opcode op_, u32 flags_) noexcept : op{op_}, flags{flags_} {
|
||||||
if (op == Opcode::Phi) {
|
if (op == Opcode::Phi) {
|
||||||
std::construct_at(&phi_args);
|
std::construct_at(&phi_args);
|
||||||
|
} else if (op == Opcode::StringLiteral) {
|
||||||
|
std::construct_at(&string_literal);
|
||||||
} else {
|
} else {
|
||||||
std::construct_at(&args);
|
std::construct_at(&args);
|
||||||
}
|
}
|
||||||
|
@ -22,17 +24,22 @@ Inst::Inst(IR::Opcode op_, u32 flags_) noexcept : op{op_}, flags{flags_} {
|
||||||
Inst::Inst(const Inst& base) : op{base.op}, flags{base.flags} {
|
Inst::Inst(const Inst& base) : op{base.op}, flags{base.flags} {
|
||||||
if (base.op == Opcode::Phi) {
|
if (base.op == Opcode::Phi) {
|
||||||
throw NotImplementedException("Copying phi node");
|
throw NotImplementedException("Copying phi node");
|
||||||
}
|
} else if (base.op == Opcode::StringLiteral) {
|
||||||
|
std::construct_at(&string_literal, base.string_literal);
|
||||||
|
} else {
|
||||||
std::construct_at(&args);
|
std::construct_at(&args);
|
||||||
const size_t num_args{base.NumArgs()};
|
const size_t num_args{base.NumArgs()};
|
||||||
for (size_t index = 0; index < num_args; ++index) {
|
for (size_t index = 0; index < num_args; ++index) {
|
||||||
SetArg(index, base.Arg(index));
|
SetArg(index, base.Arg(index));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Inst::~Inst() {
|
Inst::~Inst() {
|
||||||
if (op == Opcode::Phi) {
|
if (op == Opcode::Phi) {
|
||||||
std::destroy_at(&phi_args);
|
std::destroy_at(&phi_args);
|
||||||
|
} else if (op == Opcode::StringLiteral) {
|
||||||
|
std::destroy_at(&string_literal);
|
||||||
} else {
|
} else {
|
||||||
std::destroy_at(&args);
|
std::destroy_at(&args);
|
||||||
}
|
}
|
||||||
|
@ -100,6 +107,9 @@ bool Inst::AreAllArgsImmediates() const {
|
||||||
if (op == Opcode::Phi) {
|
if (op == Opcode::Phi) {
|
||||||
UNREACHABLE_MSG("Testing for all arguments are immediates on phi instruction");
|
UNREACHABLE_MSG("Testing for all arguments are immediates on phi instruction");
|
||||||
}
|
}
|
||||||
|
if (op == Opcode::StringLiteral) {
|
||||||
|
UNREACHABLE_MSG("Testing for all arguments are immediates on StringLiteral instruction");
|
||||||
|
}
|
||||||
return std::all_of(args.begin(), args.begin() + NumArgs(),
|
return std::all_of(args.begin(), args.begin() + NumArgs(),
|
||||||
[](const IR::Value& value) { return value.IsImmediate(); });
|
[](const IR::Value& value) { return value.IsImmediate(); });
|
||||||
}
|
}
|
||||||
|
@ -121,6 +131,8 @@ void Inst::SetArg(size_t index, Value value) {
|
||||||
}
|
}
|
||||||
if (op == Opcode::Phi) {
|
if (op == Opcode::Phi) {
|
||||||
phi_args[index].second = value;
|
phi_args[index].second = value;
|
||||||
|
} else if (op == Opcode::StringLiteral) {
|
||||||
|
UNREACHABLE_MSG("SetArg on StringLiteral instruction");
|
||||||
} else {
|
} else {
|
||||||
args[index] = value;
|
args[index] = value;
|
||||||
}
|
}
|
||||||
|
@ -157,6 +169,8 @@ void Inst::ClearArgs() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
phi_args.clear();
|
phi_args.clear();
|
||||||
|
} else if (op == Opcode::StringLiteral) {
|
||||||
|
string_literal.clear();
|
||||||
} else {
|
} else {
|
||||||
for (auto& value : args) {
|
for (auto& value : args) {
|
||||||
if (!value.IsImmediate()) {
|
if (!value.IsImmediate()) {
|
||||||
|
@ -182,6 +196,9 @@ void Inst::ReplaceOpcode(IR::Opcode opcode) {
|
||||||
if (opcode == IR::Opcode::Phi) {
|
if (opcode == IR::Opcode::Phi) {
|
||||||
UNREACHABLE_MSG("Cannot transition into Phi");
|
UNREACHABLE_MSG("Cannot transition into Phi");
|
||||||
}
|
}
|
||||||
|
if (op == IR::Opcode::StringLiteral || opcode == IR::Opcode::StringLiteral) {
|
||||||
|
UNREACHABLE_MSG("Cannot transition to or from StringLiteral");
|
||||||
|
}
|
||||||
if (op == Opcode::Phi) {
|
if (op == Opcode::Phi) {
|
||||||
// Transition out of phi arguments into non-phi
|
// Transition out of phi arguments into non-phi
|
||||||
std::destroy_at(&phi_args);
|
std::destroy_at(&phi_args);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue