This is the mail archive of the
cgen@sourceware.org
mailing list for the CGEN project.
selecting between two forms of an instruction
- From: Alan Lehotsky <apl at alum dot mit dot edu>
- To: cgen at sourceware dot org
- Cc: Alan Lehotsky <apl at alum dot mit dot edu>
- Date: Sat, 15 Nov 2008 09:55:58 -0500
- Subject: selecting between two forms of an instruction
Working on a port for a machine with 16 bit and 32 bit fixed length
instructions. The machine is somewhat like an ARM/Thumb
architecture, but
there is no mode switch. You use the 16 bit instructions if you have
short displacements or only need to access a subset of all the
registers.
It occurs to me that I could ALWAYS generate 32 bit instructions in
the assembler and let the linker relax 32 bitters to 16 bitters based on
the actual requirements of the program.
Is there any downside to this strategy? I've done this in the past
for branching instructions and (on the IP2K) the insertion and
deletion of bank switching
instructions - but never so aggressively where nearly every
instruction has a short form.
-- Al