summary refs log tree commit diff
path: root/spill.c
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2021-09-25 13:29:54 -0700
committerQuentin Carbonneaux <quentin@c9x.me>2021-10-11 10:26:34 +0200
commit4309ac5bdc75763324fb7384f04027c3f07525cd (patch)
treeb32b84c52cf24e8eee8386189c4c8689f8d3ea51 /spill.c
parent8401139089ad8dfd1c8478e14a0cbf04572c42ce (diff)
downloadroux-4309ac5bdc75763324fb7384f04027c3f07525cd.tar.gz
spill: add some comments describing functions
Diffstat (limited to 'spill.c')
-rw-r--r--spill.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/spill.c b/spill.c
index 132e0e9..baceccc 100644
--- a/spill.c
+++ b/spill.c
@@ -155,6 +155,12 @@ slot(int t)
 	return SLOT(s);
 }
 
+/* restricts b to hold at most k
+ * temporaries, preferring those
+ * present in f (if given), then
+ * those with the largest spill
+ * cost
+ */
 static void
 limit(BSet *b, int k, BSet *f)
 {
@@ -187,8 +193,14 @@ limit(BSet *b, int k, BSet *f)
 		slot(tarr[i]);
 }
 
+/* spills temporaries to fit the
+ * target limits using the same
+ * preferences as limit(); assumes
+ * that k1 gprs and k2 fprs are
+ * currently in use
+ */
 static void
-limit2(BSet *b1, int k1, int k2, BSet *fst)
+limit2(BSet *b1, int k1, int k2, BSet *f)
 {
 	BSet b2[1];
 
@@ -196,8 +208,8 @@ limit2(BSet *b1, int k1, int k2, BSet *fst)
 	bscopy(b2, b1);
 	bsinter(b1, mask[0]);
 	bsinter(b2, mask[1]);
-	limit(b1, T.ngpr - k1, fst);
-	limit(b2, T.nfpr - k2, fst);
+	limit(b1, T.ngpr - k1, f);
+	limit(b2, T.nfpr - k2, f);
 	bsunion(b1, b2);
 }
 
@@ -210,6 +222,9 @@ sethint(BSet *u, bits r)
 		tmp[phicls(t, tmp)].hint.m |= r;
 }
 
+/* reloads temporaries in u that are
+ * not in v from their slots
+ */
 static void
 reloads(BSet *u, BSet *v)
 {