This was contributed by Simon Cook and Edward Jones at Embecosm.
AAP: Alterations to Instr encoding
Instruction encodings are tidier and some missing instructions were added. The assembly syntax has been altered (registers prefixed with '$' and memsrc operands in square brackets) which avoids name conflicts with symbols and makes differentiating between memsrc operands and expressions easier.
AAP: Added custom operands, Fixup generation and relaxation, and
relocations. Immediate operands have been replaced with custom operands, and new memsrc operands have been added for the short load and store instructions. Operands now check that their immediates fit within their defined range. Fixups are now emitted for all instructions and now have accompanying relocations. If a fixup cannot be resolved in the compiler then the corresponding instruction will be relaxed to a longer equivalent.
AAP: Add FrameIndex selection, truncstore and extloads, expand
unsupported ops
AAP: Allow stack frames greater than 1023 bytes
Uses repeated adds/subs to move the stack pointer. For large stack frames this will become very inefficient.
AAP: Disable STD/LDD instructions
They are likely to be removed in the future and their encoding is currently invalid.
AAP: Add constant immediate operand types
These types are the same as the immediate types, however they cannot encode expressions and therefore cannot produce fixups.
AAP: Allow imm16 to take negative values
An imm16 may take values in the range [-32768, 65535].
AAP: Don't assemble short branch/jump instrs
Conditional and unconditional branches and jumps should always assemble long. This means that the immediate fields should be large enough for any fixup. These instructions will be relaxed in the linker at a later point.
AAP: Shorts jumps may be assembled
Short jumps do not have any immediate field, so they can always be assembled safely.
AAP: Replace memsrc6 with memsrc10, update instrs
Memsrc10 is a ten bit signed offset for load and store instructions, replacing memsrc6. It reuses the opcodes bits of the second instruction word to encode a longer immediate. A new fixup and relocation has been added for the 10 bit offset field. The field encodes in the same bits as the ABS10 relocation, the only difference is that it may be signed.
AAP: Disable relaxation in the compiler
Short branch instructions should never be generated or assembled, and short ALU ops cannot encode fixups in their immediate fields as they do not accept arbitrary expression.
AAP: Fix chain on stack argument stores
The TokenFactor was only provided the chain of the first store
AAP: Add support for a frame pointer (R2)
Initial frame pointer support has been added, with the frame pointer currently statically defined as R2.
AAP: Don't resolve branch fixups in the compiler
Tell LLVM that branches are not PC relative to avoid them from being resolved in the compiler. These have more complex bit-fields and are instead resolved in the linker.
AAP: Add complexity to short instrs, add short load/stores
Complexity has been added in order to select short instructions in preference to long. 123 was chosen as the AddedComplexity value so that it is easy to identify, as it does not seem to be possible to parameterize it.
AAP: Replace FIXME /w TODO on suboptimal test seqs
Some of the tests produce correct code sequences, but the code sequences are not optimal. These were previously marked as FIXMEs, but I am remarking as TODOs as they are still functionally correct.
AAP: Tweak AddedComplexity of all instructions
CodeGen tests have been updated to reflect the desired prioritization when selecting instructions. The AddedComplexity of the instructions has been tweaked such that they are the minimal values which cause all of the tests to pass.
AAP: Changed layout AAPISelLowering
These files have been reorganized to make them easier to read.