Added missing instructions and constant expressions. Updated documentation.
git-svn-id: http://llvm-py.googlecode.com/svn/trunk@9 8d1e9007-1d4e-0410-b67e-1979fd6579aa
This commit is contained in:
parent
71e1ee072a
commit
a73422f719
17 changed files with 752 additions and 57 deletions
|
|
@ -38,19 +38,27 @@
|
|||
<p>llvm-py is developed by Mahadevan R, in his spare time, without being
|
||||
paid for it. He can be reached at mdevan.foobar@gmail.com, on the
|
||||
llvm-dev mailing list and irc.oftc.net#llvm (mdevan).</p>
|
||||
<p>Many thanks to the guys over at LLVM for all the nifty software, and a
|
||||
helpful mailing list.</p>
|
||||
<p>Many thanks to the guys over at LLVM for all the nifty software.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div id="footer">
|
||||
<div id="footer-text">
|
||||
Web pages © Mahadevan R. Generated with <a href="http://www.methods.co.nz/asciidoc/">asciidoc</a>.
|
||||
Last updated 10-Jun-2008.
|
||||
Last updated 11-Jun-2008.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<script type="text/javascript">
|
||||
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
|
||||
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
var pageTracker = _gat._getTracker("UA-4519056-2");
|
||||
pageTracker._initData();
|
||||
pageTracker._trackPageview();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -91,5 +91,14 @@ Last updated 10-Jun-2008.
|
|||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<script type="text/javascript">
|
||||
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
|
||||
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
var pageTracker = _gat._getTracker("UA-4519056-2");
|
||||
pageTracker._initData();
|
||||
pageTracker._trackPageview();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ package.</p>
|
|||
<div class="sectionbody">
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre><tt>0.2, ongoing:
|
||||
<pre><tt>0.2, xx-Jun-2008:
|
||||
|
||||
* Independent package, need not be unpacked into llvm/bindings
|
||||
* Fixed ownership issues with Module/ModuleProvider
|
||||
|
|
@ -126,7 +126,6 @@ package.</p>
|
|||
|
||||
* Initial release.
|
||||
|
||||
|
||||
</tt></pre>
|
||||
</div></div>
|
||||
</div>
|
||||
|
|
@ -140,5 +139,14 @@ Last updated 10-Jun-2008.
|
|||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<script type="text/javascript">
|
||||
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
|
||||
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
var pageTracker = _gat._getTracker("UA-4519056-2");
|
||||
pageTracker._initData();
|
||||
pageTracker._trackPageview();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -110,5 +110,14 @@ Last updated 10-Jun-2008.
|
|||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<script type="text/javascript">
|
||||
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
|
||||
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
var pageTracker = _gat._getTracker("UA-4519056-2");
|
||||
pageTracker._initData();
|
||||
pageTracker._trackPageview();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -67,5 +67,14 @@ Last updated 10-Jun-2008.
|
|||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<script type="text/javascript">
|
||||
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
|
||||
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
var pageTracker = _gat._getTracker("UA-4519056-2");
|
||||
pageTracker._initData();
|
||||
pageTracker._trackPageview();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -35,9 +35,9 @@
|
|||
</div>
|
||||
<div id="preamble">
|
||||
<div class="sectionbody">
|
||||
<p><em>llvm-py</em> is distributed under the
|
||||
<p>llvm-py is distributed under the
|
||||
<a href="http://www.opensource.org/licenses/bsd-license.php">new BSD license</a>.
|
||||
This is similar to LLVM's license. You should be able to use <em>llvm-py</em>
|
||||
This is similar to LLVM's license. You should be able to use llvm-py
|
||||
where-ever and how-ever you're able to use LLVM itself.</p>
|
||||
<p>The license text is present in the
|
||||
<a href="http://code.google.com/p/llvm-py/source/browse/trunk/LICENSE">LICENSE</a>
|
||||
|
|
@ -76,12 +76,21 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</tt></pre>
|
|||
<div id="footer">
|
||||
<div id="footer-text">
|
||||
Web pages © Mahadevan R. Generated with <a href="http://www.methods.co.nz/asciidoc/">asciidoc</a>.
|
||||
Last updated 10-Jun-2008.
|
||||
Last updated 11-Jun-2008.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<script type="text/javascript">
|
||||
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
|
||||
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
var pageTracker = _gat._getTracker("UA-4519056-2");
|
||||
pageTracker._initData();
|
||||
pageTracker._trackPageview();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -224,8 +224,6 @@ level than the usual assembly language; for example there are
|
|||
instructions related to variable argument handling, exception handling,
|
||||
and garbage collection. These allow high-level languages to be
|
||||
represented cleanly in the IR.</p>
|
||||
<p>The full set of instructions are:</p>
|
||||
<p>TODO</p>
|
||||
<h3>SSA Form and PHI Nodes</h3>
|
||||
<p>All LLVM instructions are represented in the <em>Static Single Assignment</em>
|
||||
(SSA) form. Essentially, this means that any variable can be assigned to
|
||||
|
|
@ -261,7 +259,7 @@ LLVM instruction set has an instruction called <tt>phi</tt>.</p>
|
|||
<h3>LLVM Assembly Language</h3>
|
||||
<p>The LLVM IR can be represented offline in two formats
|
||||
- a textual, human-readable form, similar to assembly language, called
|
||||
the LLVM assembly language (files with .ll extension) (XXX ?)
|
||||
the LLVM assembly language (files with .ll extension)
|
||||
- a binary form, called the LLVM bitcode (files with .bc extension)
|
||||
All three formats (the in-memory IR, the LLVM assembly language and the
|
||||
LLVM bitcode) represent the <em>same</em> information. Each format can be
|
||||
|
|
@ -269,26 +267,215 @@ converted into the other two formats (using LLVM APIs).</p>
|
|||
<p>The <a href="http://www.llvm.org/demo/">LLVM demo page</a> lets you type in C or C++
|
||||
code, converts it into LLVM IR and outputs the IR as LLVM assembly
|
||||
language code.</p>
|
||||
<p>Here's a function in C, that calculates the sum of the first <em>n</em>
|
||||
fibonacci numbers:</p>
|
||||
<p>Just to get a feel of the LLVM assembly language, here's a function in C,
|
||||
and the corresponding LLVM assembly (as generated by the demo page):</p>
|
||||
<div class="listingblock">
|
||||
<div class="content"><!-- Generator: GNU source-highlight 2.4
|
||||
by Lorenzo Bettini
|
||||
http://www.lorenzobettini.it
|
||||
http://www.gnu.org/software/src-highlite -->
|
||||
<pre><tt><span style="color: #009900">int</span> <span style="font-weight: bold"><span style="color: #000000">fibsum</span></span><span style="color: #990000">(</span><span style="color: #009900">int</span> n<span style="color: #990000">)</span>
|
||||
<pre><tt><span style="font-style: italic"><span style="color: #9A1900">/* compute sum of 1..n */</span></span>
|
||||
<span style="color: #009900">unsigned</span> <span style="font-weight: bold"><span style="color: #000000">sum</span></span><span style="color: #990000">(</span><span style="color: #009900">unsigned</span> n<span style="color: #990000">)</span>
|
||||
<span style="color: #FF0000">{</span>
|
||||
<span style="font-weight: bold"><span style="color: #0000FF">if</span></span> <span style="color: #990000">(</span>n <span style="color: #990000">==</span> <span style="color: #993399">0</span><span style="color: #990000">)</span>
|
||||
<span style="font-weight: bold"><span style="color: #0000FF">return</span></span> <span style="color: #993399">0</span><span style="color: #990000">;</span>
|
||||
<span style="font-weight: bold"><span style="color: #0000FF">else</span></span>
|
||||
<span style="font-weight: bold"><span style="color: #0000FF">return</span></span> n <span style="color: #990000">+</span> <span style="font-weight: bold"><span style="color: #000000">sum</span></span><span style="color: #990000">(</span>n<span style="color: #990000">-</span><span style="color: #993399">1</span><span style="color: #990000">);</span>
|
||||
<span style="color: #FF0000">}</span>
|
||||
</tt></pre></div></div>
|
||||
<p>And here's the corresponding LLVM assembly listing, as provided by the
|
||||
demo page:</p>
|
||||
<p>The corresponding LLVM assembly:</p>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre><tt></tt></pre>
|
||||
<pre><tt>; ModuleID = '/tmp/webcompile/_4940_0.bc'
|
||||
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
|
||||
target triple = "i386-pc-linux-gnu"
|
||||
|
||||
define i32 @sum(i32 %n) nounwind {
|
||||
entry:
|
||||
%tmp215 = icmp eq i32 %n, 0 ; <i1> [#uses=1]
|
||||
br i1 %tmp215, label %bb10, label %tailrecurse.bb10_crit_edge
|
||||
|
||||
tailrecurse.bb10_crit_edge: ; preds = %entry
|
||||
%tmp = add i32 %n, -1 ; <i32> [#uses=3]
|
||||
%tmp17 = mul i32 %tmp, %tmp ; <i32> [#uses=1]
|
||||
%tmp18 = add i32 %tmp17, %n ; <i32> [#uses=1]
|
||||
%tmp. = zext i32 %tmp to i64 ; <i64> [#uses=2]
|
||||
%tmp19 = add i64 %tmp., -1 ; <i64> [#uses=1]
|
||||
%tmp20 = mul i64 %tmp19, %tmp. ; <i64> [#uses=1]
|
||||
%tmp21 = lshr i64 %tmp20, 1 ; <i64> [#uses=1]
|
||||
%tmp.22 = trunc i64 %tmp21 to i32 ; <i32> [#uses=1]
|
||||
%tmp24 = sub i32 %tmp18, %tmp.22 ; <i32> [#uses=1]
|
||||
ret i32 %tmp24
|
||||
|
||||
bb10: ; preds = %entry
|
||||
ret i32 0
|
||||
}</tt></pre>
|
||||
</div></div>
|
||||
<p>Note the … TODO …</p>
|
||||
<p>Note the usage of SSA form and the total absence of any loop or
|
||||
recursion at all!</p>
|
||||
<p>The <a href="http://www.llvm.org/docs/LangRef.html">LLVM Language Reference</a>
|
||||
defines the LLVM assembly language including the entire instruction set.</p>
|
||||
defines the LLVM assembly language including the entire instruction set.
|
||||
The table below lists all the LLVM instructions. Each instruction links
|
||||
to it's documentation.</p>
|
||||
<div class="tableblock">
|
||||
<table rules="all"
|
||||
frame="border"
|
||||
cellspacing="0" cellpadding="4">
|
||||
<caption class="title">Table: LLVM Instruction Set</caption>
|
||||
<col width="240" />
|
||||
<col width="560" />
|
||||
<thead>
|
||||
<tr>
|
||||
<th align="left">
|
||||
Category
|
||||
</th>
|
||||
<th align="left">
|
||||
Instructions
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody valign="top">
|
||||
<tr>
|
||||
<td align="left">
|
||||
Terminator instructions
|
||||
</td>
|
||||
<td align="left">
|
||||
<a href="http://www.llvm.org/docs/LangRef.html#i_ret">ret</a>, <a href="http://www.llvm.org/docs/LangRef.html#i_br">br</a>, <a href="http://www.llvm.org/docs/LangRef.html#i_switch">switch</a>, <a href="http://www.llvm.org/docs/LangRef.html#i_invoke">invoke</a>, <a href="http://www.llvm.org/docs/LangRef.html#i_unwind">unwind</a>, <a href="http://www.llvm.org/docs/LangRef.html#i_unreachable">unreachable</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">
|
||||
Binary operations
|
||||
</td>
|
||||
<td align="left">
|
||||
<a href="http://www.llvm.org/docs/LangRef.html#i_add">add</a>, <a href="http://www.llvm.org/docs/LangRef.html#i_sub">sub</a>, <a href="http://www.llvm.org/docs/LangRef.html#i_mul">mul</a>, <a href="http://www.llvm.org/docs/LangRef.html#i_udiv">udiv</a>, <a href="http://www.llvm.org/docs/LangRef.html#i_sdiv">sdiv</a>, <a href="http://www.llvm.org/docs/LangRef.html#i_fdiv">fdiv</a>, <a href="http://www.llvm.org/docs/LangRef.html#i_urem">urem</a>, <a href="http://www.llvm.org/docs/LangRef.html#i_srem">srem</a>, <a href="http://www.llvm.org/docs/LangRef.html#i_frem">frem</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">
|
||||
Bitwise binary operations
|
||||
</td>
|
||||
<td align="left">
|
||||
<a href="http://www.llvm.org/docs/LangRef.html#i_shl">shl</a>, <a href="http://www.llvm.org/docs/LangRef.html#i_lshr">lshr</a>, <a href="http://www.llvm.org/docs/LangRef.html#i_ashr">ashr</a>, <a href="http://www.llvm.org/docs/LangRef.html#i_and">and</a>, <a href="http://www.llvm.org/docs/LangRef.html#i_or">or</a>, <a href="http://www.llvm.org/docs/LangRef.html#i_xor">xor</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">
|
||||
Vector operations
|
||||
</td>
|
||||
<td align="left">
|
||||
<a href="http://www.llvm.org/docs/LangRef.html#i_extractelement">extractelement</a>, <a href="http://www.llvm.org/docs/LangRef.html#i_insertelement">insertelement</a>, <a href="http://www.llvm.org/docs/LangRef.html#i_shufflevector">shufflevector</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">
|
||||
Aggregate operations
|
||||
</td>
|
||||
<td align="left">
|
||||
<a href="http://www.llvm.org/docs/LangRef.html#i_extractvalue">extractvalue</a>, <a href="http://www.llvm.org/docs/LangRef.html#i_insertvalue">insertvalue</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">
|
||||
Memory access and addressing operations
|
||||
</td>
|
||||
<td align="left">
|
||||
<a href="http://www.llvm.org/docs/LangRef.html#i_malloc">malloc</a>, <a href="http://www.llvm.org/docs/LangRef.html#i_free">free</a>, <a href="http://www.llvm.org/docs/LangRef.html#i_alloca">alloca</a>, <a href="http://www.llvm.org/docs/LangRef.html#i_load">load</a>, <a href="http://www.llvm.org/docs/LangRef.html#i_store">store</a>, <a href="http://www.llvm.org/docs/LangRef.html#i_getelementptr">getelementptr</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">
|
||||
Conversion operations
|
||||
</td>
|
||||
<td align="left">
|
||||
<a href="http://www.llvm.org/docs/LangRef.html#i_trunc">trunc</a>, <a href="http://www.llvm.org/docs/LangRef.html#i_zext">zext</a>, <a href="http://www.llvm.org/docs/LangRef.html#i_sext">sext</a>, <a href="http://www.llvm.org/docs/LangRef.html#i_fptrunc">fptrunc</a>, <a href="http://www.llvm.org/docs/LangRef.html#i_fpext">fpext</a>, <a href="http://www.llvm.org/docs/LangRef.html#i_fptoui">fptoui</a>, <a href="http://www.llvm.org/docs/LangRef.html#i_fptosi">fptosi</a>, <a href="http://www.llvm.org/docs/LangRef.html#i_uitofp">uitofp</a>, <a href="http://www.llvm.org/docs/LangRef.html#i_sitofp">sitofp</a>, <a href="http://www.llvm.org/docs/LangRef.html#i_ptrtoint">ptrtoint</a>, <a href="http://www.llvm.org/docs/LangRef.html#i_inttoptr">inttoptr</a>, <a href="http://www.llvm.org/docs/LangRef.html#i_bitcast">bitcast</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">
|
||||
Other operations
|
||||
</td>
|
||||
<td align="left">
|
||||
<a href="http://www.llvm.org/docs/LangRef.html#i_icmp">icmp</a>, <a href="http://www.llvm.org/docs/LangRef.html#i_fcmp">fcmp</a>, <a href="http://www.llvm.org/docs/LangRef.html#i_vicmp">vicmp</a>, <a href="http://www.llvm.org/docs/LangRef.html#i_vfcmp">vfcmp</a>, <a href="http://www.llvm.org/docs/LangRef.html#i_phi">phi</a>, <a href="http://www.llvm.org/docs/LangRef.html#i_select">select</a>, <a href="http://www.llvm.org/docs/LangRef.html#i_call">call</a>, <a href="http://www.llvm.org/docs/LangRef.html#i_va_arg">va_arg</a>, <a href="http://www.llvm.org/docs/LangRef.html#i_getresult">getresult</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">
|
||||
Variable argument handling intrinsics
|
||||
</td>
|
||||
<td align="left">
|
||||
<a href="http://www.llvm.org/docs/LangRef.html#int_va_start">llvm.va_start</a>, <a href="http://www.llvm.org/docs/LangRef.html#int_va_end">llvm.va_end</a>, <a href="http://www.llvm.org/docs/LangRef.html#int_va_copy">llvm.va_copy</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">
|
||||
Accurate garbage collection intrinsics
|
||||
</td>
|
||||
<td align="left">
|
||||
<a href="http://www.llvm.org/docs/LangRef.html#int_returnaddress">llvm.returnaddress</a>, <a href="http://www.llvm.org/docs/LangRef.html#int_frameaddress">llvm.frameaddress</a>, <a href="http://www.llvm.org/docs/LangRef.html#int_stacksave">llvm.stacksave</a>, <a href="http://www.llvm.org/docs/LangRef.html#int_stackrestore">llvm.stackrestore</a>, <a href="http://www.llvm.org/docs/LangRef.html#int_prefetch">llvm.prefetch</a>, <a href="http://www.llvm.org/docs/LangRef.html#int_pcmarker">llvm.pcmarker</a>, <a href="http://www.llvm.org/docs/LangRef.html#int_readcyclecounter">llvm.readcyclecounter</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">
|
||||
Standard C library intrinsics
|
||||
</td>
|
||||
<td align="left">
|
||||
<a href="http://www.llvm.org/docs/LangRef.html#int_memcpy">llvm.memcpy.*</a>, <a href="http://www.llvm.org/docs/LangRef.html#int_memmove">llvm.memmove.*</a>, <a href="http://www.llvm.org/docs/LangRef.html#int_memset">llvm.memset.*</a>, <a href="http://www.llvm.org/docs/LangRef.html#int_sqrt">llvm.sqrt.*</a>, <a href="http://www.llvm.org/docs/LangRef.html#int_powi">llvm.powi.*</a>, <a href="http://www.llvm.org/docs/LangRef.html#int_sin">llvm.sin.*</a>, <a href="http://www.llvm.org/docs/LangRef.html#int_cos">llvm.cos.*</a>, <a href="http://www.llvm.org/docs/LangRef.html#int_pow">llvm.pow.*</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">
|
||||
Bit manipulation intrinsics
|
||||
</td>
|
||||
<td align="left">
|
||||
<a href="http://www.llvm.org/docs/LangRef.html#int_bswap">llvm.bswap.*</a>, <a href="http://www.llvm.org/docs/LangRef.html#int_ctpop">llvm.ctpop.*</a>, <a href="http://www.llvm.org/docs/LangRef.html#int_ctlz">llvm.ctlz.*</a>, <a href="http://www.llvm.org/docs/LangRef.html#int_cttz">llvm.cttz.*</a>, <a href="http://www.llvm.org/docs/LangRef.html#int_part_select">llvm.part.select.*</a>, <a href="http://www.llvm.org/docs/LangRef.html#int_part_set">llvm.part.set.*</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">
|
||||
Debugger intrinsics
|
||||
</td>
|
||||
<td align="left">
|
||||
<a href="http://www.llvm.org/docs/SourceLevelDebugging.html#format_common_stoppoint">llvm.dbg.stoppoint</a>, <a href="http://www.llvm.org/docs/SourceLevelDebugging.html#format_common_func_start">llvm.dbg.func.start</a>, <a href="http://www.llvm.org/docs/SourceLevelDebugging.html#format_common_region_start">llvm.dbg.region.start</a>, <a href="http://www.llvm.org/docs/SourceLevelDebugging.html#format_common_region_end">llvm.dbg.region.end</a>, <a href="http://www.llvm.org/docs/SourceLevelDebugging.html#format_common_declare">llvm.dbg.declare</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">
|
||||
Exception handling intrinsics
|
||||
</td>
|
||||
<td align="left">
|
||||
<a href="http://www.llvm.org/docs/ExceptionHandling.html#llvm_eh_exception">llvm.eh_exception</a>, <a href="http://www.llvm.org/docs/ExceptionHandling.html#llvm_eh_selector">llvm.eh_selector</a>, <a href="http://www.llvm.org/docs/ExceptionHandling.html#llvm_eh_typeid_for">llvm.eh_typeid_for</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">
|
||||
Trampoline intrinsics
|
||||
</td>
|
||||
<td align="left">
|
||||
<a href="http://www.llvm.org/docs/LangRef.html#int_it">llvm.init.trampoline</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">
|
||||
Atomic intrinsics
|
||||
</td>
|
||||
<td align="left">
|
||||
<a href="http://www.llvm.org/docs/LangRef.html#int_memory_barrier">llvm.memory.barrier</a>, <a href="http://www.llvm.org/docs/LangRef.html#int_atomic_lcs">llvm.atomic.lcs</a>, <a href="http://www.llvm.org/docs/LangRef.html#int_atomic_las">llvm.atomic.las</a>, <a href="http://www.llvm.org/docs/LangRef.html#int_atomic_swap">llvm.atomic.swap</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">
|
||||
General intrinsics
|
||||
</td>
|
||||
<td align="left">
|
||||
<a href="http://www.llvm.org/docs/LangRef.html#int_var_annotation">llvm.var.annotation</a>, <a href="http://www.llvm.org/docs/LangRef.html#int_annotation">llvm.annotation.*</a>, <a href="http://www.llvm.org/docs/LangRef.html#int_trap">llvm.trap</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<p>Intrinsics (instructions that start with <tt>llvm.</tt>) are not yet available
|
||||
in llvm-py.</p>
|
||||
<h3>Modules</h3>
|
||||
<p>Modules, in the LLVM IR, are similar to a single <em>C</em> language source
|
||||
file (.c file). A module contains:</p>
|
||||
|
|
@ -330,8 +517,7 @@ can write your own passes (in C/C++, as a shared library). This can be
|
|||
loaded and executed by <tt>opt</tt>. (Although llvm-py does not allow you to
|
||||
write your own passes, it does allow you to navigate the entire IR at
|
||||
any stage, and perform any transforms on it as you like.)</p>
|
||||
<p>Passes are run using a <em>pass manager</em>. For our purposes, there are two
|
||||
pass managers TODO</p>
|
||||
<p>Passes are run using a <em>pass manager</em>. TODO</p>
|
||||
<h3>Execution Engine</h3>
|
||||
<p>TODO</p>
|
||||
<h3>BitCode</h3>
|
||||
|
|
@ -374,9 +560,10 @@ public modules. These are:</p>
|
|||
Python constructs are used (deliberately) —
|
||||
<a href="http://docs.python.org/lib/built-in-funcs.html">property()</a> and
|
||||
<a href="http://wiki.python.org/moin/PythonDecoratorLibrary">property
|
||||
decorators</a> are probably the most exotic animals around. The APIs are
|
||||
designed to be navigable (and guessable!) once you know a few
|
||||
conventions. These conventions are highlighted in the sections below.</p>
|
||||
decorators</a> are probably the most exotic animals around. All classes are
|
||||
the "new style" classes. The APIs are designed to be navigable (and
|
||||
guessable!) once you know a few conventions. These conventions are
|
||||
highlighted in the sections below.</p>
|
||||
<p>Here is a quick overview of the contents of each package:</p>
|
||||
<div class="title">llvm</div><ul>
|
||||
<li>
|
||||
|
|
@ -559,7 +746,112 @@ corresponding classes. Constructors <em>should not</em> be used.</p>
|
|||
</td>
|
||||
</tr></table>
|
||||
</div>
|
||||
<p>The argument <em>my_module</em> is a module identifier (a plain string).</p>
|
||||
<p>The argument <tt>my_module</tt> is a module identifier (a plain string). The
|
||||
attributes of the <tt>Module</tt> class is:</p>
|
||||
<div class="exampleblock">
|
||||
<div class="title">llvm.core.Module</div>
|
||||
<div class="exampleblock-content">
|
||||
<div class="title">Static Constructors</div><dl>
|
||||
<dt>
|
||||
<tt>new(module_id)</tt>
|
||||
</dt>
|
||||
<dd>
|
||||
<p>
|
||||
create a new <tt>Module</tt> instance with given <tt>module_id</tt>. The <tt>module_id</tt>
|
||||
should be a string.
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="title">Properties</div><dl>
|
||||
<dt>
|
||||
<tt>data_layout</tt> (r/w)
|
||||
</dt>
|
||||
<dd>
|
||||
<p>
|
||||
a string representing the ABI of the platform
|
||||
</p>
|
||||
</dd>
|
||||
<dt>
|
||||
<tt>target</tt> (r/w)
|
||||
</dt>
|
||||
<dd>
|
||||
<p>
|
||||
a string like <tt>i386-pc-linux-gnu</tt> or <tt>i386-pc-solaris2.8</tt>
|
||||
</p>
|
||||
</dd>
|
||||
<dt>
|
||||
<tt>global_variables</tt> (r)
|
||||
</dt>
|
||||
<dd>
|
||||
<p>
|
||||
TODO
|
||||
</p>
|
||||
</dd>
|
||||
<dt>
|
||||
<tt>functions</tt> (r)
|
||||
</dt>
|
||||
<dd>
|
||||
<p>
|
||||
TODO
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="title">Methods</div><dl>
|
||||
<dt>
|
||||
<tt>add_type_name</tt>
|
||||
</dt>
|
||||
<dd>
|
||||
<p>
|
||||
TODO
|
||||
</p>
|
||||
</dd>
|
||||
<dt>
|
||||
<tt>delete_type_name</tt>
|
||||
</dt>
|
||||
<dd>
|
||||
<p>
|
||||
TODO
|
||||
</p>
|
||||
</dd>
|
||||
<dt>
|
||||
<tt>add_global_variable</tt>
|
||||
</dt>
|
||||
<dd>
|
||||
<p>
|
||||
TODO
|
||||
</p>
|
||||
</dd>
|
||||
<dt>
|
||||
<tt>get_global_variable_named</tt>
|
||||
</dt>
|
||||
<dd>
|
||||
<p>
|
||||
TODO
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="title">Special Methods</div><dl>
|
||||
<dt>
|
||||
<tt>__str__</tt>
|
||||
</dt>
|
||||
<dd>
|
||||
<p>
|
||||
Module objects can be stringified into it's LLVM assembly language
|
||||
representation.
|
||||
</p>
|
||||
</dd>
|
||||
<dt>
|
||||
<tt>__eq__</tt>
|
||||
</dt>
|
||||
<dd>
|
||||
<p>
|
||||
Module objects can be compared for equality. Internally, this
|
||||
converts both into their LLVM assembly representations and compares
|
||||
them.
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</div></div>
|
||||
<h3>Types (llvm.core)</h3>
|
||||
<p>Types are what you think they are. A instance of <tt>llvm.core.Type</tt>, or
|
||||
one of its derived classes, represent a type. llvm-py does not use as
|
||||
|
|
@ -761,6 +1053,17 @@ cellspacing="0" cellpadding="4">
|
|||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<p>The class hierarchy is:</p>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre><tt>Type
|
||||
IntegerType
|
||||
FunctionType
|
||||
StructType
|
||||
ArrayType
|
||||
PointerType
|
||||
VectorType</tt></pre>
|
||||
</div></div>
|
||||
<h3>Values (llvm.core)</h3>
|
||||
<p>TODO</p>
|
||||
<h3>Instructions (llvm.core)</h3>
|
||||
|
|
@ -806,12 +1109,21 @@ reached at <em>mdevan.foobar@gmail.com</em>.</p>
|
|||
<div id="footer">
|
||||
<div id="footer-text">
|
||||
Web pages © Mahadevan R. Generated with <a href="http://www.methods.co.nz/asciidoc/">asciidoc</a>.
|
||||
Last updated 10-Jun-2008.
|
||||
Last updated 11-Jun-2008.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<script type="text/javascript">
|
||||
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
|
||||
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
var pageTracker = _gat._getTracker("UA-4519056-2");
|
||||
pageTracker._initData();
|
||||
pageTracker._trackPageview();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue