Build cleanly with LLVM 2.3 or 2.3svn.
git-svn-id: http://llvm-py.googlecode.com/svn/trunk@15 8d1e9007-1d4e-0410-b67e-1979fd6579aa
This commit is contained in:
parent
0a20bf7084
commit
9cc8fdc0cd
16 changed files with 96 additions and 58 deletions
12
llvm/_core.c
12
llvm/_core.c
|
|
@ -286,8 +286,10 @@ _wrap_objobj2obj(LLVMConstXor, LLVMValueRef, LLVMValueRef, LLVMValueRef)
|
|||
|
||||
_wrap_intobjobj2obj(LLVMConstICmp, LLVMValueRef, LLVMValueRef, LLVMValueRef)
|
||||
_wrap_intobjobj2obj(LLVMConstFCmp, LLVMValueRef, LLVMValueRef, LLVMValueRef)
|
||||
/* after LLVM 2.3!
|
||||
_wrap_intobjobj2obj(LLVMConstVICmp, LLVMValueRef, LLVMValueRef, LLVMValueRef)
|
||||
_wrap_intobjobj2obj(LLVMConstVFCmp, LLVMValueRef, LLVMValueRef, LLVMValueRef)
|
||||
*/
|
||||
|
||||
_wrap_objobj2obj(LLVMConstShl, LLVMValueRef, LLVMValueRef, LLVMValueRef)
|
||||
_wrap_objobj2obj(LLVMConstLShr, LLVMValueRef, LLVMValueRef, LLVMValueRef)
|
||||
|
|
@ -522,8 +524,10 @@ _wrap_objobjobjstr2obj(LLVMBuildBitCast, LLVMBuilderRef, LLVMValueRef, LLVMTypeR
|
|||
|
||||
_wrap_objintobjobjstr2obj(LLVMBuildICmp, LLVMBuilderRef, LLVMValueRef, LLVMValueRef, LLVMValueRef)
|
||||
_wrap_objintobjobjstr2obj(LLVMBuildFCmp, LLVMBuilderRef, LLVMValueRef, LLVMValueRef, LLVMValueRef)
|
||||
/* after LLVM 2.3!
|
||||
_wrap_objintobjobjstr2obj(LLVMBuildVICmp, LLVMBuilderRef, LLVMValueRef, LLVMValueRef, LLVMValueRef)
|
||||
_wrap_objintobjobjstr2obj(LLVMBuildVFCmp, LLVMBuilderRef, LLVMValueRef, LLVMValueRef, LLVMValueRef)
|
||||
*/
|
||||
|
||||
/* Miscellaneous instructions */
|
||||
|
||||
|
|
@ -835,8 +839,10 @@ static PyMethodDef core_methods[] = {
|
|||
_method( LLVMConstXor )
|
||||
_method( LLVMConstICmp )
|
||||
_method( LLVMConstFCmp )
|
||||
_method( LLVMConstVICmp )
|
||||
_method( LLVMConstVFCmp )
|
||||
/* after LLVM 2.3!
|
||||
_method( LLVMConstVICmp )
|
||||
_method( LLVMConstVFCmp )
|
||||
*/
|
||||
_method( LLVMConstShl )
|
||||
_method( LLVMConstLShr )
|
||||
_method( LLVMConstAShr )
|
||||
|
|
@ -1003,8 +1009,10 @@ static PyMethodDef core_methods[] = {
|
|||
/* Comparisons */
|
||||
_method( LLVMBuildICmp )
|
||||
_method( LLVMBuildFCmp )
|
||||
/* after LLVM 2.3!
|
||||
_method( LLVMBuildVICmp )
|
||||
_method( LLVMBuildVFCmp )
|
||||
*/
|
||||
|
||||
/* Miscellaneous instructions */
|
||||
_method( LLVMBuildGetResult )
|
||||
|
|
|
|||
34
llvm/core.py
34
llvm/core.py
|
|
@ -750,13 +750,14 @@ class Constant(Value):
|
|||
check_is_constant(rhs)
|
||||
return Constant(_core.LLVMConstFCmp(real_pred, self.ptr, rhs.ptr))
|
||||
|
||||
def vicmp(self, int_pred, rhs):
|
||||
check_is_constant(rhs)
|
||||
return Constant(_core.LLVMConstVICmp(int_pred, self.ptr, rhs.ptr))
|
||||
|
||||
def vfcmp(self, real_pred, rhs):
|
||||
check_is_constant(rhs)
|
||||
return Constant(_core.LLVMConstVFCmp(real_pred, self.ptr, rhs.ptr))
|
||||
# after LLVM 2.3!
|
||||
# def vicmp(self, int_pred, rhs):
|
||||
# check_is_constant(rhs)
|
||||
# return Constant(_core.LLVMConstVICmp(int_pred, self.ptr, rhs.ptr))
|
||||
#
|
||||
# def vfcmp(self, real_pred, rhs):
|
||||
# check_is_constant(rhs)
|
||||
# return Constant(_core.LLVMConstVFCmp(real_pred, self.ptr, rhs.ptr))
|
||||
|
||||
def shl(self, rhs):
|
||||
check_is_constant(rhs)
|
||||
|
|
@ -1365,15 +1366,16 @@ class Builder(object):
|
|||
check_is_value(rhs)
|
||||
return Value(_core.LLVMBuildFCmp(self.ptr, rpred, lhs.ptr, rhs.ptr, name))
|
||||
|
||||
def vicmp(self, ipred, lhs, rhs, name=""):
|
||||
check_is_value(lhs)
|
||||
check_is_value(rhs)
|
||||
return Value(_core.LLVMBuildVICmp(self.ptr, ipred, lhs.ptr, rhs.ptr, name))
|
||||
|
||||
def vfcmp(self, rpred, lhs, rhs, name=""):
|
||||
check_is_value(lhs)
|
||||
check_is_value(rhs)
|
||||
return Value(_core.LLVMBuildVFCmp(self.ptr, rpred, lhs.ptr, rhs.ptr, name))
|
||||
# after LLVM 2.3!
|
||||
# def vicmp(self, ipred, lhs, rhs, name=""):
|
||||
# check_is_value(lhs)
|
||||
# check_is_value(rhs)
|
||||
# return Value(_core.LLVMBuildVICmp(self.ptr, ipred, lhs.ptr, rhs.ptr, name))
|
||||
#
|
||||
# def vfcmp(self, rpred, lhs, rhs, name=""):
|
||||
# check_is_value(lhs)
|
||||
# check_is_value(rhs)
|
||||
# return Value(_core.LLVMBuildVFCmp(self.ptr, rpred, lhs.ptr, rhs.ptr, name))
|
||||
|
||||
# misc
|
||||
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ char *LLVMDumpValueToString(LLVMValueRef Val) {
|
|||
return strdup(buf.str().c_str());
|
||||
}
|
||||
|
||||
#if 0 /* after LLVM 2.3! */
|
||||
LLVMValueRef LLVMConstVICmp(LLVMIntPredicate Predicate,
|
||||
LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) {
|
||||
return wrap(ConstantExpr::getVICmp(Predicate,
|
||||
|
|
@ -55,15 +56,6 @@ LLVMValueRef LLVMConstVFCmp(LLVMRealPredicate Predicate,
|
|||
unwrap<Constant>(RHSConstant)));
|
||||
}
|
||||
|
||||
LLVMValueRef LLVMBuildRetMultiple(LLVMBuilderRef B, LLVMValueRef *Values,
|
||||
unsigned NumValues) {
|
||||
std::vector<Value *> Vs;
|
||||
for (LLVMValueRef *I = Values, *E = Values + NumValues; I != E; ++I)
|
||||
Vs.push_back(unwrap(*I));
|
||||
|
||||
return wrap(unwrap(B)->CreateRet(&Vs[0], NumValues));
|
||||
}
|
||||
|
||||
LLVMValueRef LLVMBuildVICmp(LLVMBuilderRef B, LLVMIntPredicate Op,
|
||||
LLVMValueRef LHS, LLVMValueRef RHS,
|
||||
const char *Name) {
|
||||
|
|
@ -77,6 +69,16 @@ LLVMValueRef LLVMBuildVFCmp(LLVMBuilderRef B, LLVMRealPredicate Op,
|
|||
return wrap(unwrap(B)->CreateVFCmp(static_cast<FCmpInst::Predicate>(Op),
|
||||
unwrap(LHS), unwrap(RHS), Name));
|
||||
}
|
||||
#endif
|
||||
|
||||
LLVMValueRef LLVMBuildRetMultiple(LLVMBuilderRef B, LLVMValueRef *Values,
|
||||
unsigned NumValues) {
|
||||
std::vector<Value *> Vs;
|
||||
for (LLVMValueRef *I = Values, *E = Values + NumValues; I != E; ++I)
|
||||
Vs.push_back(unwrap(*I));
|
||||
|
||||
return wrap(unwrap(B)->CreateRet(&Vs[0], NumValues));
|
||||
}
|
||||
|
||||
LLVMValueRef LLVMBuildGetResult(LLVMBuilderRef B, LLVMValueRef V,
|
||||
unsigned Index, const char *Name) {
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ char *LLVMDumpValueToString(LLVMValueRef Val);
|
|||
|
||||
/* missing constant expressions */
|
||||
|
||||
#if 0 /* after LLVM 2.3! */
|
||||
LLVMValueRef LLVMConstVICmp(LLVMIntPredicate Predicate,
|
||||
LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
|
||||
LLVMValueRef LLVMConstVFCmp(LLVMRealPredicate Predicate,
|
||||
|
|
@ -32,14 +33,16 @@ LLVMValueRef LLVMConstVFCmp(LLVMRealPredicate Predicate,
|
|||
|
||||
/* missing instructions */
|
||||
|
||||
LLVMValueRef LLVMBuildRetMultiple(LLVMBuilderRef, LLVMValueRef *Values,
|
||||
unsigned NumValues);
|
||||
LLVMValueRef LLVMBuildVICmp(LLVMBuilderRef, LLVMIntPredicate Op,
|
||||
LLVMValueRef LHS, LLVMValueRef RHS,
|
||||
const char *Name);
|
||||
LLVMValueRef LLVMBuildVFCmp(LLVMBuilderRef, LLVMRealPredicate Op,
|
||||
LLVMValueRef LHS, LLVMValueRef RHS,
|
||||
const char *Name);
|
||||
#endif
|
||||
|
||||
LLVMValueRef LLVMBuildRetMultiple(LLVMBuilderRef, LLVMValueRef *Values,
|
||||
unsigned NumValues);
|
||||
LLVMValueRef LLVMBuildGetResult(LLVMBuilderRef, LLVMValueRef V,
|
||||
unsigned Index, const char *Name);
|
||||
|
||||
|
|
|
|||
|
|
@ -23,8 +23,7 @@ func.args[1].name = "arg2"
|
|||
entry = func.append_basic_block("entry")
|
||||
|
||||
# create an llvm::IRBuilder
|
||||
builder = Builder.new()
|
||||
builder.position_at_end(entry)
|
||||
builder = Builder.new(entry)
|
||||
|
||||
# add two args into tmp1
|
||||
tmp1 = builder.add(func.args[0], func.args[1], "tmp1")
|
||||
|
|
|
|||
|
|
@ -120,9 +120,10 @@ def do_constant():
|
|||
k.srem(k).and_(k).or_(k).icmp(IPRED_ULT, k)
|
||||
f.fdiv(f).frem(f).fcmp(RPRED_ULT, f)
|
||||
vi = Constant.vector([Constant.int(ti,42)]*10)
|
||||
vi.vicmp(IPRED_ULT, vi)
|
||||
vf = Constant.vector([Constant.real(Type.float(), 3.14)]*10)
|
||||
vf.vfcmp(RPRED_ULT, vf)
|
||||
# after LLVM 2.3!
|
||||
#vi.vicmp(IPRED_ULT, vi)
|
||||
#vf.vfcmp(RPRED_ULT, vf)
|
||||
k.shl(k).lshr(k).ashr(k)
|
||||
# TODO gep
|
||||
k.trunc(Type.int(1))
|
||||
|
|
@ -332,9 +333,10 @@ def do_builder():
|
|||
b.icmp(IPRED_ULT, v, v)
|
||||
b.fcmp(RPRED_ULT, fv, fv)
|
||||
vi = Constant.vector([Constant.int(ti,42)]*10)
|
||||
b.vicmp(IPRED_ULT, vi, vi)
|
||||
vf = Constant.vector([Constant.real(Type.float(), 3.14)]*10)
|
||||
b.vfcmp(RPRED_ULT, vf, vf)
|
||||
# after LLVM 2.3!
|
||||
# b.vicmp(IPRED_ULT, vi, vi)
|
||||
# b.vfcmp(RPRED_ULT, vf, vf)
|
||||
# TODO b.getresult(v, 0)
|
||||
b.call(f, [v])
|
||||
b.select(Constant.int(Type.int(1), 1), blk, blk)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
Download
|
||||
========
|
||||
|
||||
The latest release is 0.2, released xx-Jun-2008 (link:#changelog[Changelog]
|
||||
The latest release is 0.2.1, released 18-Jun-2008 (link:#changelog[Changelog]
|
||||
below).
|
||||
|
||||
Download it here:
|
||||
|
|
@ -10,6 +10,7 @@ Download it here:
|
|||
````~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Release,Date,Package,Mirror
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
0.2.1,18-Jun-2008,http://llvm-py.googlecode.com/files/llvm-py-0.2.1.tar.bz2[llvm-py-0.2.tar.bz2],link:llvm-py-0.2.tar.bz2[llvm-py-0.2.1.tar.bz2]
|
||||
0.2,15-Jun-2008,http://llvm-py.googlecode.com/files/llvm-py-0.2.tar.bz2[llvm-py-0.2.tar.bz2],link:llvm-py-0.2.tar.bz2[llvm-py-0.2.tar.bz2]
|
||||
0.1,20-May-2008,http://llvm-py.googlecode.com/files/llvm-py-0.1.tar.bz2[llvm-py-0.1.tar.bz2],link:llvm-py-0.1.tar.bz2[llvm-py-0.1.tar.bz2]
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ llvm-py: Python Bindings for LLVM
|
|||
|
||||
llvm-py provides http://www.python.org/[Python] bindings for
|
||||
http://llvm.org/[LLVM]. It's goal is to expose enough of LLVM APIs to
|
||||
implement a compiler or VM in pure Python. Currently, llvm-py is
|
||||
implement a compiler backend or a VM in pure Python. Currently, llvm-py is
|
||||
available for LLVM 2.3 and Python 2.5, on Linux/x86. It is expected to
|
||||
be usable on various unices, as well as with Python 2.4, with minimal
|
||||
changes, if any.
|
||||
|
|
@ -15,6 +15,9 @@ miss any specific LLVM API.
|
|||
News
|
||||
----
|
||||
|
||||
18-Jun-2008::
|
||||
0.2.1 released. Builds cleanly with LLVM 2.3 and 2.3+svn.
|
||||
|
||||
15-Jun-2008::
|
||||
0.2 released. Lots of cleanup, new website, more documentation.
|
||||
|
||||
|
|
|
|||
|
|
@ -879,9 +879,9 @@ Constants (llvm.core)
|
|||
|
||||
`Constant`-s represents constants that appear within the code. The
|
||||
values of such objects are known at creation time. Constants can be
|
||||
created from Python constants. A constant expression is also a constant.
|
||||
Given a `Constant` object, an operation (like addition, subtraction etc)
|
||||
can be specified, to yield a new `Constant` object. Let's see some
|
||||
created from Python constants. A constant expression is also a constant
|
||||
-- given a `Constant` object, an operation (like addition, subtraction
|
||||
etc) can be specified, to yield a new `Constant` object. Let's see some
|
||||
examples:
|
||||
|
||||
[python]
|
||||
|
|
@ -897,11 +897,10 @@ tr = Type.float()
|
|||
|
||||
r1 = Constant.real(tr, "3.141592") # create from a string
|
||||
r2 = Constant.real(tr, 1.61803399) # create from a Python float
|
||||
|
||||
r3 = Constant.undef() # an `undefined' value
|
||||
source~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
|
||||
TypeHandle (llvm.core)
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ llvm-dev mailing list and irc.oftc.net#llvm (mdevan).</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 11-Jun-2008.
|
||||
Last updated 18-Jun-2008.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ Improve tests.
|
|||
<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 15-Jun-2008.
|
||||
Last updated 18-Jun-2008.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@
|
|||
</div>
|
||||
<div id="preamble">
|
||||
<div class="sectionbody">
|
||||
<p>The latest release is 0.2, released xx-Jun-2008 (<a href="#changelog">Changelog</a>
|
||||
<p>The latest release is 0.2.1, released 18-Jun-2008 (<a href="#changelog">Changelog</a>
|
||||
below).</p>
|
||||
<p>Download it here:</p>
|
||||
<div class="tableblock">
|
||||
|
|
@ -63,6 +63,20 @@ cellspacing="0" cellpadding="4">
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody valign="top">
|
||||
<tr>
|
||||
<td align="left">
|
||||
0.2.1
|
||||
</td>
|
||||
<td align="left">
|
||||
18-Jun-2008
|
||||
</td>
|
||||
<td align="left">
|
||||
<a href="http://llvm-py.googlecode.com/files/llvm-py-0.2.1.tar.bz2">llvm-py-0.2.tar.bz2</a>
|
||||
</td>
|
||||
<td align="left">
|
||||
<a href="llvm-py-0.2.tar.bz2">llvm-py-0.2.1.tar.bz2</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">
|
||||
0.2
|
||||
|
|
@ -133,7 +147,7 @@ package.</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 15-Jun-2008.
|
||||
Last updated 18-Jun-2008.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -66,8 +66,7 @@ func<span style="color: #990000">.</span>args<span style="color: #990000">[</spa
|
|||
entry <span style="color: #990000">=</span> func<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">append_basic_block</span></span><span style="color: #990000">(</span><span style="color: #FF0000">"entry"</span><span style="color: #990000">)</span>
|
||||
|
||||
<span style="font-style: italic"><span style="color: #9A1900"># create an llvm::IRBuilder</span></span>
|
||||
builder <span style="color: #990000">=</span> <span style="color: #009900">Builder</span><span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">new</span></span><span style="color: #990000">()</span>
|
||||
builder<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">position_at_end</span></span><span style="color: #990000">(</span>entry<span style="color: #990000">)</span>
|
||||
builder <span style="color: #990000">=</span> <span style="color: #009900">Builder</span><span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">new</span></span><span style="color: #990000">(</span>entry<span style="color: #990000">)</span>
|
||||
|
||||
<span style="font-style: italic"><span style="color: #9A1900"># add two args into tmp1</span></span>
|
||||
tmp1 <span style="color: #990000">=</span> builder<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">add</span></span><span style="color: #990000">(</span>func<span style="color: #990000">.</span>args<span style="color: #990000">[</span><span style="color: #993399">0</span><span style="color: #990000">],</span> func<span style="color: #990000">.</span>args<span style="color: #990000">[</span><span style="color: #993399">1</span><span style="color: #990000">],</span> <span style="color: #FF0000">"tmp1"</span><span style="color: #990000">)</span>
|
||||
|
|
@ -103,7 +102,7 @@ entry:
|
|||
<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 18-Jun-2008.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
<div class="sectionbody">
|
||||
<p>llvm-py provides <a href="http://www.python.org/">Python</a> bindings for
|
||||
<a href="http://llvm.org/">LLVM</a>. It's goal is to expose enough of LLVM APIs to
|
||||
implement a compiler or VM in pure Python. Currently, llvm-py is
|
||||
implement a compiler backend or a VM in pure Python. Currently, llvm-py is
|
||||
available for LLVM 2.3 and Python 2.5, on Linux/x86. It is expected to
|
||||
be usable on various unices, as well as with Python 2.4, with minimal
|
||||
changes, if any.</p>
|
||||
|
|
@ -50,6 +50,14 @@ miss any specific LLVM API.</p>
|
|||
<div class="sectionbody">
|
||||
<dl>
|
||||
<dt>
|
||||
18-Jun-2008
|
||||
</dt>
|
||||
<dd>
|
||||
<p>
|
||||
0.2.1 released. Builds cleanly with LLVM 2.3 and 2.3+svn.
|
||||
</p>
|
||||
</dd>
|
||||
<dt>
|
||||
15-Jun-2008
|
||||
</dt>
|
||||
<dd>
|
||||
|
|
@ -70,7 +78,7 @@ miss any specific LLVM API.</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 15-Jun-2008.
|
||||
Last updated 18-Jun-2008.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ 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 11-Jun-2008.
|
||||
Last updated 18-Jun-2008.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1651,9 +1651,9 @@ the <tt>Builder</tt> class. These are also covered separately.</p>
|
|||
<h3>Constants (llvm.core)</h3>
|
||||
<p><tt>Constant</tt>-s represents constants that appear within the code. The
|
||||
values of such objects are known at creation time. Constants can be
|
||||
created from Python constants. A constant expression is also a constant.
|
||||
Given a <tt>Constant</tt> object, an operation (like addition, subtraction etc)
|
||||
can be specified, to yield a new <tt>Constant</tt> object. Let's see some
|
||||
created from Python constants. A constant expression is also a constant
|
||||
— given a <tt>Constant</tt> object, an operation (like addition, subtraction
|
||||
etc) can be specified, to yield a new <tt>Constant</tt> object. Let's see some
|
||||
examples:</p>
|
||||
<div class="listingblock">
|
||||
<div class="content"><!-- Generator: GNU source-highlight 2.4
|
||||
|
|
@ -1671,8 +1671,6 @@ tr <span style="color: #990000">=</span> <span style="color: #009900">Type</span
|
|||
|
||||
r1 <span style="color: #990000">=</span> <span style="color: #009900">Constant</span><span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">real</span></span><span style="color: #990000">(</span>tr<span style="color: #990000">,</span> <span style="color: #FF0000">"3.141592"</span><span style="color: #990000">)</span> <span style="font-style: italic"><span style="color: #9A1900"># create from a string</span></span>
|
||||
r2 <span style="color: #990000">=</span> <span style="color: #009900">Constant</span><span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">real</span></span><span style="color: #990000">(</span>tr<span style="color: #990000">,</span> <span style="color: #993399">1.61803399</span><span style="color: #990000">)</span> <span style="font-style: italic"><span style="color: #9A1900"># create from a Python float</span></span>
|
||||
|
||||
r3 <span style="color: #990000">=</span> <span style="color: #009900">Constant</span><span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">undef</span></span><span style="color: #990000">()</span> <span style="font-style: italic"><span style="color: #9A1900"># an `undefined' value</span></span>
|
||||
</tt></pre></div></div>
|
||||
<h3>TypeHandle (llvm.core)</h3>
|
||||
<p>TODO</p>
|
||||
|
|
@ -1719,7 +1717,7 @@ 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 15-Jun-2008.
|
||||
Last updated 18-Jun-2008.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue