Edit

kc3-lang/angle/src/compiler/translator/tree_ops/PruneNoOps.h

Branch :

  • Show log

    Commit

  • Author : Shahbaz Youssefi
    Date : 2021-06-12 01:37:32
    Hash : 3f9dcb00
    Message : Translator: Prune trivial dead code Code after discard, return, break and continue is discarded with this change. This simplifies SPIR-V generation as no code is allowed after a branch instruction and no special handling is necessary after this change. Bug: angleproject:4889 Change-Id: Ife9c8de8a6d0db9d682561daf44366aad9b1cf61 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2957811 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>

  • src/compiler/translator/tree_ops/PruneNoOps.h
  • //
    // Copyright 2002 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.
    //
    // PruneNoOps.h: The PruneNoOps function prunes:
    //   1. Empty declarations "int;". Empty declarators will be pruned as well, so for example:
    //        int , a;
    //      is turned into
    //        int a;
    //   2. Literal statements: "1.0;". The ESSL output doesn't define a default precision for float,
    //      so float literal statements would end up with no precision which is invalid ESSL.
    //   3. Statements after discard, return, break and continue.
    
    #ifndef COMPILER_TRANSLATOR_TREEOPS_PRUNENOOPS_H_
    #define COMPILER_TRANSLATOR_TREEOPS_PRUNENOOPS_H_
    
    #include "common/angleutils.h"
    
    namespace sh
    {
    class TCompiler;
    class TIntermBlock;
    class TSymbolTable;
    
    ANGLE_NO_DISCARD bool PruneNoOps(TCompiler *compiler,
                                     TIntermBlock *root,
                                     TSymbolTable *symbolTable);
    }  // namespace sh
    
    #endif  // COMPILER_TRANSLATOR_TREEOPS_PRUNENOOPS_H_