Fold user-definedness of function nodes into TOperator
Whether a function call is user-defined is not orthogonal to TOperator
associated with the call node - other ops than function calls can't be
user-defined. Because of this it makes sense to store the user-
definedness by having different TOperator enums for different types of
calls.
This patch also tags internal helper functions that have a raw
definition outside the AST with a separate TOperator enum. This way
they can be handled with logic that is easy to understand. Before this,
function calls like this left the user-defined bit unset, despite not
really being built-ins either. The EmulatePrecision traverser uses
this. This is also something that could be used to clean up built-in
emulation in the future.
BUG=angleproject:1490
TEST=angle_unittests
Change-Id: I597fcd9789d0cc22b689ef3ce5a0cc3f621d4859
Reviewed-on: https://chromium-review.googlesource.com/433443
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/compiler/translator/CallDAG.cpp b/src/compiler/translator/CallDAG.cpp
index e09f8c9..6daa778 100644
--- a/src/compiler/translator/CallDAG.cpp
+++ b/src/compiler/translator/CallDAG.cpp
@@ -136,30 +136,17 @@
// Aggregates the AST node for each function as well as the name of the functions called by it
bool visitAggregate(Visit visit, TIntermAggregate *node) override
{
- switch (node->getOp())
+ if (visit == PreVisit && node->getOp() == EOpCallFunctionInAST)
{
- case EOpFunctionCall:
- {
- // Function call, add the callees
- if (visit == PreVisit)
- {
- // Do not handle calls to builtin functions
- if (node->isUserDefined())
- {
- auto it = mFunctions.find(node->getFunctionSymbolInfo()->getName());
- ASSERT(it != mFunctions.end());
+ // Function call, add the callees
+ auto it = mFunctions.find(node->getFunctionSymbolInfo()->getName());
+ ASSERT(it != mFunctions.end());
- // We might be in a top-level function call to set a global variable
- if (mCurrentFunction)
- {
- mCurrentFunction->callees.insert(&it->second);
- }
- }
- }
- break;
+ // We might be in a top-level function call to set a global variable
+ if (mCurrentFunction)
+ {
+ mCurrentFunction->callees.insert(&it->second);
}
- default:
- break;
}
return true;
}