public inbox for cgen@sourceware.org
 help / color / mirror / Atom feed
* CGEN: RFA: CGEN_INT_INSN_P
@ 2000-08-22 13:22 Dave Brolley
  2000-08-22 13:29 ` Dave Brolley
  2000-08-28 11:40 ` Dave Brolley
  0 siblings, 2 replies; 4+ messages in thread
From: Dave Brolley @ 2000-08-22 13:22 UTC (permalink / raw)
  To: cgen

Hi,

I ran into a problem with the cgen-based gas/opcodes/binutils/sim
port that I am working on. The ISA has some 16 bit insns and some
32 bit insns, so I set default-insn-word-bitsize=16,
default-insn-bitsize=16 and base-insn-bitsize=16.

Now in <arch>-desc.h, CGEN_INT_INSN_P gets define to 1, since all
of my insns are 32 bit or less. However, the current code enabled
by CGEN_INT_INSN_P in cgen-ibld.in and cgen-dis.in does not allow
for base-insn-bitsize != max-insn-bitsize. 

1) It aborts in 'extract_normal' because when accessing a 16 bit
insn field at offset 16 it is called with word_offset==16. Also
start==0, length==16, word_length==16 and total_length==32. These
value are generated by cgen in <arch>_cgen_insert_operand and I
believe that they are correct.

2) Even if the abort did not occur the generated insn was wrong
because the insns base value was not correctly onserted into the
insn integer by insert_insn_normal.

3) A similar problem to 2) exists in print_insn

This patch allows for CGEN_INT_INSN_P==1 with base-insn-bitsize
!= max-insn-bitsize. I have tested it against my correct work
(which has this configuration) and against the fr30 (which has
CGEN_INT_INSN_P==0) and against another port for which
CGEN_INT_INSN_P==1 and base-insn-bitsize == max-insn-bitsize.

OK to commit? ---- or was there a much easier way to handle
this?  :-)

Dave
2000-08-22  Dave Brolley  <brolley@redhat.com>

	* cgen-ibld.in (cgen_put_insn_int_value): New function.
	(insert_normal): Allow for non-zero word_offset with CGEN_INT_INSN_P.
	(insert_insn_normal): Use cgen_put_insn_int_value with CGEN_INT_INSN_P.
	(extract_normal): Allow for non-zero word_offset with CGEN_INT_INSN_P.
	* cgen-dis.in (read_insn): New statis function.
	(print_insn): Use read_insn to read the insn into the buffer and set
	up for disassembly.
	(print_insn): in CGEN_INT_INSN_P, make sure that the entire insn is
	in the buffer.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2000-08-28 11:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <Pine.LNX.4.21.0008280502180.7345-100000@moshpit.cygnus.com>
2000-08-28  9:30 ` CGEN: RFA: CGEN_INT_INSN_P Dave Brolley
2000-08-22 13:22 Dave Brolley
2000-08-22 13:29 ` Dave Brolley
2000-08-28 11:40 ` Dave Brolley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).