[cfe-commits] r68724 - /cfe/trunk/docs/LanguageExtensions.html

Chris Lattner sabre at nondot.org
Thu Apr 9 12:58:17 PDT 2009


Author: lattner
Date: Thu Apr  9 14:58:15 2009
New Revision: 68724

URL: http://llvm.org/viewvc/llvm-project?rev=68724&view=rev
Log:
document the x86 address space extension for GS.

Modified:
    cfe/trunk/docs/LanguageExtensions.html

Modified: cfe/trunk/docs/LanguageExtensions.html
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LanguageExtensions.html?rev=68724&r1=68723&r2=68724&view=diff

==============================================================================
--- cfe/trunk/docs/LanguageExtensions.html (original)
+++ cfe/trunk/docs/LanguageExtensions.html Thu Apr  9 14:58:15 2009
@@ -27,6 +27,11 @@
   <li><a href="#__builtin_shufflevector">__builtin_shufflevector</a></li>
   </ul>
 </li>
+<li><a href="#targetspecific">Target-Specific Extensions</a>
+  <ul>
+  <li><a href="#x86-specific">X86/X86-64 Language Extensions</a></li>
+  </ul>
+</li>
 </ul>
 
 
@@ -224,6 +229,45 @@
 the number of indices specified.
 </p>
 
+<!-- ======================================================================= -->
+<h2 id="targetspecific">Target-Specific Extensions</h2>
+<!-- ======================================================================= -->
+
+<p>Clang supports some language features conditionally on some targets.</p>
+
+<!-- ======================================================================= -->
+<h3 id="x86-specific">X86/X86-64 Language Extensions</h3>
+<!-- ======================================================================= -->
+
+<p>The X86 backend has these language extensions:</p>
+
+<!-- ======================================================================= -->
+<h4 id="x86-gs-segment">Memory references off the GS segment</h4>
+<!-- ======================================================================= -->
+
+<p>Annotating a pointer with address space #256 causes it to  be code generated
+relative to the X86 GS segment register.  
+Note that this is a very very low-level feature that should only be used if you
+know what you're doing (for example in an OS kernel).</p>
+
+<p>Here is an example:</p>
+
+<pre>
+#define GS_RELATIVE __attribute__((address_space(256)))
+int foo(int GS_RELATIVE *P) {
+  return *P;
+}
+</pre>
+
+<p>Which compiles to (on X86-32):</p>
+
+<pre>
+_foo:
+	movl	4(%esp), %eax
+	movl	%gs:(%eax), %eax
+	ret
+</pre>
+
 </div>
 </body>
 </html>





More information about the cfe-commits mailing list