aboutsummaryrefslogtreecommitdiffstats
path: root/libjulia
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-12-15 00:38:32 +0800
committerchriseth <chris@ethereum.org>2018-02-06 19:30:03 +0800
commitd400c44007b6579f2da61bb57104c47f32fbdf9e (patch)
tree2a0999a7c65a25144b05b5ab4e9ee0b57713121d /libjulia
parent6b917eb528fcbcbb11e81810c8f6bd4d554f21e1 (diff)
downloaddexon-solidity-d400c44007b6579f2da61bb57104c47f32fbdf9e.tar
dexon-solidity-d400c44007b6579f2da61bb57104c47f32fbdf9e.tar.gz
dexon-solidity-d400c44007b6579f2da61bb57104c47f32fbdf9e.tar.bz2
dexon-solidity-d400c44007b6579f2da61bb57104c47f32fbdf9e.tar.lz
dexon-solidity-d400c44007b6579f2da61bb57104c47f32fbdf9e.tar.xz
dexon-solidity-d400c44007b6579f2da61bb57104c47f32fbdf9e.tar.zst
dexon-solidity-d400c44007b6579f2da61bb57104c47f32fbdf9e.zip
Description of variable eliminator.
Diffstat (limited to 'libjulia')
-rw-r--r--libjulia/optimiser/README.md23
1 files changed, 21 insertions, 2 deletions
diff --git a/libjulia/optimiser/README.md b/libjulia/optimiser/README.md
index 771cb707..24ee429c 100644
--- a/libjulia/optimiser/README.md
+++ b/libjulia/optimiser/README.md
@@ -54,8 +54,27 @@ As an example, neither ``mload`` nor ``mstore`` would be allowed.
## Full Function Inliner
-## Variable Eliminator
+## Rematerialisation
+
+The rematerialisation stage tries to replace variable references by the expression that
+was last assigned to the variable. This is of course only beneficial if this expression
+is comparatively cheap to evaluate. Furthermore, it is only semantically equivalent if
+the value of the expression did not change between the point of assignment and the
+point of use. The main benefit of this stage is that it can save stack slots if it
+leads to a variable being eliminated completely (see below), but it can also
+save a DUP opcode on the EVM if the expression is very cheap.
+
+The algorithm only allows movable expressions (see above for a definition) in this case.
+Expressions that contain other variables are also disallowed if one of those variables
+have been assigned to in the meantime. This is also not applied to variables where
+assignment and use span across loops and conditionals.
+
+## Unused Definition Pruner
+
+If a variable or function is not referenced, it is removed from the code.
+If there are two assignments to a variable where the first one is a movable expression
+and the variable is not used between the two assignments (and the second is not inside
+a loop or conditional, the first one is not inside), the first assignment is removed.
-## Unused Declaration Pruner
## Function Unifier