shithub: scc

Download patch

ref: 6030d9c7298661721d0490c0ebf15e0b3aa5181e
parent: 989be0ccc62e691120b60f29a8da641b60954e52
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Wed Sep 27 18:34:22 EDT 2017

[as] Add skeleton to check size of IMM operands

At this moment this check is not performed, but the call to
the correct function is added.

--- a/as/as.h
+++ b/as/as.h
@@ -108,6 +108,7 @@
 extern Section *section(char *name);
 extern Symbol *tmpsym(TUINT val);
 extern void killtmp(void);
+extern int toobig(Node *np, int type);
 
 /* main.c */
 extern Symbol *lookup(char *name, int type);
--- a/as/symbol.c
+++ b/as/symbol.c
@@ -115,6 +115,13 @@
 	return sym;
 }
 
+int
+toobig(Node *np, int type)
+{
+	/* TODO */
+	return 0;
+}
+
 char *
 pack(TUINT v, int n, int inc)
 {
--- a/as/target/z80/proc.c
+++ b/as/target/z80/proc.c
@@ -71,6 +71,8 @@
 			np = *args++;
 			if (np->addr != AIMM)
 				return 0;
+			if (toobig(np, arg))
+				return 0;
 			break;
 		default:
 			abort();