Hash :
c9c259cc
Author :
Date :
2018-06-13T11:03:22
Add a shared traverse() function for most node types The traversal logic for many node types is essentially the same. Use a single traverse() function for all simple node types instead of having different ones for each node type. Special traversal code is only needed for those node types where the traversal logic is overridden in specific traversers or which do special bookkeeping. This makes traverser behavior a bit more consistent: InVisit calls are now done for all node types, including if/else, ternary and loop nodes. Also false returned from visit function will always skip traversing the next children of that node. This reduces shader_translator binary size on Windows by 8 kilobytes. The added helper functions will also make it easier to implement alternative more efficient traversers. Unfortunately this also regresses compiler perf tests by around 2-3%. BUG=angleproject:2662 TEST=angle_unittests, angle_end2end_tests Change-Id: I3cb1256297b66e1db4b133b8fb84a24c349a9e29 Reviewed-on: https://chromium-review.googlesource.com/1133009 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
//
// Copyright (c) 2018 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_TREEUTIL_VISIT_H_
#define COMPILER_TRANSLATOR_TREEUTIL_VISIT_H_
namespace sh
{
enum Visit
{
PreVisit,
InVisit,
PostVisit
};
} // namespace sh
#endif // COMPILER_TRANSLATOR_TREEUTIL_VISIT_H_