Flutter Engine
The Flutter Engine
|
#include <SkSLConstantFolder.h>
Static Public Member Functions | |
static bool | GetConstantInt (const Expression &value, SKSL_INT *out) |
static bool | GetConstantValue (const Expression &value, double *out) |
static const Expression * | GetConstantValueForVariable (const Expression &value) |
static const Expression * | GetConstantValueOrNull (const Expression &value) |
static bool | IsConstantSplat (const Expression &expr, double value) |
static std::unique_ptr< Expression > | MakeConstantValueForVariable (Position pos, std::unique_ptr< Expression > expr) |
static std::unique_ptr< Expression > | Simplify (const Context &context, Position pos, const Expression &left, Operator op, const Expression &right, const Type &resultType) |
Performs constant folding on IR expressions. This simplifies expressions containing compile-time constants, such as replacing Literal(2) + Literal(2)
with Literal(4)
.
Definition at line 27 of file SkSLConstantFolder.h.
|
static |
If value
is an int literal or const int variable with a known value, returns true and stores the value in out
. Otherwise, returns false.
Definition at line 325 of file SkSLConstantFolder.cpp.
|
static |
If value
is a literal or const scalar variable with a known value, returns true and stores the value in out
. Otherwise, returns false.
Definition at line 334 of file SkSLConstantFolder.cpp.
|
static |
If the expression is a const variable with a known compile-time-constant value, returns that value. If not, returns the original expression as-is.
Definition at line 461 of file SkSLConstantFolder.cpp.
|
static |
If the expression can be replaced by a compile-time-constant value, returns that value. If not, returns null.
Definition at line 440 of file SkSLConstantFolder.cpp.
|
static |
Returns true if the expression contains value
in every slot.
Definition at line 354 of file SkSLConstantFolder.cpp.
|
static |
If the expression is a const variable with a known compile-time-constant value, returns a clone of that value. If not, returns the original expression as-is.
Definition at line 466 of file SkSLConstantFolder.cpp.
|
static |
Simplifies the binary expression left OP right
. Returns null if it can't be simplified.
Definition at line 810 of file SkSLConstantFolder.cpp.