Rename TIntermSelection to TIntermIfElse
Now that ternary nodes are not represented by TIntermSelection any
more, TIntermIfElse is an easier name to understand for newcomers to
the code.
BUG=angleproject:1490
TEST=angle_unittests
Change-Id: Ia1e04e356ab93409400245092a84533d7dfd129d
Reviewed-on: https://chromium-review.googlesource.com/385416
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/compiler/translator/ASTMetadataHLSL.cpp b/src/compiler/translator/ASTMetadataHLSL.cpp
index 31bfae9..1fa3c59 100644
--- a/src/compiler/translator/ASTMetadataHLSL.cpp
+++ b/src/compiler/translator/ASTMetadataHLSL.cpp
@@ -72,9 +72,9 @@
return true;
}
- bool visitSelection(Visit visit, TIntermSelection *selection) override
+ bool visitIfElse(Visit visit, TIntermIfElse *ifElse) override
{
- visitControlFlow(visit, selection);
+ visitControlFlow(visit, ifElse);
return true;
}
@@ -196,7 +196,7 @@
return true;
}
- bool visitSelection(Visit visit, TIntermSelection *node) override
+ bool visitIfElse(Visit visit, TIntermIfElse *node) override
{
if (visit == PreVisit)
{
@@ -310,7 +310,7 @@
const CallDAG &mDag;
std::vector<TIntermNode*> mLoopsAndSwitches;
- std::vector<TIntermSelection*> mIfs;
+ std::vector<TIntermIfElse *> mIfs;
};
// Tags all the functions called in a discontinuous loop
@@ -385,7 +385,7 @@
return mControlFlowsContainingGradient.count(node) > 0;
}
-bool ASTMetadataHLSL::hasGradientLoop(TIntermSelection *node)
+bool ASTMetadataHLSL::hasGradientLoop(TIntermIfElse *node)
{
return mIfsContainingGradientLoop.count(node) > 0;
}
diff --git a/src/compiler/translator/ASTMetadataHLSL.h b/src/compiler/translator/ASTMetadataHLSL.h
index 39e671e..4795bc3 100644
--- a/src/compiler/translator/ASTMetadataHLSL.h
+++ b/src/compiler/translator/ASTMetadataHLSL.h
@@ -14,7 +14,7 @@
class CallDAG;
class TIntermNode;
-class TIntermSelection;
+class TIntermIfElse;
class TIntermLoop;
struct ASTMetadataHLSL
@@ -30,7 +30,7 @@
// Here "something uses a gradient" means here that it either contains a
// gradient operation, or a call to a function that uses a gradient.
bool hasGradientInCallGraph(TIntermLoop *node);
- bool hasGradientLoop(TIntermSelection *node);
+ bool hasGradientLoop(TIntermIfElse *node);
// Does the function use a gradient.
bool mUsesGradient;
@@ -44,7 +44,7 @@
bool mCalledInDiscontinuousLoop;
bool mHasGradientLoopInCallGraph;
std::set<TIntermLoop*> mDiscontinuousLoops;
- std::set<TIntermSelection *> mIfsContainingGradientLoop;
+ std::set<TIntermIfElse *> mIfsContainingGradientLoop;
// Will we need to generate a Lod0 version of the function.
bool mNeedsLod0;
diff --git a/src/compiler/translator/InitializeVariables.cpp b/src/compiler/translator/InitializeVariables.cpp
index 8332385..4fdcea1 100644
--- a/src/compiler/translator/InitializeVariables.cpp
+++ b/src/compiler/translator/InitializeVariables.cpp
@@ -25,7 +25,7 @@
protected:
bool visitBinary(Visit, TIntermBinary *node) override { return false; }
bool visitUnary(Visit, TIntermUnary *node) override { return false; }
- bool visitSelection(Visit, TIntermSelection *node) override { return false; }
+ bool visitIfElse(Visit, TIntermIfElse *node) override { return false; }
bool visitLoop(Visit, TIntermLoop *node) override { return false; }
bool visitBranch(Visit, TIntermBranch *node) override { return false; }
diff --git a/src/compiler/translator/IntermNode.cpp b/src/compiler/translator/IntermNode.cpp
index 48949a8..055d529 100644
--- a/src/compiler/translator/IntermNode.cpp
+++ b/src/compiler/translator/IntermNode.cpp
@@ -300,8 +300,7 @@
return false;
}
-bool TIntermSelection::replaceChildNode(
- TIntermNode *original, TIntermNode *replacement)
+bool TIntermIfElse::replaceChildNode(TIntermNode *original, TIntermNode *replacement)
{
REPLACE_IF_IS(mCondition, TIntermTyped, original, replacement);
REPLACE_IF_IS(mTrueBlock, TIntermNode, original, replacement);
diff --git a/src/compiler/translator/IntermNode.h b/src/compiler/translator/IntermNode.h
index 1ff5b57..0fc7ab0 100644
--- a/src/compiler/translator/IntermNode.h
+++ b/src/compiler/translator/IntermNode.h
@@ -35,7 +35,7 @@
class TIntermUnary;
class TIntermConstantUnion;
class TIntermTernary;
-class TIntermSelection;
+class TIntermIfElse;
class TIntermSwitch;
class TIntermCase;
class TIntermTyped;
@@ -95,7 +95,7 @@
virtual TIntermBinary *getAsBinaryNode() { return 0; }
virtual TIntermUnary *getAsUnaryNode() { return 0; }
virtual TIntermTernary *getAsTernaryNode() { return nullptr; }
- virtual TIntermSelection *getAsSelectionNode() { return 0; }
+ virtual TIntermIfElse *getAsIfElseNode() { return nullptr; }
virtual TIntermSwitch *getAsSwitchNode() { return 0; }
virtual TIntermCase *getAsCaseNode() { return 0; }
virtual TIntermSymbol *getAsSymbolNode() { return 0; }
@@ -603,11 +603,10 @@
TIntermTyped *mFalseExpression;
};
-// For if tests.
-class TIntermSelection : public TIntermNode
+class TIntermIfElse : public TIntermNode
{
public:
- TIntermSelection(TIntermTyped *cond, TIntermNode *trueB, TIntermNode *falseB)
+ TIntermIfElse(TIntermTyped *cond, TIntermNode *trueB, TIntermNode *falseB)
: TIntermNode(), mCondition(cond), mTrueBlock(trueB), mFalseBlock(falseB)
{
}
@@ -618,7 +617,7 @@
TIntermTyped *getCondition() const { return mCondition; }
TIntermNode *getTrueBlock() const { return mTrueBlock; }
TIntermNode *getFalseBlock() const { return mFalseBlock; }
- TIntermSelection *getAsSelectionNode() override { return this; }
+ TIntermIfElse *getAsIfElseNode() override { return this; }
protected:
TIntermTyped *mCondition;
@@ -710,7 +709,7 @@
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 visitSelection(Visit visit, TIntermSelection *node) { return true; }
+ virtual bool visitIfElse(Visit visit, TIntermIfElse *node) { return true; }
virtual bool visitSwitch(Visit visit, TIntermSwitch *node) { return true; }
virtual bool visitCase(Visit visit, TIntermCase *node) { return true; }
virtual bool visitAggregate(Visit visit, TIntermAggregate *node) { return true; }
@@ -726,7 +725,7 @@
virtual void traverseBinary(TIntermBinary *node);
virtual void traverseUnary(TIntermUnary *node);
virtual void traverseTernary(TIntermTernary *node);
- virtual void traverseSelection(TIntermSelection *node);
+ virtual void traverseIfElse(TIntermIfElse *node);
virtual void traverseSwitch(TIntermSwitch *node);
virtual void traverseCase(TIntermCase *node);
virtual void traverseAggregate(TIntermAggregate *node);
@@ -1014,7 +1013,7 @@
bool visitBinary(Visit, TIntermBinary *) override { return depthCheck(); }
bool visitUnary(Visit, TIntermUnary *) override { return depthCheck(); }
bool visitTernary(Visit, TIntermTernary *) override { return depthCheck(); }
- bool visitSelection(Visit, TIntermSelection *) override { return depthCheck(); }
+ bool visitIfElse(Visit, TIntermIfElse *) override { return depthCheck(); }
bool visitAggregate(Visit, TIntermAggregate *) override { return depthCheck(); }
bool visitLoop(Visit, TIntermLoop *) override { return depthCheck(); }
bool visitBranch(Visit, TIntermBranch *) override { return depthCheck(); }
diff --git a/src/compiler/translator/IntermTraverse.cpp b/src/compiler/translator/IntermTraverse.cpp
index 7adea71..72da6d2 100644
--- a/src/compiler/translator/IntermTraverse.cpp
+++ b/src/compiler/translator/IntermTraverse.cpp
@@ -38,9 +38,9 @@
it->traverseTernary(this);
}
-void TIntermSelection::traverse(TIntermTraverser *it)
+void TIntermIfElse::traverse(TIntermTraverser *it)
{
- it->traverseSelection(this);
+ it->traverseIfElse(this);
}
void TIntermSwitch::traverse(TIntermTraverser *it)
@@ -596,15 +596,13 @@
visitTernary(PostVisit, node);
}
-//
-// Traverse a selection node. Same comments in binary node apply here.
-//
-void TIntermTraverser::traverseSelection(TIntermSelection *node)
+// Traverse an if-else node. Same comments in binary node apply here.
+void TIntermTraverser::traverseIfElse(TIntermIfElse *node)
{
bool visit = true;
if (preVisit)
- visit = visitSelection(PreVisit, node);
+ visit = visitIfElse(PreVisit, node);
if (visit)
{
@@ -618,7 +616,7 @@
}
if (visit && postVisit)
- visitSelection(PostVisit, node);
+ visitIfElse(PostVisit, node);
}
//
diff --git a/src/compiler/translator/Intermediate.cpp b/src/compiler/translator/Intermediate.cpp
index 53eaa6f..d018260 100644
--- a/src/compiler/translator/Intermediate.cpp
+++ b/src/compiler/translator/Intermediate.cpp
@@ -172,37 +172,35 @@
return aggNode;
}
-//
// For "if" test nodes. There are three children; a condition,
// a true path, and a false path. The two paths are in the
// nodePair.
//
-// Returns the selection node created.
-//
-TIntermNode *TIntermediate::addSelection(
- TIntermTyped *cond, TIntermNodePair nodePair, const TSourceLoc &line)
+// Returns the node created.
+TIntermNode *TIntermediate::addIfElse(TIntermTyped *cond,
+ TIntermNodePair nodePair,
+ const TSourceLoc &line)
{
- //
- // For compile time constant selections, prune the code and
- // test now.
- //
+ // For compile time constant conditions, prune the code now.
if (cond->getAsConstantUnion())
{
if (cond->getAsConstantUnion()->getBConst(0) == true)
{
- return nodePair.node1 ? setAggregateOperator(
- nodePair.node1, EOpSequence, nodePair.node1->getLine()) : NULL;
+ return nodePair.node1 ? setAggregateOperator(nodePair.node1, EOpSequence,
+ nodePair.node1->getLine())
+ : nullptr;
}
else
{
- return nodePair.node2 ? setAggregateOperator(
- nodePair.node2, EOpSequence, nodePair.node2->getLine()) : NULL;
+ return nodePair.node2 ? setAggregateOperator(nodePair.node2, EOpSequence,
+ nodePair.node2->getLine())
+ : nullptr;
}
}
- TIntermSelection *node = new TIntermSelection(
- cond, ensureSequence(nodePair.node1), ensureSequence(nodePair.node2));
+ TIntermIfElse *node =
+ new TIntermIfElse(cond, ensureSequence(nodePair.node1), ensureSequence(nodePair.node2));
node->setLine(line);
return node;
diff --git a/src/compiler/translator/Intermediate.h b/src/compiler/translator/Intermediate.h
index 0d75444..435e32e 100644
--- a/src/compiler/translator/Intermediate.h
+++ b/src/compiler/translator/Intermediate.h
@@ -38,7 +38,7 @@
TIntermAggregate *makeAggregate(TIntermNode *node, const TSourceLoc &);
TIntermAggregate *ensureSequence(TIntermNode *node);
TIntermAggregate *setAggregateOperator(TIntermNode *, TOperator, const TSourceLoc &);
- TIntermNode *addSelection(TIntermTyped *cond, TIntermNodePair code, const TSourceLoc &line);
+ TIntermNode *addIfElse(TIntermTyped *cond, TIntermNodePair code, const TSourceLoc &line);
static TIntermTyped *AddTernarySelection(TIntermTyped *cond,
TIntermTyped *trueExpression,
TIntermTyped *falseExpression,
diff --git a/src/compiler/translator/OutputGLSLBase.cpp b/src/compiler/translator/OutputGLSLBase.cpp
index 77dac74..899b166 100644
--- a/src/compiler/translator/OutputGLSLBase.cpp
+++ b/src/compiler/translator/OutputGLSLBase.cpp
@@ -27,7 +27,7 @@
return (aggregate->getOp() != EOpFunction) &&
(aggregate->getOp() != EOpSequence);
}
- else if (node->getAsSelectionNode())
+ else if (node->getAsIfElseNode())
{
return false;
}
@@ -726,7 +726,7 @@
return false;
}
-bool TOutputGLSLBase::visitSelection(Visit visit, TIntermSelection *node)
+bool TOutputGLSLBase::visitIfElse(Visit visit, TIntermIfElse *node)
{
TInfoSinkBase &out = objSink();
diff --git a/src/compiler/translator/OutputGLSLBase.h b/src/compiler/translator/OutputGLSLBase.h
index 8fb92aa..79c2c72 100644
--- a/src/compiler/translator/OutputGLSLBase.h
+++ b/src/compiler/translator/OutputGLSLBase.h
@@ -45,7 +45,7 @@
bool visitBinary(Visit visit, TIntermBinary *node) override;
bool visitUnary(Visit visit, TIntermUnary *node) override;
bool visitTernary(Visit visit, TIntermTernary *node) override;
- bool visitSelection(Visit visit, TIntermSelection *node) override;
+ bool visitIfElse(Visit visit, TIntermIfElse *node) override;
bool visitSwitch(Visit visit, TIntermSwitch *node) override;
bool visitCase(Visit visit, TIntermCase *node) override;
bool visitAggregate(Visit visit, TIntermAggregate *node) override;
diff --git a/src/compiler/translator/OutputHLSL.cpp b/src/compiler/translator/OutputHLSL.cpp
index ce14d3c..6835c2e 100644
--- a/src/compiler/translator/OutputHLSL.cpp
+++ b/src/compiler/translator/OutputHLSL.cpp
@@ -1457,9 +1457,9 @@
// Don't output ; after case labels, they're terminated by :
// This is needed especially since outputting a ; after a case statement would turn empty
// case statements into non-empty case statements, disallowing fall-through from them.
- // Also no need to output ; after selection (if) statements or sequences. This is done just
- // for code clarity.
- if ((*sit)->getAsCaseNode() == nullptr && (*sit)->getAsSelectionNode() == nullptr &&
+ // Also no need to output ; after if statements or sequences. This is done just for
+ // code clarity.
+ if ((*sit)->getAsCaseNode() == nullptr && (*sit)->getAsIfElseNode() == nullptr &&
!IsSequence(*sit))
out << ";\n";
}
@@ -1929,7 +1929,7 @@
return true;
}
-void OutputHLSL::writeSelection(TInfoSinkBase &out, TIntermSelection *node)
+void OutputHLSL::writeIfElse(TInfoSinkBase &out, TIntermIfElse *node)
{
out << "if (";
@@ -1967,7 +1967,8 @@
outputLineDirective(out, node->getFalseBlock()->getLine().first_line);
// Either this is "else if" or the falseBlock child node will output braces.
- ASSERT(IsSequence(node->getFalseBlock()) || node->getFalseBlock()->getAsSelectionNode() != nullptr);
+ ASSERT(IsSequence(node->getFalseBlock()) ||
+ node->getFalseBlock()->getAsIfElseNode() != nullptr);
node->getFalseBlock()->traverse(this);
@@ -1992,7 +1993,7 @@
return false;
}
-bool OutputHLSL::visitSelection(Visit visit, TIntermSelection *node)
+bool OutputHLSL::visitIfElse(Visit visit, TIntermIfElse *node)
{
TInfoSinkBase &out = getInfoSink();
@@ -2004,7 +2005,7 @@
out << "FLATTEN ";
}
- writeSelection(out, node);
+ writeIfElse(out, node);
return false;
}
diff --git a/src/compiler/translator/OutputHLSL.h b/src/compiler/translator/OutputHLSL.h
index ebc0033..6a5d6b7 100644
--- a/src/compiler/translator/OutputHLSL.h
+++ b/src/compiler/translator/OutputHLSL.h
@@ -62,7 +62,7 @@
bool visitBinary(Visit visit, TIntermBinary*);
bool visitUnary(Visit visit, TIntermUnary*);
bool visitTernary(Visit visit, TIntermTernary *);
- bool visitSelection(Visit visit, TIntermSelection*);
+ bool visitIfElse(Visit visit, TIntermIfElse *);
bool visitSwitch(Visit visit, TIntermSwitch *);
bool visitCase(Visit visit, TIntermCase *);
bool visitAggregate(Visit visit, TIntermAggregate*);
@@ -105,7 +105,7 @@
TIntermTyped *expression);
void writeDeferredGlobalInitializers(TInfoSinkBase &out);
- void writeSelection(TInfoSinkBase &out, TIntermSelection *node);
+ void writeIfElse(TInfoSinkBase &out, TIntermIfElse *node);
// Returns the function name
TString addStructEqualityFunction(const TStructure &structure);
diff --git a/src/compiler/translator/RemoveDynamicIndexing.cpp b/src/compiler/translator/RemoveDynamicIndexing.cpp
index e46041d..4ac3e9f 100644
--- a/src/compiler/translator/RemoveDynamicIndexing.cpp
+++ b/src/compiler/translator/RemoveDynamicIndexing.cpp
@@ -280,7 +280,7 @@
TIntermBranch *returnLastNode = new TIntermBranch(EOpReturn, indexLastNode);
useLastBlock->getSequence()->push_back(returnLastNode);
}
- TIntermSelection *ifNode = new TIntermSelection(cond, useFirstBlock, nullptr);
+ TIntermIfElse *ifNode = new TIntermIfElse(cond, useFirstBlock, nullptr);
bodyNode->getSequence()->push_back(ifNode);
bodyNode->getSequence()->push_back(useLastBlock);
diff --git a/src/compiler/translator/RemoveSwitchFallThrough.cpp b/src/compiler/translator/RemoveSwitchFallThrough.cpp
index 191586e..521cbeb 100644
--- a/src/compiler/translator/RemoveSwitchFallThrough.cpp
+++ b/src/compiler/translator/RemoveSwitchFallThrough.cpp
@@ -69,7 +69,7 @@
return false;
}
-bool RemoveSwitchFallThrough::visitSelection(Visit, TIntermSelection *node)
+bool RemoveSwitchFallThrough::visitIfElse(Visit, TIntermIfElse *node)
{
mPreviousCase->getSequence()->push_back(node);
mLastStatementWasBreak = false;
diff --git a/src/compiler/translator/RemoveSwitchFallThrough.h b/src/compiler/translator/RemoveSwitchFallThrough.h
index 3182797..fc73da7 100644
--- a/src/compiler/translator/RemoveSwitchFallThrough.h
+++ b/src/compiler/translator/RemoveSwitchFallThrough.h
@@ -24,7 +24,7 @@
bool visitBinary(Visit, TIntermBinary *node) override;
bool visitUnary(Visit, TIntermUnary *node) override;
bool visitTernary(Visit visit, TIntermTernary *node) override;
- bool visitSelection(Visit visit, TIntermSelection *node) override;
+ bool visitIfElse(Visit visit, TIntermIfElse *node) override;
bool visitSwitch(Visit, TIntermSwitch *node) override;
bool visitCase(Visit, TIntermCase *node) override;
bool visitAggregate(Visit, TIntermAggregate *node) override;
diff --git a/src/compiler/translator/RewriteDoWhile.cpp b/src/compiler/translator/RewriteDoWhile.cpp
index eac6751..3a62de2 100644
--- a/src/compiler/translator/RewriteDoWhile.cpp
+++ b/src/compiler/translator/RewriteDoWhile.cpp
@@ -95,7 +95,7 @@
// break;
// }
// }
- TIntermSelection *breakIf = nullptr;
+ TIntermIfElse *breakIf = nullptr;
{
TIntermBranch *breakStatement = new TIntermBranch(EOpBreak, nullptr);
@@ -105,13 +105,12 @@
TIntermUnary *negatedCondition =
new TIntermUnary(EOpLogicalNot, loop->getCondition());
- TIntermSelection *innerIf =
- new TIntermSelection(negatedCondition, breakBlock, nullptr);
+ TIntermIfElse *innerIf = new TIntermIfElse(negatedCondition, breakBlock, nullptr);
TIntermAggregate *innerIfBlock = new TIntermAggregate(EOpSequence);
innerIfBlock->getSequence()->push_back(innerIf);
- breakIf = new TIntermSelection(createTempSymbol(boolType), innerIfBlock, nullptr);
+ breakIf = new TIntermIfElse(createTempSymbol(boolType), innerIfBlock, nullptr);
}
// Assemble the replacement loops, reusing the do-while loop's body and inserting our
diff --git a/src/compiler/translator/RewriteElseBlocks.cpp b/src/compiler/translator/RewriteElseBlocks.cpp
index d583e73..bbffc79 100644
--- a/src/compiler/translator/RewriteElseBlocks.cpp
+++ b/src/compiler/translator/RewriteElseBlocks.cpp
@@ -28,7 +28,7 @@
private:
const TType *mFunctionType;
- TIntermNode *rewriteSelection(TIntermSelection *selection);
+ TIntermNode *rewriteIfElse(TIntermIfElse *ifElse);
};
ElseBlockRewriter::ElseBlockRewriter()
@@ -46,19 +46,19 @@
for (size_t statementIndex = 0; statementIndex != node->getSequence()->size(); statementIndex++)
{
TIntermNode *statement = (*node->getSequence())[statementIndex];
- TIntermSelection *selection = statement->getAsSelectionNode();
- if (selection && selection->getFalseBlock() != nullptr)
+ TIntermIfElse *ifElse = statement->getAsIfElseNode();
+ if (ifElse && ifElse->getFalseBlock() != nullptr)
{
// Check for if / else if
- TIntermSelection *elseIfBranch = selection->getFalseBlock()->getAsSelectionNode();
+ TIntermIfElse *elseIfBranch = ifElse->getFalseBlock()->getAsIfElseNode();
if (elseIfBranch)
{
- selection->replaceChildNode(elseIfBranch, rewriteSelection(elseIfBranch));
+ ifElse->replaceChildNode(elseIfBranch, rewriteIfElse(elseIfBranch));
delete elseIfBranch;
}
- (*node->getSequence())[statementIndex] = rewriteSelection(selection);
- delete selection;
+ (*node->getSequence())[statementIndex] = rewriteIfElse(ifElse);
+ delete ifElse;
}
}
}
@@ -75,20 +75,20 @@
return true;
}
-TIntermNode *ElseBlockRewriter::rewriteSelection(TIntermSelection *selection)
+TIntermNode *ElseBlockRewriter::rewriteIfElse(TIntermIfElse *ifElse)
{
- ASSERT(selection != nullptr);
+ ASSERT(ifElse != nullptr);
nextTemporaryIndex();
- TIntermTyped *typedCondition = selection->getCondition()->getAsTyped();
+ TIntermTyped *typedCondition = ifElse->getCondition()->getAsTyped();
TIntermAggregate *storeCondition = createTempInitDeclaration(typedCondition);
- TIntermSelection *falseBlock = nullptr;
+ TIntermIfElse *falseBlock = nullptr;
TType boolType(EbtBool, EbpUndefined, EvqTemporary);
- if (selection->getFalseBlock())
+ if (ifElse->getFalseBlock())
{
TIntermAggregate *negatedElse = nullptr;
// crbug.com/346463
@@ -107,16 +107,16 @@
TIntermSymbol *conditionSymbolElse = createTempSymbol(boolType);
TIntermUnary *negatedCondition = new TIntermUnary(EOpLogicalNot, conditionSymbolElse);
- falseBlock = new TIntermSelection(negatedCondition,
- selection->getFalseBlock(), negatedElse);
+ falseBlock = new TIntermIfElse(negatedCondition, ifElse->getFalseBlock(), negatedElse);
}
TIntermSymbol *conditionSymbolSel = createTempSymbol(boolType);
- TIntermSelection *newSelection = new TIntermSelection(conditionSymbolSel, selection->getTrueBlock(), falseBlock);
+ TIntermIfElse *newIfElse =
+ new TIntermIfElse(conditionSymbolSel, ifElse->getTrueBlock(), falseBlock);
TIntermAggregate *block = new TIntermAggregate(EOpSequence);
block->getSequence()->push_back(storeCondition);
- block->getSequence()->push_back(newSelection);
+ block->getSequence()->push_back(newIfElse);
return block;
}
diff --git a/src/compiler/translator/UnfoldShortCircuitToIf.cpp b/src/compiler/translator/UnfoldShortCircuitToIf.cpp
index 6503194..f6e9a2e 100644
--- a/src/compiler/translator/UnfoldShortCircuitToIf.cpp
+++ b/src/compiler/translator/UnfoldShortCircuitToIf.cpp
@@ -80,7 +80,7 @@
assignRightBlock->getSequence()->push_back(createTempAssignment(node->getRight()));
TIntermUnary *notTempSymbol = new TIntermUnary(EOpLogicalNot, createTempSymbol(boolType));
- TIntermSelection *ifNode = new TIntermSelection(notTempSymbol, assignRightBlock, nullptr);
+ TIntermIfElse *ifNode = new TIntermIfElse(notTempSymbol, assignRightBlock, nullptr);
insertions.push_back(ifNode);
insertStatementsInParentBlock(insertions);
@@ -103,8 +103,8 @@
ASSERT(node->getRight()->getType() == boolType);
assignRightBlock->getSequence()->push_back(createTempAssignment(node->getRight()));
- TIntermSelection *ifNode =
- new TIntermSelection(createTempSymbol(boolType), assignRightBlock, nullptr);
+ TIntermIfElse *ifNode =
+ new TIntermIfElse(createTempSymbol(boolType), assignRightBlock, nullptr);
insertions.push_back(ifNode);
insertStatementsInParentBlock(insertions);
@@ -147,8 +147,8 @@
TIntermBinary *falseAssignment = createTempAssignment(node->getFalseExpression());
falseBlock->getSequence()->push_back(falseAssignment);
- TIntermSelection *ifNode =
- new TIntermSelection(node->getCondition()->getAsTyped(), trueBlock, falseBlock);
+ TIntermIfElse *ifNode =
+ new TIntermIfElse(node->getCondition()->getAsTyped(), trueBlock, falseBlock);
insertions.push_back(ifNode);
insertStatementsInParentBlock(insertions);
diff --git a/src/compiler/translator/ValidateSwitch.cpp b/src/compiler/translator/ValidateSwitch.cpp
index 9fe9b5d..1ebdffd 100644
--- a/src/compiler/translator/ValidateSwitch.cpp
+++ b/src/compiler/translator/ValidateSwitch.cpp
@@ -71,7 +71,7 @@
return true;
}
-bool ValidateSwitch::visitSelection(Visit visit, TIntermSelection *)
+bool ValidateSwitch::visitIfElse(Visit visit, TIntermIfElse *)
{
if (visit == PreVisit)
++mControlFlowDepth;
diff --git a/src/compiler/translator/ValidateSwitch.h b/src/compiler/translator/ValidateSwitch.h
index b20ee75..fb6a614 100644
--- a/src/compiler/translator/ValidateSwitch.h
+++ b/src/compiler/translator/ValidateSwitch.h
@@ -24,7 +24,7 @@
bool visitBinary(Visit, TIntermBinary *) override;
bool visitUnary(Visit, TIntermUnary *) override;
bool visitTernary(Visit, TIntermTernary *) override;
- bool visitSelection(Visit visit, TIntermSelection *) override;
+ bool visitIfElse(Visit visit, TIntermIfElse *) override;
bool visitSwitch(Visit, TIntermSwitch *) override;
bool visitCase(Visit, TIntermCase *node) override;
bool visitAggregate(Visit, TIntermAggregate *) override;
diff --git a/src/compiler/translator/glslang.y b/src/compiler/translator/glslang.y
index 97b0861..c068c05 100644
--- a/src/compiler/translator/glslang.y
+++ b/src/compiler/translator/glslang.y
@@ -1334,7 +1334,7 @@
selection_statement
: IF LEFT_PAREN expression RIGHT_PAREN selection_rest_statement {
context->checkIsScalarBool(@1, $3);
- $$ = context->intermediate.addSelection($3, $5, @1);
+ $$ = context->intermediate.addIfElse($3, $5, @1);
}
;
diff --git a/src/compiler/translator/glslang_tab.cpp b/src/compiler/translator/glslang_tab.cpp
index 06eb2bb..a34001d 100644
--- a/src/compiler/translator/glslang_tab.cpp
+++ b/src/compiler/translator/glslang_tab.cpp
@@ -4400,7 +4400,7 @@
{
context->checkIsScalarBool((yylsp[-4]), (yyvsp[-2].interm.intermTypedNode));
- (yyval.interm.intermNode) = context->intermediate.addSelection((yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.nodePair), (yylsp[-4]));
+ (yyval.interm.intermNode) = context->intermediate.addIfElse((yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.nodePair), (yylsp[-4]));
}
break;
diff --git a/src/compiler/translator/intermOut.cpp b/src/compiler/translator/intermOut.cpp
index 942eadc..2eb0441 100644
--- a/src/compiler/translator/intermOut.cpp
+++ b/src/compiler/translator/intermOut.cpp
@@ -45,7 +45,7 @@
bool visitBinary(Visit visit, TIntermBinary *) override;
bool visitUnary(Visit visit, TIntermUnary *) override;
bool visitTernary(Visit visit, TIntermTernary *node) override;
- bool visitSelection(Visit visit, TIntermSelection *) override;
+ bool visitIfElse(Visit visit, TIntermIfElse *node) override;
bool visitAggregate(Visit visit, TIntermAggregate *) override;
bool visitLoop(Visit visit, TIntermLoop *) override;
bool visitBranch(Visit visit, TIntermBranch *) override;
@@ -492,7 +492,7 @@
return false;
}
-bool TOutputTraverser::visitSelection(Visit visit, TIntermSelection *node)
+bool TOutputTraverser::visitIfElse(Visit visit, TIntermIfElse *node)
{
TInfoSinkBase &out = sink;