llvm-6502/lib
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
..
Analysis [block-freq] Teach branch probability how to return the edge weight in between a BasicBlock and one of its successors. 2013-12-14 02:24:25 +00:00
AsmParser Begin adding docs and IR-level support for the inalloca attribute 2013-12-19 02:14:12 +00:00
Bitcode Begin adding docs and IR-level support for the inalloca attribute 2013-12-19 02:14:12 +00:00
CodeGen [stackprotector] Use analysis from the StackProtector pass for stack layout in PEI a nd LocalStackSlot passes. 2013-12-19 03:17:11 +00:00
DebugInfo DebugInfo: Move type units into the debug_types section with appropriate comdat grouping and type unit headers 2013-12-13 21:33:40 +00:00
ExecutionEngine There are no __register_frame and __deregister_frame functions 2013-12-17 08:40:11 +00:00
IR GCOV.cpp: Fix format strings, %lf. Don't use %lf to double. 2013-12-19 08:46:28 +00:00
IRReader [llvm-c] Expose IRReader interface 2013-11-06 09:21:15 +00:00
Linker Revert "Move copying of global initializers below the cloning of functions." 2013-11-09 00:43:18 +00:00
LTO Add TargetLibraryInfo in LTO passes builder 2013-12-12 01:37:39 +00:00
MC Add a finishParse() callback to the targer asm parser 2013-12-19 18:08:08 +00:00
Object Support for microMIPS TLS relocations. 2013-12-19 16:02:32 +00:00
Option Avoid buffer copies when a Twine already is a StringRef. 2013-12-03 18:18:28 +00:00
Support Pull in a couple of new constants from the upcoming DWARF 5 standard. 2013-12-18 21:48:14 +00:00
TableGen Fix most memory leaks in tablegen. 2013-10-31 04:07:41 +00:00
Target Implement the ldr-pseudo opcode for ARM assembly 2013-12-19 18:12:36 +00:00
Transforms Improved fix for PR17827 (instcombine of shift/and/compare). 2013-12-19 18:07:17 +00:00
CMakeLists.txt Move LTO support library to a component, allowing it to be tested 2013-09-24 23:52:22 +00:00
LLVMBuild.txt Move LTO support library to a component, allowing it to be tested 2013-09-24 23:52:22 +00:00
Makefile Reformat Makefile. No other changes. 2013-10-30 04:03:03 +00:00