gfx/angle/src/compiler/RemoveTree.cpp

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/angle/src/compiler/RemoveTree.cpp	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,77 @@
     1.4 +//
     1.5 +// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
     1.6 +// Use of this source code is governed by a BSD-style license that can be
     1.7 +// found in the LICENSE file.
     1.8 +//
     1.9 +
    1.10 +#include "compiler/intermediate.h"
    1.11 +#include "compiler/RemoveTree.h"
    1.12 +
    1.13 +//
    1.14 +// Code to recursively delete the intermediate tree.
    1.15 +//
    1.16 +
    1.17 +class RemoveTree : public TIntermTraverser
    1.18 +{
    1.19 +public:
    1.20 +	RemoveTree() : TIntermTraverser(false, false, true)
    1.21 +	{
    1.22 +	}
    1.23 +
    1.24 +protected:
    1.25 +	void visitSymbol(TIntermSymbol*);
    1.26 +	void visitConstantUnion(TIntermConstantUnion*);
    1.27 +	bool visitBinary(Visit visit, TIntermBinary*);
    1.28 +	bool visitUnary(Visit visit, TIntermUnary*);
    1.29 +	bool visitSelection(Visit visit, TIntermSelection*);
    1.30 +	bool visitAggregate(Visit visit, TIntermAggregate*);
    1.31 +};
    1.32 +
    1.33 +void RemoveTree::visitSymbol(TIntermSymbol* node)
    1.34 +{
    1.35 +	delete node;
    1.36 +}
    1.37 +
    1.38 +bool RemoveTree::visitBinary(Visit visit, TIntermBinary* node)
    1.39 +{
    1.40 +	delete node;
    1.41 +
    1.42 +	return true;
    1.43 +}
    1.44 +
    1.45 +bool RemoveTree::visitUnary(Visit visit, TIntermUnary* node)
    1.46 +{
    1.47 +    delete node;
    1.48 +
    1.49 +	return true;
    1.50 +}
    1.51 +
    1.52 +bool RemoveTree::visitAggregate(Visit visit, TIntermAggregate* node)
    1.53 +{
    1.54 +	delete node;
    1.55 +
    1.56 +	return true;
    1.57 +}
    1.58 +
    1.59 +bool RemoveTree::visitSelection(Visit visit, TIntermSelection* node)
    1.60 +{
    1.61 +	delete node;
    1.62 +
    1.63 +	return true;
    1.64 +}
    1.65 +
    1.66 +void RemoveTree::visitConstantUnion(TIntermConstantUnion* node)
    1.67 +{
    1.68 +	delete node;
    1.69 +}
    1.70 +
    1.71 +//
    1.72 +// Entry point.
    1.73 +//
    1.74 +void RemoveAllTreeNodes(TIntermNode* root)
    1.75 +{
    1.76 +    RemoveTree it;
    1.77 +
    1.78 +    root->traverse(&it);
    1.79 +}
    1.80 +

mercurial