Shader_IR: mark labels as unused for partial decompile.

This commit is contained in:
Fernando Sahmkow 2019-08-21 11:54:47 -04:00 committed by FernandoS27
parent 47e4f6a52c
commit 0366c18d87
2 changed files with 9 additions and 3 deletions

View file

@ -497,9 +497,7 @@ void ASTManager::Decompile() {
} }
} }
if (can_remove) { if (can_remove) {
auto& manager = label->GetManager(); label->MarkLabelUnused();
manager.Remove(label);
labels.erase(it);
} }
} }
} }

View file

@ -112,6 +112,7 @@ class ASTLabel {
public: public:
ASTLabel(u32 index) : index{index} {} ASTLabel(u32 index) : index{index} {}
u32 index; u32 index;
bool unused{};
}; };
class ASTGoto { class ASTGoto {
@ -204,6 +205,13 @@ public:
return nullptr; return nullptr;
} }
void MarkLabelUnused() const {
auto inner = std::get_if<ASTLabel>(&data);
if (inner) {
inner->unused = true;
}
}
Expr GetIfCondition() const { Expr GetIfCondition() const {
auto inner = std::get_if<ASTIfThen>(&data); auto inner = std::get_if<ASTIfThen>(&data);
if (inner) { if (inner) {