diff options
author | 2016-11-09 13:26:45 -0800 | |
---|---|---|
committer | 2016-11-09 13:26:45 -0800 | |
commit | 08a9211a8492a84e1f4a6899759f8f37ed5aec3e (patch) | |
tree | 8fe430d685b62467d0a59aa374ef7b98d6a3db4a /src/sksl/SkSLIRGenerator.h | |
parent | f2b024db6777a904d986c68a21ba0bc41f956f6e (diff) |
added constant folding & branch elimination to skslc
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2489673002
Committed: https://skia.googlesource.com/skia/+/6136310ee8f43247548bcefcaeca6d43023c10aa
Review-Url: https://codereview.chromium.org/2489673002
Diffstat (limited to 'src/sksl/SkSLIRGenerator.h')
-rw-r--r-- | src/sksl/SkSLIRGenerator.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/sksl/SkSLIRGenerator.h b/src/sksl/SkSLIRGenerator.h index a1b86f4f54..036f24253b 100644 --- a/src/sksl/SkSLIRGenerator.h +++ b/src/sksl/SkSLIRGenerator.h @@ -89,6 +89,11 @@ private: std::unique_ptr<Statement> convertDiscard(const ASTDiscardStatement& d); std::unique_ptr<Statement> convertDo(const ASTDoStatement& d); std::unique_ptr<Expression> convertBinaryExpression(const ASTBinaryExpression& expression); + // Returns null if it cannot fold the expression. Note that unlike most other functions here, a + // null return does not represent a compilation error. + std::unique_ptr<Expression> constantFold(const Expression& left, + Token::Kind op, + const Expression& right); std::unique_ptr<Extension> convertExtension(const ASTExtension& e); std::unique_ptr<Statement> convertExpressionStatement(const ASTExpressionStatement& s); std::unique_ptr<Statement> convertFor(const ASTForStatement& f); |