# HG changeset patch # User William Astle # Date 1426519640 21600 # Node ID 98f3e016cfd845569473195de90480af437d9115 # Parent 12e2453f8417f4d75b27894aab522a410f3c606d 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. diff -r 12e2453f8417 -r 98f3e016cfd8 lwasm/lwasm.h --- 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 }; diff -r 12e2453f8417 -r 98f3e016cfd8 lwasm/pass1.c --- 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) diff -r 12e2453f8417 -r 98f3e016cfd8 lwasm/pragma.c --- 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} };