This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: patch for cgen generated decoders
- To: matthew green <mrg at cygnus dot com>
- Subject: Re: patch for cgen generated decoders
- From: Dave Brolley <brolley at redhat dot com>
- Date: Mon, 06 Nov 2000 12:22:41 -0500
- CC: binutils at sources dot redhat dot com, cgen at sources dot redhat dot com
- Organization: Red Hat Canada, Inc
- References: <18832.973406829@cygnus.com>
Yes -- this makes sense due to my change a while back which
caused the extraction functions to extract any fields in the
first sizeof (CGEN_INSN_INT) * 8 bits as if CGEN_INT_INSN_P was
set (see extract_normal).
Dave
matthew green wrote:
>
> hi folks.
>
> i need this patch for an architecture where the standard instruction
> bitsize is 16 bits, yet there exists a 48-bit instruction (which
> causes CGEN_INT_INSN_P to be false). the problem i was seeing is
> that for the 32-bit instruction my ifields were not being extracted
> correctly, because only 16 bits were present in the "insn_value".
> the patch below enables the code previously only available for the
> CGEN_INT_INSN_P==1 case, but ensures that 32-bit instructions are
> passed in their entirity in all cases.
>
> (actually, this code uses "unsigned long" to hold this value, where
> it should probably use a "CGEN_INSN_INT". i'm not sure exactly if
> it will work correctly on a LP64 host...)
>
> i've tested this change with the fr30 & m32r ports and it does not
> affect their operation (fr30 is the only other port that sets
> CGEN_INT_INSN_P to be false).
>
> 2000-11-05 matthew green <mrg@redhat.com>
>
> * cgen-dis.in (print_insn): Load a full CGEN_INSN_INT in the
> !CGEN_INT_INSN_P case as well.
>
> Index: cgen-dis.in
> ===================================================================
> RCS file: /cvs/src/src/opcodes/cgen-dis.in,v
> retrieving revision 1.2
> diff -p -r1.2 cgen-dis.in
> *** cgen-dis.in 2000/08/28 18:36:53 1.2
> --- cgen-dis.in 2000/11/05 02:28:01
> *************** print_insn (cd, pc, info, buf, buflen)
> *** 281,289 ****
> machine insn and extracts the fields. The second pass prints
> them. */
>
> ! #if CGEN_INT_INSN_P
> ! /* Make sure the entire insn is loaded into insn_value. */
> ! if (CGEN_INSN_BITSIZE (insn) > cd->base_insn_bitsize)
> {
> unsigned long full_insn_value;
> int rc = read_insn (cd, pc, info, buf,
> --- 281,290 ----
> machine insn and extracts the fields. The second pass prints
> them. */
>
> ! /* Make sure the entire insn is loaded into insn_value, if it
> ! can fit. */
> ! if (CGEN_INSN_BITSIZE (insn) > cd->base_insn_bitsize &&
> ! (CGEN_INSN_BITSIZE (insn) / 8) <= sizeof (unsigned long))
> {
> unsigned long full_insn_value;
> int rc = read_insn (cd, pc, info, buf,
> *************** print_insn (cd, pc, info, buf, buflen)
> *** 295,304 ****
> (cd, insn, &ex_info, full_insn_value, &fields, pc);
> }
> else
> ! #endif
>
> - length = CGEN_EXTRACT_FN (cd, insn)
> - (cd, insn, &ex_info, insn_value, &fields, pc);
> /* length < 0 -> error */
> if (length < 0)
> return length;
> --- 296,304 ----
> (cd, insn, &ex_info, full_insn_value, &fields, pc);
> }
> else
> ! length = CGEN_EXTRACT_FN (cd, insn)
> ! (cd, insn, &ex_info, insn_value, &fields, pc);
>
> /* length < 0 -> error */
> if (length < 0)
> return length;