1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 03:23:01 +02:00
llvm-mirror/lib
Bill Schmidt 45b56f7632 This patch implements the general dynamic TLS model for 64-bit PowerPC.
Given a thread-local symbol x with global-dynamic access, the generated
code to obtain x's address is:

     Instruction                            Relocation            Symbol
  addis ra,r2,x@got@tlsgd@ha           R_PPC64_GOT_TLSGD16_HA       x
  addi  r3,ra,x@got@tlsgd@l            R_PPC64_GOT_TLSGD16_L        x
  bl __tls_get_addr(x@tlsgd)           R_PPC64_TLSGD                x
                                       R_PPC64_REL24           __tls_get_addr
  nop
  <use address in r3>

The implementation borrows from the medium code model work for introducing
special forms of ADDIS and ADDI into the DAG representation.  This is made
slightly more complicated by having to introduce a call to the external
function __tls_get_addr.  Using the full call machinery is overkill and,
more importantly, makes it difficult to add a special relocation.  So I've
introduced another opcode GET_TLS_ADDR to represent the function call, and
surrounded it with register copies to set up the parameter and return value.

Most of the code is pretty straightforward.  I ran into one peculiarity
when I introduced a new PPC opcode BL8_NOP_ELF_TLSGD, which is just like
BL8_NOP_ELF except that it takes another parameter to represent the symbol
("x" above) that requires a relocation on the call.  Something in the 
TblGen machinery causes BL8_NOP_ELF and BL8_NOP_ELF_TLSGD to be treated
identically during the emit phase, so this second operand was never
visited to generate relocations.  This is the reason for the slightly
messy workaround in PPCMCCodeEmitter.cpp:getDirectBrEncoding().

Two new tests are included to demonstrate correct external assembly and
correct generation of relocations using the integrated assembler.

Comments welcome!

Thanks,
Bill

llvm-svn: 169910
2012-12-11 20:30:11 +00:00
..
Analysis Holding my nose and moving the accumulation routine to GEPOperator 2012-12-11 11:05:15 +00:00
Archive Sort includes for all of the .h files under the 'lib' tree. These were 2012-12-04 07:12:27 +00:00
AsmParser Reorganize FastMathFlags to be a wrapper around unsigned, and streamline some interfaces. 2012-12-09 21:12:04 +00:00
Bitcode Reorganize FastMathFlags to be a wrapper around unsigned, and streamline some interfaces. 2012-12-09 21:12:04 +00:00
CodeGen Update some comments. 2012-12-11 19:42:09 +00:00
DebugInfo Sort includes for all of the .h files under the 'lib' tree. These were 2012-12-04 07:12:27 +00:00
ExecutionEngine Adjust JIT target triple on OS X to match the current architecture. 2012-12-05 19:09:13 +00:00
Linker Use the new script to sort the includes of every file under lib. 2012-12-03 16:50:05 +00:00
MC This patch implements the general dynamic TLS model for 64-bit PowerPC. 2012-12-11 20:30:11 +00:00
Object Use the new script to sort the includes of every file under lib. 2012-12-03 16:50:05 +00:00
Option Copy clang/Driver/<Option parsing stuff> to llvm. 2012-12-05 00:29:32 +00:00
Support Make NaCl naming consistent. The triple OSType is called NaCl and is represented 2012-12-04 18:37:26 +00:00
TableGen Sort includes for all of the .h files under the 'lib' tree. These were 2012-12-04 07:12:27 +00:00
Target This patch implements the general dynamic TLS model for 64-bit PowerPC. 2012-12-11 20:30:11 +00:00
Transforms Loop Vectorize: optimize the vectorization of trunc(induction_var). The truncation is now done on scalars. 2012-12-11 18:58:10 +00:00
VMCore Holding my nose and moving the accumulation routine to GEPOperator 2012-12-11 11:05:15 +00:00
CMakeLists.txt Copy clang/Driver/<Option parsing stuff> to llvm. 2012-12-05 00:29:32 +00:00
LLVMBuild.txt Copy clang/Driver/<Option parsing stuff> to llvm. 2012-12-05 00:29:32 +00:00
Makefile Copy clang/Driver/<Option parsing stuff> to llvm. 2012-12-05 00:29:32 +00:00