From 9cc8fdc0cd8ba654cb799fbce2eae696dbb46299 Mon Sep 17 00:00:00 2001
From: "mdevan.foobar"
Date: Wed, 18 Jun 2008 16:31:35 +0000
Subject: [PATCH] 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
---
llvm/_core.c | 12 ++++++++++--
llvm/core.py | 34 ++++++++++++++++++----------------
llvm/extra.cpp | 20 +++++++++++---------
llvm/extra.h | 7 +++++--
test/example.py | 3 +--
test/testall.py | 10 ++++++----
www/src/download.txt | 3 ++-
www/src/index.txt | 5 ++++-
www/src/userguide.txt | 9 ++++-----
www/web/about.html | 2 +-
www/web/contribute.html | 2 +-
www/web/download.html | 18 ++++++++++++++++--
www/web/examples.html | 5 ++---
www/web/index.html | 12 ++++++++++--
www/web/license.html | 2 +-
www/web/userguide.html | 10 ++++------
16 files changed, 96 insertions(+), 58 deletions(-)
diff --git a/llvm/_core.c b/llvm/_core.c
index bb6ddba..bf5e0f8 100644
--- a/llvm/_core.c
+++ b/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 )
diff --git a/llvm/core.py b/llvm/core.py
index 15c8678..5122517 100644
--- a/llvm/core.py
+++ b/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
diff --git a/llvm/extra.cpp b/llvm/extra.cpp
index e54741b..9b37f1b 100644
--- a/llvm/extra.cpp
+++ b/llvm/extra.cpp
@@ -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(RHSConstant)));
}
-LLVMValueRef LLVMBuildRetMultiple(LLVMBuilderRef B, LLVMValueRef *Values,
- unsigned NumValues) {
- std::vector 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(Op),
unwrap(LHS), unwrap(RHS), Name));
}
+#endif
+
+LLVMValueRef LLVMBuildRetMultiple(LLVMBuilderRef B, LLVMValueRef *Values,
+ unsigned NumValues) {
+ std::vector 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) {
diff --git a/llvm/extra.h b/llvm/extra.h
index b405cf4..54f9fe5 100644
--- a/llvm/extra.h
+++ b/llvm/extra.h
@@ -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);
diff --git a/test/example.py b/test/example.py
index 3a61dde..1a5ee47 100644
--- a/test/example.py
+++ b/test/example.py
@@ -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")
diff --git a/test/testall.py b/test/testall.py
index f9e21de..1858bf1 100644
--- a/test/testall.py
+++ b/test/testall.py
@@ -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)
diff --git a/www/src/download.txt b/www/src/download.txt
index 0370d86..e7facde 100644
--- a/www/src/download.txt
+++ b/www/src/download.txt
@@ -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]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/www/src/index.txt b/www/src/index.txt
index 83fc305..d77a217 100644
--- a/www/src/index.txt
+++ b/www/src/index.txt
@@ -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.
diff --git a/www/src/userguide.txt b/www/src/userguide.txt
index 11cd455..a7ccb37 100644
--- a/www/src/userguide.txt
+++ b/www/src/userguide.txt
@@ -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)
~~~~~~~~~~~~~~~~~~~~~~
diff --git a/www/web/about.html b/www/web/about.html
index 508a036..6c65a62 100644
--- a/www/web/about.html
+++ b/www/web/about.html
@@ -44,7 +44,7 @@ llvm-dev mailing list and irc.oftc.net#llvm (mdevan).
diff --git a/www/web/contribute.html b/www/web/contribute.html
index dede335..24073e8 100644
--- a/www/web/contribute.html
+++ b/www/web/contribute.html
@@ -119,7 +119,7 @@ Improve tests.
diff --git a/www/web/download.html b/www/web/download.html
index 506deee..68e0030 100644
--- a/www/web/download.html
+++ b/www/web/download.html
@@ -35,7 +35,7 @@
-
The latest release is 0.2, released xx-Jun-2008 (Changelog
+
The latest release is 0.2.1, released 18-Jun-2008 (Changelog
below).
Download it here:
@@ -63,6 +63,20 @@ cellspacing="0" cellpadding="4">
+
+ |
+ 0.2.1
+ |
+
+ 18-Jun-2008
+ |
+
+ llvm-py-0.2.tar.bz2
+ |
+
+ llvm-py-0.2.1.tar.bz2
+ |
+
0.2
@@ -133,7 +147,7 @@ package.
diff --git a/www/web/examples.html b/www/web/examples.html
index a2f3cef..72c554c 100644
--- a/www/web/examples.html
+++ b/www/web/examples.html
@@ -66,8 +66,7 @@ func.args[= 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")
@@ -103,7 +102,7 @@ entry:
diff --git a/www/web/index.html b/www/web/index.html
index 591652d..84cacd6 100644
--- a/www/web/index.html
+++ b/www/web/index.html
@@ -37,7 +37,7 @@
llvm-py provides Python bindings for
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.
@@ -50,6 +50,14 @@ miss any specific LLVM API.
-
+18-Jun-2008
+
+-
+
+ 0.2.1 released. Builds cleanly with LLVM 2.3 and 2.3+svn.
+
+
+-
15-Jun-2008
-
@@ -70,7 +78,7 @@ miss any specific LLVM API.
diff --git a/www/web/license.html b/www/web/license.html
index c33da95..4f5ff85 100644
--- a/www/web/license.html
+++ b/www/web/license.html
@@ -76,7 +76,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/www/web/userguide.html b/www/web/userguide.html
index 3ad4794..53dd55c 100644
--- a/www/web/userguide.html
+++ b/www/web/userguide.html
@@ -1651,9 +1651,9 @@ the Builder class. These are also covered separately.
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:
|