Immediate converions change an instruction that cannot be encoded to an
equivalent but different instruction. For example, "ADD r0, r1, #FFFFFFFF"
cannot be encoded as an ADD instruction. However, "SUB r0, r1, #1" is
equivalent.
These conversions are different from instruction aliases. An alias maps
several assembler instructions onto one encoding. An immediate
conversion, however, maps an *invalid* instruction--e.g. with an
immediate that cannot be represented in the encoding--to a different
(but equivalent) instruction.
Several instruction immediates were being converted already, but this
was not systematically tested, nor did it cover the full set of possible
conversions.
This patch implements all possible substitutions for ARM, Thumb1 and
Thumb2 assembler and adds tests. It also adds a feature flag
(-mattr=+no-imm-conversions) to turn these substitutions off. This is
helpful for users who want their code to assemble to exactly what they
wrote.
If the substitution is only for instructions with immediates, would a narrower name e.g. FeatureNoImplicitImmSubstitution be more appropriate?