From: Taylor R Campbell Date: Mon, 7 Oct 2013 22:57:53 +0000 (+0000) Subject: Turn some phony rules into explicit file rules to reduce rebuilds. X-Git-Tag: release-9.2.0~72 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=54e7f433ab16f65cd12779b7a672edf713c72427;p=mit-scheme.git Turn some phony rules into explicit file rules to reduce rebuilds. Unfinished conversion; some of the explicit file rules still depend on phony rules. Finishing this is left as an exercise for the reader. --- diff --git a/src/Makefile.in b/src/Makefile.in index f6dc36897..2a3150cdb 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -214,6 +214,11 @@ restore: ### Stuff we build with the tools compiler necessarily from scratch. +# This rule is for LIARC. +.SUFFIXES: .bld .pkd .c +.pkd.c .bld.c: toolchain + echo '(cbf "$<")' | $(TOOL_COMPILER) + # Compiler (LIAR) # The subdirectories can be compiled independently and in parallel, but @@ -226,15 +231,9 @@ all-compiler: compile-compiler .PHONY: bundle-compiler bundle-compiler: compile-compiler -bundle-compiler: compile-compiler-pkd +bundle-compiler: compiler/compiler-unx.c (cd compiler && $(MAKE) compile-liarc-bundle) -.PHONY: compile-compiler-pkd -compile-compiler-pkd: toolchain -compile-compiler-pkd: cref-compiler - test compiler/compiler-unx.c -nt compiler/compiler-unx.pkd || \ - echo '(cbf "compiler/compiler-unx.pkd")' | $(TOOL_COMPILER) - .PHONY: compile-compiler compile-compiler: compile-compiler-back compile-compiler: compile-compiler-base @@ -294,9 +293,12 @@ syntax-compiler: cref-compiler | $(TOOL_SYNTAXER) .PHONY: cref-compiler -cref-compiler: toolchain -cref-compiler: cref-runtime -cref-compiler: cref-sf +cref-compiler: compiler/compiler-unx.pkd + +compiler/compiler-unx.pkd: toolchain +compiler/compiler-unx.pkd: compiler/compiler.pkg +compiler/compiler-unx.pkd: cref-runtime +compiler/compiler-unx.pkd: cref-sf (echo '(with-working-directory-pathname "compiler"' && \ echo ' (lambda ()' && \ echo ' (cref/generate-trivial-constructor "compiler")))') \ @@ -310,15 +312,9 @@ all-cref: compile-cref .PHONY: bundle-cref bundle-cref: compile-cref -bundle-cref: compile-cref-pkd +bundle-cref: cref/cref-unx.c (cd cref && $(MAKE) compile-liarc-bundle) -.PHONY: compile-cref-pkd -compile-cref-pkd: toolchain -compile-cref-pkd: cref-cref - test cref/cref-unx.c -nt cref/cref-unx.pkd || \ - echo '(cbf "cref/cref-unx.pkd")' | $(TOOL_COMPILER) - .PHONY: compile-cref compile-cref: toolchain compile-cref: syntax-cref @@ -334,8 +330,11 @@ syntax-cref: cref-cref | $(TOOL_SYNTAXER) .PHONY: cref-cref -cref-cref: toolchain -cref-cref: cref-runtime +cref-cref: cref/cref-unx.pkd + +cref/cref-unx.pkd: toolchain +cref/cref-unx.pkd: cref-runtime +cref/cref-unx.pkd: cref/cref.pkg (echo '(with-working-directory-pathname "cref"' && \ echo ' (lambda ()' && \ echo ' (cref/generate-trivial-constructor "cref")))') \ @@ -345,13 +344,10 @@ cref-cref: cref-runtime .PHONY: all-runtime all-runtime: compile-runtime -@IF_LIARC@all-runtime: compile-runtime-pkd +@IF_LIARC@all-runtime: bundle-runtime -.PHONY: compile-runtime-pkd -compile-runtime-pkd: toolchain -compile-runtime-pkd: cref-runtime - test runtime/runtime-unx.c -nt runtime/runtime-unx.pkd || \ - echo '(cbf "runtime/runtime-unx.pkd")' | $(TOOL_COMPILER) +.PHONY: bundle-runtime +bundle-runtime: runtime/runtime-unx.c .PHONY: compile-runtime compile-runtime: toolchain @@ -368,7 +364,10 @@ syntax-runtime: cref-runtime | $(TOOL_SYNTAXER) .PHONY: cref-runtime -cref-runtime: toolchain +cref-runtime: runtime/runtime-unx.pkd + +runtime/runtime-unx.pkd: toolchain +runtime/runtime-unx.pkd: runtime/runtime.pkg (echo '(with-working-directory-pathname "runtime"' && \ echo ' (lambda ()' && \ echo ' (cref/generate-trivial-constructor "runtime")))') \ @@ -382,15 +381,9 @@ all-sf: compile-sf .PHONY: bundle-sf bundle-sf: compile-sf -bundle-sf: compile-sf-pkd +bundle-sf: sf/sf-unx.c (cd sf && $(MAKE) compile-liarc-bundle) -.PHONY: compile-sf-pkd -compile-sf-pkd: toolchain -compile-sf-pkd: cref-sf - test sf/sf-unx.c -nt sf/sf-unx.pkd || \ - echo '(cbf "sf/sf-unx.pkd")' | $(TOOL_COMPILER) - .PHONY: compile-sf compile-sf: toolchain compile-sf: syntax-sf @@ -406,8 +399,11 @@ syntax-sf: cref-sf | $(TOOL_SYNTAXER) .PHONY: cref-sf -cref-sf: toolchain -cref-sf: cref-runtime +cref-sf: sf/sf-unx.pkd + +sf/sf-unx.pkd: toolchain +sf/sf-unx.pkd: cref-runtime +sf/sf-unx.pkd: sf/sf.pkg (echo '(with-working-directory-pathname "sf"' && \ echo ' (lambda ()' && \ echo ' (cref/generate-trivial-constructor "sf")))') \ @@ -425,21 +421,11 @@ all-edwin: compile-edwin .PHONY: bundle-edwin bundle-edwin: compile-edwin -bundle-edwin: compile-edwin-bld -bundle-edwin: compile-edwin-pkd +bundle-edwin: edwin/edwin.c +bundle-edwin: edwin/edwin-unx.c (cd edwin && $(MAKE) compile-liarc-bundle) -.PHONY: compile-edwin-bld -compile-edwin-bld: toolchain -compile-edwin-bld: syntax-edwin - test edwin/edwin.c -nt edwin/edwin.bld || \ - echo '(cbf "edwin/edwin.bld")' | $(TOOL_COMPILER) - -.PHONY: compile-edwin-pkd -compile-edwin-pkd: toolchain -compile-edwin-pkd: cref-edwin - test edwin/edwin-unx.c -nt edwin/edwin-unx.pkd || \ - echo '(cbf "edwin/edwin-unx.pkd")' | $(TOOL_COMPILER) +edwin/edwin.bld: syntax-edwin .PHONY: compile-edwin compile-edwin: toolchain @@ -456,10 +442,13 @@ syntax-edwin: cref-edwin | $(TOOL_TOOLCHAIN) .PHONY: cref-edwin -cref-edwin: toolchain -cref-edwin: cref-runtime -cref-edwin: cref-win32 -cref-edwin: cref-xml +cref-edwin: edwin/edwin-unx.pkd + +edwin/edwin-unx.pkd: toolchain +edwin/edwin-unx.pkd: cref-runtime +edwin/edwin-unx.pkd: cref-win32 +edwin/edwin-unx.pkd: cref-xml +edwin/edwin-unx.pkd: edwin/edwin.pkg (echo '(with-working-directory-pathname "edwin"' && \ echo ' (lambda ()' && \ echo ' (cref/generate-trivial-constructor "edwin")))') \ @@ -473,25 +462,23 @@ all-ffi: compile-ffi .PHONY: bundle-ffi bundle-ffi: compile-ffi -bundle-ffi: compile-ffi-pkd +bundle-ffi: ffi/ffi-unx.c (cd ffi && $(MAKE) compile-liarc-bundle) -.PHONY: compile-ffi-pkd -compile-ffi-pkd: toolchain -compile-ffi-pkd: cref-ffi - test ffi/ffi-unx.c -nt ffi/ffi-unx.pkd || \ - echo '(cbf "ffi/ffi-unx.pkd")' | $(TOOL_COMPILER) - .PHONY: compile-ffi compile-ffi: toolchain compile-ffi: cref-ffi +compile-ffi: syntax-cref # XXX Urgh! Should not be here! (echo '(with-working-directory-pathname "ffi"' && \ echo ' (lambda () (load "compile.scm")))') \ | $(TOOL_TOOLCHAIN) .PHONY: cref-ffi -cref-ffi: toolchain -cref-ffi: cref-runtime +cref-ffi: ffi/ffi-unx.pkd + +ffi/ffi-unx.pkd: toolchain +ffi/ffi-unx.pkd: cref-runtime +ffi/ffi-unx.pkd: ffi/ffi.pkg (echo '(with-working-directory-pathname "ffi"' && \ echo ' (lambda ()' && \ echo ' (cref/generate-trivial-constructor "ffi")))') \ @@ -505,15 +492,9 @@ all-sos: compile-sos .PHONY: bundle-sos bundle-sos: compile-sos -bundle-sos: compile-sos-pkd +bundle-sos: sos/sos-unx.c (cd sos && $(MAKE) compile-liarc-bundle) -.PHONY: compile-sos-pkd -compile-sos-pkd: toolchain -compile-sos-pkd: cref-sos - test sos/sos-unx.c -nt sos/sos-unx.pkd || \ - echo '(cbf "sos/sos-unx.pkd")' | $(TOOL_COMPILER) - .PHONY: compile-sos compile-sos: toolchain compile-sos: cref-sos @@ -522,8 +503,11 @@ compile-sos: cref-sos | $(TOOL_TOOLCHAIN) .PHONY: cref-sos -cref-sos: toolchain -cref-sos: cref-runtime +cref-sos: sos/sos-unx.pkd + +sos/sos-unx.pkd: toolchain +sos/sos-unx.pkd: cref-runtime +sos/sos-unx.pkd: sos/sos.pkg (echo '(with-working-directory-pathname "sos"' && \ echo ' (lambda ()' && \ echo ' (cref/generate-trivial-constructor "sos")))') \ @@ -537,15 +521,9 @@ all-ssp: compile-ssp .PHONY: bundle-ssp bundle-ssp: compile-ssp -bundle-ssp: compile-ssp-pkd +bundle-ssp: ssp/ssp-unx.c (cd ssp && $(MAKE) compile-liarc-bundle) -.PHONY: compile-ssp-pkd -compile-ssp-pkd: toolchain -compile-ssp-pkd: cref-ssp - test ssp/ssp-unx.c -nt ssp/ssp-unx.pkd || \ - echo '(cbf "ssp/ssp-unx.pkd")' | $(TOOL_COMPILER) - .PHONY: compile-ssp compile-ssp: toolchain compile-ssp: cref-ssp @@ -554,9 +532,12 @@ compile-ssp: cref-ssp | $(TOOL_TOOLCHAIN) .PHONY: cref-ssp -cref-ssp: toolchain -cref-ssp: cref-runtime -cref-ssp: cref-xml +cref-ssp: ssp/ssp-unx.pkd + +ssp/ssp-unx.pkd: toolchain +ssp/ssp-unx.pkd: cref-runtime +ssp/ssp-unx.pkd: cref-xml +ssp/ssp-unx.pkd: ssp/ssp.pkg (echo '(with-working-directory-pathname "ssp"' && \ echo ' (lambda ()' && \ echo ' (cref/generate-trivial-constructor "ssp")))') \ @@ -570,15 +551,9 @@ all-star-parser: compile-star-parser .PHONY: bundle-star-parser bundle-star-parser: compile-star-parser -bundle-star-parser: compile-star-parser-pkd +bundle-star-parser: star-parser/parser-unx.c (cd star-parser && $(MAKE) compile-liarc-bundle) -.PHONY: compile-star-parser-pkd -compile-star-parser-pkd: toolchain -compile-star-parser-pkd: cref-star-parser - test star-parser/parser-unx.c -nt star-parser/parser-unx.pkd || \ - echo '(cbf "star-parser/parser-unx.pkd")' | $(TOOL_COMPILER) - .PHONY: compile-star-parser compile-star-parser: toolchain compile-star-parser: cref-star-parser @@ -587,8 +562,11 @@ compile-star-parser: cref-star-parser | $(TOOL_TOOLCHAIN) .PHONY: cref-star-parser -cref-star-parser: toolchain -cref-star-parser: cref-runtime +cref-star-parser: star-parser/parser-unx.pkd + +star-parser/parser-unx.pkd: toolchain +star-parser/parser-unx.pkd: cref-runtime +star-parser/parser-unx.pkd: star-parser/parser.pkg (echo '(with-working-directory-pathname "star-parser"' && \ echo ' (lambda ()' && \ echo ' (cref/generate-trivial-constructor "parser")))') \ @@ -614,8 +592,11 @@ syntax-win32: cref-win32 | $(TOOL_SYNTAXER) .PHONY: cref-win32 -cref-win32: toolchain -cref-win32: cref-runtime +cref-win32: win32/win32-unx.pkd # XXX Er... + +win32/win32-unx.pkd: toolchain +win32/win32-unx.pkd: cref-runtime +win32/win32-unx.pkd: win32/win32.pkg (echo '(with-working-directory-pathname "win32"' && \ echo ' (lambda ()' && \ echo ' (cref/generate-trivial-constructor "win32")))') \ @@ -629,15 +610,9 @@ all-xml: compile-xml .PHONY: bundle-xml bundle-xml: compile-xml -bundle-xml: compile-xml-pkd +bundle-xml: xml/xml-unx.c (cd xml && $(MAKE) compile-liarc-bundle) -.PHONY: compile-xml-pkd -compile-xml-pkd: toolchain -compile-xml-pkd: cref-xml - test xml/xml-unx.c -nt xml/xml-unx.pkd || \ - echo '(cbf "xml/xml-unx.pkd")' | $(TOOL_COMPILER) - .PHONY: compile-xml compile-xml: toolchain compile-xml: cref-xml @@ -646,9 +621,12 @@ compile-xml: cref-xml | $(TOOL_TOOLCHAIN) .PHONY: cref-xml -cref-xml: toolchain -cref-xml: cref-runtime -cref-xml: cref-sos +cref-xml: xml/xml-unx.pkd + +xml/xml-unx.pkd: toolchain +xml/xml-unx.pkd: cref-runtime +xml/xml-unx.pkd: cref-sos +xml/xml-unx.pkd: xml/xml.pkg (echo '(with-working-directory-pathname "xml"' && \ echo ' (lambda ()' && \ echo ' (cref/generate-trivial-constructor "xml")))') \ @@ -708,13 +686,12 @@ all-imail: compile-imail .PHONY: bundle-imail bundle-imail: compile-imail -bundle-imail: compile-imail-pkd +bundle-imail: imail/imail-unx.c (cd imail && $(MAKE) compile-liarc-bundle) -.PHONY: compile-imail-pkd -compile-imail-pkd: target-toolchain -compile-imail-pkd: cref-imail - test imail/imail-unx.c -nt imail/imail-unx.pkd || \ +# Must write this rule explicitly because we use TARGET_COMPILER, not +# TOOL_COMPILER. +imail/imail-unx.c: imail/imail-unx.pkd echo '(cbf "imail/imail-unx.pkd")' | $(TARGET_COMPILER) .PHONY: compile-imail @@ -734,11 +711,14 @@ compile-imail: cref-imail | $(TARGET_TOOLCHAIN) .PHONY: cref-imail -cref-imail: target-toolchain -cref-imail: cref-edwin -cref-imail: cref-runtime -cref-imail: cref-sos -cref-imail: cref-star-parser +cref-imail: imail/imail-unx.pkd + +imail/imail-unx.pkd: target-toolchain +imail/imail-unx.pkd: cref-edwin +imail/imail-unx.pkd: cref-runtime +imail/imail-unx.pkd: cref-sos +imail/imail-unx.pkd: cref-star-parser +imail/imail-unx.pkd: imail/imail.pkg (echo '(with-working-directory-pathname "imail"' && \ echo ' (lambda ()' && \ echo ' (cref/generate-trivial-constructor "imail")))') \ diff --git a/src/microcode/svm1-interp.c b/src/microcode/svm1-interp.c index 1f3fa0640..90e8d5e1f 100644 --- a/src/microcode/svm1-interp.c +++ b/src/microcode/svm1-interp.c @@ -128,17 +128,27 @@ static long svm1_result; #define ILL EXIT_VM (ERR_COMPILED_CODE_ERROR) -typedef bool address_decoder_t (word_t *); +typedef struct address_s address_t; +typedef word_t address_value_t (address_t *); +typedef bool address_decoder_t (address_t *); static address_decoder_t * address_decoders [256]; -#define ADDRESS_VALUE(name) name +struct address_s +{ + wreg_t r1; + wreg_t r2; + word_t n1; + long n2; + address_value_t * value; +}; +#define ADDRESS_VALUE(name) ((name.value) (&name)) #define DEFINE_ADDRESS_DECODER(name) \ - static bool decode_addr_##name (word_t * address) -#define ADDRESS_DECODED(addr) (*address) = (addr); return (true) + static bool decode_addr_##name (address_t * address) +#define ADDRESS_DECODED return (true) #define DECODE_ADDRESS(name) \ - word_t name; if (predict_false (! (decode_address (&name)))) ILL -static bool decode_address (word_t *); + address_t name; if (predict_false (! (decode_address (&name)))) ILL +static bool decode_address (address_t *); typedef bool trap_0_t (void); typedef bool trap_1_t (wreg_t); @@ -1225,273 +1235,328 @@ DEFINE_BINARY_FR (atan2, ATAN2, atan2) /* Address decoders */ static inline bool -decode_address (word_t * address) +decode_address (address_t * address) { return ((* (address_decoders[NEXT_BYTE])) (address)); } static bool -illegal_address (word_t * address) +illegal_address (address_t * address) { (void) address; /* ignore */ return (false); } static word_t -offset_address_value (wreg_t base, word_t offset, unsigned int scale) +offset_address_value (address_t * address) { - return ((WREG_REF (base)) + (offset * scale)); + return ((WREG_REF (address->r1)) + (address->n1)); } -#define MAKE_OFFSET_ADDRESS(base, offset, scale) \ - ADDRESS_DECODED (offset_address_value ((base), (offset), (scale))) - DEFINE_ADDRESS_DECODER (indir) { DECODE_SVM1_ADDR_INDIR (base); - MAKE_OFFSET_ADDRESS (base, 0, 0); + (address->r1) = base; + (address->n1) = 0; + (address->value) = offset_address_value; + ADDRESS_DECODED; +} + +#define MAKE_OFFSET_ADDRESS(base, offset, scale) \ +{ \ + (address->r1) = (base); \ + (address->n1) = ((offset) * (scale)); \ + (address->value) = offset_address_value; \ } DEFINE_ADDRESS_DECODER (offset_s8_b) { DECODE_SVM1_ADDR_OFFSET_S8_B (base, offset); MAKE_OFFSET_ADDRESS (base, offset, SBYTE); + ADDRESS_DECODED; } DEFINE_ADDRESS_DECODER (offset_s8_w) { DECODE_SVM1_ADDR_OFFSET_S8_W (base, offset); MAKE_OFFSET_ADDRESS (base, offset, SWORD); + ADDRESS_DECODED; } DEFINE_ADDRESS_DECODER (offset_s8_f) { DECODE_SVM1_ADDR_OFFSET_S8_F (base, offset); MAKE_OFFSET_ADDRESS (base, offset, SFLOAT); + ADDRESS_DECODED; } DEFINE_ADDRESS_DECODER (offset_s16_b) { DECODE_SVM1_ADDR_OFFSET_S16_B (base, offset); MAKE_OFFSET_ADDRESS (base, offset, SBYTE); + ADDRESS_DECODED; } DEFINE_ADDRESS_DECODER (offset_s16_w) { DECODE_SVM1_ADDR_OFFSET_S16_W (base, offset); MAKE_OFFSET_ADDRESS (base, offset, SWORD); + ADDRESS_DECODED; } DEFINE_ADDRESS_DECODER (offset_s16_f) { DECODE_SVM1_ADDR_OFFSET_S16_F (base, offset); MAKE_OFFSET_ADDRESS (base, offset, SFLOAT); + ADDRESS_DECODED; } DEFINE_ADDRESS_DECODER (offset_s32_b) { DECODE_SVM1_ADDR_OFFSET_S32_B (base, offset); MAKE_OFFSET_ADDRESS (base, offset, SBYTE); + ADDRESS_DECODED; } DEFINE_ADDRESS_DECODER (offset_s32_w) { DECODE_SVM1_ADDR_OFFSET_S32_W (base, offset); MAKE_OFFSET_ADDRESS (base, offset, SWORD); + ADDRESS_DECODED; } DEFINE_ADDRESS_DECODER (offset_s32_f) { DECODE_SVM1_ADDR_OFFSET_S32_F (base, offset); MAKE_OFFSET_ADDRESS (base, offset, SFLOAT); + ADDRESS_DECODED; } -static inline word_t -indexed_address_value (wreg_t base, word_t offset, unsigned int oscale, - wreg_t index, unsigned int iscale) +static word_t +indexed_address_value (address_t * address) { return - ((WREG_REF (base)) - + (offset * oscale) - + ((WREG_REF (index)) * iscale)); + ((WREG_REF (address->r1)) + + (address->n1) + + ((WREG_REF (address->r2)) * (address->n2))); } #define MAKE_INDEXED_ADDRESS(base, offset, oscale, index, iscale) \ - ADDRESS_DECODED \ - (indexed_address_value ((base), (offset), (oscale), (index), (iscale))) +{ \ + (address->r1) = (base); \ + (address->n1) = ((offset) * (oscale)); \ + (address->r2) = (index); \ + (address->n2) = (iscale); \ + (address->value) = indexed_address_value; \ +} DEFINE_ADDRESS_DECODER (index_b_b) { DECODE_SVM1_ADDR_INDEX_B_B (base, offset, index); MAKE_INDEXED_ADDRESS (base, offset, SBYTE, index, SBYTE); + ADDRESS_DECODED; } DEFINE_ADDRESS_DECODER (index_b_w) { DECODE_SVM1_ADDR_INDEX_B_W (base, offset, index); MAKE_INDEXED_ADDRESS (base, offset, SBYTE, index, SWORD); + ADDRESS_DECODED; } DEFINE_ADDRESS_DECODER (index_b_f) { DECODE_SVM1_ADDR_INDEX_B_F (base, offset, index); MAKE_INDEXED_ADDRESS (base, offset, SBYTE, index, SFLOAT); + ADDRESS_DECODED; } DEFINE_ADDRESS_DECODER (index_w_b) { DECODE_SVM1_ADDR_INDEX_W_B (base, offset, index); MAKE_INDEXED_ADDRESS (base, offset, SWORD, index, SBYTE); + ADDRESS_DECODED; } DEFINE_ADDRESS_DECODER (index_w_w) { DECODE_SVM1_ADDR_INDEX_W_W (base, offset, index); MAKE_INDEXED_ADDRESS (base, offset, SWORD, index, SWORD); + ADDRESS_DECODED; } DEFINE_ADDRESS_DECODER (index_w_f) { DECODE_SVM1_ADDR_INDEX_W_F (base, offset, index); MAKE_INDEXED_ADDRESS (base, offset, SWORD, index, SFLOAT); + ADDRESS_DECODED; } DEFINE_ADDRESS_DECODER (index_f_b) { DECODE_SVM1_ADDR_INDEX_F_B (base, offset, index); MAKE_INDEXED_ADDRESS (base, offset, SFLOAT, index, SBYTE); + ADDRESS_DECODED; } DEFINE_ADDRESS_DECODER (index_f_w) { DECODE_SVM1_ADDR_INDEX_F_W (base, offset, index); MAKE_INDEXED_ADDRESS (base, offset, SFLOAT, index, SWORD); + ADDRESS_DECODED; } DEFINE_ADDRESS_DECODER (index_f_f) { DECODE_SVM1_ADDR_INDEX_F_F (base, offset, index); MAKE_INDEXED_ADDRESS (base, offset, SFLOAT, index, SFLOAT); + ADDRESS_DECODED; } -static inline word_t -preinc_address_value (wreg_t reg, signed int incr) +static word_t +preinc_address_value (address_t * address) { - WREG_SET (reg, ((WREG_REF (reg)) + incr)); - return (WREG_REF (reg)); + WREG_SET ((address->r1), ((WREG_REF (address->r1)) + (address->n2))); + return (WREG_REF (address->r1)); } #define MAKE_PREINC_ADDRESS(base, scale) \ - ADDRESS_DECODED (preinc_address_value ((base), (scale))) +{ \ + (address->r1) = (base); \ + (address->n2) = (scale); \ + (address->value) = preinc_address_value; \ +} DEFINE_ADDRESS_DECODER (predec_b) { DECODE_SVM1_ADDR_PREDEC_B (base); - MAKE_PREINC_ADDRESS (base, (- ((signed) SBYTE))); + MAKE_PREINC_ADDRESS (base, (- SBYTE)); + ADDRESS_DECODED; } DEFINE_ADDRESS_DECODER (predec_w) { DECODE_SVM1_ADDR_PREDEC_W (base); - MAKE_PREINC_ADDRESS (base, (- ((signed) SWORD))); + MAKE_PREINC_ADDRESS (base, (- SWORD)); + ADDRESS_DECODED; } DEFINE_ADDRESS_DECODER (predec_f) { DECODE_SVM1_ADDR_PREDEC_F (base); - MAKE_PREINC_ADDRESS (base, (- ((signed) SFLOAT))); + MAKE_PREINC_ADDRESS (base, (- SFLOAT)); + ADDRESS_DECODED; } DEFINE_ADDRESS_DECODER (preinc_b) { DECODE_SVM1_ADDR_PREINC_B (base); MAKE_PREINC_ADDRESS (base, SBYTE); + ADDRESS_DECODED; } DEFINE_ADDRESS_DECODER (preinc_w) { DECODE_SVM1_ADDR_PREINC_W (base); MAKE_PREINC_ADDRESS (base, SWORD); + ADDRESS_DECODED; } DEFINE_ADDRESS_DECODER (preinc_f) { DECODE_SVM1_ADDR_PREINC_F (base); MAKE_PREINC_ADDRESS (base, SFLOAT); + ADDRESS_DECODED; } -static inline word_t -postinc_address_value (wreg_t reg, signed int incr) +static word_t +postinc_address_value (address_t * address) { - word_t value = (WREG_REF (reg)); - WREG_SET (reg, ((WREG_REF (reg)) + incr)); + word_t value = (WREG_REF (address->r1)); + WREG_SET ((address->r1), ((WREG_REF (address->r1)) + (address->n2))); return (value); } #define MAKE_POSTINC_ADDRESS(base, scale) \ - ADDRESS_DECODED (postinc_address_value ((base), (scale))) +{ \ + (address->r1) = (base); \ + (address->n2) = (scale); \ + (address->value) = postinc_address_value; \ +} DEFINE_ADDRESS_DECODER (postdec_b) { DECODE_SVM1_ADDR_POSTDEC_B (base); - MAKE_POSTINC_ADDRESS (base, (- ((signed) SBYTE))); + MAKE_POSTINC_ADDRESS (base, (- SBYTE)); + ADDRESS_DECODED; } DEFINE_ADDRESS_DECODER (postdec_w) { DECODE_SVM1_ADDR_POSTDEC_W (base); - MAKE_POSTINC_ADDRESS (base, (- ((signed) SWORD))); + MAKE_POSTINC_ADDRESS (base, (- SWORD)); + ADDRESS_DECODED; } DEFINE_ADDRESS_DECODER (postdec_f) { DECODE_SVM1_ADDR_POSTDEC_F (base); - MAKE_POSTINC_ADDRESS (base, (- ((signed) SFLOAT))); + MAKE_POSTINC_ADDRESS (base, (- SFLOAT)); + ADDRESS_DECODED; } DEFINE_ADDRESS_DECODER (postinc_b) { DECODE_SVM1_ADDR_POSTINC_B (base); MAKE_POSTINC_ADDRESS (base, SBYTE); + ADDRESS_DECODED; } DEFINE_ADDRESS_DECODER (postinc_w) { DECODE_SVM1_ADDR_POSTINC_W (base); MAKE_POSTINC_ADDRESS (base, SWORD); + ADDRESS_DECODED; } DEFINE_ADDRESS_DECODER (postinc_f) { DECODE_SVM1_ADDR_POSTINC_F (base); MAKE_POSTINC_ADDRESS (base, SFLOAT); + ADDRESS_DECODED; } -static inline word_t -pcr_value (word_t offset) +static word_t +pcr_value (address_t * address) { - return (((word_t) PC) + offset); + return (((word_t) PC) + (address->n2)); } #define MAKE_PCR_ADDRESS(offset) \ - ADDRESS_DECODED (pcr_value (offset)) +{ \ + (address->n2) = (offset); \ + (address->value) = pcr_value; \ +} DEFINE_ADDRESS_DECODER (pcr_s8) { DECODE_SVM1_ADDR_PCR_S8 (offset); MAKE_PCR_ADDRESS (offset); + ADDRESS_DECODED; } DEFINE_ADDRESS_DECODER (pcr_s16) { DECODE_SVM1_ADDR_PCR_S16 (offset); MAKE_PCR_ADDRESS (offset); + ADDRESS_DECODED; } DEFINE_ADDRESS_DECODER (pcr_s32) { DECODE_SVM1_ADDR_PCR_S32 (offset); MAKE_PCR_ADDRESS (offset); + ADDRESS_DECODED; } #define INITIALIZE_DECODER_TABLE(table, initial_value) do \