summary refs log tree commit diff
path: root/main.c
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin@c9x.me>2022-11-20 22:14:41 +0100
committerQuentin Carbonneaux <quentin@c9x.me>2022-11-20 22:14:41 +0100
commit674901b71834739cccf3f8665833dc125d1172b7 (patch)
tree34da28ca9697819d5250d45deaea631007165de0 /main.c
parentf5007126f3140a8c932d393c5b217308b80bd46a (diff)
downloadroux-674901b71834739cccf3f8665833dc125d1172b7.tar.gz
new slot coalescing pass
This pass limits stack usage when
many small aggregates are allocated
on the stack. A fast liveness
analysis figures out which slots
interfere and the pass then fuses
slots that do not interfere. The
pass also kills stack slots that
are only ever assigned.

On the hare stdlib test suite, this
fusion pass managed to reduce the
total eligible slot bytes count
by 84%.

The slots considered for fusion
must not escape and not exceed
64 bytes in size.
Diffstat (limited to 'main.c')
-rw-r--r--main.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/main.c b/main.c
index 8959cd9..3fcfd7f 100644
--- a/main.c
+++ b/main.c
@@ -62,7 +62,7 @@ func(Fn *fn)
 	fillrpo(fn);
 	fillpreds(fn);
 	filluse(fn);
-	memopt(fn);
+	promote(fn);
 	filluse(fn);
 	ssa(fn);
 	filluse(fn);
@@ -70,6 +70,9 @@ func(Fn *fn)
 	fillalias(fn);
 	loadopt(fn);
 	filluse(fn);
+	fillalias(fn);
+	coalesce(fn);
+	filluse(fn);
 	ssacheck(fn);
 	copy(fn);
 	filluse(fn);