Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Unified Diff: src/sksl/SkSLContext.h

Issue 2405383003: added basic dataflow analysis to skslc (Closed)
Patch Set: I have no idea what I was thinking Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/sksl/SkSLCompiler.cpp ('k') | src/sksl/SkSLGLSLCodeGenerator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/sksl/SkSLContext.h
diff --git a/src/sksl/SkSLContext.h b/src/sksl/SkSLContext.h
index 82c265bbb20ace40d8e32a535e9f259bc36d2702..e652948499b42e3873f06e6cedf8b6d4db8d95b2 100644
--- a/src/sksl/SkSLContext.h
+++ b/src/sksl/SkSLContext.h
@@ -9,6 +9,7 @@
#define SKSL_CONTEXT
#include "ir/SkSLType.h"
+#include "ir/SkSLExpression.h"
namespace SkSL {
@@ -114,7 +115,8 @@ public:
, fUVec_Type(new Type("$uvec"))
, fBVec_Type(new Type("$bvec", { fBVec2_Type.get(), fBVec2_Type.get(), fBVec3_Type.get(),
fBVec4_Type.get() }))
- , fInvalid_Type(new Type("<INVALID>")) {}
+ , fInvalid_Type(new Type("<INVALID>"))
+ , fDefined_Expression(new Defined(*fInvalid_Type)) {}
static std::vector<const Type*> static_type(const Type& t) {
return { &t, &t, &t, &t };
@@ -222,6 +224,24 @@ public:
const std::unique_ptr<Type> fBVec_Type;
const std::unique_ptr<Type> fInvalid_Type;
+
+ // dummy expression used to mark that a variable has a value during dataflow analysis (when it
+ // could have several different values, or the analyzer is otherwise unable to assign it a
+ // specific expression)
+ const std::unique_ptr<Expression> fDefined_Expression;
+
+private:
+ class Defined : public Expression {
+ public:
+ Defined(const Type& type)
+ : INHERITED(Position(), kDefined_Kind, type) {}
+
+ virtual std::string description() const override {
+ return "<defined>";
+ }
+
+ typedef Expression INHERITED;
+ };
};
} // namespace
« no previous file with comments | « src/sksl/SkSLCompiler.cpp ('k') | src/sksl/SkSLGLSLCodeGenerator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698