Hash :
280e79e1
Author :
Date :
2023-08-10T14:08:00
Rescope globals only used in one function to function-local. We can demote global variables when they are only used in one function. This has performance implications on Metal. Bug: angleproject:8311 Change-Id: Id666e6b167be771c14768cd73efa61fdacd897d4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4771215 Commit-Queue: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
//
// Copyright 2023 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
#ifndef COMPILER_TRANSLATOR_TREEOPS_RESCOPEGLOBALVARIABLES_H_
#define COMPILER_TRANSLATOR_TREEOPS_RESCOPEGLOBALVARIABLES_H_
#include "common/angleutils.h"
#include "compiler/translator/Compiler.h"
namespace sh
{
// This function rescopes any globally-declared variable to be local to a function if the variable
// is only used in one function.
[[nodiscard]] bool RescopeGlobalVariables(TCompiler &compiler, TIntermBlock &root);
} // namespace sh
#endif // COMPILER_TRANSLATOR_TREEOPS_RESCOPEGLOBALVARIABLES_H_