Alan Lehotsky | 15 Nov 2008 15:55
Picon
Favicon

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


Gmane