glsl: Rework var alloc to not assign unused results
This commit is contained in:
parent
8185a5ab34
commit
33f63cdc22
9 changed files with 91 additions and 49 deletions
|
@ -25,7 +25,7 @@ void EmitPhi(EmitContext& ctx, IR::Inst& phi) {
|
|||
}
|
||||
if (!phi.Definition<Id>().is_valid) {
|
||||
// The phi node wasn't forward defined
|
||||
ctx.Add("{};", ctx.var_alloc.Define(phi, phi.Arg(0).Type()));
|
||||
ctx.var_alloc.PhiDefine(phi, phi.Arg(0).Type());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,8 +33,8 @@ void EmitVoid(EmitContext& ctx) {
|
|||
// NotImplemented();
|
||||
}
|
||||
|
||||
void EmitReference(EmitContext&) {
|
||||
// NotImplemented();
|
||||
void EmitReference(EmitContext& ctx, const IR::Value& value) {
|
||||
ctx.var_alloc.Consume(value);
|
||||
}
|
||||
|
||||
void EmitPhiMove(EmitContext& ctx, const IR::Value& phi_value, const IR::Value& value) {
|
||||
|
@ -42,7 +42,7 @@ void EmitPhiMove(EmitContext& ctx, const IR::Value& phi_value, const IR::Value&
|
|||
const auto phi_type{phi.Arg(0).Type()};
|
||||
if (!phi.Definition<Id>().is_valid) {
|
||||
// The phi node wasn't forward defined
|
||||
ctx.Add("{};", ctx.var_alloc.Define(phi, phi_type));
|
||||
ctx.var_alloc.PhiDefine(phi, phi_type);
|
||||
}
|
||||
const auto phi_reg{ctx.var_alloc.Consume(IR::Value{&phi})};
|
||||
const auto val_reg{ctx.var_alloc.Consume(value)};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue