changeset 343:98f3e016cfd8

Add pragma to turn off forward reference optimization Much source code doesn't benefit much, if at all, from forward reference optimization. Add "pragma forwardrefmax" to turn off such optimization in the event that it is not required and long assembly times result.
author William Astle <lost@l-w.ca>
date Mon, 16 Mar 2015 09:27:20 -0600
parents 12e2453f8417
children 55c1f9a321e9
files lwasm/lwasm.h lwasm/pass1.c lwasm/pragma.c
diffstat 3 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lwasm/lwasm.h	Sat Mar 14 14:06:13 2015 -0600
+++ b/lwasm/lwasm.h	Mon Mar 16 09:27:20 2015 -0600
@@ -90,7 +90,8 @@
 	PRAGMA_EXPORT = 0x0200,				// export symbols by default, unless local
 	PRAGMA_SYMBOLNOCASE = 0x400,		// symbols defined under this pragma are matched case insensitively
 	PRAGMA_CONDUNDEFZERO = 0x800,		// treat undefined symbols as zero in conditionals during pass 1
-	PRAGMA_6800COMPAT = 0x1000			// enable 6800 compatibility opcodes
+	PRAGMA_6800COMPAT = 0x1000,			// enable 6800 compatibility opcodes
+	PRAGMA_FORWARDREFMAX = 0x2000		// force incomplete references on pass 1 to maximum mode
 };
 
 
--- a/lwasm/pass1.c	Sat Mar 14 14:06:13 2015 -0600
+++ b/lwasm/pass1.c	Mon Mar 16 09:27:20 2015 -0600
@@ -342,6 +342,11 @@
 						// call parse function
 						debug_message(as, 100, "len = %d, dlen = %d", cl -> len, cl -> dlen);
 						(instab[opnum].parse)(as, cl, &p1);
+						// if we're forcing address modes on pass 1, force a resolution
+						if (CURPRAGMA(cl, PRAGMA_FORWARDREFMAX) && instab[opnum].resolve)
+						{
+							(instab[opnum].resolve)(as, cl, 1);
+						}
 						if ((cl -> inmod == 0) && cl -> len >= 0 && cl -> dlen >= 0)
 						{
 							if (cl -> len == 0)
--- a/lwasm/pragma.c	Sat Mar 14 14:06:13 2015 -0600
+++ b/lwasm/pragma.c	Mon Mar 16 09:27:20 2015 -0600
@@ -61,6 +61,7 @@
 	{ "nosymbolcase", "symbolcase", PRAGMA_SYMBOLNOCASE },
 	{ "condundefzero", "nocondundefzero", PRAGMA_CONDUNDEFZERO },
 	{ "6800compat", "no6800compat", PRAGMA_6800COMPAT },
+	{ "forwardrefmax", "noforwardrefmax", PRAGMA_FORWARDREFMAX },
 	{ 0, 0, 0}
 };