Add some more documentation for x86 special address spaces.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71012 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dan Gohman 2009-05-05 20:48:47 +00:00
parent f9a9b51429
commit d26795a034

View File

@ -1838,7 +1838,8 @@ OperandTy: VirtReg, | VirtReg, UnsImm, VirtReg, SignExtImm
<div class="doc_text">
<p>x86 has the ability to perform loads and stores to different address spaces
<p>x86 has an experimental feature which provides
the ability to perform loads and stores to different address spaces
via the x86 segment registers. A segment override prefix byte on an
instruction causes the instruction's memory access to go to the specified
segment. LLVM address space 0 is the default address space, which includes
@ -1848,9 +1849,30 @@ OperandTy: VirtReg, | VirtReg, UnsImm, VirtReg, SignExtImm
address space 257. Other x86 segments have yet to be allocated address space
numbers.</p>
<p>Some operating systems use the FS/GS-segment to implement TLS, so care
should be taken when reading and writing to address space 256/257 on these
platforms.</p>
<p>While these address spaces may seem similar to TLS via the
<tt>thread_local</tt> keyword, and often use the same underlying hardware,
there are some fundamental differences.</p>
<p>The <tt>thread_local</tt> keyword applies to global variables and
specifies that they are to be allocated in thread-local memory. There are
no type qualifiers involved, and these variables can be pointed to with
normal pointers and accessed with normal loads and stores.
The <tt>thread_local</tt> keyword is target-independent at the LLVM IR
level (though LLVM doesn't yet have implementations of it for some
configurations).<p>
<p>Special address spaces, in contrast, apply to static types. Every
load and store has a particular address space in its address operand type,
and this is what determines which address space is accessed.
LLVM ignores these special address space qualifiers on global variables,
and does not provide a way to directly allocate storage in them.
At the LLVM IR level, the behavior of these special address spaces depends
in part on the underlying OS or runtime environment, and they are specific
to x86 (and LLVM doesn't yet handle them correctly in some cases).</p>
<p>Some operating systems and runtime environments use (or may in the future
use) the FS/GS-segment registers for various low-level purposes, so care
should be taken when considering them.</p>
</div>