From: Frank Ch. Eigler Date: Thu, 12 Jul 2001 02:32:25 +0000 (+0000) Subject: * some support for funny-endian 16/32-bit insn sets X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=e6d81253dca8cc64d33ea6183ee75445cb8efae1;p=cgen.git * some support for funny-endian 16/32-bit insn sets [cgen/ChangeLog] 2001-07-11 Frank Ch. Eigler * desc-cpu.scm (-gen-mach-table-defns): Emit fourth field: the mach->cpu insn-chunk-bitsize. (-gen-cpu-open): In @arch@_cgen_rebuild_tables, process above new field toward CGEN_CPU_TABLE->insn_chunk_bitsize. * mach.scm (): New field insn-chunk-bitsize. (-cpu-parse, -cpu-read): Parse/initialize it. * doc/rtl.texi (define-cpu): Document it. [opcodes/ChangeLog] 2001-07-11 Frank Ch. Eigler * cgen-dis.in (print_insn): Use cgen_get_insn_value instead of bfd_get_bits. * cgen-opc.c (cgen_get_insn_value, cgen_put_insn_value): Respect non-zero CGEN_CPU_DESC->insn_chunk_bitsize. [include/opcode/ChangeLog] 2001-07-11 Frank Ch. Eigler * cgen.h (CGEN_MACH): Add insn_chunk_bitsize field. (cgen_cpu_desc): Ditto. --- diff --git a/ChangeLog b/ChangeLog index 926e7b9..0804e89 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2001-07-11 Frank Ch. Eigler + + * desc-cpu.scm (-gen-mach-table-defns): Emit fourth field: the + mach->cpu insn-chunk-bitsize. + (-gen-cpu-open): In @arch@_cgen_rebuild_tables, process above new + field toward CGEN_CPU_TABLE->insn_chunk_bitsize. + * mach.scm (): New field insn-chunk-bitsize. + (-cpu-parse, -cpu-read): Parse/initialize it. + * doc/rtl.texi (define-cpu): Document it. + 2001-07-09 Geoffrey Keating * ifield.scm ( 'field-start): Don't look at word-len. diff --git a/desc-cpu.scm b/desc-cpu.scm index 5df36ca..79959c2 100644 --- a/desc-cpu.scm +++ b/desc-cpu.scm @@ -70,11 +70,12 @@ static const CGEN_MACH @arch@_cgen_mach_table[] = { (string-append " { " "\"" (obj:name mach) "\", " "\"" (mach-bfd-name mach) "\", " - (mach-enum mach) + (mach-enum mach) ", " + (number->string (cpu-insn-chunk-bitsize (mach-cpu mach))) " },\n"))) (current-mach-list)) "\ - { 0, 0, 0 } + { 0, 0, 0, 0 } }; \n" ) @@ -635,11 +636,9 @@ static void @arch@_cgen_rebuild_tables (cd) CGEN_CPU_TABLE *cd; { - int i,n_isas; + int i; unsigned int isas = cd->isas; -#if 0 unsigned int machs = cd->machs; -#endif cd->int_insn_p = CGEN_INT_INSN_P; @@ -677,20 +676,26 @@ static void cd->min_insn_bitsize = isa->min_insn_bitsize; if (isa->max_insn_bitsize > cd->max_insn_bitsize) cd->max_insn_bitsize = isa->max_insn_bitsize; - - ++n_isas; } -#if 0 /* Does nothing?? */ /* Data derived from the mach spec. */ for (i = 0; i < MAX_MACHS; ++i) if (((1 << i) & machs) != 0) { const CGEN_MACH *mach = & @arch@_cgen_mach_table[i]; - ++n_machs; + if (mach->insn_chunk_bitsize != 0) + { + if (cd->insn_chunk_bitsize != 0 && cd->insn_chunk_bitsize != mach->insn_chunk_bitsize) + { + fprintf (stderr, \"@arch@_cgen_rebuild_tables: conflicting insn-chunk-bitsize values: `%d' vs. `%d'\\n\", + cd->insn_chunk_bitsize, mach->insn_chunk_bitsize); + abort (); + } + + cd->insn_chunk_bitsize = mach->insn_chunk_bitsize; + } } -#endif /* Determine which hw elements are used by MACH. */ build_hw_table (cd); diff --git a/doc/rtl.texi b/doc/rtl.texi index c12c2c5..a781b09 100644 --- a/doc/rtl.texi +++ b/doc/rtl.texi @@ -556,6 +556,7 @@ The syntax of @code{define-cpu} is: (data-endian big|little|either) (float-endian big|little|either) (word-bitsize n) + (insn-chunk-bitsize n) (parallel-insns n) (file-transform transformation) ) @@ -587,6 +588,12 @@ by the @file{.cpu} file reader, but not all are supported internally. The number of bits in a word. In GCC, this is @code{BITS_PER_WORD}. +@subsubsection insn-chunk-bitsize + +The number of bits in an instruction word chunk, for purposes of +per-chunk endianness conversion. The default is zero, meaning +no chunking is required. + @subsubsection parallel-insns This is the same as the @code{parallel-insns} spec of @code{define-isa}. diff --git a/mach.scm b/mach.scm index 6069788..37e63e0 100644 --- a/mach.scm +++ b/mach.scm @@ -992,6 +992,10 @@ ; number of bits in a word. word-bitsize + ; number of bits in a chunk of an instruction word, for + ; endianness conversion purposes; 0 = no chunking + insn-chunk-bitsize + ; Transformation to use in generated files should one be ; needed. At present the only supported value is a string ; which is the file suffix. @@ -1010,7 +1014,7 @@ ; Accessors. -(define-getters cpu (word-bitsize file-transform parallel-insns)) +(define-getters cpu (word-bitsize insn-chunk-bitsize file-transform parallel-insns)) ; Return endianness of instructions. @@ -1046,7 +1050,7 @@ (define (-cpu-parse name comment attrs endian insn-endian data-endian float-endian - word-bitsize file-transform parallel-insns) + word-bitsize insn-chunk-bitsize file-transform parallel-insns) (logit 2 "Processing cpu family " name " ...\n") ; Pick out name first 'cus we need it as a string(/symbol). (let* ((name (parse-name name "cpu")) @@ -1058,6 +1062,7 @@ (atlist-parse attrs "cpu" errtxt) endian insn-endian data-endian float-endian word-bitsize + insn-chunk-bitsize file-transform parallel-insns) (begin @@ -1082,6 +1087,7 @@ (data-endian #f) (float-endian #f) (word-bitsize nil) + (insn-chunk-bitsize 0) (file-transform "") ; FIXME: Hobbit computes the wrong symbol for `parallel-insns' ; in the `case' expression below because there is a local var @@ -1103,6 +1109,7 @@ ((data-endian) (set! data-endian (cadr arg))) ((float-endian) (set! float-endian (cadr arg))) ((word-bitsize) (set! word-bitsize (cadr arg))) + ((insn-chunk-bitsize) (set! insn-chunk-bitsize (cadr arg))) ((file-transform) (set! file-transform (cadr arg))) ((parallel-insns) (set! parallel-insns- (cadr arg))) (else (parse-error errtxt "invalid cpu arg" arg))) @@ -1110,7 +1117,7 @@ ; Now that we've identified the elements, build the object. (-cpu-parse name comment attrs endian insn-endian data-endian float-endian - word-bitsize file-transform parallel-insns-) + word-bitsize insn-chunk-bitsize file-transform parallel-insns-) ) ) )