aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCamil Staps2017-07-28 11:58:21 +0200
committerCamil Staps2017-07-28 11:58:21 +0200
commit27afc13b1211ec1f5f3304850075329e708d7052 (patch)
treec5edec44377de594a0dc4b24a5096afc3cbcad6c
parentResolve #1: implement lists (tuples have been done earlier) (diff)
Optimise: remove needless moves between stacks
-rw-r--r--Sil/Compile.icl3
1 files changed, 3 insertions, 0 deletions
diff --git a/Sil/Compile.icl b/Sil/Compile.icl
index de3f47f..9404b1c 100644
--- a/Sil/Compile.icl
+++ b/Sil/Compile.icl
@@ -53,6 +53,9 @@ where
// Remove unreachable code
opt ['ABC'.Rtn:ss] = ['ABC'.Rtn:opt $ skipUntilEntryPoint ss]
opt ['ABC'.Jmp l:ss] = ['ABC'.Jmp l:opt $ skipUntilEntryPoint ss]
+ // Remove needless moves between A and B stacks
+ opt ['ABC'.PushI_a 0:'ABC'.Pop_a 1:'ABC'.Create:'ABC'.FillI_b 0 0:'ABC'.Pop_b 1:ss] = opt ss
+ opt ['ABC'.PushB_a 0:'ABC'.Pop_a 1:'ABC'.Create:'ABC'.FillB_b 0 0:'ABC'.Pop_b 1:ss] = opt ss
// Base cases
opt [s:ss] = [s:opt ss]
opt [] = []