llvm-6502/test/MC
David Peixotto 0fa193b086 Implement the ldr-pseudo opcode for ARM assembly
The ldr-pseudo opcode is a convenience for loading 32-bit constants.
It is converted into a pc-relative load from a constant pool. For
example,

  ldr r0, =0x10001
  ldr r1, =bar

will generate this output in the final assembly

  ldr r0, .Ltmp0
  ldr r1, .Ltmp1
  ...
  .Ltmp0: .long 0x10001
  .Ltmp1: .long bar

Sketch of the LDR pseudo implementation:
  Keep a map from Section => ConstantPool

  When parsing ldr r0, =val
    parse val as an MCExpr
    get ConstantPool for current Section
    Label = CreateTempSymbol()
    remember val in ConstantPool at next free slot
    add operand to ldr that is MCSymbolRef of Label

  On finishParse() callback
    Write out all non-empty constant pools
    for each Entry in ConstantPool
      Emit Entry.Label
      Emit Entry.Value

Possible improvements to be added in a later patch:
  1. Does not convert load of small constants to mov
     (e.g. ldr r0, =0x1 => mov r0, 0x1)
  2. Does reuse constant pool entries for same constant

The implementation was tested for ARM, Thumb1, and Thumb2 targets on
linux and darwin.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197708 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-19 18:12:36 +00:00
..
AArch64 [AArch64] Add support for NEON scalar floating-point absolute difference. 2013-11-27 01:45:58 +00:00
ARM Implement the ldr-pseudo opcode for ARM assembly 2013-12-19 18:12:36 +00:00
AsmParser AsmParser: add support for .end directive 2013-12-18 02:53:03 +00:00
COFF MC COFF: Emit the 'b' section flag for .bss sections in GNU assembly 2013-12-17 22:12:40 +00:00
Disassembler Add a disassembler to the PowerPC backend 2013-12-19 16:13:01 +00:00
ELF Correct word hyphenations 2013-12-05 05:44:44 +00:00
MachO Fixed a bug in getARMFixupKindMachOInfo() where three ARM fixup kinds 2013-12-13 22:46:54 +00:00
Markup
Mips Support for microMIPS control instructions. 2013-12-19 16:25:00 +00:00
PowerPC
SystemZ [SystemZ] Add the general form of BCR 2013-11-13 16:57:53 +00:00
X86 Grow the stackmap/patchpoint format to hold 64-bit IDs. 2013-12-13 18:37:10 +00:00