code: plan9front

Download patch

ref: e74a87d537dfd2ed817ba94314df7c517b51d65a
parent: ef1b1e159b71e36a3e2870a28f905f5715795dcf
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Tue Dec 12 15:42:20 EST 2023

?c: allow registerizing .ret (thanks rodri)

In constrast to .safe, the .ret variable can
be registerized just fine which can avoid
some quite ugly code in functions manipulating
a returned struct.

--- a/sys/src/cmd/2c/reg.c
+++ b/sys/src/cmd/2c/reg.c
@@ -617,7 +617,7 @@
 		v++;
 	}
 	if(s)
-		if(s->name[0] == '.')
+		if(s->name[0] == '.' && s != nodret->sym)
 			goto none;
 	if(nvar >= NVAR) {
 		if(debug['w'] > 1 && s)
--- a/sys/src/cmd/5c/reg.c
+++ b/sys/src/cmd/5c/reg.c
@@ -585,7 +585,7 @@
 		v++;
 	}
 	if(s)
-		if(s->name[0] == '.')
+		if(s->name[0] == '.' && s != nodret->sym)
 			goto none;
 	if(nvar >= NVAR) {
 		if(debug['w'] > 1 && s)
--- a/sys/src/cmd/6c/reg.c
+++ b/sys/src/cmd/6c/reg.c
@@ -752,7 +752,7 @@
 	s = a->sym;
 	if(s == S)
 		goto none;
-	if(s->name[0] == '.')
+	if(s->name[0] == '.' && s != nodret->sym)
 		goto none;
 	et = a->etype;
 	o = a->offset;
--- a/sys/src/cmd/7c/reg.c
+++ b/sys/src/cmd/7c/reg.c
@@ -584,7 +584,7 @@
 		v++;
 	}
 	if(s)
-		if(s->name[0] == '.')
+		if(s->name[0] == '.' && s != nodret->sym)
 			goto none;
 	if(nvar >= NVAR) {
 		if(debug['w'] > 1 && s)
--- a/sys/src/cmd/8c/reg.c
+++ b/sys/src/cmd/8c/reg.c
@@ -682,7 +682,7 @@
 	s = a->sym;
 	if(s == S)
 		goto none;
-	if(s->name[0] == '.')
+	if(s->name[0] == '.' && s != nodret->sym)
 		goto none;
 	o = a->offset;
 	v = var;
--- a/sys/src/cmd/qc/reg.c
+++ b/sys/src/cmd/qc/reg.c
@@ -545,7 +545,7 @@
 		v++;
 	}
 	if(s)
-		if(s->name[0] == '.')
+		if(s->name[0] == '.' && s != nodret->sym)
 			goto none;
 	if(nvar >= NVAR) {
 		if(debug['w'] > 1 && s)
--- a/sys/src/cmd/vc/reg.c
+++ b/sys/src/cmd/vc/reg.c
@@ -575,7 +575,7 @@
 		v++;
 	}
 	if(s)
-		if(s->name[0] == '.')
+		if(s->name[0] == '.' && s != nodret->sym)
 			goto none;
 	if(nvar >= NVAR) {
 		if(debug['w'] > 1 && s)