OSDN Git Service

Remove the Radiance compiler copy and use OpenGL's instead.
[android-x86/external-swiftshader.git] / src / OpenGL / compiler / AnalyzeCallDepth.h
1 //\r
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
5 //\r
6 \r
7 #ifndef COMPILER_ANALYZE_CALL_DEPTH_H_\r
8 #define COMPILER_ANALYZE_CALL_DEPTH_H_\r
9 \r
10 #include "intermediate.h"\r
11 \r
12 #include <set>\r
13 #include <limits.h>\r
14 \r
15 // Traverses intermediate tree to analyze call depth or detect function recursion\r
16 class AnalyzeCallDepth : public TIntermTraverser\r
17 {\r
18 public:\r
19     AnalyzeCallDepth(TIntermNode *root);\r
20     ~AnalyzeCallDepth();\r
21 \r
22     virtual bool visitAggregate(Visit, TIntermAggregate*);\r
23 \r
24     unsigned int analyzeCallDepth();\r
25 \r
26 private:\r
27     class FunctionNode\r
28         {\r
29     public:\r
30         FunctionNode(TIntermAggregate *node);\r
31 \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
36 \r
37                 void removeIfUnreachable();\r
38 \r
39     private:\r
40         TIntermAggregate *const node;\r
41         TVector<FunctionNode*> callees;\r
42 \r
43         Visit visit;\r
44                 unsigned int callDepth;\r
45     };\r
46 \r
47     FunctionNode *findFunctionByName(const TString &name);\r
48         \r
49     std::vector<FunctionNode*> functions;\r
50         typedef std::set<FunctionNode*> FunctionSet;\r
51         FunctionSet globalFunctionCalls;\r
52     FunctionNode *currentFunction;\r
53 };\r
54 \r
55 #endif  // COMPILER_ANALYZE_CALL_DEPTH_H_\r