Back in 2004 and 2005, two features were added to GNU binutils for msp430:

-mP : Enables polymorphs
-mQ : Enables relaxation

As best I can reconstruct it:

Polymorphs are extended jump instructions like "beq" which have a
constant size regardless of whether the target is within a 1KB code
window allowing use of the PC-relative short jump instructions (je
#target), or is farther away and must be reached with a jump-around
sequence (jne 1f; br #target; 1:).  If the jump is found to be in
range when relocations are resolved at link time, the short form is
used and the remainder of the space filled with nops.

Relaxation is a separate but supportive operation that detects
situations where the shorter jump is selected at link time and
attempts to move objects to eliminate the nops.

Neither flag is enabled by default.  There are comments in the
binutils code indicating that these flags are disabled because they
are dangerous and don't work.  Contemporaneous email on the binutils
mailing list suggests certain problems were never resolved.  I have
created an assembly-language test case that confirms that polymorphs
will generate incorrect jumps.  gcc does not currently emit any
polymorph jump instructions: it attempts to determine the jump
distance and select the appropriate instruction.

All this leaves me relatively convinced that both features are
candidates for removal.  I'm guessing that the only use of either of
these features is in historical projects which have hand-written
assembly code that uses the polymorph jump instructions between
functions.

If there is anybody out there who actively uses either the -mP or -mQ
flags to any msp430 binutils programs, or gets polymorphs or
relaxation to work in some other way, please respond and explain what
you're doing.

At this time, it is highly likely that these features will be removed
during a binutils validation phase in preparation for object file
enhancements that will improve/support 20-bit code and data
operations.  The fewer non-functional/untested "features" I have to
work around the better the functional ones will be.  Response to this
email will determine whether I keep and work around them, or remove
them (and if so, whether I ever put them back). So if you care about
polymorphs, speak up.

(It is more likely that relaxation will return in a future
optimization that supports link-time assignment of objects to near
(16-bit) or far (20-bit) addresses, but AFAICT what's there won't help
with that, and we need to get the basic functionality right first.)

Peter

------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create 
new or port existing apps to sell to consumers worldwide. Explore the 
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
Mspgcc-users mailing list
Mspgcc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mspgcc-users

Reply via email to