llvm-6502/include/llvm/Support
Bill Schmidt 57ac1f458a 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169910 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-11 20:30:11 +00:00
..
AIXDataTypesFix.h Now to chant the magical incantation that will exorcise the System library 2010-11-29 19:44:50 +00:00
AlignOf.h xlc supports __attribute__((aligned(x))), use it. 2012-10-31 00:54:26 +00:00
Allocator.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
Atomic.h Now to chant the magical incantation that will exorcise the System library 2010-11-29 19:44:50 +00:00
BlockFrequency.h Add missing includes/class declaration. 2011-11-04 18:30:30 +00:00
BranchProbability.h Make an obviously const interface actually be marked as const. 2011-11-20 11:22:03 +00:00
CallSite.h s/AttrListPtr/AttributeSet/g to better label what this class is going to be in the near future. 2012-12-07 23:16:57 +00:00
Capacity.h Add missing includes/class declaration. 2011-11-04 18:30:30 +00:00
Casting.h Casting.h: Automatically handle isa<Base>(Derived). 2012-10-11 23:30:40 +00:00
CFG.h Calls and invokes with the new clang.arc.no_objc_arc_exceptions 2012-02-17 18:59:53 +00:00
circular_raw_ostream.h Use empty parens for empty function parameter list instead of '(void)'. 2012-11-15 16:51:49 +00:00
CodeGen.h Move the TLSModel information into the TargetMachine rather than hiding 2012-04-08 17:20:55 +00:00
COFF.h [yaml2obj] Fix incorrect use of signed values. 2012-08-14 22:42:31 +00:00
CommandLine.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
Compiler.h Switch LLVM_USE_RVALUE_REFERENCES to LLVM_HAS_RVALUE_REFERENCES. 2012-11-30 11:45:22 +00:00
ConstantFolder.h Convert ConstantExpr::getGetElementPtr and 2011-07-21 14:31:17 +00:00
ConstantRange.h add ConstantRange::difference (to perform set difference/relative complement) 2012-06-28 16:10:13 +00:00
CrashRecoveryContext.h Add explicit 'unregister' method to CrashRecoveryConextCleanupRegistrar. 2011-05-04 23:26:59 +00:00
DataExtractor.h Add a relocation visitor to lib object. This works via caching relocated 2012-11-07 23:22:07 +00:00
DataFlow.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
DataStream.h Fix comment-rulers. 2012-02-06 22:41:47 +00:00
DataTypes.h.cmake Remove OpenBSD defines: 2012-08-08 18:37:39 +00:00
DataTypes.h.in Remove OpenBSD defines: 2012-08-08 18:37:39 +00:00
Debug.h Typos. 2012-07-27 21:41:59 +00:00
DebugLoc.h Pull the simple parts of DenseMapInfo<DebugLoc> inline and prune includes. 2012-07-19 15:00:34 +00:00
Disassembler.h Merge System into Support. 2010-11-29 18:16:10 +00:00
DOTGraphTraits.h Delete names for unused parameters in inline function definitions in headers, so LLVM users can compile with -Wunused-parameter. PR11257; based on patch by Kevin Harris. 2011-11-04 18:11:56 +00:00
Dwarf.h Add constant definitions for fission dwarf attributes, forms, etc. 2012-11-16 23:04:31 +00:00
DynamicLibrary.h Add missing includes/class declaration. 2011-11-04 18:30:30 +00:00
ELF.h This patch implements the general dynamic TLS model for 64-bit PowerPC. 2012-12-11 20:30:11 +00:00
Endian.h Remove 'static' from inline functions defined in header files. 2012-06-20 08:39:33 +00:00
Errno.h Now to chant the magical incantation that will exorcise the System library 2010-11-29 19:44:50 +00:00
ErrorHandling.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
FEnv.h Add missing file. 2011-06-23 14:02:13 +00:00
FileOutputBuffer.h [Support] Make FileOutputBuffer work on Windows. 2012-12-03 22:09:52 +00:00
FileSystem.h Switch LLVM_USE_RVALUE_REFERENCES to LLVM_HAS_RVALUE_REFERENCES. 2012-11-30 11:45:22 +00:00
FileUtilities.h Fix whitespace. 2011-03-31 13:06:39 +00:00
Format.h Fix Doxygen issues: 2012-09-14 14:57:36 +00:00
FormattedStream.h Add LLVM_OVERRIDE to methods that override their base classes. 2012-09-23 02:12:10 +00:00
GCOV.h Stop casting away const qualifier needlessly. 2012-09-05 22:26:57 +00:00
GetElementPtrTypeIterator.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
GraphWriter.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
Host.h revert r147542 after comments from Joerg Sonnenberger 2012-01-05 18:28:46 +00:00
IncludeFile.h Now to chant the magical incantation that will exorcise the System library 2010-11-29 19:44:50 +00:00
InstIterator.h Don't attribute in file headers anymore. See llvmdev for the 2007-12-29 19:59:42 +00:00
IntegersSubset.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
IntegersSubsetMapping.h BranchProb: modify the definition of an edge in BranchProbabilityInfo to handle 2012-08-24 18:14:27 +00:00
IRReader.h Make SMDiagnostic a little more sane. Instead of passing around note/warning/error as a 2011-10-16 05:43:57 +00:00
LeakDetector.h Make a few headers standalone. Plus, add a missing "template" keyword 2009-11-05 13:30:28 +00:00
LEB128.h Fix a couple include directives that used angle brackets for llvm files. 2012-09-15 18:41:37 +00:00
LICENSE.TXT Merge System into Support. 2010-11-29 18:16:10 +00:00
Locale.h platform support for counting column widths and checking isprint 2012-04-17 20:03:03 +00:00
LockFileManager.h Use LLVM_DELETED_FUNCTION for copy constructors and copy assignment operators that aren't implemented. 2012-09-16 21:37:56 +00:00
MachO.h Remove tabs. 2012-07-19 00:01:00 +00:00
ManagedStatic.h Add support for tsan annotations (thread sanitizer, a valgrind-based tool). 2011-11-14 20:50:16 +00:00
MathExtras.h Fix Doxygen issues: 2012-09-13 12:34:29 +00:00
Memory.h Correcting enum values mentioned in comments. 2012-10-12 21:47:49 +00:00
MemoryBuffer.h Use LLVM_DELETED_FUNCTION for copy constructors and copy assignment operators that aren't implemented. 2012-09-16 21:37:56 +00:00
MemoryObject.h Make MemoryObject accessor members const again 2012-02-29 01:09:06 +00:00
Mutex.h Use LLVM_DELETED_FUNCTION for copy constructors and copy assignment operators that aren't implemented. 2012-09-16 21:37:56 +00:00
MutexGuard.h Mark unimplemented copy constructors and copy assignment operators as LLVM_DELETED_FUNCTION. 2012-09-17 06:31:17 +00:00
NoFolder.h Insertion of NoFolder functions to avoid ambiguous overload warnings or errors about whether to convert Idx to ArrayRef<Constant *> or ArrayRef<Value *> like ConstantFolder and TargetFolder. 2012-08-17 08:54:57 +00:00
OutputBuffer.h Make a few headers standalone. Plus, add a missing "template" keyword 2009-11-05 13:30:28 +00:00
PassNameParser.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
Path.h Support: Rename Path.h to PathV1.h and add a new Path.h that includes both V1 and V2. 2010-12-17 17:22:36 +00:00
PathV1.h Revert 'Fix a typo 'iff' => 'if''. iff is an abreviation of if and only if. See: http://en.wikipedia.org/wiki/If_and_only_if Commit 164767 2012-09-27 10:14:43 +00:00
PathV2.h Fix a doxygen issue: these examples are supposed to be displayed preformatted. 2012-09-13 11:42:30 +00:00
PatternMatch.h Remove trailing whitespace 2012-12-07 21:41:53 +00:00
PluginLoader.h Don't attribute in file headers anymore. See llvmdev for the 2007-12-29 19:59:42 +00:00
PointerLikeTypeTraits.h Merge System into Support. 2010-11-29 18:16:10 +00:00
PredIteratorCache.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
PrettyStackTrace.h Add LLVM_OVERRIDE to methods that override their base classes. 2012-09-23 02:12:10 +00:00
Process.h Process: Add sys::Process::FileDescriptorHasColors(). 2012-07-20 18:29:38 +00:00
Program.h Use LLVM_DELETED_FUNCTION for copy constructors and copy assignment operators that aren't implemented. 2012-09-16 21:37:56 +00:00
raw_os_ostream.h Add LLVM_OVERRIDE to methods that override their base classes. 2012-09-23 02:12:10 +00:00
raw_ostream.h Add LLVM_OVERRIDE to methods that override their base classes. 2012-09-23 02:12:10 +00:00
Recycler.h Convert assert(0) to llvm_unreachable 2012-02-05 22:14:15 +00:00
RecyclingAllocator.h Provide operator delete for BumpPtrAllocator and RecyclingAllocator. They will 2010-04-08 15:22:35 +00:00
Regex.h Add backreference matching capabilities to Support/Regex, with 2012-11-28 19:00:02 +00:00
Registry.h Mark unimplemented copy constructors and copy assignment operators as LLVM_DELETED_FUNCTION. 2012-09-17 06:31:17 +00:00
RegistryParser.h Registry.h should not depend on CommandLine.h. 2009-01-16 07:02:28 +00:00
RWMutex.h Use LLVM_DELETED_FUNCTION for copy constructors and copy assignment operators that aren't implemented. 2012-09-16 21:37:56 +00:00
SaveAndRestore.h Move include/llvm/ADT/SaveAndRestore.h -> include/llvm/Support/SaveAndRestore.h 2012-03-01 19:45:47 +00:00
Signals.h Fix a ton of comment typos found by codespell. Patch by 2011-04-15 05:18:47 +00:00
SMLoc.h Remove some trivial copy ctors so the classes become trivially copyable and get the optimized SmallVector implementation. 2012-07-08 19:47:51 +00:00
Solaris.h Now to chant the magical incantation that will exorcise the System library 2010-11-29 19:44:50 +00:00
SourceMgr.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
StreamableMemoryObject.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
StringPool.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
SwapByteOrder.h Merge System into Support. 2010-11-29 18:16:10 +00:00
system_error.h Add LLVM_OVERRIDE to methods that override their base classes. 2012-09-23 02:12:10 +00:00
SystemUtils.h Rename FindExecutable to PrependMainExecutablePath. 2010-11-03 16:14:16 +00:00
TargetFolder.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
TargetRegistry.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
TargetSelect.h Add InitializeNativeTargetDisassembler function. 2012-03-26 21:56:56 +00:00
Threading.h Fix Doxygen issues: 2012-09-13 12:34:29 +00:00
ThreadLocal.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
Timer.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
TimeValue.h Revert 'Fix a typo 'iff' => 'if''. iff is an abreviation of if and only if. See: http://en.wikipedia.org/wiki/If_and_only_if Commit 164767 2012-09-27 10:14:43 +00:00
ToolOutputFile.h Move tool_output_file into its own file. 2010-10-07 20:32:40 +00:00
type_traits.h Fix some code which is invalid in C++11: an expression of enumeration type 2012-09-13 21:18:18 +00:00
Valgrind.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
ValueHandle.h Mark unimplemented copy constructors and copy assignment operators as LLVM_DELETED_FUNCTION. 2012-09-17 06:31:17 +00:00
Win64EH.h Updates to Win64EH.h structures. 2012-12-05 20:12:13 +00:00
YAMLParser.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00