This is the mail archive of the cgen@sources.redhat.com mailing list for the CGEN project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: CGEN:PATCH:RFA: Extracting from the entire insn int


I should have mentioned that I've tested this on a variety of
sim/gas ports with different ISA qualitites:

o fr30 - adata-integral-insn? is false

o m32r - adata-integral-insn? is true, some insns shorted than
base-insn-bitsize

o internal port 1 - adata-integral-insn? is true all insns same
length as base-insn-bitsize

o internal port 2 - adata-integral-insn? is true. some insns
longer than base-insn-bitsize.

Dave

Dave Brolley wrote:
> 
> Hi,
> 
> The attached patch extends the capability of
> -gen-ifld-extract-base so that it can extract all of the fields
> of an instruction when adata-integral-insn? is true. This changes
> generated code in decode.c like:
> 
>     /* Contents of trailing part of insn.  */
>     UINT word_1;
>     word_1 = GETIMEMUHI (current_cpu, pc + 2);
>     f_imm16 = (0|(EXTRACT_MSB0_UINT (word_1, 16, 0, 16) << 0));
>     f_Rn1 = EXTRACT_MSB0_UINT (insn, 32, 12, 4);
> 
> into:
> 
>     f_imm16 = EXTRACT_MSB0_UINT (insn, 32, 16, 16);
>     f_Rn1 = EXTRACT_MSB0_UINT (insn, 32, 12, 4);
> 
> which is a-good-thing(tm) because:
> 
> o It takes advantage of the fact that the entire insn is already
> in 'insn'
> o I avoids a redundant core access
> 
> OK to commit?
> 
> Dave
> 
>   -----------------------------------------------------------------
> 2000-10-05  Dave Brolley  <brolley@redhat.com>
> 
>         * utils-gen.scm (-gen-ifld-extract-base): Compute start position as
>         ifld-start + ifld-word-offset.
>         (gen-ifld-extract): Check adata-integral-insn? before checking whether
>         the field is beyond the base number of bits.
>         (gen-define-ifields): Use a base-length of 32 if adata-integral-insn?.
>         (gen-extract-ifields): Ditto.
> 
>   -----------------------------------------------------------------
> Index: utils-gen.scm
> ===================================================================
> RCS file: /cvs/src/src/cgen/utils-gen.scm,v
> retrieving revision 1.3
> diff -c -p -r1.3 utils-gen.scm
> *** utils-gen.scm       2000/09/06 19:24:45     1.3
> --- utils-gen.scm       2000/10/05 21:35:41
> ***************
> *** 92,98 ****
>                         base-value ", "
>                         (number->string total-length) ", "
>                         ; ??? Is passing total-length right here?
> !                       (number->string (ifld-start f total-length)) ", "
>                         (number->string (ifld-length f))
>                         ")"))
>         (decode (ifld-decode f)))
> --- 92,99 ----
>                         base-value ", "
>                         (number->string total-length) ", "
>                         ; ??? Is passing total-length right here?
> !                       (number->string (+ (ifld-start f total-length)
> !                                          (ifld-word-offset f))) ", "
>                         (number->string (ifld-length f))
>                         ")"))
>         (decode (ifld-decode f)))
> ***************
> *** 220,232 ****
>      indent
>      (gen-sym f)
>      " = "
> !    (if (ifld-beyond-base? f base-length total-length)
> !        (-gen-ifld-extract-beyond f base-length total-length var-list)
> !        (-gen-ifld-extract-base f
> !                              (if (adata-integral-insn? CURRENT-ARCH)
> !                                  total-length
> !                                  (min base-length total-length))
> !                              base-value))
>      ";"
>      (if macro? " \\\n" "\n")
>      )
> --- 221,232 ----
>      indent
>      (gen-sym f)
>      " = "
> !    (if (adata-integral-insn? CURRENT-ARCH)
> !        (-gen-ifld-extract-base f total-length base-value)
> !        (if (ifld-beyond-base? f base-length total-length)
> !          (-gen-ifld-extract-beyond f base-length total-length var-list)
> !          (-gen-ifld-extract-base f (min base-length total-length)
> !                                  base-value)))
>      ";"
>      (if macro? " \\\n" "\n")
>      )
> ***************
> *** 324,330 ****
>   ; to each line).
> 
>   (define (gen-define-ifields ifields total-length indent macro?)
> !   (let* ((base-length (state-base-insn-bitsize))
>          (chunk-specs (-extract-chunk-specs base-length total-length
>                                             (current-arch-default-alignment))))
>       (string-list
> --- 324,332 ----
>   ; to each line).
> 
>   (define (gen-define-ifields ifields total-length indent macro?)
> !   (let* ((base-length (if (adata-integral-insn? CURRENT-ARCH)
> !                         32
> !                         (state-base-insn-bitsize)))
>          (chunk-specs (-extract-chunk-specs base-length total-length
>                                             (current-arch-default-alignment))))
>       (string-list
> ***************
> *** 439,445 ****
>   ; doing this for now.
> 
>   (define (gen-extract-ifields ifields total-length indent macro?)
> !   (let* ((base-length (state-base-insn-bitsize))
>          (chunk-specs (-extract-chunk-specs base-length total-length
>                                             (current-arch-default-alignment))))
>       (string-list
> --- 441,449 ----
>   ; doing this for now.
> 
>   (define (gen-extract-ifields ifields total-length indent macro?)
> !   (let* ((base-length (if (adata-integral-insn? CURRENT-ARCH)
> !                         32
> !                         (state-base-insn-bitsize)))
>          (chunk-specs (-extract-chunk-specs base-length total-length
>                                             (current-arch-default-alignment))))
>       (string-list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]