#include "src/sksl/SkSLConstantFolder.h"
#include "include/core/SkTypes.h"
#include "include/private/base/SkFloatingPoint.h"
#include "include/private/base/SkTArray.h"
#include "src/sksl/SkSLAnalysis.h"
#include "src/sksl/SkSLContext.h"
#include "src/sksl/SkSLErrorReporter.h"
#include "src/sksl/SkSLPosition.h"
#include "src/sksl/SkSLProgramSettings.h"
#include "src/sksl/ir/SkSLBinaryExpression.h"
#include "src/sksl/ir/SkSLConstructorCompound.h"
#include "src/sksl/ir/SkSLConstructorDiagonalMatrix.h"
#include "src/sksl/ir/SkSLConstructorSplat.h"
#include "src/sksl/ir/SkSLExpression.h"
#include "src/sksl/ir/SkSLLiteral.h"
#include "src/sksl/ir/SkSLModifierFlags.h"
#include "src/sksl/ir/SkSLPrefixExpression.h"
#include "src/sksl/ir/SkSLType.h"
#include "src/sksl/ir/SkSLVariable.h"
#include "src/sksl/ir/SkSLVariableReference.h"
#include <cstdint>
#include <float.h>
#include <limits>
#include <optional>
#include <string>
#include <utility>
usingnamespaceskia_private;
namespace SkSL {
static bool is_vec_or_mat(const Type& type) { … }
static std::unique_ptr<Expression> eliminate_no_op_boolean(Position pos,
const Expression& left,
Operator op,
const Expression& right) { … }
static std::unique_ptr<Expression> short_circuit_boolean(Position pos,
const Expression& left,
Operator op,
const Expression& right) { … }
static std::unique_ptr<Expression> simplify_constant_equality(const Context& context,
Position pos,
const Expression& left,
Operator op,
const Expression& right) { … }
static std::unique_ptr<Expression> simplify_matrix_multiplication(const Context& context,
Position pos,
const Expression& left,
const Expression& right,
int leftColumns,
int leftRows,
int rightColumns,
int rightRows) { … }
static std::unique_ptr<Expression> simplify_matrix_times_matrix(const Context& context,
Position pos,
const Expression& left,
const Expression& right) { … }
static std::unique_ptr<Expression> simplify_vector_times_matrix(const Context& context,
Position pos,
const Expression& left,
const Expression& right) { … }
static std::unique_ptr<Expression> simplify_matrix_times_vector(const Context& context,
Position pos,
const Expression& left,
const Expression& right) { … }
static std::unique_ptr<Expression> simplify_componentwise(const Context& context,
Position pos,
const Expression& left,
Operator op,
const Expression& right) { … }
static std::unique_ptr<Expression> splat_scalar(const Context& context,
const Expression& scalar,
const Type& type) { … }
static std::unique_ptr<Expression> cast_expression(const Context& context,
Position pos,
const Expression& expr,
const Type& type) { … }
static std::unique_ptr<Expression> zero_expression(const Context& context,
Position pos,
const Type& type) { … }
static std::unique_ptr<Expression> negate_expression(const Context& context,
Position pos,
const Expression& expr,
const Type& type) { … }
bool ConstantFolder::GetConstantInt(const Expression& value, SKSL_INT* out) { … }
bool ConstantFolder::GetConstantValue(const Expression& value, double* out) { … }
static bool contains_constant_zero(const Expression& expr) { … }
bool ConstantFolder::IsConstantSplat(const Expression& expr, double value) { … }
static bool is_constant_diagonal(const Expression& expr, double value) { … }
static bool is_constant_value(const Expression& expr, double value) { … }
static std::unique_ptr<Expression> make_reciprocal_expression(const Context& context,
const Expression& right) { … }
static bool error_on_divide_by_zero(const Context& context, Position pos, Operator op,
const Expression& right) { … }
const Expression* ConstantFolder::GetConstantValueOrNull(const Expression& inExpr) { … }
const Expression* ConstantFolder::GetConstantValueForVariable(const Expression& inExpr) { … }
std::unique_ptr<Expression> ConstantFolder::MakeConstantValueForVariable(
Position pos, std::unique_ptr<Expression> inExpr) { … }
static bool is_scalar_op_matrix(const Expression& left, const Expression& right) { … }
static bool is_matrix_op_scalar(const Expression& left, const Expression& right) { … }
static std::unique_ptr<Expression> simplify_arithmetic(const Context& context,
Position pos,
const Expression& left,
Operator op,
const Expression& right,
const Type& resultType) { … }
static std::unique_ptr<Expression> one_over_scalar(const Context& context,
const Expression& right) { … }
static std::unique_ptr<Expression> simplify_matrix_division(const Context& context,
Position pos,
const Expression& left,
Operator op,
const Expression& right,
const Type& resultType) { … }
static std::unique_ptr<Expression> fold_expression(Position pos,
double result,
const Type* resultType) { … }
static std::unique_ptr<Expression> fold_two_constants(const Context& context,
Position pos,
const Expression* left,
Operator op,
const Expression* right,
const Type& resultType) { … }
std::unique_ptr<Expression> ConstantFolder::Simplify(const Context& context,
Position pos,
const Expression& leftExpr,
Operator op,
const Expression& rightExpr,
const Type& resultType) { … }
}