xref: /aosp_15_r20/external/angle/src/compiler/translator/tree_ops/PruneNoOps.h (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
1 //
2 // Copyright 2002 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6 // PruneNoOps.h: The PruneNoOps function prunes:
7 //   1. Empty declarations "int;". Empty declarators will be pruned as well, so for example:
8 //        int , a;
9 //      is turned into
10 //        int a;
11 //   2. Literal statements: "1.0;". The ESSL output doesn't define a default precision for float,
12 //      so float literal statements would end up with no precision which is invalid ESSL.
13 //   3. Statements after discard, return, break and continue.
14 //   4. Switch statements over a constant, where no case matches the constant
15 
16 #ifndef COMPILER_TRANSLATOR_TREEOPS_PRUNENOOPS_H_
17 #define COMPILER_TRANSLATOR_TREEOPS_PRUNENOOPS_H_
18 
19 #include "common/angleutils.h"
20 
21 namespace sh
22 {
23 class TCompiler;
24 class TIntermBlock;
25 class TSymbolTable;
26 
27 [[nodiscard]] bool PruneNoOps(TCompiler *compiler, TIntermBlock *root, TSymbolTable *symbolTable);
28 }  // namespace sh
29 
30 #endif  // COMPILER_TRANSLATOR_TREEOPS_PRUNENOOPS_H_
31