daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1 | // |
Nicolas Capens | 16004fc | 2014-06-11 11:29:11 -0400 | [diff] [blame] | 2 | // Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved. |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3 | // Use of this source code is governed by a BSD-style license that can be |
| 4 | // found in the LICENSE file. |
| 5 | // |
| 6 | |
Geoff Lang | 0a73dd8 | 2014-11-19 16:18:08 -0500 | [diff] [blame] | 7 | #ifndef COMPILER_TRANSLATOR_INTERMEDIATE_H_ |
| 8 | #define COMPILER_TRANSLATOR_INTERMEDIATE_H_ |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 9 | |
Jamie Madill | b1a85f4 | 2014-08-19 15:23:24 -0400 | [diff] [blame] | 10 | #include "compiler/translator/IntermNode.h" |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 11 | |
Jamie Madill | 45bcc78 | 2016-11-07 13:58:48 -0500 | [diff] [blame^] | 12 | namespace sh |
| 13 | { |
| 14 | |
Jamie Madill | b1a85f4 | 2014-08-19 15:23:24 -0400 | [diff] [blame] | 15 | struct TVectorFields |
Zhenyao Mo | e40d1e9 | 2014-07-16 17:40:36 -0700 | [diff] [blame] | 16 | { |
Jamie Madill | b1a85f4 | 2014-08-19 15:23:24 -0400 | [diff] [blame] | 17 | int offsets[4]; |
| 18 | int num; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 19 | }; |
| 20 | |
Jamie Madill | b1a85f4 | 2014-08-19 15:23:24 -0400 | [diff] [blame] | 21 | // |
Olli Etuaho | f119a26 | 2016-08-19 15:54:22 +0300 | [diff] [blame] | 22 | // Set of helper functions to help build the tree. |
Jamie Madill | b1a85f4 | 2014-08-19 15:23:24 -0400 | [diff] [blame] | 23 | // |
Jamie Madill | b1a85f4 | 2014-08-19 15:23:24 -0400 | [diff] [blame] | 24 | class TIntermediate |
Zhenyao Mo | e40d1e9 | 2014-07-16 17:40:36 -0700 | [diff] [blame] | 25 | { |
| 26 | public: |
Alok Priyadarshi | 8156b6b | 2013-09-23 14:56:58 -0400 | [diff] [blame] | 27 | POOL_ALLOCATOR_NEW_DELETE(); |
Olli Etuaho | f119a26 | 2016-08-19 15:54:22 +0300 | [diff] [blame] | 28 | TIntermediate() {} |
alokp@chromium.org | 58e5429 | 2010-08-24 21:40:03 +0000 | [diff] [blame] | 29 | |
Jamie Madill | b1a85f4 | 2014-08-19 15:23:24 -0400 | [diff] [blame] | 30 | TIntermSymbol *addSymbol( |
| 31 | int id, const TString &, const TType &, const TSourceLoc &); |
Olli Etuaho | 3272a6d | 2016-08-29 17:54:50 +0300 | [diff] [blame] | 32 | TIntermTyped *addIndex(TOperator op, |
| 33 | TIntermTyped *base, |
| 34 | TIntermTyped *index, |
| 35 | const TSourceLoc &line, |
| 36 | TDiagnostics *diagnostics); |
Jamie Madill | b1a85f4 | 2014-08-19 15:23:24 -0400 | [diff] [blame] | 37 | TIntermTyped *addUnaryMath( |
Olli Etuaho | f6c694b | 2015-03-26 14:50:53 +0200 | [diff] [blame] | 38 | TOperator op, TIntermTyped *child, const TSourceLoc &line, const TType *funcReturnType); |
Jamie Madill | b1a85f4 | 2014-08-19 15:23:24 -0400 | [diff] [blame] | 39 | TIntermAggregate *growAggregate( |
| 40 | TIntermNode *left, TIntermNode *right, const TSourceLoc &); |
Olli Etuaho | 32db19b | 2016-10-04 14:43:16 +0100 | [diff] [blame] | 41 | static TIntermAggregate *MakeAggregate(TIntermNode *node, const TSourceLoc &line); |
Olli Etuaho | 6d40bbd | 2016-09-30 13:49:38 +0100 | [diff] [blame] | 42 | static TIntermBlock *EnsureBlock(TIntermNode *node); |
Jamie Madill | b1a85f4 | 2014-08-19 15:23:24 -0400 | [diff] [blame] | 43 | TIntermAggregate *setAggregateOperator(TIntermNode *, TOperator, const TSourceLoc &); |
Olli Etuaho | 5796127 | 2016-09-14 13:57:46 +0300 | [diff] [blame] | 44 | TIntermNode *addIfElse(TIntermTyped *cond, TIntermNodePair code, const TSourceLoc &line); |
Olli Etuaho | d0bad2c | 2016-09-09 18:01:16 +0300 | [diff] [blame] | 45 | static TIntermTyped *AddTernarySelection(TIntermTyped *cond, |
| 46 | TIntermTyped *trueExpression, |
| 47 | TIntermTyped *falseExpression, |
| 48 | const TSourceLoc &line); |
Olli Etuaho | 6d40bbd | 2016-09-30 13:49:38 +0100 | [diff] [blame] | 49 | TIntermSwitch *addSwitch(TIntermTyped *init, |
| 50 | TIntermBlock *statementList, |
| 51 | const TSourceLoc &line); |
Olli Etuaho | a3a3666 | 2015-02-17 13:46:51 +0200 | [diff] [blame] | 52 | TIntermCase *addCase( |
| 53 | TIntermTyped *condition, const TSourceLoc &line); |
Olli Etuaho | 4db7ded | 2016-10-13 12:23:11 +0100 | [diff] [blame] | 54 | static TIntermTyped *AddComma(TIntermTyped *left, |
| 55 | TIntermTyped *right, |
| 56 | const TSourceLoc &line, |
| 57 | int shaderVersion); |
Olli Etuaho | 5c0e023 | 2015-11-11 15:55:59 +0200 | [diff] [blame] | 58 | TIntermConstantUnion *addConstantUnion(const TConstantUnion *constantUnion, |
| 59 | const TType &type, |
| 60 | const TSourceLoc &line); |
Jamie Madill | b1a85f4 | 2014-08-19 15:23:24 -0400 | [diff] [blame] | 61 | TIntermNode *addLoop(TLoopType, TIntermNode *, TIntermTyped *, TIntermTyped *, |
| 62 | TIntermNode *, const TSourceLoc &); |
| 63 | TIntermBranch *addBranch(TOperator, const TSourceLoc &); |
| 64 | TIntermBranch *addBranch(TOperator, TIntermTyped *, const TSourceLoc &); |
Olli Etuaho | b6fa043 | 2016-09-28 16:28:05 +0100 | [diff] [blame] | 65 | static TIntermTyped *AddSwizzle(TIntermTyped *baseExpression, |
| 66 | const TVectorFields &fields, |
| 67 | const TSourceLoc &dotLocation); |
Olli Etuaho | a3a5cc6 | 2015-02-13 13:12:22 +0200 | [diff] [blame] | 68 | |
| 69 | static void outputTree(TIntermNode *, TInfoSinkBase &); |
alokp@chromium.org | 58e5429 | 2010-08-24 21:40:03 +0000 | [diff] [blame] | 70 | |
Olli Etuaho | f119a26 | 2016-08-19 15:54:22 +0300 | [diff] [blame] | 71 | TIntermTyped *foldAggregateBuiltIn(TIntermAggregate *aggregate, TDiagnostics *diagnostics); |
Arun Patole | 274f070 | 2015-05-05 13:33:30 +0530 | [diff] [blame] | 72 | |
Jamie Madill | b1a85f4 | 2014-08-19 15:23:24 -0400 | [diff] [blame] | 73 | private: |
| 74 | void operator=(TIntermediate &); // prevent assignments |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 75 | }; |
| 76 | |
Jamie Madill | 45bcc78 | 2016-11-07 13:58:48 -0500 | [diff] [blame^] | 77 | } // namespace sh |
| 78 | |
Geoff Lang | 0a73dd8 | 2014-11-19 16:18:08 -0500 | [diff] [blame] | 79 | #endif // COMPILER_TRANSLATOR_INTERMEDIATE_H_ |