aboutsummaryrefslogtreecommitdiffstats
path: root/libyul/optimiser/ForLoopInitRewriter.h
diff options
context:
space:
mode:
authorChristian Parpart <christian@parpart.family>2018-11-07 18:18:02 +0800
committerChristian Parpart <christian@ethereum.org>2018-11-16 20:15:41 +0800
commitf705a45d43d69ca4f29bd496d091f7237bdc31ff (patch)
treee176c4b1d512bc9f2b0e0353a125a535ccf69691 /libyul/optimiser/ForLoopInitRewriter.h
parent460c58fbd194fef5add699405238d3ed302a003f (diff)
downloaddexon-solidity-f705a45d43d69ca4f29bd496d091f7237bdc31ff.tar
dexon-solidity-f705a45d43d69ca4f29bd496d091f7237bdc31ff.tar.gz
dexon-solidity-f705a45d43d69ca4f29bd496d091f7237bdc31ff.tar.bz2
dexon-solidity-f705a45d43d69ca4f29bd496d091f7237bdc31ff.tar.lz
dexon-solidity-f705a45d43d69ca4f29bd496d091f7237bdc31ff.tar.xz
dexon-solidity-f705a45d43d69ca4f29bd496d091f7237bdc31ff.tar.zst
dexon-solidity-f705a45d43d69ca4f29bd496d091f7237bdc31ff.zip
[Yul] Implements a pass to rewrite for-loop's pre block into the parent's Block.
Diffstat (limited to 'libyul/optimiser/ForLoopInitRewriter.h')
-rw-r--r--libyul/optimiser/ForLoopInitRewriter.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/libyul/optimiser/ForLoopInitRewriter.h b/libyul/optimiser/ForLoopInitRewriter.h
new file mode 100644
index 00000000..64f53711
--- /dev/null
+++ b/libyul/optimiser/ForLoopInitRewriter.h
@@ -0,0 +1,39 @@
+/*
+ This file is part of solidity.
+
+ solidity is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ solidity is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with solidity. If not, see <http://www.gnu.org/licenses/>.
+*/
+#pragma once
+
+#include <libyul/optimiser/ASTWalker.h>
+
+namespace dev
+{
+namespace yul
+{
+
+/**
+ * Rewrites ForLoop by moving the pre statement block in front of the ForLoop.
+ * Requirements:
+ * - The Disambiguator must be run upfront.
+ */
+class ForLoopInitRewriter: public ASTModifier
+{
+public:
+ using ASTModifier::operator();
+ void operator()(Block& _block) override;
+};
+
+}
+}