aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sksl/SkSLCFGGenerator.cpp
diff options
context:
space:
mode:
authorGravatar Ethan Nicholas <ethannicholas@google.com>2017-02-23 16:18:54 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-02-23 16:20:10 +0000
commit7d975fc200bbbea991ec4c04c08f3a5ea7b847af (patch)
tree813ff12f25afc903a65880be187ef88162fad866 /src/sksl/SkSLCFGGenerator.cpp
parentd196cbe9c270799a6edb6e110ab647c5a4a850a2 (diff)
Revert "skslc switch support"
This reverts commit 2b1e468dabd2ac7bea7ec17740275f4f4aad30c3. Reason for revert: bot breakage Original change's description: > skslc switch support > > BUG=skia: > > Change-Id: Ida7f9e80139aa1e4f43804cafbcac640e47fab25 > Reviewed-on: https://skia-review.googlesource.com/8771 > Commit-Queue: Ethan Nicholas <ethannicholas@google.com> > Reviewed-by: Ben Wagner <benjaminwagner@google.com> > TBR=benjaminwagner@google.com,ethannicholas@google.com,reviews@skia.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Change-Id: Iaaa35d10a15704279c6883d4d68f6d4ad5078320 Reviewed-on: https://skia-review.googlesource.com/8792 Reviewed-by: Ethan Nicholas <ethannicholas@google.com> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Diffstat (limited to 'src/sksl/SkSLCFGGenerator.cpp')
-rw-r--r--src/sksl/SkSLCFGGenerator.cpp39
1 files changed, 3 insertions, 36 deletions
diff --git a/src/sksl/SkSLCFGGenerator.cpp b/src/sksl/SkSLCFGGenerator.cpp
index 28533df557..31bace9fb7 100644
--- a/src/sksl/SkSLCFGGenerator.cpp
+++ b/src/sksl/SkSLCFGGenerator.cpp
@@ -20,7 +20,6 @@
#include "ir/SkSLPrefixExpression.h"
#include "ir/SkSLReturnStatement.h"
#include "ir/SkSLSwizzle.h"
-#include "ir/SkSLSwitchStatement.h"
#include "ir/SkSLTernaryExpression.h"
#include "ir/SkSLVarDeclarationsStatement.h"
#include "ir/SkSLWhileStatement.h"
@@ -153,17 +152,13 @@ void CFGGenerator::addExpression(CFG& cfg, std::unique_ptr<Expression>* e, bool
cfg.fBlocks[cfg.fCurrent].fNodes.push_back({ BasicBlock::Node::kExpression_Kind,
constantPropagate, e, nullptr });
break;
- case Expression::kPrefix_Kind: {
- PrefixExpression* p = (PrefixExpression*) e->get();
- this->addExpression(cfg, &p->fOperand, constantPropagate &&
- p->fOperator != Token::PLUSPLUS &&
- p->fOperator != Token::MINUSMINUS);
+ case Expression::kPrefix_Kind:
+ this->addExpression(cfg, &((PrefixExpression*) e->get())->fOperand, constantPropagate);
cfg.fBlocks[cfg.fCurrent].fNodes.push_back({ BasicBlock::Node::kExpression_Kind,
constantPropagate, e, nullptr });
break;
- }
case Expression::kPostfix_Kind:
- this->addExpression(cfg, &((PostfixExpression*) e->get())->fOperand, false);
+ this->addExpression(cfg, &((PostfixExpression*) e->get())->fOperand, constantPropagate);
cfg.fBlocks[cfg.fCurrent].fNodes.push_back({ BasicBlock::Node::kExpression_Kind,
constantPropagate, e, nullptr });
break;
@@ -350,34 +345,6 @@ void CFGGenerator::addStatement(CFG& cfg, const Statement* s) {
cfg.fCurrent = loopExit;
break;
}
- case Statement::kSwitch_Kind: {
- SwitchStatement* ss = (SwitchStatement*) s;
- this->addExpression(cfg, &ss->fValue, true);
- BlockId start = cfg.fCurrent;
- BlockId switchExit = cfg.newIsolatedBlock();
- fLoopExits.push(switchExit);
- for (const auto& c : ss->fCases) {
- cfg.newBlock();
- cfg.addExit(start, cfg.fCurrent);
- if (c->fValue) {
- // technically this should go in the start block, but it doesn't actually matter
- // because it must be constant. Not worth running two loops for.
- this->addExpression(cfg, &c->fValue, true);
- }
- for (const auto& caseStatement : c->fStatements) {
- this->addStatement(cfg, caseStatement.get());
- }
- }
- cfg.addExit(cfg.fCurrent, switchExit);
- // note that unlike GLSL, our grammar requires the default case to be last
- if (0 == ss->fCases.size() || ss->fCases[ss->fCases.size() - 1]->fValue) {
- // switch does not have a default clause, mark that it can skip straight to the end
- cfg.addExit(start, switchExit);
- }
- fLoopExits.pop();
- cfg.fCurrent = switchExit;
- break;
- }
default:
printf("statement: %s\n", s->description().c_str());
ABORT("unsupported statement kind");