michael@0: // michael@0: // Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved. michael@0: // Use of this source code is governed by a BSD-style license that can be michael@0: // found in the LICENSE file. michael@0: // michael@0: michael@0: #ifndef _LOCAL_INTERMEDIATE_INCLUDED_ michael@0: #define _LOCAL_INTERMEDIATE_INCLUDED_ michael@0: michael@0: #include "GLSLANG/ShaderLang.h" michael@0: #include "compiler/intermediate.h" michael@0: #include "compiler/SymbolTable.h" michael@0: michael@0: struct TVectorFields { michael@0: int offsets[4]; michael@0: int num; michael@0: }; michael@0: michael@0: // michael@0: // Set of helper functions to help parse and build the tree. michael@0: // michael@0: class TInfoSink; michael@0: class TIntermediate { michael@0: public: michael@0: POOL_ALLOCATOR_NEW_DELETE(); michael@0: TIntermediate(TInfoSink& i) : infoSink(i) { } michael@0: michael@0: TIntermSymbol* addSymbol(int Id, const TString&, const TType&, const TSourceLoc&); michael@0: TIntermTyped* addConversion(TOperator, const TType&, TIntermTyped*); michael@0: TIntermTyped* addBinaryMath(TOperator op, TIntermTyped* left, TIntermTyped* right, const TSourceLoc&, TSymbolTable&); michael@0: TIntermTyped* addAssign(TOperator op, TIntermTyped* left, TIntermTyped* right, const TSourceLoc&); michael@0: TIntermTyped* addIndex(TOperator op, TIntermTyped* base, TIntermTyped* index, const TSourceLoc&); michael@0: TIntermTyped* addUnaryMath(TOperator op, TIntermNode* child, const TSourceLoc&, TSymbolTable&); michael@0: TIntermAggregate* growAggregate(TIntermNode* left, TIntermNode* right, const TSourceLoc&); michael@0: TIntermAggregate* makeAggregate(TIntermNode* node, const TSourceLoc&); michael@0: TIntermAggregate* setAggregateOperator(TIntermNode*, TOperator, const TSourceLoc&); michael@0: TIntermNode* addSelection(TIntermTyped* cond, TIntermNodePair code, const TSourceLoc&); michael@0: TIntermTyped* addSelection(TIntermTyped* cond, TIntermTyped* trueBlock, TIntermTyped* falseBlock, const TSourceLoc&); michael@0: TIntermTyped* addComma(TIntermTyped* left, TIntermTyped* right, const TSourceLoc&); michael@0: TIntermConstantUnion* addConstantUnion(ConstantUnion*, const TType&, const TSourceLoc&); michael@0: TIntermTyped* promoteConstantUnion(TBasicType, TIntermConstantUnion*) ; michael@0: bool parseConstTree(const TSourceLoc&, TIntermNode*, ConstantUnion*, TOperator, TSymbolTable&, TType, bool singleConstantParam = false); michael@0: TIntermNode* addLoop(TLoopType, TIntermNode*, TIntermTyped*, TIntermTyped*, TIntermNode*, const TSourceLoc&); michael@0: TIntermBranch* addBranch(TOperator, const TSourceLoc&); michael@0: TIntermBranch* addBranch(TOperator, TIntermTyped*, const TSourceLoc&); michael@0: TIntermTyped* addSwizzle(TVectorFields&, const TSourceLoc&); michael@0: bool postProcess(TIntermNode*); michael@0: void remove(TIntermNode*); michael@0: void outputTree(TIntermNode*); michael@0: michael@0: private: michael@0: void operator=(TIntermediate&); // prevent assignments michael@0: michael@0: TInfoSink& infoSink; michael@0: }; michael@0: michael@0: #endif // _LOCAL_INTERMEDIATE_INCLUDED_