shithub: scc

Download patch

ref: 15e86f6ab34475a0be35a4acaa04c0f29716297b
parent: 9ecf926bc59721f5d244c679dd58acf39faf2e30
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Fri Dec 29 06:55:47 EST 2017

[as-z80] Remove argtype field form symbols

These field could be integrated in the value field.

--- a/as/as.h
+++ b/as/as.h
@@ -124,7 +124,6 @@
 	String type;
 	unsigned char flags;
 	unsigned char pass;
-	unsigned char argtype;
 	TUINT value;
 	TUINT size;
 	Section *section;
--- a/as/symbol.c
+++ b/as/symbol.c
@@ -34,7 +34,7 @@
 		fprintf(stderr, "[%d]", (int) (bp - hashtbl));
 		for (sym = *bp; sym; sym = sym->hash) {
 			fprintf(stderr, " -> %s:%0X:%0X",
-			       sym->name.buf, sym->flags, sym->argtype);
+			       sym->name.buf, sym->flags, sym->value);
 		}
 		putc('\n', stderr);
 	}
--- a/as/target/i386/proc.c
+++ b/as/target/i386/proc.c
@@ -94,7 +94,7 @@
 	for (bp = regs; bp->name; ++bp) {
 		Symbol *sym = lookup(bp->name);
 		sym->flags = FREG;
-		sym->argtype = bp->type;
+		sym->value = bp->type;
 	}
 }
 
--- a/as/target/x80/ins.c
+++ b/as/target/x80/ins.c
@@ -203,9 +203,9 @@
 	memcpy(buf, op->bytes, n);
 
 	if (par1->addr == AREG)
-		regval |= reg2int(par1->sym->argtype) << 3;
+		regval |= reg2int(par1->sym->value) << 3;
 	if (par2->addr == AREG)
-		regval |= reg2int(par2->sym->argtype);
+		regval |= reg2int(par2->sym->value);
 	else if (par2->addr == AIMM)
 		buf[--i] = par2->sym->value;
 
@@ -222,7 +222,7 @@
 	unsigned char buf[4];
 
 	par = (args[1]) ? args[1] : args[0];
-	val = reg2int(par->sym->argtype);
+	val = reg2int(par->sym->value);
 	memcpy(buf, op->bytes, n);
 	buf[n-1] |= val << 4;
 	emit(buf, n);
@@ -255,7 +255,7 @@
 	val = src->sym->value;
 	buf[n-1] = val >> 8;
 	buf[n-2] = val;
-	buf[n-3] |= reg2int(dst->sym->argtype) << 4;
+	buf[n-3] |= reg2int(dst->sym->value) << 4;
 	emit(buf, n);
 }
 
@@ -280,7 +280,7 @@
 		val = par->sym->value;
 		break;
 	case AREG:
-		val = reg2int(par->sym->argtype) << shift;
+		val = reg2int(par->sym->value) << shift;
 		break;
 	case AINDEX:
 		val = par->left->right->sym->value;
@@ -324,7 +324,7 @@
 		buf[--i] = imm->sym->value;
 	buf[--i] = idx->sym->value;
 	if (reg)
-		buf[--i] |= reg2int(reg->sym->argtype) << shift;
+		buf[--i] |= reg2int(reg->sym->value) << shift;
 
 	emit(buf, n);
 }
@@ -347,7 +347,7 @@
 	if (port->addr == ADIRECT)
 		val = port->left->sym->value;
 	else if (value->addr == AREG)
-		val = reg2int(value->sym->argtype) << 3;
+		val = reg2int(value->sym->value) << 3;
 	else
 		val = 0;
 
@@ -380,7 +380,7 @@
 		if (!par)
 			break;
 	case AREG:
-		val = reg2int(par->sym->argtype);
+		val = reg2int(par->sym->value);
 		buf[n-1] |= val;
 		break;
 	case AINDIR:
@@ -430,7 +430,7 @@
 		buf[--i] = val;
 	}
 	if (flag)
-		buf[--i] |= flag2int(flag->sym->argtype) << 3;
+		buf[--i] |= flag2int(flag->sym->value) << 3;
 
 	emit(buf, n);
 }
--- a/as/target/z80/proc.c
+++ b/as/target/z80/proc.c
@@ -56,7 +56,7 @@
 	for (bp = regs; bp->name; ++bp) {
 		Symbol *sym = lookup(bp->name);
 		sym->flags = FREG;
-		sym->argtype = bp->type;
+		sym->value = bp->type;
 	}
 }
 
@@ -115,7 +115,7 @@
 		case AREG_SP:
 		case AREG_AF:
 		case AREG_AF_:
-			if (np->addr != AREG || np->sym->argtype != arg)
+			if (np->addr != AREG || np->sym->value != arg)
 				return 0;
 			break;
 		case AREG_RCLASS:
@@ -144,7 +144,7 @@
 		register_class:
 			if (np->addr != AREG)
 				return 0;
-			if (!(*class)(np->sym->argtype))
+			if (!(*class)(np->sym->value))
 				return 0;
 			break;
 		case AINDEX_IY:
@@ -155,7 +155,7 @@
 		index_address:
 			if (np->addr != AINDEX)
 				return 0;
-			if (np->left->left->sym->argtype != arg)
+			if (np->left->left->sym->value != arg)
 				return 0;
 			if (toobig(np, arg))
 				error("overflow in index");