summaryrefslogtreecommitdiffstats
path: root/gfx/angle/src/compiler/translator/IntermNode.h
diff options
context:
space:
mode:
Diffstat (limited to 'gfx/angle/src/compiler/translator/IntermNode.h')
-rwxr-xr-xgfx/angle/src/compiler/translator/IntermNode.h403
1 files changed, 104 insertions, 299 deletions
diff --git a/gfx/angle/src/compiler/translator/IntermNode.h b/gfx/angle/src/compiler/translator/IntermNode.h
index 94811bd1c..7068685ee 100755
--- a/gfx/angle/src/compiler/translator/IntermNode.h
+++ b/gfx/angle/src/compiler/translator/IntermNode.h
@@ -27,22 +27,14 @@
#include "compiler/translator/Operator.h"
#include "compiler/translator/Types.h"
-namespace sh
-{
-
class TDiagnostics;
class TIntermTraverser;
class TIntermAggregate;
-class TIntermBlock;
-class TIntermDeclaration;
-class TIntermFunctionDefinition;
-class TIntermSwizzle;
class TIntermBinary;
class TIntermUnary;
class TIntermConstantUnion;
-class TIntermTernary;
-class TIntermIfElse;
+class TIntermSelection;
class TIntermSwitch;
class TIntermCase;
class TIntermTyped;
@@ -54,7 +46,6 @@ class TIntermRaw;
class TIntermBranch;
class TSymbolTable;
-class TFunction;
// Encapsulate an identifier string and track whether it is coming from the original shader code
// (not internal) or from ANGLE (internal). Usually internal names shouldn't be decorated or hashed.
@@ -99,15 +90,10 @@ class TIntermNode : angle::NonCopyable
virtual void traverse(TIntermTraverser *) = 0;
virtual TIntermTyped *getAsTyped() { return 0; }
virtual TIntermConstantUnion *getAsConstantUnion() { return 0; }
- virtual TIntermFunctionDefinition *getAsFunctionDefinition() { return nullptr; }
virtual TIntermAggregate *getAsAggregate() { return 0; }
- virtual TIntermBlock *getAsBlock() { return nullptr; }
- virtual TIntermDeclaration *getAsDeclarationNode() { return nullptr; }
- virtual TIntermSwizzle *getAsSwizzleNode() { return nullptr; }
virtual TIntermBinary *getAsBinaryNode() { return 0; }
virtual TIntermUnary *getAsUnaryNode() { return 0; }
- virtual TIntermTernary *getAsTernaryNode() { return nullptr; }
- virtual TIntermIfElse *getAsIfElseNode() { return nullptr; }
+ virtual TIntermSelection *getAsSelectionNode() { return 0; }
virtual TIntermSwitch *getAsSwitchNode() { return 0; }
virtual TIntermCase *getAsCaseNode() { return 0; }
virtual TIntermSymbol *getAsSymbolNode() { return 0; }
@@ -155,7 +141,6 @@ class TIntermTyped : public TIntermNode
TBasicType getBasicType() const { return mType.getBasicType(); }
TQualifier getQualifier() const { return mType.getQualifier(); }
TPrecision getPrecision() const { return mType.getPrecision(); }
- TMemoryQualifier getMemoryQualifier() const { return mType.getMemoryQualifier(); }
int getCols() const { return mType.getCols(); }
int getRows() const { return mType.getRows(); }
int getNominalSize() const { return mType.getNominalSize(); }
@@ -174,9 +159,6 @@ class TIntermTyped : public TIntermNode
bool isConstructorWithOnlyConstantUnionParameters();
- static TIntermTyped *CreateIndexNode(int index);
- static TIntermTyped *CreateZero(const TType &type);
-
protected:
TType mType;
@@ -200,7 +182,7 @@ class TIntermLoop : public TIntermNode
TIntermNode *init,
TIntermTyped *cond,
TIntermTyped *expr,
- TIntermBlock *body)
+ TIntermAggregate *body)
: mType(type), mInit(init), mCond(cond), mExpr(expr), mBody(body), mUnrollFlag(false)
{
}
@@ -213,11 +195,11 @@ class TIntermLoop : public TIntermNode
TIntermNode *getInit() { return mInit; }
TIntermTyped *getCondition() { return mCond; }
TIntermTyped *getExpression() { return mExpr; }
- TIntermBlock *getBody() { return mBody; }
+ TIntermAggregate *getBody() { return mBody; }
void setCondition(TIntermTyped *condition) { mCond = condition; }
void setExpression(TIntermTyped *expression) { mExpr = expression; }
- void setBody(TIntermBlock *body) { mBody = body; }
+ void setBody(TIntermAggregate *body) { mBody = body; }
void setUnrollFlag(bool flag) { mUnrollFlag = flag; }
bool getUnrollFlag() const { return mUnrollFlag; }
@@ -227,7 +209,7 @@ class TIntermLoop : public TIntermNode
TIntermNode *mInit; // for-loop initialization
TIntermTyped *mCond; // loop exit condition
TIntermTyped *mExpr; // for-loop expression
- TIntermBlock *mBody; // loop body
+ TIntermAggregate *mBody; // loop body
bool mUnrollFlag; // Whether the loop should be unrolled or not.
};
@@ -334,7 +316,6 @@ class TIntermConstantUnion : public TIntermTyped
TIntermConstantUnion(const TConstantUnion *unionPointer, const TType &type)
: TIntermTyped(type), mUnionArrayPointer(unionPointer)
{
- ASSERT(unionPointer);
}
TIntermTyped *deepCopy() const override { return new TIntermConstantUnion(*this); }
@@ -362,7 +343,6 @@ class TIntermConstantUnion : public TIntermTyped
void replaceConstantUnion(const TConstantUnion *safeConstantUnion)
{
- ASSERT(safeConstantUnion);
// Previous union pointer freed on pool deallocation.
mUnionArrayPointer = safeConstantUnion;
}
@@ -373,15 +353,13 @@ class TIntermConstantUnion : public TIntermTyped
TConstantUnion *foldBinary(TOperator op,
TIntermConstantUnion *rightNode,
- TDiagnostics *diagnostics,
- const TSourceLoc &line);
- const TConstantUnion *foldIndexing(int index);
- TConstantUnion *foldUnaryNonComponentWise(TOperator op);
- TConstantUnion *foldUnaryComponentWise(TOperator op, TDiagnostics *diagnostics);
+ TDiagnostics *diagnostics);
+ TConstantUnion *foldUnaryWithDifferentReturnType(TOperator op, TInfoSink &infoSink);
+ TConstantUnion *foldUnaryWithSameReturnType(TOperator op, TInfoSink &infoSink);
- static TConstantUnion *FoldAggregateConstructor(TIntermAggregate *aggregate);
- static TConstantUnion *FoldAggregateBuiltIn(TIntermAggregate *aggregate,
- TDiagnostics *diagnostics);
+ static TConstantUnion *FoldAggregateConstructor(TIntermAggregate *aggregate,
+ TInfoSink &infoSink);
+ static TConstantUnion *FoldAggregateBuiltIn(TIntermAggregate *aggregate, TInfoSink &infoSink);
protected:
// Same data may be shared between multiple constant unions, so it can't be modified.
@@ -389,9 +367,7 @@ class TIntermConstantUnion : public TIntermTyped
private:
typedef float(*FloatTypeUnaryFunc) (float);
- void foldFloatTypeUnary(const TConstantUnion &parameter,
- FloatTypeUnaryFunc builtinFunc,
- TConstantUnion *result) const;
+ bool foldFloatTypeUnary(const TConstantUnion &parameter, FloatTypeUnaryFunc builtinFunc, TInfoSink &infoSink, TConstantUnion *result) const;
TIntermConstantUnion(const TIntermConstantUnion &node); // Note: not deleted, just private!
};
@@ -403,6 +379,7 @@ class TIntermOperator : public TIntermTyped
{
public:
TOperator getOp() const { return mOp; }
+ void setOp(TOperator op) { mOp = op; }
bool isAssignment() const;
bool isMultiplication() const;
@@ -423,54 +400,24 @@ class TIntermOperator : public TIntermTyped
TOperator mOp;
};
-// Node for vector swizzles.
-class TIntermSwizzle : public TIntermTyped
-{
- public:
- // This constructor determines the type of the node based on the operand.
- TIntermSwizzle(TIntermTyped *operand, const TVector<int> &swizzleOffsets);
-
- TIntermTyped *deepCopy() const override { return new TIntermSwizzle(*this); }
-
- TIntermSwizzle *getAsSwizzleNode() override { return this; };
- void traverse(TIntermTraverser *it) override;
- bool replaceChildNode(TIntermNode *original, TIntermNode *replacement) override;
-
- bool hasSideEffects() const override { return mOperand->hasSideEffects(); }
-
- TIntermTyped *getOperand() { return mOperand; }
- void writeOffsetsAsXYZW(TInfoSinkBase *out) const;
-
- bool hasDuplicateOffsets() const;
-
- TIntermTyped *fold();
-
- protected:
- TIntermTyped *mOperand;
- TVector<int> mSwizzleOffsets;
-
- private:
- void promote();
-
- TIntermSwizzle(const TIntermSwizzle &node); // Note: not deleted, just private!
-};
-
//
// Nodes for all the basic binary math operators.
//
class TIntermBinary : public TIntermOperator
{
public:
+ TIntermBinary(TOperator op)
+ : TIntermOperator(op),
+ mAddIndexClamp(false) {}
+
// This constructor determines the type of the binary node based on the operands and op.
+ // This is only supported for math/logical ops, not indexing.
TIntermBinary(TOperator op, TIntermTyped *left, TIntermTyped *right);
TIntermTyped *deepCopy() const override { return new TIntermBinary(*this); }
static TOperator GetMulOpBasedOnOperands(const TType &left, const TType &right);
static TOperator GetMulAssignOpBasedOnOperands(const TType &left, const TType &right);
- static TQualifier GetCommaQualifier(int shaderVersion,
- const TIntermTyped *left,
- const TIntermTyped *right);
TIntermBinary *getAsBinaryNode() override { return this; };
void traverse(TIntermTraverser *it) override;
@@ -481,6 +428,8 @@ class TIntermBinary : public TIntermOperator
return isAssignment() || mLeft->hasSideEffects() || mRight->hasSideEffects();
}
+ void setLeft(TIntermTyped *node) { mLeft = node; }
+ void setRight(TIntermTyped *node) { mRight = node; }
TIntermTyped *getLeft() const { return mLeft; }
TIntermTyped *getRight() const { return mRight; }
TIntermTyped *fold(TDiagnostics *diagnostics);
@@ -507,7 +456,14 @@ class TIntermBinary : public TIntermOperator
class TIntermUnary : public TIntermOperator
{
public:
- TIntermUnary(TOperator op, TIntermTyped *operand);
+ TIntermUnary(TOperator op, const TType &type)
+ : TIntermOperator(op, type),
+ mOperand(NULL),
+ mUseEmulatedFunction(false) {}
+ TIntermUnary(TOperator op)
+ : TIntermOperator(op),
+ mOperand(NULL),
+ mUseEmulatedFunction(false) {}
TIntermTyped *deepCopy() const override { return new TIntermUnary(*this); }
@@ -517,8 +473,10 @@ class TIntermUnary : public TIntermOperator
bool hasSideEffects() const override { return isAssignment() || mOperand->hasSideEffects(); }
+ void setOperand(TIntermTyped *operand) { mOperand = operand; }
TIntermTyped *getOperand() { return mOperand; }
- TIntermTyped *fold(TDiagnostics *diagnostics);
+ void promote(const TType *funcReturnType);
+ TIntermTyped *fold(TInfoSink &infoSink);
void setUseEmulatedFunction() { mUseEmulatedFunction = true; }
bool getUseEmulatedFunction() { return mUseEmulatedFunction; }
@@ -531,107 +489,22 @@ class TIntermUnary : public TIntermOperator
bool mUseEmulatedFunction;
private:
- void promote();
-
TIntermUnary(const TIntermUnary &node); // note: not deleted, just private!
};
-class TFunctionSymbolInfo
-{
- public:
- POOL_ALLOCATOR_NEW_DELETE();
- TFunctionSymbolInfo() : mId(0) {}
-
- TFunctionSymbolInfo(const TFunctionSymbolInfo &) = default;
- TFunctionSymbolInfo &operator=(const TFunctionSymbolInfo &) = default;
-
- void setFromFunction(const TFunction &function);
-
- void setNameObj(const TName &name) { mName = name; }
- const TName &getNameObj() const { return mName; }
-
- const TString &getName() const { return mName.getString(); }
- void setName(const TString &name) { mName.setString(name); }
- bool isMain() const { return mName.getString() == "main("; }
-
- void setId(int functionId) { mId = functionId; }
- int getId() const { return mId; }
- private:
- TName mName;
- int mId;
-};
-
-// Node for function definitions.
-class TIntermFunctionDefinition : public TIntermTyped
-{
- public:
- // TODO(oetuaho@nvidia.com): See if TFunctionSymbolInfo could be added to constructor
- // parameters.
- TIntermFunctionDefinition(const TType &type, TIntermAggregate *parameters, TIntermBlock *body)
- : TIntermTyped(type), mParameters(parameters), mBody(body)
- {
- ASSERT(parameters != nullptr);
- ASSERT(body != nullptr);
- }
-
- TIntermFunctionDefinition *getAsFunctionDefinition() override { return this; }
- void traverse(TIntermTraverser *it) override;
- bool replaceChildNode(TIntermNode *original, TIntermNode *replacement) override;
-
- TIntermTyped *deepCopy() const override
- {
- UNREACHABLE();
- return nullptr;
- }
- bool hasSideEffects() const override
- {
- UNREACHABLE();
- return true;
- }
-
- TIntermAggregate *getFunctionParameters() const { return mParameters; }
- TIntermBlock *getBody() const { return mBody; }
-
- TFunctionSymbolInfo *getFunctionSymbolInfo() { return &mFunctionInfo; }
- const TFunctionSymbolInfo *getFunctionSymbolInfo() const { return &mFunctionInfo; }
-
- private:
- TIntermAggregate *mParameters;
- TIntermBlock *mBody;
-
- TFunctionSymbolInfo mFunctionInfo;
-};
-
typedef TVector<TIntermNode *> TIntermSequence;
typedef TVector<int> TQualifierList;
-// Interface for node classes that have an arbitrarily sized set of children.
-class TIntermAggregateBase
-{
- public:
- virtual ~TIntermAggregateBase() {}
-
- virtual TIntermSequence *getSequence() = 0;
- virtual const TIntermSequence *getSequence() const = 0;
-
- bool replaceChildNodeWithMultiple(TIntermNode *original, const TIntermSequence &replacements);
- bool insertChildNodes(TIntermSequence::size_type position, const TIntermSequence &insertions);
-
- protected:
- TIntermAggregateBase() {}
-
- bool replaceChildNodeInternal(TIntermNode *original, TIntermNode *replacement);
-};
-
//
// Nodes that operate on an arbitrary sized set of children.
//
-class TIntermAggregate : public TIntermOperator, public TIntermAggregateBase
+class TIntermAggregate : public TIntermOperator
{
public:
TIntermAggregate()
: TIntermOperator(EOpNull),
mUserDefined(false),
+ mFunctionId(0),
mUseEmulatedFunction(false),
mGotPrecisionFromChildren(false)
{
@@ -639,6 +512,7 @@ class TIntermAggregate : public TIntermOperator, public TIntermAggregateBase
TIntermAggregate(TOperator op)
: TIntermOperator(op),
mUserDefined(false),
+ mFunctionId(0),
mUseEmulatedFunction(false),
mGotPrecisionFromChildren(false)
{
@@ -648,22 +522,29 @@ class TIntermAggregate : public TIntermOperator, public TIntermAggregateBase
// Note: only supported for nodes that can be a part of an expression.
TIntermTyped *deepCopy() const override { return new TIntermAggregate(*this); }
- void setOp(TOperator op) { mOp = op; }
-
TIntermAggregate *getAsAggregate() override { return this; }
void traverse(TIntermTraverser *it) override;
bool replaceChildNode(TIntermNode *original, TIntermNode *replacement) override;
-
+ bool replaceChildNodeWithMultiple(TIntermNode *original, TIntermSequence replacements);
+ bool insertChildNodes(TIntermSequence::size_type position, TIntermSequence insertions);
// Conservatively assume function calls and other aggregate operators have side-effects
bool hasSideEffects() const override { return true; }
- TIntermTyped *fold(TDiagnostics *diagnostics);
+ TIntermTyped *fold(TInfoSink &infoSink);
- TIntermSequence *getSequence() override { return &mSequence; }
- const TIntermSequence *getSequence() const override { return &mSequence; }
+ TIntermSequence *getSequence() { return &mSequence; }
+
+ void setNameObj(const TName &name) { mName = name; }
+ const TName &getNameObj() const { return mName; }
+
+ void setName(const TString &name) { mName.setString(name); }
+ const TString &getName() const { return mName.getString(); }
void setUserDefined() { mUserDefined = true; }
bool isUserDefined() const { return mUserDefined; }
+ void setFunctionId(int functionId) { mFunctionId = functionId; }
+ int getFunctionId() const { return mFunctionId; }
+
void setUseEmulatedFunction() { mUseEmulatedFunction = true; }
bool getUseEmulatedFunction() { return mUseEmulatedFunction; }
@@ -674,12 +555,11 @@ class TIntermAggregate : public TIntermOperator, public TIntermAggregateBase
// Returns true if changing parameter precision may affect the return value.
bool gotPrecisionFromChildren() const { return mGotPrecisionFromChildren; }
- TFunctionSymbolInfo *getFunctionSymbolInfo() { return &mFunctionInfo; }
- const TFunctionSymbolInfo *getFunctionSymbolInfo() const { return &mFunctionInfo; }
-
protected:
TIntermSequence mSequence;
+ TName mName;
bool mUserDefined; // used for user defined function names
+ int mFunctionId;
// If set to true, replace the built-in function call with an emulated one
// to work around driver bugs.
@@ -687,110 +567,50 @@ class TIntermAggregate : public TIntermOperator, public TIntermAggregateBase
bool mGotPrecisionFromChildren;
- TFunctionSymbolInfo mFunctionInfo;
-
private:
TIntermAggregate(const TIntermAggregate &node); // note: not deleted, just private!
};
-// A list of statements. Either the root node which contains declarations and function definitions,
-// or a block that can be marked with curly braces {}.
-class TIntermBlock : public TIntermNode, public TIntermAggregateBase
-{
- public:
- TIntermBlock() : TIntermNode() {}
- ~TIntermBlock() {}
-
- TIntermBlock *getAsBlock() override { return this; }
- void traverse(TIntermTraverser *it) override;
- bool replaceChildNode(TIntermNode *original, TIntermNode *replacement) override;
-
- // Only intended for initially building the block.
- void appendStatement(TIntermNode *statement);
-
- TIntermSequence *getSequence() override { return &mStatements; }
- const TIntermSequence *getSequence() const override { return &mStatements; }
-
- protected:
- TIntermSequence mStatements;
-};
-
-// Struct, interface block or variable declaration. Can contain multiple variable declarators.
-class TIntermDeclaration : public TIntermNode, public TIntermAggregateBase
+//
+// For if tests.
+//
+class TIntermSelection : public TIntermTyped
{
public:
- TIntermDeclaration() : TIntermNode() {}
- ~TIntermDeclaration() {}
-
- TIntermDeclaration *getAsDeclarationNode() override { return this; }
- void traverse(TIntermTraverser *it) override;
- bool replaceChildNode(TIntermNode *original, TIntermNode *replacement) override;
-
- // Only intended for initially building the declaration.
- // The declarator node should be either TIntermSymbol or TIntermBinary with op set to
- // EOpInitialize.
- void appendDeclarator(TIntermTyped *declarator);
-
- TIntermSequence *getSequence() override { return &mDeclarators; }
- const TIntermSequence *getSequence() const override { return &mDeclarators; }
- protected:
- TIntermSequence mDeclarators;
-};
+ TIntermSelection(TIntermTyped *cond, TIntermNode *trueB, TIntermNode *falseB)
+ : TIntermTyped(TType(EbtVoid, EbpUndefined)),
+ mCondition(cond),
+ mTrueBlock(trueB),
+ mFalseBlock(falseB) {}
+ TIntermSelection(TIntermTyped *cond, TIntermNode *trueB, TIntermNode *falseB,
+ const TType &type)
+ : TIntermTyped(type),
+ mCondition(cond),
+ mTrueBlock(trueB),
+ mFalseBlock(falseB) {}
-// For ternary operators like a ? b : c.
-class TIntermTernary : public TIntermTyped
-{
- public:
- TIntermTernary(TIntermTyped *cond, TIntermTyped *trueExpression, TIntermTyped *falseExpression);
+ // Note: only supported for ternary operator nodes.
+ TIntermTyped *deepCopy() const override { return new TIntermSelection(*this); }
void traverse(TIntermTraverser *it) override;
bool replaceChildNode(TIntermNode *original, TIntermNode *replacement) override;
- TIntermTyped *getCondition() const { return mCondition; }
- TIntermTyped *getTrueExpression() const { return mTrueExpression; }
- TIntermTyped *getFalseExpression() const { return mFalseExpression; }
- TIntermTernary *getAsTernaryNode() override { return this; }
-
- TIntermTyped *deepCopy() const override { return new TIntermTernary(*this); }
-
- bool hasSideEffects() const override
- {
- return mCondition->hasSideEffects() || mTrueExpression->hasSideEffects() ||
- mFalseExpression->hasSideEffects();
- }
-
- static TQualifier DetermineQualifier(TIntermTyped *cond,
- TIntermTyped *trueExpression,
- TIntermTyped *falseExpression);
-
- private:
- TIntermTernary(const TIntermTernary &node); // Note: not deleted, just private!
-
- TIntermTyped *mCondition;
- TIntermTyped *mTrueExpression;
- TIntermTyped *mFalseExpression;
-};
-
-class TIntermIfElse : public TIntermNode
-{
- public:
- TIntermIfElse(TIntermTyped *cond, TIntermBlock *trueB, TIntermBlock *falseB)
- : TIntermNode(), mCondition(cond), mTrueBlock(trueB), mFalseBlock(falseB)
- {
- }
-
- void traverse(TIntermTraverser *it) override;
- bool replaceChildNode(TIntermNode *original, TIntermNode *replacement) override;
+ // Conservatively assume selections have side-effects
+ bool hasSideEffects() const override { return true; }
- TIntermTyped *getCondition() const { return mCondition; }
- TIntermBlock *getTrueBlock() const { return mTrueBlock; }
- TIntermBlock *getFalseBlock() const { return mFalseBlock; }
- TIntermIfElse *getAsIfElseNode() override { return this; }
+ bool usesTernaryOperator() const { return getBasicType() != EbtVoid; }
+ TIntermNode *getCondition() const { return mCondition; }
+ TIntermNode *getTrueBlock() const { return mTrueBlock; }
+ TIntermNode *getFalseBlock() const { return mFalseBlock; }
+ TIntermSelection *getAsSelectionNode() override { return this; }
protected:
TIntermTyped *mCondition;
- TIntermBlock *mTrueBlock;
- TIntermBlock *mFalseBlock;
+ TIntermNode *mTrueBlock;
+ TIntermNode *mFalseBlock;
+
+ private:
+ TIntermSelection(const TIntermSelection &node); // Note: not deleted, just private!
};
//
@@ -799,8 +619,10 @@ class TIntermIfElse : public TIntermNode
class TIntermSwitch : public TIntermNode
{
public:
- TIntermSwitch(TIntermTyped *init, TIntermBlock *statementList)
- : TIntermNode(), mInit(init), mStatementList(statementList)
+ TIntermSwitch(TIntermTyped *init, TIntermAggregate *statementList)
+ : TIntermNode(),
+ mInit(init),
+ mStatementList(statementList)
{
}
@@ -811,12 +633,12 @@ class TIntermSwitch : public TIntermNode
TIntermSwitch *getAsSwitchNode() override { return this; }
TIntermTyped *getInit() { return mInit; }
- TIntermBlock *getStatementList() { return mStatementList; }
- void setStatementList(TIntermBlock *statementList) { mStatementList = statementList; }
+ TIntermAggregate *getStatementList() { return mStatementList; }
+ void setStatementList(TIntermAggregate *statementList) { mStatementList = statementList; }
protected:
TIntermTyped *mInit;
- TIntermBlock *mStatementList;
+ TIntermAggregate *mStatementList;
};
//
@@ -872,20 +694,12 @@ class TIntermTraverser : angle::NonCopyable
virtual void visitSymbol(TIntermSymbol *node) {}
virtual void visitRaw(TIntermRaw *node) {}
virtual void visitConstantUnion(TIntermConstantUnion *node) {}
- virtual bool visitSwizzle(Visit visit, TIntermSwizzle *node) { return true; }
virtual bool visitBinary(Visit visit, TIntermBinary *node) { return true; }
virtual bool visitUnary(Visit visit, TIntermUnary *node) { return true; }
- virtual bool visitTernary(Visit visit, TIntermTernary *node) { return true; }
- virtual bool visitIfElse(Visit visit, TIntermIfElse *node) { return true; }
+ virtual bool visitSelection(Visit visit, TIntermSelection *node) { return true; }
virtual bool visitSwitch(Visit visit, TIntermSwitch *node) { return true; }
virtual bool visitCase(Visit visit, TIntermCase *node) { return true; }
- virtual bool visitFunctionDefinition(Visit visit, TIntermFunctionDefinition *node)
- {
- return true;
- }
virtual bool visitAggregate(Visit visit, TIntermAggregate *node) { return true; }
- virtual bool visitBlock(Visit visit, TIntermBlock *node) { return true; }
- virtual bool visitDeclaration(Visit visit, TIntermDeclaration *node) { return true; }
virtual bool visitLoop(Visit visit, TIntermLoop *node) { return true; }
virtual bool visitBranch(Visit visit, TIntermBranch *node) { return true; }
@@ -895,17 +709,12 @@ class TIntermTraverser : angle::NonCopyable
virtual void traverseSymbol(TIntermSymbol *node);
virtual void traverseRaw(TIntermRaw *node);
virtual void traverseConstantUnion(TIntermConstantUnion *node);
- virtual void traverseSwizzle(TIntermSwizzle *node);
virtual void traverseBinary(TIntermBinary *node);
virtual void traverseUnary(TIntermUnary *node);
- virtual void traverseTernary(TIntermTernary *node);
- virtual void traverseIfElse(TIntermIfElse *node);
+ virtual void traverseSelection(TIntermSelection *node);
virtual void traverseSwitch(TIntermSwitch *node);
virtual void traverseCase(TIntermCase *node);
- virtual void traverseFunctionDefinition(TIntermFunctionDefinition *node);
virtual void traverseAggregate(TIntermAggregate *node);
- virtual void traverseBlock(TIntermBlock *node);
- virtual void traverseDeclaration(TIntermDeclaration *node);
virtual void traverseLoop(TIntermLoop *node);
virtual void traverseBranch(TIntermBranch *node);
@@ -952,7 +761,7 @@ class TIntermTraverser : angle::NonCopyable
return nullptr;
}
- void pushParentBlock(TIntermBlock *node);
+ void pushParentBlock(TIntermAggregate *node);
void incrementParentBlockPos();
void popParentBlock();
@@ -964,14 +773,14 @@ class TIntermTraverser : angle::NonCopyable
// To replace a single node with multiple nodes on the parent aggregate node
struct NodeReplaceWithMultipleEntry
{
- NodeReplaceWithMultipleEntry(TIntermAggregateBase *_parent,
- TIntermNode *_original,
- TIntermSequence _replacements)
- : parent(_parent), original(_original), replacements(_replacements)
+ NodeReplaceWithMultipleEntry(TIntermAggregate *_parent, TIntermNode *_original, TIntermSequence _replacements)
+ : parent(_parent),
+ original(_original),
+ replacements(_replacements)
{
}
- TIntermAggregateBase *parent;
+ TIntermAggregate *parent;
TIntermNode *original;
TIntermSequence replacements;
};
@@ -979,7 +788,7 @@ class TIntermTraverser : angle::NonCopyable
// To insert multiple nodes on the parent aggregate node
struct NodeInsertMultipleEntry
{
- NodeInsertMultipleEntry(TIntermBlock *_parent,
+ NodeInsertMultipleEntry(TIntermAggregate *_parent,
TIntermSequence::size_type _position,
TIntermSequence _insertionsBefore,
TIntermSequence _insertionsAfter)
@@ -990,7 +799,7 @@ class TIntermTraverser : angle::NonCopyable
{
}
- TIntermBlock *parent;
+ TIntermAggregate *parent;
TIntermSequence::size_type position;
TIntermSequence insertionsBefore;
TIntermSequence insertionsAfter;
@@ -1016,11 +825,11 @@ class TIntermTraverser : angle::NonCopyable
// Helper to create a temporary symbol node.
TIntermSymbol *createTempSymbol(const TType &type);
// Create a node that declares but doesn't initialize a temporary symbol.
- TIntermDeclaration *createTempDeclaration(const TType &type);
+ TIntermAggregate *createTempDeclaration(const TType &type);
// Create a node that initializes the current temporary symbol with initializer having the given qualifier.
- TIntermDeclaration *createTempInitDeclaration(TIntermTyped *initializer, TQualifier qualifier);
+ TIntermAggregate *createTempInitDeclaration(TIntermTyped *initializer, TQualifier qualifier);
// Create a node that initializes the current temporary symbol with initializer.
- TIntermDeclaration *createTempInitDeclaration(TIntermTyped *initializer);
+ TIntermAggregate *createTempInitDeclaration(TIntermTyped *initializer);
// Create a node that assigns rightNode to the current temporary symbol.
TIntermBinary *createTempAssignment(TIntermTyped *rightNode);
// Increment temporary symbol index.
@@ -1082,12 +891,13 @@ class TIntermTraverser : angle::NonCopyable
struct ParentBlock
{
- ParentBlock(TIntermBlock *nodeIn, TIntermSequence::size_type posIn)
- : node(nodeIn), pos(posIn)
+ ParentBlock(TIntermAggregate *nodeIn, TIntermSequence::size_type posIn)
+ : node(nodeIn),
+ pos(posIn)
{
}
- TIntermBlock *node;
+ TIntermAggregate *node;
TIntermSequence::size_type pos;
};
@@ -1120,7 +930,6 @@ class TLValueTrackingTraverser : public TIntermTraverser
void traverseBinary(TIntermBinary *node) final;
void traverseUnary(TIntermUnary *node) final;
- void traverseFunctionDefinition(TIntermFunctionDefinition *node) final;
void traverseAggregate(TIntermAggregate *node) final;
protected:
@@ -1189,10 +998,8 @@ class TMaxDepthTraverser : public TIntermTraverser
bool visitBinary(Visit, TIntermBinary *) override { return depthCheck(); }
bool visitUnary(Visit, TIntermUnary *) override { return depthCheck(); }
- bool visitTernary(Visit, TIntermTernary *) override { return depthCheck(); }
- bool visitIfElse(Visit, TIntermIfElse *) override { return depthCheck(); }
+ bool visitSelection(Visit, TIntermSelection *) override { return depthCheck(); }
bool visitAggregate(Visit, TIntermAggregate *) override { return depthCheck(); }
- bool visitBlock(Visit, TIntermBlock *) override { return depthCheck(); }
bool visitLoop(Visit, TIntermLoop *) override { return depthCheck(); }
bool visitBranch(Visit, TIntermBranch *) override { return depthCheck(); }
@@ -1202,6 +1009,4 @@ class TMaxDepthTraverser : public TIntermTraverser
int mDepthLimit;
};
-} // namespace sh
-
#endif // COMPILER_TRANSLATOR_INTERMNODE_H_