This is the mail archive of the
cgen@sourceware.org
mailing list for the CGEN project.
Re: CGEN_DIS_HASH: how to get endianness and/or instruction size?
- From: "Frank Ch. Eigler" <fche at redhat dot com>
- To: Joern Rennecke <Joern dot Rennecke at arc dot com>
- Cc: cgen at sources dot redhat dot com
- Date: Thu, 25 Jan 2007 20:31:07 -0500
- Subject: Re: CGEN_DIS_HASH: how to get endianness and/or instruction size?
- References: <20A30789B9F48C4E9D71A188EFE8042C2BC65C@elexch01.arc.com>
Hi -
joern wrote:
> [...]
> The top 5 bits of the first 16 bit word are what is known as major
> opcode field. [...]
> I reckon that, given a suitably endian-correted input,
> I could make an adequate hash by using a switch based on
> the 5 bit major opcode to decide which bits from the first 16
> bit word to use.
Heck, just use those five bits.
> I had already written the hash function, only to discover that the
> endian check depended on an argument that was not passed to my
> macro/function.
You should use the *value* rather than *buf* input.
> Its easy to change his code into incorrect and/or useless (return 0)
> code that will compile [...]
It is neither incorrect nor useless. It just means that the hash
table will be degenerate, and a linear search will be required for
each disassembled instruction. It won't hurt anyone and will only
slightly worsen global warming.
> Unless otherwise expressly stated, this message does not create or vary =
> any contractual relationship between you and ARC International. [...]
That's a relief!
- FChE