Go to file
David Peixotto e407d093e8 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.

llvm-svn: 197708
2013-12-19 18:12:36 +00:00
clang Removing the SourceLocation unused attribute argument type. 2013-12-19 18:10:57 +00:00
clang-tools-extra Fix the usage of the CommonOptionsParser ctor changed in r197139. 2013-12-12 10:01:39 +00:00
compiler-rt [ASan] Get rid of ASan-specific functions for printing stack traces 2013-12-19 11:25:05 +00:00
debuginfo-tests don't use CHECK-NEXT because it may be on the same line. 2013-09-18 23:01:54 +00:00
libclc Fix a C&P error in r195021 (65a950abab3cb8435ccb2646ac4773986c995c81) 2013-11-28 00:17:29 +00:00
libcxx Fix GCC unknown pragma warning in libc++. 2013-12-14 06:45:09 +00:00
libcxxabi Add a first cut at a Registers_arm class, to be used for 32bit arm EHABI unwinding. 2013-12-18 17:53:55 +00:00
lld Remove dead code. 2013-12-19 08:05:34 +00:00
lldb Revert one part of Ashok Thirumurthi's patch from September 16, r190812. 2013-12-19 04:32:42 +00:00
llvm Implement the ldr-pseudo opcode for ARM assembly 2013-12-19 18:12:36 +00:00
openmp Update web pages to include style sheets and referenced documents missed before. 2013-10-03 11:55:28 +00:00
polly Fix formatting 2013-12-18 11:14:36 +00:00