This is the mail archive of the
cgen@sources.redhat.com
mailing list for the CGEN project.
CGEN:PATCH:RFA: Extracting from the entire insn int
- To: Dave Brolley <brolley at redhat dot com>
- Subject: CGEN:PATCH:RFA: Extracting from the entire insn int
- From: Doug Evans <dje at transmeta dot com>
- Date: Fri, 6 Oct 2000 09:07:27 -0700 (PDT)
- Cc: cgen at sources dot redhat dot com
- References: <39DCF802.1615CADF@redhat.com>
Dave Brolley writes:
> 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?
ok.
> Dave2000-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