From: Taylor R Campbell Date: Tue, 8 Oct 2013 02:54:21 +0000 (+0000) Subject: Revert "Turn some phony rules into explicit file rules to reduce rebuilds." X-Git-Tag: release-9.2.0~71 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=68a3dad6df7b249ca591392f6686569d0efd174f;p=mit-scheme.git Revert "Turn some phony rules into explicit file rules to reduce rebuilds." This reverts commit 54e7f433ab16f65cd12779b7a672edf713c72427. That commit wasn't supposed to revert an earlier change to SVM1; not sure how that snuck in there. --- diff --git a/src/Makefile.in b/src/Makefile.in index 2a3150cdb..f6dc36897 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -214,11 +214,6 @@ 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 @@ -231,9 +226,15 @@ all-compiler: compile-compiler .PHONY: bundle-compiler bundle-compiler: compile-compiler -bundle-compiler: compiler/compiler-unx.c +bundle-compiler: compile-compiler-pkd (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 @@ -293,12 +294,9 @@ syntax-compiler: cref-compiler | $(TOOL_SYNTAXER) .PHONY: cref-compiler -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 +cref-compiler: toolchain +cref-compiler: cref-runtime +cref-compiler: cref-sf (echo '(with-working-directory-pathname "compiler"' && \ echo ' (lambda ()' && \ echo ' (cref/generate-trivial-constructor "compiler")))') \ @@ -312,9 +310,15 @@ all-cref: compile-cref .PHONY: bundle-cref bundle-cref: compile-cref -bundle-cref: cref/cref-unx.c +bundle-cref: compile-cref-pkd (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 @@ -330,11 +334,8 @@ syntax-cref: cref-cref | $(TOOL_SYNTAXER) .PHONY: cref-cref -cref-cref: cref/cref-unx.pkd - -cref/cref-unx.pkd: toolchain -cref/cref-unx.pkd: cref-runtime -cref/cref-unx.pkd: cref/cref.pkg +cref-cref: toolchain +cref-cref: cref-runtime (echo '(with-working-directory-pathname "cref"' && \ echo ' (lambda ()' && \ echo ' (cref/generate-trivial-constructor "cref")))') \ @@ -344,10 +345,13 @@ cref/cref-unx.pkd: cref/cref.pkg .PHONY: all-runtime all-runtime: compile-runtime -@IF_LIARC@all-runtime: bundle-runtime +@IF_LIARC@all-runtime: compile-runtime-pkd -.PHONY: bundle-runtime -bundle-runtime: runtime/runtime-unx.c +.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: compile-runtime compile-runtime: toolchain @@ -364,10 +368,7 @@ syntax-runtime: cref-runtime | $(TOOL_SYNTAXER) .PHONY: cref-runtime -cref-runtime: runtime/runtime-unx.pkd - -runtime/runtime-unx.pkd: toolchain -runtime/runtime-unx.pkd: runtime/runtime.pkg +cref-runtime: toolchain (echo '(with-working-directory-pathname "runtime"' && \ echo ' (lambda ()' && \ echo ' (cref/generate-trivial-constructor "runtime")))') \ @@ -381,9 +382,15 @@ all-sf: compile-sf .PHONY: bundle-sf bundle-sf: compile-sf -bundle-sf: sf/sf-unx.c +bundle-sf: compile-sf-pkd (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 @@ -399,11 +406,8 @@ syntax-sf: cref-sf | $(TOOL_SYNTAXER) .PHONY: cref-sf -cref-sf: sf/sf-unx.pkd - -sf/sf-unx.pkd: toolchain -sf/sf-unx.pkd: cref-runtime -sf/sf-unx.pkd: sf/sf.pkg +cref-sf: toolchain +cref-sf: cref-runtime (echo '(with-working-directory-pathname "sf"' && \ echo ' (lambda ()' && \ echo ' (cref/generate-trivial-constructor "sf")))') \ @@ -421,11 +425,21 @@ all-edwin: compile-edwin .PHONY: bundle-edwin bundle-edwin: compile-edwin -bundle-edwin: edwin/edwin.c -bundle-edwin: edwin/edwin-unx.c +bundle-edwin: compile-edwin-bld +bundle-edwin: compile-edwin-pkd (cd edwin && $(MAKE) compile-liarc-bundle) -edwin/edwin.bld: syntax-edwin +.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) .PHONY: compile-edwin compile-edwin: toolchain @@ -442,13 +456,10 @@ syntax-edwin: cref-edwin | $(TOOL_TOOLCHAIN) .PHONY: cref-edwin -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 +cref-edwin: toolchain +cref-edwin: cref-runtime +cref-edwin: cref-win32 +cref-edwin: cref-xml (echo '(with-working-directory-pathname "edwin"' && \ echo ' (lambda ()' && \ echo ' (cref/generate-trivial-constructor "edwin")))') \ @@ -462,23 +473,25 @@ all-ffi: compile-ffi .PHONY: bundle-ffi bundle-ffi: compile-ffi -bundle-ffi: ffi/ffi-unx.c +bundle-ffi: compile-ffi-pkd (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: ffi/ffi-unx.pkd - -ffi/ffi-unx.pkd: toolchain -ffi/ffi-unx.pkd: cref-runtime -ffi/ffi-unx.pkd: ffi/ffi.pkg +cref-ffi: toolchain +cref-ffi: cref-runtime (echo '(with-working-directory-pathname "ffi"' && \ echo ' (lambda ()' && \ echo ' (cref/generate-trivial-constructor "ffi")))') \ @@ -492,9 +505,15 @@ all-sos: compile-sos .PHONY: bundle-sos bundle-sos: compile-sos -bundle-sos: sos/sos-unx.c +bundle-sos: compile-sos-pkd (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 @@ -503,11 +522,8 @@ compile-sos: cref-sos | $(TOOL_TOOLCHAIN) .PHONY: cref-sos -cref-sos: sos/sos-unx.pkd - -sos/sos-unx.pkd: toolchain -sos/sos-unx.pkd: cref-runtime -sos/sos-unx.pkd: sos/sos.pkg +cref-sos: toolchain +cref-sos: cref-runtime (echo '(with-working-directory-pathname "sos"' && \ echo ' (lambda ()' && \ echo ' (cref/generate-trivial-constructor "sos")))') \ @@ -521,9 +537,15 @@ all-ssp: compile-ssp .PHONY: bundle-ssp bundle-ssp: compile-ssp -bundle-ssp: ssp/ssp-unx.c +bundle-ssp: compile-ssp-pkd (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 @@ -532,12 +554,9 @@ compile-ssp: cref-ssp | $(TOOL_TOOLCHAIN) .PHONY: cref-ssp -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 +cref-ssp: toolchain +cref-ssp: cref-runtime +cref-ssp: cref-xml (echo '(with-working-directory-pathname "ssp"' && \ echo ' (lambda ()' && \ echo ' (cref/generate-trivial-constructor "ssp")))') \ @@ -551,9 +570,15 @@ all-star-parser: compile-star-parser .PHONY: bundle-star-parser bundle-star-parser: compile-star-parser -bundle-star-parser: star-parser/parser-unx.c +bundle-star-parser: compile-star-parser-pkd (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 @@ -562,11 +587,8 @@ compile-star-parser: cref-star-parser | $(TOOL_TOOLCHAIN) .PHONY: cref-star-parser -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 +cref-star-parser: toolchain +cref-star-parser: cref-runtime (echo '(with-working-directory-pathname "star-parser"' && \ echo ' (lambda ()' && \ echo ' (cref/generate-trivial-constructor "parser")))') \ @@ -592,11 +614,8 @@ syntax-win32: cref-win32 | $(TOOL_SYNTAXER) .PHONY: cref-win32 -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 +cref-win32: toolchain +cref-win32: cref-runtime (echo '(with-working-directory-pathname "win32"' && \ echo ' (lambda ()' && \ echo ' (cref/generate-trivial-constructor "win32")))') \ @@ -610,9 +629,15 @@ all-xml: compile-xml .PHONY: bundle-xml bundle-xml: compile-xml -bundle-xml: xml/xml-unx.c +bundle-xml: compile-xml-pkd (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 @@ -621,12 +646,9 @@ compile-xml: cref-xml | $(TOOL_TOOLCHAIN) .PHONY: cref-xml -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 +cref-xml: toolchain +cref-xml: cref-runtime +cref-xml: cref-sos (echo '(with-working-directory-pathname "xml"' && \ echo ' (lambda ()' && \ echo ' (cref/generate-trivial-constructor "xml")))') \ @@ -686,12 +708,13 @@ all-imail: compile-imail .PHONY: bundle-imail bundle-imail: compile-imail -bundle-imail: imail/imail-unx.c +bundle-imail: compile-imail-pkd (cd imail && $(MAKE) compile-liarc-bundle) -# Must write this rule explicitly because we use TARGET_COMPILER, not -# TOOL_COMPILER. -imail/imail-unx.c: imail/imail-unx.pkd +.PHONY: compile-imail-pkd +compile-imail-pkd: target-toolchain +compile-imail-pkd: cref-imail + test imail/imail-unx.c -nt imail/imail-unx.pkd || \ echo '(cbf "imail/imail-unx.pkd")' | $(TARGET_COMPILER) .PHONY: compile-imail @@ -711,14 +734,11 @@ compile-imail: cref-imail | $(TARGET_TOOLCHAIN) .PHONY: cref-imail -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 +cref-imail: target-toolchain +cref-imail: cref-edwin +cref-imail: cref-runtime +cref-imail: cref-sos +cref-imail: cref-star-parser (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 90e8d5e1f..1f3fa0640 100644 --- a/src/microcode/svm1-interp.c +++ b/src/microcode/svm1-interp.c @@ -128,27 +128,17 @@ static long svm1_result; #define ILL EXIT_VM (ERR_COMPILED_CODE_ERROR) -typedef struct address_s address_t; -typedef word_t address_value_t (address_t *); -typedef bool address_decoder_t (address_t *); +typedef bool address_decoder_t (word_t *); static address_decoder_t * address_decoders [256]; -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 ADDRESS_VALUE(name) name #define DEFINE_ADDRESS_DECODER(name) \ - static bool decode_addr_##name (address_t * address) -#define ADDRESS_DECODED return (true) + static bool decode_addr_##name (word_t * address) +#define ADDRESS_DECODED(addr) (*address) = (addr); return (true) #define DECODE_ADDRESS(name) \ - address_t name; if (predict_false (! (decode_address (&name)))) ILL -static bool decode_address (address_t *); + word_t name; if (predict_false (! (decode_address (&name)))) ILL +static bool decode_address (word_t *); typedef bool trap_0_t (void); typedef bool trap_1_t (wreg_t); @@ -1235,328 +1225,273 @@ DEFINE_BINARY_FR (atan2, ATAN2, atan2) /* Address decoders */ static inline bool -decode_address (address_t * address) +decode_address (word_t * address) { return ((* (address_decoders[NEXT_BYTE])) (address)); } static bool -illegal_address (address_t * address) +illegal_address (word_t * address) { (void) address; /* ignore */ return (false); } static word_t -offset_address_value (address_t * address) +offset_address_value (wreg_t base, word_t offset, unsigned int scale) { - return ((WREG_REF (address->r1)) + (address->n1)); + return ((WREG_REF (base)) + (offset * scale)); } +#define MAKE_OFFSET_ADDRESS(base, offset, scale) \ + ADDRESS_DECODED (offset_address_value ((base), (offset), (scale))) + DEFINE_ADDRESS_DECODER (indir) { DECODE_SVM1_ADDR_INDIR (base); - (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; \ + MAKE_OFFSET_ADDRESS (base, 0, 0); } 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 word_t -indexed_address_value (address_t * address) +static inline word_t +indexed_address_value (wreg_t base, word_t offset, unsigned int oscale, + wreg_t index, unsigned int iscale) { return - ((WREG_REF (address->r1)) - + (address->n1) - + ((WREG_REF (address->r2)) * (address->n2))); + ((WREG_REF (base)) + + (offset * oscale) + + ((WREG_REF (index)) * iscale)); } #define MAKE_INDEXED_ADDRESS(base, offset, oscale, index, iscale) \ -{ \ - (address->r1) = (base); \ - (address->n1) = ((offset) * (oscale)); \ - (address->r2) = (index); \ - (address->n2) = (iscale); \ - (address->value) = indexed_address_value; \ -} + ADDRESS_DECODED \ + (indexed_address_value ((base), (offset), (oscale), (index), (iscale))) 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 word_t -preinc_address_value (address_t * address) +static inline word_t +preinc_address_value (wreg_t reg, signed int incr) { - WREG_SET ((address->r1), ((WREG_REF (address->r1)) + (address->n2))); - return (WREG_REF (address->r1)); + WREG_SET (reg, ((WREG_REF (reg)) + incr)); + return (WREG_REF (reg)); } #define MAKE_PREINC_ADDRESS(base, scale) \ -{ \ - (address->r1) = (base); \ - (address->n2) = (scale); \ - (address->value) = preinc_address_value; \ -} + ADDRESS_DECODED (preinc_address_value ((base), (scale))) DEFINE_ADDRESS_DECODER (predec_b) { DECODE_SVM1_ADDR_PREDEC_B (base); - MAKE_PREINC_ADDRESS (base, (- SBYTE)); - ADDRESS_DECODED; + MAKE_PREINC_ADDRESS (base, (- ((signed) SBYTE))); } DEFINE_ADDRESS_DECODER (predec_w) { DECODE_SVM1_ADDR_PREDEC_W (base); - MAKE_PREINC_ADDRESS (base, (- SWORD)); - ADDRESS_DECODED; + MAKE_PREINC_ADDRESS (base, (- ((signed) SWORD))); } DEFINE_ADDRESS_DECODER (predec_f) { DECODE_SVM1_ADDR_PREDEC_F (base); - MAKE_PREINC_ADDRESS (base, (- SFLOAT)); - ADDRESS_DECODED; + MAKE_PREINC_ADDRESS (base, (- ((signed) SFLOAT))); } 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 word_t -postinc_address_value (address_t * address) +static inline word_t +postinc_address_value (wreg_t reg, signed int incr) { - word_t value = (WREG_REF (address->r1)); - WREG_SET ((address->r1), ((WREG_REF (address->r1)) + (address->n2))); + word_t value = (WREG_REF (reg)); + WREG_SET (reg, ((WREG_REF (reg)) + incr)); return (value); } #define MAKE_POSTINC_ADDRESS(base, scale) \ -{ \ - (address->r1) = (base); \ - (address->n2) = (scale); \ - (address->value) = postinc_address_value; \ -} + ADDRESS_DECODED (postinc_address_value ((base), (scale))) DEFINE_ADDRESS_DECODER (postdec_b) { DECODE_SVM1_ADDR_POSTDEC_B (base); - MAKE_POSTINC_ADDRESS (base, (- SBYTE)); - ADDRESS_DECODED; + MAKE_POSTINC_ADDRESS (base, (- ((signed) SBYTE))); } DEFINE_ADDRESS_DECODER (postdec_w) { DECODE_SVM1_ADDR_POSTDEC_W (base); - MAKE_POSTINC_ADDRESS (base, (- SWORD)); - ADDRESS_DECODED; + MAKE_POSTINC_ADDRESS (base, (- ((signed) SWORD))); } DEFINE_ADDRESS_DECODER (postdec_f) { DECODE_SVM1_ADDR_POSTDEC_F (base); - MAKE_POSTINC_ADDRESS (base, (- SFLOAT)); - ADDRESS_DECODED; + MAKE_POSTINC_ADDRESS (base, (- ((signed) SFLOAT))); } 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 word_t -pcr_value (address_t * address) +static inline word_t +pcr_value (word_t offset) { - return (((word_t) PC) + (address->n2)); + return (((word_t) PC) + offset); } #define MAKE_PCR_ADDRESS(offset) \ -{ \ - (address->n2) = (offset); \ - (address->value) = pcr_value; \ -} + ADDRESS_DECODED (pcr_value (offset)) 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 \