Line data Source code
1 : //
2 : // Copyright (c) 2002-2014 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 : #ifndef COMPILER_TRANSLATOR_INTERMEDIATE_H_
8 : #define COMPILER_TRANSLATOR_INTERMEDIATE_H_
9 :
10 : #include "compiler/translator/IntermNode.h"
11 :
12 : namespace sh
13 : {
14 :
15 : struct TVectorFields
16 : {
17 : int offsets[4];
18 : int num;
19 : };
20 :
21 : //
22 : // Set of helper functions to help build the tree.
23 : //
24 : class TIntermediate
25 : {
26 : public:
27 : POOL_ALLOCATOR_NEW_DELETE();
28 0 : TIntermediate() {}
29 :
30 : TIntermSymbol *addSymbol(
31 : int id, const TString &, const TType &, const TSourceLoc &);
32 : TIntermTyped *addIndex(TOperator op,
33 : TIntermTyped *base,
34 : TIntermTyped *index,
35 : const TSourceLoc &line,
36 : TDiagnostics *diagnostics);
37 : TIntermTyped *addUnaryMath(
38 : TOperator op, TIntermTyped *child, const TSourceLoc &line, const TType *funcReturnType);
39 : TIntermAggregate *growAggregate(
40 : TIntermNode *left, TIntermNode *right, const TSourceLoc &);
41 : static TIntermAggregate *MakeAggregate(TIntermNode *node, const TSourceLoc &line);
42 : static TIntermBlock *EnsureBlock(TIntermNode *node);
43 : TIntermAggregate *setAggregateOperator(TIntermNode *, TOperator, const TSourceLoc &);
44 : TIntermNode *addIfElse(TIntermTyped *cond, TIntermNodePair code, const TSourceLoc &line);
45 : static TIntermTyped *AddTernarySelection(TIntermTyped *cond,
46 : TIntermTyped *trueExpression,
47 : TIntermTyped *falseExpression,
48 : const TSourceLoc &line);
49 : TIntermSwitch *addSwitch(TIntermTyped *init,
50 : TIntermBlock *statementList,
51 : const TSourceLoc &line);
52 : TIntermCase *addCase(
53 : TIntermTyped *condition, const TSourceLoc &line);
54 : static TIntermTyped *AddComma(TIntermTyped *left,
55 : TIntermTyped *right,
56 : const TSourceLoc &line,
57 : int shaderVersion);
58 : TIntermConstantUnion *addConstantUnion(const TConstantUnion *constantUnion,
59 : const TType &type,
60 : const TSourceLoc &line);
61 : TIntermNode *addLoop(TLoopType, TIntermNode *, TIntermTyped *, TIntermTyped *,
62 : TIntermNode *, const TSourceLoc &);
63 : TIntermBranch *addBranch(TOperator, const TSourceLoc &);
64 : TIntermBranch *addBranch(TOperator, TIntermTyped *, const TSourceLoc &);
65 : static TIntermTyped *AddSwizzle(TIntermTyped *baseExpression,
66 : const TVectorFields &fields,
67 : const TSourceLoc &dotLocation);
68 :
69 : static void outputTree(TIntermNode *, TInfoSinkBase &);
70 :
71 : TIntermTyped *foldAggregateBuiltIn(TIntermAggregate *aggregate, TDiagnostics *diagnostics);
72 :
73 : private:
74 : void operator=(TIntermediate &); // prevent assignments
75 : };
76 :
77 : } // namespace sh
78 :
79 : #endif // COMPILER_TRANSLATOR_INTERMEDIATE_H_
|