zenilib: zenilib/jni/external/angle/src/compiler/QualifierAlive.cpp Source File

zenilib 0.5.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
QualifierAlive.cpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6
7 #include "compiler/intermediate.h"
8
9 class TAliveTraverser : public TIntermTraverser {
10 public:
11 TAliveTraverser(TQualifier q) : TIntermTraverser(true, false, false, true), found(false), qualifier(q)
12 {
13 }
14
15 bool wasFound() { return found; }
16
17 protected:
18 bool found;
19 TQualifier qualifier;
20
21 void visitSymbol(TIntermSymbol*);
22 bool visitSelection(Visit, TIntermSelection*);
23 };
24
25 //
26 // Report whether or not a variable of the given qualifier type
27 // is guaranteed written. Not always possible to determine if
28 // it is written conditionally.
29 //
30 // ?? It does not do this well yet, this is just a place holder
31 // that simply determines if it was reference at all, anywhere.
32 //
33 bool QualifierWritten(TIntermNode* node, TQualifier qualifier)
34 {
35 TAliveTraverser it(qualifier);
36
37 if (node)
38 node->traverse(&it);
39
40 return it.wasFound();
41 }
42
43 void TAliveTraverser::visitSymbol(TIntermSymbol* node)
44 {
45 //
46 // If it's what we're looking for, record it.
47 //
48 if (node->getQualifier() == qualifier)
49 found = true;
50 }
51
52 bool TAliveTraverser::visitSelection(Visit preVisit, TIntermSelection* node)
53 {
54 if (wasFound())
55 return false;
56
57 return true;
58 }
Visit
Visit
Definition: intermediate.h:524
TQualifier
TQualifier
Definition: BaseTypes.h:81
QualifierWritten
bool QualifierWritten(TIntermNode *node, TQualifier qualifier)
Definition: QualifierAlive.cpp:33
intermediate.h
TIntermTyped::getQualifier
TQualifier getQualifier() const
Definition: intermediate.h:255
TIntermSelection
Definition: intermediate.h:503
TIntermTraverser::visitSymbol
virtual void visitSymbol(TIntermSymbol *)
Definition: intermediate.h:552
true
#define true
Definition: ftrandom.c:49
TIntermNode::traverse
virtual void traverse(TIntermTraverser *)=0
TIntermTraverser
Definition: intermediate.h:539
TIntermTraverser::visitSelection
virtual bool visitSelection(Visit visit, TIntermSelection *)
Definition: intermediate.h:556
TIntermSymbol
Definition: intermediate.h:340
q
GLdouble GLdouble GLdouble GLdouble q
Definition: glew.h:1400
TIntermNode
Definition: intermediate.h:206
false
#define false
Definition: ftrandom.c:50