This is the mail archive of the
cgen@sources.redhat.com
mailing list for the CGEN project.
cgen-dis.in
- To: Doug Evans <dje at transmeta dot com>, Frank Eigler <fche at redhat dot com>, Ben Elliston <bje at redhat dot com>
- Subject: cgen-dis.in
- From: Patrick Macdonald <patrickm at redhat dot com>
- Date: Wed, 31 Jan 2001 14:16:26 -0500
- CC: cgen at sources dot redhat dot com
- Organization: Red Hat Canada Limited
Comrades,
Starting from scratch... think of yesterday as my first day.
Doug, you are correct, this conditional inside print_insn () is
causing me pain.
if (CGEN_INSN_BITSIZE (insn) > cd->base_insn_bitsize &&
(CGEN_INSN_BITSIZE (insn) / 8) <= sizeof (unsigned long))
{
read in 32 bits;
extract information;
}
else
extract information;
The patch that I provided solved my problem but I was requested to
keep looking for a better solution (perhaps off the 'else' branch).
I'm trying to get a handle on what a better solution encompasses.
Just getting to the 'else' branch, as requested, is not straight
forward. One problem is that the instructions in question satisfy
the if conditional. I could add a condition such that only big endian
insns get through but that's kind of bogus besides probably being
blatantly wrong.
Just to refresh your memory: I have an ISA with a 16 bit base insn
bitsize, little endian. Several instructions have an instruction length
of 32 (16 bit instruction + 16 bit immediate). If I had an instruction,
0xabcd, and an immediate 0x1234, it's written to the obj as cdab 3412.
The 16 bit instruction is read in, 0xabcd, but then hits this conditional
as: if (32 > 16 && 32/8 <= 4). So... this is true. The instruction is
reread as a 32 bit, little endian instruction which returns 0x1234abcd.
This is why I had to flip the hi/lo bytes. If this had of been a big
endian target, all would be well. This is probably why we have not been
stung by this before.
So, where does this leave me? Well, I need help to fix this problem. The
help of people in the know. My cgen internal knowledge is minimal and having
me hack here and there without direction is a waste of time. Yeah, I could
hunker down for weeks and attempt to bring myself up to your gentlefellows
level, but that's not realistic. Guidance is requested and required.
Thanks,
Patrick