1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 04:32:44 +01:00
llvm-mirror/include/llvm/MC
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
..
MCParser Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
EDInstInfo.h Tidy up. Trailing whitespace. 2012-05-11 01:39:13 +00:00
MachineLocation.h Tidy up. Trailing whitespace. 2012-05-11 01:39:13 +00:00
MCAsmBackend.h MachO: direct-to-object attribute for data-in-code markers. 2012-10-01 22:20:54 +00:00
MCAsmInfo.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
MCAsmInfoCOFF.h Unweaken vtables as per http://llvm.org/docs/CodingStandards.html#ll_virtual_anch 2011-12-20 02:50:00 +00:00
MCAsmInfoDarwin.h Unweaken vtables as per http://llvm.org/docs/CodingStandards.html#ll_virtual_anch 2011-12-20 02:50:00 +00:00
MCAsmLayout.h Cleanup formatting, comments and naming. 2012-12-10 20:13:43 +00:00
MCAssembler.h Cleanup formatting, comments and naming. 2012-12-10 20:13:43 +00:00
MCAtom.h MCAtom extending methods need to extend the range of the atom as well. 2011-10-10 18:09:38 +00:00
MCCodeEmitter.h Fix Doxygen issues: 2012-09-14 14:57:36 +00:00
MCCodeGenInfo.h Fix typo in comment. 2012-02-17 16:39:47 +00:00
MCContext.h fixed valgrind issues of prior commit, this change applies r169456 changes back to the tree with fixes. on darwin no valgrind issues exist in the tests that used to fail. 2012-12-06 22:12:44 +00:00
MCDirectives.h Refactor data-in-code annotations. 2012-05-18 19:12:01 +00:00
MCDisassembler.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
MCDwarf.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
MCELF.h Added Mapping Symbols for ARM ELF 2012-12-07 16:50:23 +00:00
MCELFObjectWriter.h Add 'const' qualifier on member functions not changing its fields. 2012-10-25 18:35:04 +00:00
MCELFStreamer.h Fix Windows build breakage. 2012-12-08 05:19:49 +00:00
MCELFSymbolFlags.h sets bit 0 of the function address of thumb function in .symtab 2011-05-16 16:17:21 +00:00
MCExpr.h This patch implements the general dynamic TLS model for 64-bit PowerPC. 2012-12-11 20:30:11 +00:00
MCFixedLenDisassembler.h Switch the fixed-length disassembler to be table-driven. 2012-08-14 19:06:05 +00:00
MCFixup.h Convert assert(0) to llvm_unreachable 2012-02-05 22:14:15 +00:00
MCFixupKindInfo.h Tidy up. Trailing whitespace. 2012-05-11 01:39:13 +00:00
MCInst.h Fix Doxygen issues: 2012-09-14 14:57:36 +00:00
MCInstBuilder.h Decouple MCInstBuilder from the streamer per Eli's request. 2012-11-26 18:05:52 +00:00
MCInstPrinter.h Try to unbreak the build on hosts that don't transitively pull in a definition for int64_t. 2012-12-05 18:31:11 +00:00
MCInstrAnalysis.h Use the correct predicate for determining if a branch is conditional or not. 2011-10-17 21:21:44 +00:00
MCInstrDesc.h Typo. 2012-09-24 23:04:25 +00:00
MCInstrInfo.h Revert r152202: "Use uint16_t to store InstrNameIndices in MCInstrInfo." 2012-03-15 18:05:57 +00:00
MCInstrItineraries.h I'm introducing a new machine model to simultaneously allow simple 2012-07-07 04:00:00 +00:00
MCLabel.h Fix Doxygen issues: 2012-09-14 14:57:36 +00:00
MCMachObjectWriter.h Fix Doxygen issues: 2012-09-14 14:57:36 +00:00
MCMachOSymbolFlags.h MC/Mach-O/Thumb: Set the thumb bit in the symbol table. 2010-12-29 14:14:06 +00:00
MCModule.h Start stubbing out MCModule and MCAtom, which provide an API for accessing the rich disassembly of a complete object or executable. 2011-09-22 22:32:22 +00:00
MCObjectFileInfo.h Add the rest of the experimental fission sections to MC. 2012-11-30 06:47:06 +00:00
MCObjectStreamer.h Lift EmitAssignment into MCObjectStreamer which gets rid of at least three 2012-12-07 17:42:41 +00:00
MCObjectWriter.h Make the contents of encoded sections SmallVector<char, N> instead of 2012-12-07 22:06:56 +00:00
MCRegisterInfo.h Add an MCPhysReg typedef to replace naked uint16_t. 2012-11-29 02:39:28 +00:00
MCSchedule.h misched: TargetSchedule interface for machine resources. 2012-11-06 07:10:38 +00:00
MCSection.h Remove unnecessary classof()'s 2012-10-11 23:30:49 +00:00
MCSectionCOFF.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
MCSectionELF.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
MCSectionMachO.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
MCStreamer.h Defer call to InitSections until after MCContext has been initialized. If 2012-12-10 22:49:11 +00:00
MCSubtargetInfo.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
MCSymbol.h Fix Doxygen issues: 2012-09-14 14:57:36 +00:00
MCTargetAsmLexer.h Fix Doxygen issues: 2012-09-14 14:57:36 +00:00
MCTargetAsmParser.h [ms-inline asm] Add support for the TYPE operator. 2012-10-26 18:04:20 +00:00
MCValue.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
MCWin64EH.h Add a parameter to the Win64 EH section getters to get a section with a 2011-05-27 19:09:24 +00:00
MCWinCOFFObjectWriter.h Use the new script to sort the includes of every file under lib. 2012-12-03 16:50:05 +00:00
SectionKind.h Trailing whitespace. 2010-07-01 01:00:22 +00:00
SubtargetFeature.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00