CGEN: RFA: CGEN_INT_INSN_P

Dave Brolley brolley@redhat.com
Tue Aug 22 13:22:00 GMT 2000


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.



More information about the Cgen mailing list