2 // Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
\r
3 // Use of this source code is governed by a BSD-style license that can be
\r
4 // found in the LICENSE file.
\r
7 #ifndef COMPILER_ANALYZE_CALL_DEPTH_H_
\r
8 #define COMPILER_ANALYZE_CALL_DEPTH_H_
\r
10 #include "intermediate.h"
\r
15 // Traverses intermediate tree to analyze call depth or detect function recursion
\r
16 class AnalyzeCallDepth : public TIntermTraverser
\r
19 AnalyzeCallDepth(TIntermNode *root);
\r
20 ~AnalyzeCallDepth();
\r
22 virtual bool visitAggregate(Visit, TIntermAggregate*);
\r
24 unsigned int analyzeCallDepth();
\r
30 FunctionNode(TIntermAggregate *node);
\r
32 const TString &getName() const;
\r
33 void addCallee(FunctionNode *callee);
\r
34 unsigned int analyzeCallDepth(AnalyzeCallDepth *analyzeCallDepth);
\r
35 unsigned int getLastDepth() const;
\r
37 void removeIfUnreachable();
\r
40 TIntermAggregate *const node;
\r
41 TVector<FunctionNode*> callees;
\r
44 unsigned int callDepth;
\r
47 FunctionNode *findFunctionByName(const TString &name);
\r
49 std::vector<FunctionNode*> functions;
\r
50 typedef std::set<FunctionNode*> FunctionSet;
\r
51 FunctionSet globalFunctionCalls;
\r
52 FunctionNode *currentFunction;
\r
55 #endif // COMPILER_ANALYZE_CALL_DEPTH_H_
\r