summaryrefslogtreecommitdiffstats
path: root/gfx/angle/src/compiler/translator/intermOut.cpp
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-08-05 11:35:53 +0200
committerwolfbeast <mcwerewolf@gmail.com>2018-08-05 11:35:53 +0200
commit6bd66b1728eeddb058066edda740aaeb2ceaec23 (patch)
tree985faf01c526763515731569fa01a99f4dbef36e /gfx/angle/src/compiler/translator/intermOut.cpp
parente0a8dcfed131ffa58a5e2cb1d30fe48c745c2fdc (diff)
parent559824514dc95e02fbe81f1786e6ac13ee8e9d55 (diff)
downloadUXP-6bd66b1728eeddb058066edda740aaeb2ceaec23.tar
UXP-6bd66b1728eeddb058066edda740aaeb2ceaec23.tar.gz
UXP-6bd66b1728eeddb058066edda740aaeb2ceaec23.tar.lz
UXP-6bd66b1728eeddb058066edda740aaeb2ceaec23.tar.xz
UXP-6bd66b1728eeddb058066edda740aaeb2ceaec23.zip
Merge branch 'master' into js-modules
Diffstat (limited to 'gfx/angle/src/compiler/translator/intermOut.cpp')
-rwxr-xr-xgfx/angle/src/compiler/translator/intermOut.cpp426
1 files changed, 157 insertions, 269 deletions
diff --git a/gfx/angle/src/compiler/translator/intermOut.cpp b/gfx/angle/src/compiler/translator/intermOut.cpp
index 53ee1d02a..6dca547f0 100755
--- a/gfx/angle/src/compiler/translator/intermOut.cpp
+++ b/gfx/angle/src/compiler/translator/intermOut.cpp
@@ -7,17 +7,13 @@
#include "compiler/translator/Intermediate.h"
#include "compiler/translator/SymbolTable.h"
-namespace sh
-{
-
namespace
{
-void OutputFunction(TInfoSinkBase &out, const char *str, TFunctionSymbolInfo *info)
+void OutputFunction(TInfoSinkBase &out, const char *str, TIntermAggregate *node)
{
- const char *internal = info->getNameObj().isInternal() ? " (internal function)" : "";
- out << str << internal << ": " << info->getNameObj().getString() << " (symbol id "
- << info->getId() << ")";
+ const char *internal = node->getNameObj().isInternal() ? " (internal function)" : "";
+ out << str << internal << ": " << node->getNameObj().getString();
}
//
@@ -46,17 +42,10 @@ class TOutputTraverser : public TIntermTraverser
protected:
void visitSymbol(TIntermSymbol *) override;
void visitConstantUnion(TIntermConstantUnion *) override;
- bool visitSwizzle(Visit visit, TIntermSwizzle *node) override;
bool visitBinary(Visit visit, TIntermBinary *) override;
bool visitUnary(Visit visit, TIntermUnary *) override;
- bool visitTernary(Visit visit, TIntermTernary *node) override;
- bool visitIfElse(Visit visit, TIntermIfElse *node) override;
- bool visitSwitch(Visit visit, TIntermSwitch *node) override;
- bool visitCase(Visit visit, TIntermCase *node) override;
- bool visitFunctionDefinition(Visit visit, TIntermFunctionDefinition *node) override;
+ bool visitSelection(Visit visit, TIntermSelection *) override;
bool visitAggregate(Visit visit, TIntermAggregate *) override;
- bool visitBlock(Visit visit, TIntermBlock *) override;
- bool visitDeclaration(Visit visit, TIntermDeclaration *node) override;
bool visitLoop(Visit visit, TIntermLoop *) override;
bool visitBranch(Visit visit, TIntermBranch *) override;
};
@@ -93,14 +82,6 @@ void TOutputTraverser::visitSymbol(TIntermSymbol *node)
sink << "(" << node->getCompleteString() << ")\n";
}
-bool TOutputTraverser::visitSwizzle(Visit visit, TIntermSwizzle *node)
-{
- TInfoSinkBase &out = sink;
- OutputTreeText(out, node, mDepth);
- out << "vector swizzle";
- return true;
-}
-
bool TOutputTraverser::visitBinary(Visit visit, TIntermBinary *node)
{
TInfoSinkBase& out = sink;
@@ -109,148 +90,148 @@ bool TOutputTraverser::visitBinary(Visit visit, TIntermBinary *node)
switch (node->getOp())
{
- case EOpComma:
- out << "comma";
- break;
- case EOpAssign:
- out << "move second child to first child";
- break;
- case EOpInitialize:
- out << "initialize first child with second child";
- break;
- case EOpAddAssign:
- out << "add second child into first child";
- break;
- case EOpSubAssign:
- out << "subtract second child into first child";
- break;
- case EOpMulAssign:
- out << "multiply second child into first child";
- break;
- case EOpVectorTimesMatrixAssign:
- out << "matrix mult second child into first child";
- break;
- case EOpVectorTimesScalarAssign:
- out << "vector scale second child into first child";
- break;
- case EOpMatrixTimesScalarAssign:
- out << "matrix scale second child into first child";
- break;
- case EOpMatrixTimesMatrixAssign:
- out << "matrix mult second child into first child";
- break;
- case EOpDivAssign:
- out << "divide second child into first child";
- break;
- case EOpIModAssign:
- out << "modulo second child into first child";
- break;
- case EOpBitShiftLeftAssign:
- out << "bit-wise shift first child left by second child";
- break;
- case EOpBitShiftRightAssign:
- out << "bit-wise shift first child right by second child";
- break;
- case EOpBitwiseAndAssign:
- out << "bit-wise and second child into first child";
- break;
- case EOpBitwiseXorAssign:
- out << "bit-wise xor second child into first child";
- break;
- case EOpBitwiseOrAssign:
- out << "bit-wise or second child into first child";
- break;
-
- case EOpIndexDirect:
- out << "direct index";
- break;
- case EOpIndexIndirect:
- out << "indirect index";
- break;
- case EOpIndexDirectStruct:
- out << "direct index for structure";
- break;
- case EOpIndexDirectInterfaceBlock:
- out << "direct index for interface block";
- break;
-
- case EOpAdd:
- out << "add";
- break;
- case EOpSub:
- out << "subtract";
- break;
- case EOpMul:
- out << "component-wise multiply";
- break;
- case EOpDiv:
- out << "divide";
- break;
- case EOpIMod:
- out << "modulo";
- break;
- case EOpBitShiftLeft:
- out << "bit-wise shift left";
- break;
- case EOpBitShiftRight:
- out << "bit-wise shift right";
- break;
- case EOpBitwiseAnd:
- out << "bit-wise and";
- break;
- case EOpBitwiseXor:
- out << "bit-wise xor";
- break;
- case EOpBitwiseOr:
- out << "bit-wise or";
- break;
-
- case EOpEqual:
- out << "Compare Equal";
- break;
- case EOpNotEqual:
- out << "Compare Not Equal";
- break;
- case EOpLessThan:
- out << "Compare Less Than";
- break;
- case EOpGreaterThan:
- out << "Compare Greater Than";
- break;
- case EOpLessThanEqual:
- out << "Compare Less Than or Equal";
- break;
- case EOpGreaterThanEqual:
- out << "Compare Greater Than or Equal";
- break;
-
- case EOpVectorTimesScalar:
- out << "vector-scale";
- break;
- case EOpVectorTimesMatrix:
- out << "vector-times-matrix";
- break;
- case EOpMatrixTimesVector:
- out << "matrix-times-vector";
- break;
- case EOpMatrixTimesScalar:
- out << "matrix-scale";
- break;
- case EOpMatrixTimesMatrix:
- out << "matrix-multiply";
- break;
-
- case EOpLogicalOr:
- out << "logical-or";
- break;
- case EOpLogicalXor:
- out << "logical-xor";
- break;
- case EOpLogicalAnd:
- out << "logical-and";
- break;
- default:
- out << "<unknown op>";
+ case EOpAssign:
+ out << "move second child to first child";
+ break;
+ case EOpInitialize:
+ out << "initialize first child with second child";
+ break;
+ case EOpAddAssign:
+ out << "add second child into first child";
+ break;
+ case EOpSubAssign:
+ out << "subtract second child into first child";
+ break;
+ case EOpMulAssign:
+ out << "multiply second child into first child";
+ break;
+ case EOpVectorTimesMatrixAssign:
+ out << "matrix mult second child into first child";
+ break;
+ case EOpVectorTimesScalarAssign:
+ out << "vector scale second child into first child";
+ break;
+ case EOpMatrixTimesScalarAssign:
+ out << "matrix scale second child into first child";
+ break;
+ case EOpMatrixTimesMatrixAssign:
+ out << "matrix mult second child into first child";
+ break;
+ case EOpDivAssign:
+ out << "divide second child into first child";
+ break;
+ case EOpIModAssign:
+ out << "modulo second child into first child";
+ break;
+ case EOpBitShiftLeftAssign:
+ out << "bit-wise shift first child left by second child";
+ break;
+ case EOpBitShiftRightAssign:
+ out << "bit-wise shift first child right by second child";
+ break;
+ case EOpBitwiseAndAssign:
+ out << "bit-wise and second child into first child";
+ break;
+ case EOpBitwiseXorAssign:
+ out << "bit-wise xor second child into first child";
+ break;
+ case EOpBitwiseOrAssign:
+ out << "bit-wise or second child into first child";
+ break;
+
+ case EOpIndexDirect:
+ out << "direct index";
+ break;
+ case EOpIndexIndirect:
+ out << "indirect index";
+ break;
+ case EOpIndexDirectStruct:
+ out << "direct index for structure";
+ break;
+ case EOpIndexDirectInterfaceBlock:
+ out << "direct index for interface block";
+ break;
+ case EOpVectorSwizzle:
+ out << "vector swizzle";
+ break;
+
+ case EOpAdd:
+ out << "add";
+ break;
+ case EOpSub:
+ out << "subtract";
+ break;
+ case EOpMul:
+ out << "component-wise multiply";
+ break;
+ case EOpDiv:
+ out << "divide";
+ break;
+ case EOpIMod:
+ out << "modulo";
+ break;
+ case EOpBitShiftLeft:
+ out << "bit-wise shift left";
+ break;
+ case EOpBitShiftRight:
+ out << "bit-wise shift right";
+ break;
+ case EOpBitwiseAnd:
+ out << "bit-wise and";
+ break;
+ case EOpBitwiseXor:
+ out << "bit-wise xor";
+ break;
+ case EOpBitwiseOr:
+ out << "bit-wise or";
+ break;
+
+ case EOpEqual:
+ out << "Compare Equal";
+ break;
+ case EOpNotEqual:
+ out << "Compare Not Equal";
+ break;
+ case EOpLessThan:
+ out << "Compare Less Than";
+ break;
+ case EOpGreaterThan:
+ out << "Compare Greater Than";
+ break;
+ case EOpLessThanEqual:
+ out << "Compare Less Than or Equal";
+ break;
+ case EOpGreaterThanEqual:
+ out << "Compare Greater Than or Equal";
+ break;
+
+ case EOpVectorTimesScalar:
+ out << "vector-scale";
+ break;
+ case EOpVectorTimesMatrix:
+ out << "vector-times-matrix";
+ break;
+ case EOpMatrixTimesVector:
+ out << "matrix-times-vector";
+ break;
+ case EOpMatrixTimesScalar:
+ out << "matrix-scale";
+ break;
+ case EOpMatrixTimesMatrix:
+ out << "matrix-multiply";
+ break;
+
+ case EOpLogicalOr:
+ out << "logical-or";
+ break;
+ case EOpLogicalXor:
+ out << "logical-xor";
+ break;
+ case EOpLogicalAnd:
+ out << "logical-and";
+ break;
+ default:
+ out << "<unknown op>";
}
out << " (" << node->getCompleteString() << ")";
@@ -381,38 +362,27 @@ bool TOutputTraverser::visitUnary(Visit visit, TIntermUnary *node)
return true;
}
-bool TOutputTraverser::visitFunctionDefinition(Visit visit, TIntermFunctionDefinition *node)
-{
- TInfoSinkBase &out = sink;
- OutputTreeText(out, node, mDepth);
- OutputFunction(out, "Function Definition", node->getFunctionSymbolInfo());
- out << "\n";
- return true;
-}
-
bool TOutputTraverser::visitAggregate(Visit visit, TIntermAggregate *node)
{
TInfoSinkBase &out = sink;
- OutputTreeText(out, node, mDepth);
-
if (node->getOp() == EOpNull)
{
out.prefix(EPrefixError);
- out << "node is still EOpNull!\n";
+ out << "node is still EOpNull!";
return true;
}
+ OutputTreeText(out, node, mDepth);
switch (node->getOp())
{
- case EOpFunctionCall:
- OutputFunction(out, "Function Call", node->getFunctionSymbolInfo());
- break;
+ case EOpSequence: out << "Sequence\n"; return true;
+ case EOpComma: out << "Comma\n"; return true;
+ case EOpFunction: OutputFunction(out, "Function Definition", node); break;
+ case EOpFunctionCall: OutputFunction(out, "Function Call", node); break;
case EOpParameters: out << "Function Parameters: "; break;
- case EOpPrototype:
- OutputFunction(out, "Function Prototype", node->getFunctionSymbolInfo());
- break;
+ case EOpPrototype: OutputFunction(out, "Function Prototype", node); break;
case EOpConstructFloat: out << "Construct float"; break;
case EOpConstructVec2: out << "Construct vec2"; break;
@@ -471,6 +441,7 @@ bool TOutputTraverser::visitAggregate(Visit visit, TIntermAggregate *node)
case EOpOuterProduct: out << "outer product"; break;
+ case EOpDeclaration: out << "Declaration: "; break;
case EOpInvariantDeclaration: out << "Invariant Declaration: "; break;
default:
@@ -478,7 +449,7 @@ bool TOutputTraverser::visitAggregate(Visit visit, TIntermAggregate *node)
out << "Bad aggregation op";
}
- if (node->getOp() != EOpParameters)
+ if (node->getOp() != EOpSequence && node->getOp() != EOpParameters)
out << " (" << node->getCompleteString() << ")";
out << "\n";
@@ -486,33 +457,13 @@ bool TOutputTraverser::visitAggregate(Visit visit, TIntermAggregate *node)
return true;
}
-bool TOutputTraverser::visitBlock(Visit visit, TIntermBlock *node)
-{
- TInfoSinkBase &out = sink;
-
- OutputTreeText(out, node, mDepth);
- out << "Code block\n";
-
- return true;
-}
-
-bool TOutputTraverser::visitDeclaration(Visit visit, TIntermDeclaration *node)
-{
- TInfoSinkBase &out = sink;
-
- OutputTreeText(out, node, mDepth);
- out << "Declaration\n";
-
- return true;
-}
-
-bool TOutputTraverser::visitTernary(Visit visit, TIntermTernary *node)
+bool TOutputTraverser::visitSelection(Visit visit, TIntermSelection *node)
{
TInfoSinkBase &out = sink;
OutputTreeText(out, node, mDepth);
- out << "Ternary selection";
+ out << "Test condition and select";
out << " (" << node->getCompleteString() << ")\n";
++mDepth;
@@ -522,38 +473,6 @@ bool TOutputTraverser::visitTernary(Visit visit, TIntermTernary *node)
node->getCondition()->traverse(this);
OutputTreeText(sink, node, mDepth);
- if (node->getTrueExpression())
- {
- out << "true case\n";
- node->getTrueExpression()->traverse(this);
- }
- if (node->getFalseExpression())
- {
- OutputTreeText(sink, node, mDepth);
- out << "false case\n";
- node->getFalseExpression()->traverse(this);
- }
-
- --mDepth;
-
- return false;
-}
-
-bool TOutputTraverser::visitIfElse(Visit visit, TIntermIfElse *node)
-{
- TInfoSinkBase &out = sink;
-
- OutputTreeText(out, node, mDepth);
-
- out << "If test\n";
-
- ++mDepth;
-
- OutputTreeText(sink, node, mDepth);
- out << "Condition\n";
- node->getCondition()->traverse(this);
-
- OutputTreeText(sink, node, mDepth);
if (node->getTrueBlock())
{
out << "true case\n";
@@ -576,35 +495,6 @@ bool TOutputTraverser::visitIfElse(Visit visit, TIntermIfElse *node)
return false;
}
-bool TOutputTraverser::visitSwitch(Visit visit, TIntermSwitch *node)
-{
- TInfoSinkBase &out = sink;
-
- OutputTreeText(out, node, mDepth);
-
- out << "Switch\n";
-
- return true;
-}
-
-bool TOutputTraverser::visitCase(Visit visit, TIntermCase *node)
-{
- TInfoSinkBase &out = sink;
-
- OutputTreeText(out, node, mDepth);
-
- if (node->getCondition() == nullptr)
- {
- out << "Default\n";
- }
- else
- {
- out << "Case\n";
- }
-
- return true;
-}
-
void TOutputTraverser::visitConstantUnion(TIntermConstantUnion *node)
{
TInfoSinkBase &out = sink;
@@ -734,5 +624,3 @@ void TIntermediate::outputTree(TIntermNode *root, TInfoSinkBase &infoSink)
root->traverse(&it);
}
-
-} // namespace sh