git: 9front

Download patch

ref: 66e9e21f8b2e42a5ff286e7e1b8b8fbeeaf8a573
parent: b8274016ffd6b61490a4105dde73cba745b1e64f
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Tue Nov 16 20:23:57 EST 2021

6c: extern registers must be considered used on return

the peephole optimizer would remove stores to extern
register before a return statement as it would think
they are only set, but not used.

--- a/sys/src/cmd/6c/peep.c
+++ b/sys/src/cmd/6c/peep.c
@@ -890,6 +890,8 @@
 		return 0;
 
 	case ARET:	/* funny */
+		if(REGEXT && v->type <= REGEXT && v->type > exregoffset)
+			return 2;
 		if(v->type == REGRET || v->type == FREGRET)
 			return 2;
 		if(s != A)
--