shader: Misc fixes
This commit is contained in:
parent
9170200a11
commit
8af9297f09
10 changed files with 104 additions and 89 deletions
|
@ -143,19 +143,21 @@ Value Inst::Arg(size_t index) const {
|
|||
}
|
||||
|
||||
void Inst::SetArg(size_t index, Value value) {
|
||||
if (op == Opcode::Phi) {
|
||||
throw LogicError("Setting argument on a phi instruction");
|
||||
}
|
||||
if (index >= NumArgsOf(op)) {
|
||||
if (index >= NumArgs()) {
|
||||
throw InvalidArgument("Out of bounds argument index {} in opcode {}", index, op);
|
||||
}
|
||||
if (!args[index].IsImmediate()) {
|
||||
UndoUse(args[index]);
|
||||
const IR::Value arg{Arg(index)};
|
||||
if (!arg.IsImmediate()) {
|
||||
UndoUse(arg);
|
||||
}
|
||||
if (!value.IsImmediate()) {
|
||||
Use(value);
|
||||
}
|
||||
args[index] = value;
|
||||
if (op == Opcode::Phi) {
|
||||
phi_args[index].second = value;
|
||||
} else {
|
||||
args[index] = value;
|
||||
}
|
||||
}
|
||||
|
||||
Block* Inst::PhiBlock(size_t index) const {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue