CGEN_DIS_HASH: how to get endianness and/or instruction size?
Frank Ch. Eigler
fche@redhat.com
Fri Jan 26 01:31:00 GMT 2007
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
More information about the Cgen
mailing list