shithub: riscv

Download patch

ref: 92e9b85b04214f5bf5664d0e01cdd6a30d951c22
parent: ecb298419235bf5721db7e37e91af2d4c28bc783
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Thu Sep 7 11:30:41 EDT 2023

7c: add from3 support (no functional change)

--- a/sys/src/cmd/7c/gc.h
+++ b/sys/src/cmd/7c/gc.h
@@ -46,6 +46,7 @@
 struct	Prog
 {
 	Adr	from;
+	Adr	from3;
 	Adr	to;
 	Prog*	link;
 	long	lineno;
--- a/sys/src/cmd/7c/list.c
+++ b/sys/src/cmd/7c/list.c
@@ -60,6 +60,8 @@
 			s = seprint(s, e, ",R%d", p->reg);
 		else
 			s = seprint(s, e, ",F%d", p->reg);
+	if(p->from3.type != D_NONE)
+		s = seprint(s, e, ",%D", &p->from3);
 	if(p->to.type != D_NONE)
 		s = seprint(s, e, s[-1] == '\t' ? "%D" : ",%D", &p->to);
 	if(s[-1] == '\t')
--- a/sys/src/cmd/7c/peep.c
+++ b/sys/src/cmd/7c/peep.c
@@ -545,6 +545,7 @@
 	p->as = ANOP;
 	p->scond = zprog.scond;
 	p->from = zprog.from;
+	p->from3 = zprog.from3;
 	p->to = zprog.to;
 	p->reg = zprog.reg; /**/
 }
--- a/sys/src/cmd/7c/swt.c
+++ b/sys/src/cmd/7c/swt.c
@@ -309,6 +309,8 @@
 	bf[0] = p->as;
 	bf[1] = p->as>>8;
 	bf[2] = p->reg;
+	if(p->from3.type != D_NONE)
+		bf[2] |= 0x40;
 	l = p->lineno;
 	bf[3] = l;
 	bf[4] = l>>8;
@@ -315,6 +317,8 @@
 	bf[5] = l>>16;
 	bf[6] = l>>24;
 	bp = zaddr(bf+7, &p->from, sf);
+	if(bf[2] & 0x40)
+		bp = zaddr(bp, &p->from3, 0);
 	bp = zaddr(bp, &p->to, st);
 	Bwrite(b, bf, bp-bf);
 }
--- a/sys/src/cmd/7c/txt.c
+++ b/sys/src/cmd/7c/txt.c
@@ -40,6 +40,7 @@
 	zprog.from.type = D_NONE;
 	zprog.from.name = D_NONE;
 	zprog.from.reg = NREG;
+	zprog.from3 = zprog.from;
 	zprog.to = zprog.from;
 
 	regnode.op = OREGISTER;