binding compiles with llvm 3.3
This commit is contained in:
parent
2338eae5f6
commit
4c1b9016fb
22 changed files with 324 additions and 119 deletions
|
|
@ -247,7 +247,8 @@ class Class(SubModule, _Type):
|
||||||
def __call__(self, defn):
|
def __call__(self, defn):
|
||||||
assert not self._is_defined
|
assert not self._is_defined
|
||||||
# process the definition in "defn"
|
# process the definition in "defn"
|
||||||
self.name = defn.__name__
|
self.name = getattr(defn, '_name_', defn.__name__)
|
||||||
|
|
||||||
for k, v in defn.__dict__.items():
|
for k, v in defn.__dict__.items():
|
||||||
if isinstance(v, Method):
|
if isinstance(v, Method):
|
||||||
self.methods.append(v)
|
self.methods.append(v)
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,22 @@
|
||||||
#include <Python.h>
|
#include <Python.h>
|
||||||
#include <llvm/ADT/SmallVector.h>
|
#include <llvm/ADT/SmallVector.h>
|
||||||
#include <llvm/Value.h>
|
#if LLVM_VERSION_MAJOR >= 3 and LLVM_VERSION_MINOR >= 3
|
||||||
#include <llvm/DerivedTypes.h>
|
#include <llvm/IR/Value.h>
|
||||||
#include <llvm/Function.h>
|
#include <llvm/IR/DerivedTypes.h>
|
||||||
|
#include <llvm/IR/Function.h>
|
||||||
|
#include <llvm/IR/Module.h>
|
||||||
|
#include <llvm/IR/Constants.h>
|
||||||
|
#include <llvm/IR/Intrinsics.h>
|
||||||
|
#include <llvm/IR/IRBuilder.h>
|
||||||
|
#else
|
||||||
|
#include <llvm/Value.h>
|
||||||
|
#include <llvm/DerivedTypes.h>
|
||||||
|
#include <llvm/Function.h>
|
||||||
|
#include <llvm/Module.h>
|
||||||
|
#include <llvm/Constants.h>
|
||||||
|
#include <llvm/Intrinsics.h>
|
||||||
|
#include <llvm/IRBuilder.h>
|
||||||
|
#endif
|
||||||
#include <llvm/Support/raw_ostream.h>
|
#include <llvm/Support/raw_ostream.h>
|
||||||
#include <llvm/Support/FormattedStream.h>
|
#include <llvm/Support/FormattedStream.h>
|
||||||
#include <llvm/Support/MemoryBuffer.h>
|
#include <llvm/Support/MemoryBuffer.h>
|
||||||
|
|
@ -12,11 +26,7 @@
|
||||||
#include <llvm/ExecutionEngine/ExecutionEngine.h>
|
#include <llvm/ExecutionEngine/ExecutionEngine.h>
|
||||||
#include <llvm/ExecutionEngine/GenericValue.h>
|
#include <llvm/ExecutionEngine/GenericValue.h>
|
||||||
#include <llvm/Linker.h>
|
#include <llvm/Linker.h>
|
||||||
#include <llvm/Module.h>
|
|
||||||
#include <llvm/Analysis/Verifier.h>
|
#include <llvm/Analysis/Verifier.h>
|
||||||
#include <llvm/Constants.h>
|
|
||||||
#include <llvm/Intrinsics.h>
|
|
||||||
#include <llvm/IRBuilder.h>
|
|
||||||
#include <llvm/PassRegistry.h>
|
#include <llvm/PassRegistry.h>
|
||||||
#include <llvm/Support/Host.h>
|
#include <llvm/Support/Host.h>
|
||||||
|
|
||||||
|
|
@ -56,6 +66,15 @@ namespace extra{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
PyObject* callwrite(PyObject* self, PyObject* arg)
|
||||||
|
{
|
||||||
|
char meth[] = "method";
|
||||||
|
char fmt[] = "O";
|
||||||
|
return PyObject_CallMethod(self, meth, fmt, arg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static
|
static
|
||||||
PyObject* make_raw_ostream_for_printing(PyObject* self, PyObject* args)
|
PyObject* make_raw_ostream_for_printing(PyObject* self, PyObject* args)
|
||||||
{
|
{
|
||||||
|
|
@ -271,7 +290,7 @@ llvm::ExecutionEngine* ExecutionEngine_create(
|
||||||
&ErrorStr, OptLevel,
|
&ErrorStr, OptLevel,
|
||||||
GVsWithCode);
|
GVsWithCode);
|
||||||
auto_pyobject buf = PyBytes_FromString(ErrorStr.c_str());
|
auto_pyobject buf = PyBytes_FromString(ErrorStr.c_str());
|
||||||
if (errout && NULL == PyObject_CallMethod(errout, "write", "O", *buf)){
|
if (errout && NULL == callwrite(errout, *buf)){
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -298,7 +317,7 @@ llvm::ExecutionEngine* ExecutionEngine_createJIT(
|
||||||
ExecutionEngine *ee = ExecutionEngine::createJIT(M, &ErrorStr, JMM, OL,
|
ExecutionEngine *ee = ExecutionEngine::createJIT(M, &ErrorStr, JMM, OL,
|
||||||
GCsWithCode, RM, CMM);
|
GCsWithCode, RM, CMM);
|
||||||
auto_pyobject buf = PyBytes_FromString(ErrorStr.c_str());
|
auto_pyobject buf = PyBytes_FromString(ErrorStr.c_str());
|
||||||
if (errout && NULL == PyObject_CallMethod(errout, "write", "O", *buf)){
|
if (errout && NULL == callwrite(errout, *buf)){
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
// PyFile_WriteString(ErrorStr.c_str(), errout);
|
// PyFile_WriteString(ErrorStr.c_str(), errout);
|
||||||
|
|
@ -483,7 +502,7 @@ PyObject* llvm_ParseBitCodeFile(llvm::StringRef Buf, llvm::LLVMContext& Ctx,
|
||||||
std::string ErrStr;
|
std::string ErrStr;
|
||||||
M = ParseBitcodeFile(MB, Ctx, &ErrStr);
|
M = ParseBitcodeFile(MB, Ctx, &ErrStr);
|
||||||
auto_pyobject buf = PyBytes_FromString(ErrStr.c_str());
|
auto_pyobject buf = PyBytes_FromString(ErrStr.c_str());
|
||||||
if (NULL == PyObject_CallMethod(FObj, "write", "O", *buf)){
|
if (NULL == callwrite(FObj, *buf)){
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
// if (-1 == PyFile_WriteString(ErrStr.c_str(), FObj)) {
|
// if (-1 == PyFile_WriteString(ErrStr.c_str(), FObj)) {
|
||||||
|
|
@ -507,7 +526,7 @@ PyObject* llvm_WriteBitcodeToFile(const llvm::Module *M, PyObject* FObj)
|
||||||
rso.flush();
|
rso.flush();
|
||||||
StringRef ref = rso.str();
|
StringRef ref = rso.str();
|
||||||
auto_pyobject buf = PyBytes_FromStringAndSize(ref.data(), ref.size());
|
auto_pyobject buf = PyBytes_FromStringAndSize(ref.data(), ref.size());
|
||||||
return PyObject_CallMethod(FObj, "write", "O", *buf);
|
return callwrite(FObj, *buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
|
|
@ -522,7 +541,7 @@ PyObject* llvm_getBitcodeTargetTriple(llvm::StringRef Buf,
|
||||||
std::string ErrStr;
|
std::string ErrStr;
|
||||||
Triple = getBitcodeTargetTriple(MB, Ctx, &ErrStr);
|
Triple = getBitcodeTargetTriple(MB, Ctx, &ErrStr);
|
||||||
auto_pyobject buf = PyBytes_FromString(ErrStr.c_str());
|
auto_pyobject buf = PyBytes_FromString(ErrStr.c_str());
|
||||||
if (NULL == PyObject_CallMethod(FObj, "write", "O", *buf)){
|
if (NULL == callwrite(FObj, *buf)){
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
// if (-1 == PyFile_WriteString(ErrStr.c_str(), FObj)) {
|
// if (-1 == PyFile_WriteString(ErrStr.c_str(), FObj)) {
|
||||||
|
|
@ -594,19 +613,19 @@ PyObject* Linker_LinkInModule(llvm::Linker* Linker,
|
||||||
PyObject* ErrMsg)
|
PyObject* ErrMsg)
|
||||||
{
|
{
|
||||||
std::string errmsg;
|
std::string errmsg;
|
||||||
|
#if LLVM_VERSION_MAJOR >= 3 && LLVM_VERSION_MINOR >= 3
|
||||||
|
bool failed = Linker->linkInModule(Mod, &errmsg);
|
||||||
|
#else
|
||||||
bool failed = Linker->LinkInModule(Mod, &errmsg);
|
bool failed = Linker->LinkInModule(Mod, &errmsg);
|
||||||
|
#endif
|
||||||
if (! failed) {
|
if (! failed) {
|
||||||
Py_RETURN_FALSE;
|
Py_RETURN_FALSE;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
auto_pyobject buf = PyBytes_FromString(errmsg.c_str());
|
auto_pyobject buf = PyBytes_FromString(errmsg.c_str());
|
||||||
if (NULL == PyObject_CallMethod(ErrMsg, "write", "O", *buf)){
|
if (NULL == callwrite(ErrMsg, *buf)){
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (-1 == PyFile_WriteString(errmsg.c_str(), ErrMsg)) {
|
|
||||||
// return NULL;
|
|
||||||
// }
|
|
||||||
Py_RETURN_TRUE;
|
Py_RETURN_TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -623,7 +642,7 @@ PyObject* Linker_LinkModules(llvm::Module* Dest,
|
||||||
Py_RETURN_FALSE;
|
Py_RETURN_FALSE;
|
||||||
} else {
|
} else {
|
||||||
auto_pyobject buf = PyBytes_FromString(errmsg.c_str());
|
auto_pyobject buf = PyBytes_FromString(errmsg.c_str());
|
||||||
if (NULL == PyObject_CallMethod(ErrMsg, "write", "O", *buf)){
|
if (NULL == callwrite(ErrMsg, *buf)){
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
// if (-1 == PyFile_WriteString(errmsg.c_str(), ErrMsg)) {
|
// if (-1 == PyFile_WriteString(errmsg.c_str(), ErrMsg)) {
|
||||||
|
|
@ -689,7 +708,7 @@ PyObject* llvm_verifyModule(const llvm::Module& Fn,
|
||||||
|
|
||||||
if (failed) {
|
if (failed) {
|
||||||
auto_pyobject buf = PyBytes_FromString(errmsg.c_str());
|
auto_pyobject buf = PyBytes_FromString(errmsg.c_str());
|
||||||
if (NULL == PyObject_CallMethod(ErrMsg, "write", "O", *buf)){
|
if (NULL == callwrite(ErrMsg, *buf)){
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -819,7 +838,7 @@ PyObject* DynamicLibrary_LoadLibraryPermanently(const char * Filename,
|
||||||
failed = DynamicLibrary::LoadLibraryPermanently(Filename, &errmsg);
|
failed = DynamicLibrary::LoadLibraryPermanently(Filename, &errmsg);
|
||||||
if (failed) {
|
if (failed) {
|
||||||
auto_pyobject buf = PyBytes_FromString(errmsg.c_str());
|
auto_pyobject buf = PyBytes_FromString(errmsg.c_str());
|
||||||
if (NULL == PyObject_CallMethod(ErrMsg, "write", "O", *buf)){
|
if (NULL == callwrite(ErrMsg, *buf)){
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
// if (-1 == PyFile_WriteString(errmsg.c_str(), ErrMsg)) {
|
// if (-1 == PyFile_WriteString(errmsg.c_str(), ErrMsg)) {
|
||||||
|
|
@ -869,7 +888,7 @@ PyObject* TargetRegistry_lookupTarget(const std::string &Triple,
|
||||||
if (!target) {
|
if (!target) {
|
||||||
// PyFile_WriteString(error.c_str(), Error);
|
// PyFile_WriteString(error.c_str(), Error);
|
||||||
auto_pyobject buf = PyBytes_FromString(error.c_str());
|
auto_pyobject buf = PyBytes_FromString(error.c_str());
|
||||||
if (NULL == PyObject_CallMethod(Error, "write", "O", *buf)){
|
if (NULL == callwrite(Error, *buf)){
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -891,7 +910,7 @@ PyObject* TargetRegistry_lookupTarget(const std::string &Arch,
|
||||||
if (!target) {
|
if (!target) {
|
||||||
// PyFile_WriteString(error.c_str(), Error);
|
// PyFile_WriteString(error.c_str(), Error);
|
||||||
auto_pyobject buf = PyBytes_FromString(error.c_str());
|
auto_pyobject buf = PyBytes_FromString(error.c_str());
|
||||||
if (NULL == PyObject_CallMethod(Error, "write", "O", *buf)){
|
if (NULL == callwrite(Error, *buf)){
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -910,7 +929,7 @@ PyObject* TargetRegistry_getClosestTargetForJIT(PyObject* Error)
|
||||||
const Target* target = TargetRegistry::getClosestTargetForJIT(error);
|
const Target* target = TargetRegistry::getClosestTargetForJIT(error);
|
||||||
if (!target) {
|
if (!target) {
|
||||||
auto_pyobject buf = PyBytes_FromString(error.c_str());
|
auto_pyobject buf = PyBytes_FromString(error.c_str());
|
||||||
if (NULL == PyObject_CallMethod(Error, "write", "O", *buf)){
|
if (NULL == callwrite(Error, *buf)){
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -945,3 +964,21 @@ PyObject* llvm_sys_getHostCPUFeatures(PyObject* Features)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static
|
||||||
|
PyObject* llvm_sys_isLittleEndianHost()
|
||||||
|
{
|
||||||
|
if (llvm::sys::IsLittleEndianHost)
|
||||||
|
Py_RETURN_TRUE;
|
||||||
|
else
|
||||||
|
Py_RETURN_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
PyObject* llvm_sys_isBigEndianHost()
|
||||||
|
{
|
||||||
|
if (llvm::sys::IsBigEndianHost)
|
||||||
|
Py_RETURN_TRUE;
|
||||||
|
else
|
||||||
|
Py_RETURN_FALSE;
|
||||||
|
}
|
||||||
|
|
@ -1,16 +1,27 @@
|
||||||
from binding import *
|
from binding import *
|
||||||
from .namespace import llvm
|
from .namespace import llvm
|
||||||
from .Value import Argument, Value
|
from .Value import Argument, Value
|
||||||
from .Attributes import Attributes
|
if LLVM_VERSION >= (3, 3):
|
||||||
|
from .Attributes import AttributeSet, Attribute
|
||||||
|
else:
|
||||||
|
from .Attributes import Attributes
|
||||||
|
|
||||||
@Argument
|
@Argument
|
||||||
class Argument:
|
class Argument:
|
||||||
_include_ = 'llvm/Argument.h'
|
if LLVM_VERSION >= (3, 3):
|
||||||
|
_include_ = 'llvm/IR/Argument.h'
|
||||||
|
else:
|
||||||
|
_include_ = 'llvm/Argument.h'
|
||||||
|
|
||||||
_downcast_ = Value
|
_downcast_ = Value
|
||||||
|
|
||||||
addAttr = Method(Void, ref(Attributes))
|
if LLVM_VERSION >= (3, 3):
|
||||||
removeAttr = Method(Void, ref(Attributes))
|
addAttr = Method(Void, ref(AttributeSet))
|
||||||
|
removeAttr = Method(Void, ref(AttributeSet))
|
||||||
|
else:
|
||||||
|
addAttr = Method(Void, ref(Attributes))
|
||||||
|
removeAttr = Method(Void, ref(Attributes))
|
||||||
|
|
||||||
getParamAlignment = Method(cast(Unsigned, int))
|
getParamAlignment = Method(cast(Unsigned, int))
|
||||||
|
|
||||||
getArgNo = Method(cast(Unsigned, int))
|
getArgNo = Method(cast(Unsigned, int))
|
||||||
|
|
|
||||||
|
|
@ -2,38 +2,91 @@ from binding import *
|
||||||
from .namespace import llvm
|
from .namespace import llvm
|
||||||
from .LLVMContext import LLVMContext
|
from .LLVMContext import LLVMContext
|
||||||
|
|
||||||
llvm.includes.add('llvm/Attributes.h')
|
if LLVM_VERSION >= (3, 3):
|
||||||
|
llvm.includes.add('llvm/IR/Attributes.h')
|
||||||
|
else:
|
||||||
|
llvm.includes.add('llvm/Attributes.h')
|
||||||
|
|
||||||
|
|
||||||
Attributes = llvm.Class()
|
|
||||||
AttrBuilder = llvm.Class()
|
AttrBuilder = llvm.Class()
|
||||||
|
|
||||||
|
if LLVM_VERSION >= (3, 3):
|
||||||
@Attributes
|
Attribute = llvm.Class()
|
||||||
class Attributes:
|
AttributeSet = llvm.Class()
|
||||||
AttrVal = Enum('''None, AddressSafety, Alignment, AlwaysInline,
|
else:
|
||||||
ByVal, InlineHint, InReg, MinSize,
|
Attributes = llvm.Class()
|
||||||
Naked, Nest, NoAlias, NoCapture,
|
|
||||||
NoImplicitFloat, NoInline, NonLazyBind, NoRedZone,
|
|
||||||
NoReturn, NoUnwind, OptimizeForSize, ReadNone,
|
|
||||||
ReadOnly, ReturnsTwice, SExt, StackAlignment,
|
|
||||||
StackProtect, StackProtectReq, StructRet, UWTable, ZExt''')
|
|
||||||
|
|
||||||
delete = Destructor()
|
|
||||||
|
|
||||||
get = StaticMethod(Attributes, ref(LLVMContext), ref(AttrBuilder))
|
|
||||||
|
|
||||||
|
|
||||||
@AttrBuilder
|
if LLVM_VERSION >= (3, 3):
|
||||||
class AttrBuilder:
|
@Attribute
|
||||||
|
class Attribute:
|
||||||
|
AttrKind = Enum('''None, Alignment, AlwaysInline,
|
||||||
|
ByVal, InlineHint, InReg,
|
||||||
|
MinSize, Naked, Nest, NoAlias,
|
||||||
|
NoBuiltin, NoCapture, NoDuplicate, NoImplicitFloat,
|
||||||
|
NoInline, NonLazyBind, NoRedZone, NoReturn,
|
||||||
|
NoUnwind, OptimizeForSize, ReadNone, ReadOnly,
|
||||||
|
Returned, ReturnsTwice, SExt, StackAlignment,
|
||||||
|
StackProtect, StackProtectReq, StackProtectStrong, StructRet,
|
||||||
|
SanitizeAddress, SanitizeThread, SanitizeMemory, UWTable,
|
||||||
|
ZExt, EndAttrKinds''')
|
||||||
|
|
||||||
new = Constructor()
|
delete = Destructor()
|
||||||
delete = Destructor()
|
|
||||||
|
|
||||||
clear = Method()
|
get = StaticMethod(Attribute,
|
||||||
|
ref(LLVMContext),
|
||||||
|
AttrKind,
|
||||||
|
cast(int, Uint64)).require_only(2)
|
||||||
|
|
||||||
addAttribute = Method(ref(AttrBuilder), Attributes.AttrVal)
|
@AttrBuilder
|
||||||
removeAttribute = Method(ref(AttrBuilder), Attributes.AttrVal)
|
class AttrBuilder:
|
||||||
|
|
||||||
addAlignmentAttr = Method(ref(AttrBuilder), cast(int, Unsigned))
|
new = Constructor()
|
||||||
|
delete = Destructor()
|
||||||
|
|
||||||
|
clear = Method()
|
||||||
|
|
||||||
|
addAttribute = Method(ref(AttrBuilder), Attribute.AttrKind)
|
||||||
|
removeAttribute = Method(ref(AttrBuilder), Attribute.AttrKind)
|
||||||
|
|
||||||
|
addAlignmentAttr = Method(ref(AttrBuilder), cast(int, Unsigned))
|
||||||
|
|
||||||
|
@AttributeSet
|
||||||
|
class AttributeSet:
|
||||||
|
delete = Destructor()
|
||||||
|
|
||||||
|
get = StaticMethod(AttributeSet,
|
||||||
|
ref(LLVMContext),
|
||||||
|
cast(int, Unsigned),
|
||||||
|
ref(AttrBuilder))
|
||||||
|
|
||||||
|
else:
|
||||||
|
@Attributes
|
||||||
|
class Attributes:
|
||||||
|
AttrVal = Enum('''None, AddressSafety, Alignment, AlwaysInline,
|
||||||
|
ByVal, InlineHint, InReg, MinSize,
|
||||||
|
Naked, Nest, NoAlias, NoCapture,
|
||||||
|
NoImplicitFloat, NoInline, NonLazyBind, NoRedZone,
|
||||||
|
NoReturn, NoUnwind, OptimizeForSize, ReadNone,
|
||||||
|
ReadOnly, ReturnsTwice, SExt, StackAlignment,
|
||||||
|
StackProtect, StackProtectReq, StructRet, UWTable, ZExt''')
|
||||||
|
|
||||||
|
delete = Destructor()
|
||||||
|
|
||||||
|
get = StaticMethod(Attributes, ref(LLVMContext), ref(AttrBuilder))
|
||||||
|
|
||||||
|
|
||||||
|
@AttrBuilder
|
||||||
|
class AttrBuilder:
|
||||||
|
|
||||||
|
new = Constructor()
|
||||||
|
delete = Destructor()
|
||||||
|
|
||||||
|
clear = Method()
|
||||||
|
|
||||||
|
addAttribute = Method(ref(AttrBuilder), Attributes.AttrVal)
|
||||||
|
removeAttribute = Method(ref(AttrBuilder), Attributes.AttrVal)
|
||||||
|
|
||||||
|
addAlignmentAttr = Method(ref(AttrBuilder), cast(int, Unsigned))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -124,17 +124,31 @@ class DIBuilder:
|
||||||
ptr(MDNode), # TemplateParms = 0
|
ptr(MDNode), # TemplateParms = 0
|
||||||
).require_only(10)
|
).require_only(10)
|
||||||
|
|
||||||
createStructType = Method(DIType,
|
if LLVM_VERSION >= (3, 3):
|
||||||
ref(DIDescriptor), # Scope
|
createStructType = Method(DIType,
|
||||||
stringref_arg, # Name
|
ref(DIDescriptor), # Scope
|
||||||
ref(DIFile), # File
|
stringref_arg, # Name
|
||||||
unsigned_arg, # LineNumber
|
ref(DIFile), # File
|
||||||
uint64_arg, # SizeInBits
|
unsigned_arg, # LineNumber
|
||||||
uint64_arg, # AlignInBits
|
uint64_arg, # SizeInBits
|
||||||
unsigned_arg, # Flags
|
uint64_arg, # AlignInBits
|
||||||
ref(DIArray), # Elements
|
unsigned_arg, # Flags
|
||||||
unsigned_arg, # RunTimeLang = 0
|
ref(DIType), # DerivedFrom
|
||||||
).require_only(8)
|
ref(DIArray), # Elements
|
||||||
|
unsigned_arg, # RunTimeLang = 0
|
||||||
|
).require_only(9)
|
||||||
|
else:
|
||||||
|
createStructType = Method(DIType,
|
||||||
|
ref(DIDescriptor), # Scope
|
||||||
|
stringref_arg, # Name
|
||||||
|
ref(DIFile), # File
|
||||||
|
unsigned_arg, # LineNumber
|
||||||
|
uint64_arg, # SizeInBits
|
||||||
|
uint64_arg, # AlignInBits
|
||||||
|
unsigned_arg, # Flags
|
||||||
|
ref(DIArray), # Elements
|
||||||
|
unsigned_arg, # RunTimeLang = 0
|
||||||
|
).require_only(8)
|
||||||
|
|
||||||
createUnionType = Method(DIType,
|
createUnionType = Method(DIType,
|
||||||
ref(DIDescriptor), # Scope
|
ref(DIDescriptor), # Scope
|
||||||
|
|
@ -186,7 +200,7 @@ class DIBuilder:
|
||||||
ref(DIType), # Ty
|
ref(DIType), # Ty
|
||||||
)
|
)
|
||||||
|
|
||||||
createTemporaryType = Method(DIType, ref(DIFile)).require_only(0)
|
#createTemporaryType = Method(DIType, ref(DIFile)).require_only(0)
|
||||||
|
|
||||||
createForwardDecl = Method(DIType,
|
createForwardDecl = Method(DIType,
|
||||||
unsigned_arg, # Tag
|
unsigned_arg, # Tag
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,10 @@ from .GlobalVariable import GlobalVariable
|
||||||
|
|
||||||
@DataLayout
|
@DataLayout
|
||||||
class DataLayout:
|
class DataLayout:
|
||||||
_include_ = 'llvm/DataLayout.h'
|
if LLVM_VERSION >= (3, 3):
|
||||||
|
_include_ = 'llvm/IR/DataLayout.h'
|
||||||
|
else:
|
||||||
|
_include_ = 'llvm/DataLayout.h'
|
||||||
|
|
||||||
_new_string = Constructor(cast(str, StringRef))
|
_new_string = Constructor(cast(str, StringRef))
|
||||||
_new_module = Constructor(ptr(Module))
|
_new_module = Constructor(ptr(Module))
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,10 @@ FunctionType = llvm.Class(Type)
|
||||||
|
|
||||||
@FunctionType
|
@FunctionType
|
||||||
class FunctionType:
|
class FunctionType:
|
||||||
_include_ = 'llvm/DerivedTypes.h'
|
if LLVM_VERSION >= (3, 3):
|
||||||
|
_include_ = 'llvm/IR/DerivedTypes.h'
|
||||||
|
else:
|
||||||
|
_include_ = 'llvm/DerivedTypes.h'
|
||||||
_downcast_ = Type
|
_downcast_ = Type
|
||||||
|
|
||||||
_get = StaticMethod(ptr(FunctionType), ptr(Type), cast(bool, Bool))
|
_get = StaticMethod(ptr(FunctionType), ptr(Type), cast(bool, Bool))
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,10 @@ from .Value import GlobalValue, Constant, Function, Argument, Value
|
||||||
from .Module import Module
|
from .Module import Module
|
||||||
from .BasicBlock import BasicBlock
|
from .BasicBlock import BasicBlock
|
||||||
from .ValueSymbolTable import ValueSymbolTable
|
from .ValueSymbolTable import ValueSymbolTable
|
||||||
from .Attributes import Attributes
|
if LLVM_VERSION >= (3, 3):
|
||||||
|
from .Attributes import Attribute, AttributeSet
|
||||||
|
else:
|
||||||
|
from .Attributes import Attributes
|
||||||
from .Type import Type
|
from .Type import Type
|
||||||
from .DerivedTypes import FunctionType
|
from .DerivedTypes import FunctionType
|
||||||
from .LLVMContext import LLVMContext
|
from .LLVMContext import LLVMContext
|
||||||
|
|
@ -12,7 +15,11 @@ from .CallingConv import CallingConv
|
||||||
|
|
||||||
@Function
|
@Function
|
||||||
class Function:
|
class Function:
|
||||||
_include_ = 'llvm/Function.h'
|
if LLVM_VERSION >= (3, 3):
|
||||||
|
_include_ = 'llvm/IR/Function.h'
|
||||||
|
else:
|
||||||
|
_include_ = 'llvm/Function.h'
|
||||||
|
|
||||||
_downcast_ = GlobalValue, Constant, Value
|
_downcast_ = GlobalValue, Constant, Value
|
||||||
|
|
||||||
getReturnType = Method(ptr(Type))
|
getReturnType = Method(ptr(Type))
|
||||||
|
|
@ -48,10 +55,17 @@ class Function:
|
||||||
|
|
||||||
deleteBody = Method()
|
deleteBody = Method()
|
||||||
viewCFG = Method()
|
viewCFG = Method()
|
||||||
|
|
||||||
viewCFGOnly = Method()
|
viewCFGOnly = Method()
|
||||||
|
|
||||||
addFnAttr = Method(Void, Attributes.AttrVal)
|
if LLVM_VERSION >= (3, 3):
|
||||||
removeFnAttr = Method(Void, ref(Attributes))
|
addFnAttr = Method(Void, Attribute.AttrKind)
|
||||||
|
addAttributes = Method(Void, cast(int, Unsigned), ref(AttributeSet))
|
||||||
|
removeAttributes = Method(Void, cast(int, Unsigned), ref(AttributeSet))
|
||||||
|
#removeFnAttr = Method(Void, Attribute.AttrKind) # 3.4?
|
||||||
|
else:
|
||||||
|
addFnAttr = Method(Void, Attributes.AttrVal)
|
||||||
|
removeFnAttr = Method(Void, ref(Attributes))
|
||||||
#hasFnAttribute = Method(cast(Bool, bool), Attributes.AttrVal)
|
#hasFnAttribute = Method(cast(Bool, bool), Attributes.AttrVal)
|
||||||
|
|
||||||
Create = StaticMethod(ptr(Function),
|
Create = StaticMethod(ptr(Function),
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,10 @@ from .ADT.StringRef import StringRef
|
||||||
|
|
||||||
@GlobalValue
|
@GlobalValue
|
||||||
class GlobalValue:
|
class GlobalValue:
|
||||||
_include_ = 'llvm/GlobalValue.h'
|
if LLVM_VERSION >= (3, 3):
|
||||||
|
_include_ = 'llvm/IR/GlobalValue.h'
|
||||||
|
else:
|
||||||
|
_include_ = 'llvm/GlobalValue.h'
|
||||||
|
|
||||||
LinkageTypes = Enum('''
|
LinkageTypes = Enum('''
|
||||||
ExternalLinkage, AvailableExternallyLinkage, LinkOnceAnyLinkage,
|
ExternalLinkage, AvailableExternallyLinkage, LinkOnceAnyLinkage,
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,11 @@ IRBuilder = llvm.Class()
|
||||||
|
|
||||||
@IRBuilder
|
@IRBuilder
|
||||||
class IRBuilder:
|
class IRBuilder:
|
||||||
_include_ = 'llvm/IRBuilder.h'
|
if LLVM_VERSION >= (3, 3):
|
||||||
|
_include_ = 'llvm/IR/IRBuilder.h'
|
||||||
|
else:
|
||||||
|
_include_ = 'llvm/IRBuilder.h'
|
||||||
|
|
||||||
_realname_ = 'IRBuilder<>'
|
_realname_ = 'IRBuilder<>'
|
||||||
|
|
||||||
new = Constructor(ref(LLVMContext))
|
new = Constructor(ref(LLVMContext))
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,10 @@ from .Value import Value
|
||||||
from .DerivedTypes import FunctionType
|
from .DerivedTypes import FunctionType
|
||||||
from .ADT.StringRef import StringRef
|
from .ADT.StringRef import StringRef
|
||||||
|
|
||||||
llvm.includes.add('llvm/InlineAsm.h')
|
if LLVM_VERSION >= (3, 3):
|
||||||
|
llvm.includes.add('llvm/IR/InlineAsm.h')
|
||||||
|
else:
|
||||||
|
llvm.includes.add('llvm/InlineAsm.h')
|
||||||
|
|
||||||
InlineAsm = llvm.Class(Value)
|
InlineAsm = llvm.Class(Value)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,10 @@ SynchronizationScope = llvm.Enum('SynchronizationScope',
|
||||||
|
|
||||||
from .ADT.StringRef import StringRef
|
from .ADT.StringRef import StringRef
|
||||||
from .CallingConv import CallingConv
|
from .CallingConv import CallingConv
|
||||||
from .Attributes import Attributes
|
if LLVM_VERSION >= (3, 3):
|
||||||
|
from .Attributes import AttributeSet, Attribute
|
||||||
|
else:
|
||||||
|
from .Attributes import Attributes
|
||||||
from .Type import Type
|
from .Type import Type
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -142,8 +145,12 @@ class CallInst:
|
||||||
getCallingConv = Method(CallingConv.ID)
|
getCallingConv = Method(CallingConv.ID)
|
||||||
setCallingConv = Method(Void, CallingConv.ID)
|
setCallingConv = Method(Void, CallingConv.ID)
|
||||||
getParamAlignment = Method(cast(Unsigned, int), cast(int, Unsigned))
|
getParamAlignment = Method(cast(Unsigned, int), cast(int, Unsigned))
|
||||||
addAttribute = Method(Void, cast(int, Unsigned), ref(Attributes))
|
if LLVM_VERSION >= (3, 3):
|
||||||
removeAttribute = Method(Void, cast(int, Unsigned), ref(Attributes))
|
addAttribute = Method(Void, cast(int, Unsigned), Attribute.AttrKind)
|
||||||
|
removeAttribute = Method(Void, cast(int, Unsigned), ref(Attribute))
|
||||||
|
else:
|
||||||
|
addAttribute = Method(Void, cast(int, Unsigned), ref(Attributes))
|
||||||
|
removeAttribute = Method(Void, cast(int, Unsigned), ref(Attributes))
|
||||||
getCalledFunction = Method(ptr(Function))
|
getCalledFunction = Method(ptr(Function))
|
||||||
getCalledValue = Method(ptr(Value))
|
getCalledValue = Method(ptr(Value))
|
||||||
setCalledFunction = Method(Void, ptr(Function))
|
setCalledFunction = Method(Void, ptr(Function))
|
||||||
|
|
@ -264,7 +271,10 @@ class UnaryInstruction:
|
||||||
|
|
||||||
@IntrinsicInst
|
@IntrinsicInst
|
||||||
class IntrinsicInst:
|
class IntrinsicInst:
|
||||||
_include_ = 'llvm/IntrinsicInst.h'
|
if LLVM_VERSION >= (3, 3):
|
||||||
|
_include_ = 'llvm/IR/IntrinsicInst.h'
|
||||||
|
else:
|
||||||
|
_include_ = 'llvm/IntrinsicInst.h'
|
||||||
_downcast_ = Value, User, Instruction
|
_downcast_ = Value, User, Instruction
|
||||||
|
|
||||||
#compare
|
#compare
|
||||||
|
|
@ -292,8 +302,12 @@ class InvokeInst:
|
||||||
getCallingConv = Method(CallingConv.ID)
|
getCallingConv = Method(CallingConv.ID)
|
||||||
setCallingConv = Method(Void, CallingConv.ID)
|
setCallingConv = Method(Void, CallingConv.ID)
|
||||||
getParamAlignment = Method(cast(Unsigned, int), cast(int, Unsigned))
|
getParamAlignment = Method(cast(Unsigned, int), cast(int, Unsigned))
|
||||||
addAttribute = Method(Void, cast(int, Unsigned), ref(Attributes))
|
if LLVM_VERSION >= (3, 3):
|
||||||
removeAttribute = Method(Void, cast(int, Unsigned), ref(Attributes))
|
addAttribute = Method(Void, cast(int, Unsigned), Attribute.AttrKind)
|
||||||
|
removeAttribute = Method(Void, cast(int, Unsigned), ref(Attribute))
|
||||||
|
else:
|
||||||
|
addAttribute = Method(Void, cast(int, Unsigned), ref(Attributes))
|
||||||
|
removeAttribute = Method(Void, cast(int, Unsigned), ref(Attributes))
|
||||||
getCalledFunction = Method(ptr(Function))
|
getCalledFunction = Method(ptr(Function))
|
||||||
getCalledValue = Method(ptr(Value))
|
getCalledValue = Method(ptr(Value))
|
||||||
setCalledFunction = Method(Void, ptr(Function))
|
setCalledFunction = Method(Void, ptr(Function))
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,9 @@ from .namespace import llvm
|
||||||
|
|
||||||
@llvm.Class()
|
@llvm.Class()
|
||||||
class LLVMContext:
|
class LLVMContext:
|
||||||
_include_ = "llvm/LLVMContext.h"
|
if LLVM_VERSION >= (3, 3):
|
||||||
|
_include_ = "llvm/IR/LLVMContext.h"
|
||||||
|
else:
|
||||||
|
_include_ = "llvm/LLVMContext.h"
|
||||||
|
|
||||||
llvm.Function('getGlobalContext', ref(LLVMContext))
|
llvm.Function('getGlobalContext', ref(LLVMContext))
|
||||||
|
|
|
||||||
|
|
@ -10,30 +10,33 @@ Linker = llvm.Class()
|
||||||
|
|
||||||
@Linker
|
@Linker
|
||||||
class Linker:
|
class Linker:
|
||||||
ControlFlags = Enum('Verbose, QuietWarnings, QuietErrors')
|
#ControlFlags = Enum('Verbose, QuietWarnings, QuietErrors')
|
||||||
LinkerMode = Enum('DestroySource, PreserveSource')
|
LinkerMode = Enum('DestroySource, PreserveSource')
|
||||||
|
|
||||||
_new_w_empty = Constructor(cast(str, StringRef),
|
if LLVM_VERSION >= (3, 3):
|
||||||
cast(str, StringRef),
|
new = Constructor(ptr(Module))
|
||||||
ref(LLVMContext),
|
else:
|
||||||
cast(int, Unsigned)).require_only(3)
|
_new_w_empty = Constructor(cast(str, StringRef),
|
||||||
|
cast(str, StringRef),
|
||||||
|
ref(LLVMContext),
|
||||||
|
cast(int, Unsigned)).require_only(3)
|
||||||
|
|
||||||
_new_w_existing = Constructor(cast(str, StringRef),
|
_new_w_existing = Constructor(cast(str, StringRef),
|
||||||
ptr(Module),
|
ptr(Module),
|
||||||
cast(int, Unsigned)).require_only(2)
|
cast(int, Unsigned)).require_only(2)
|
||||||
|
|
||||||
@CustomPythonStaticMethod
|
@CustomPythonStaticMethod
|
||||||
def new(progname, module_or_name, *args):
|
def new(progname, module_or_name, *args):
|
||||||
if isinstance(module_or_name, Module):
|
if isinstance(module_or_name, Module):
|
||||||
return _new_w_existing(progname, module_or_name, *args)
|
return _new_w_existing(progname, module_or_name, *args)
|
||||||
else:
|
else:
|
||||||
return _new_w_empty(progname, module_or_name, *args)
|
return _new_w_empty(progname, module_or_name, *args)
|
||||||
|
|
||||||
delete = Destructor()
|
delete = Destructor()
|
||||||
|
|
||||||
getModule = Method(ptr(Module))
|
getModule = Method(ptr(Module))
|
||||||
releaseModule = Method(ptr(Module))
|
#releaseModule = Method(ptr(Module))
|
||||||
getLastError = Method(cast(ConstStdString, str))
|
#getLastError = Method(cast(ConstStdString, str))
|
||||||
|
|
||||||
LinkInModule = CustomMethod('Linker_LinkInModule',
|
LinkInModule = CustomMethod('Linker_LinkInModule',
|
||||||
PyObjectPtr, # boolean
|
PyObjectPtr, # boolean
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,10 @@ from .Metadata import NamedMDNode
|
||||||
|
|
||||||
@Module
|
@Module
|
||||||
class Module:
|
class Module:
|
||||||
_include_ = "llvm/Module.h"
|
if LLVM_VERSION >= (3, 3):
|
||||||
|
_include_ = "llvm/IR/Module.h"
|
||||||
|
else:
|
||||||
|
_include_ = "llvm/Module.h"
|
||||||
# Enumerators
|
# Enumerators
|
||||||
Endianness = Enum('AnyEndianness', 'LittleEndian', 'BigEndian')
|
Endianness = Enum('AnyEndianness', 'LittleEndian', 'BigEndian')
|
||||||
PointerSize = Enum('AnyPointerSize', 'Pointer32', 'Pointer64')
|
PointerSize = Enum('AnyPointerSize', 'Pointer32', 'Pointer64')
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,29 @@
|
||||||
from binding import *
|
from binding import *
|
||||||
from src.namespace import sys
|
from src.namespace import sys
|
||||||
|
|
||||||
isLittleEndianHost = sys.Function('isLittleEndianHost',
|
|
||||||
cast(Bool, bool))
|
|
||||||
|
|
||||||
isBigEndianHost = sys.Function('isBigEndianHost',
|
|
||||||
cast(Bool, bool))
|
|
||||||
|
|
||||||
getDefaultTargetTriple = sys.Function('getDefaultTargetTriple',
|
getDefaultTargetTriple = sys.Function('getDefaultTargetTriple',
|
||||||
cast(ConstStdString, str))
|
cast(ConstStdString, str))
|
||||||
|
|
||||||
# llvm 3.3
|
if LLVM_VERSION >= (3, 3):
|
||||||
#getProcessTriple = sys.Function('getProcessTriple',
|
getProcessTriple = sys.Function('getProcessTriple',
|
||||||
# cast(ConstStdString, str))
|
cast(ConstStdString, str))
|
||||||
|
|
||||||
|
isLittleEndianHost = sys.CustomFunction('isLittleEndianHost',
|
||||||
|
'llvm_sys_isLittleEndianHost',
|
||||||
|
cast(Bool, bool))
|
||||||
|
|
||||||
|
isBigEndianHost = sys.CustomFunction('isBigEndianHost',
|
||||||
|
'llvm_sys_isBigEndianHost',
|
||||||
|
cast(Bool, bool))
|
||||||
|
|
||||||
|
else:
|
||||||
|
|
||||||
|
isLittleEndianHost = sys.Function('isLittleEndianHost',
|
||||||
|
cast(Bool, bool))
|
||||||
|
|
||||||
|
isBigEndianHost = sys.Function('isBigEndianHost',
|
||||||
|
cast(Bool, bool))
|
||||||
|
|
||||||
|
|
||||||
getHostCPUName = sys.Function('getHostCPUName',
|
getHostCPUName = sys.Function('getHostCPUName',
|
||||||
cast(ConstStdString, str))
|
cast(ConstStdString, str))
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,10 @@ from src.ADT.StringRef import StringRef
|
||||||
from src.Support.CodeGen import CodeModel, TLSModel, CodeGenOpt, Reloc
|
from src.Support.CodeGen import CodeModel, TLSModel, CodeGenOpt, Reloc
|
||||||
from src.GlobalValue import GlobalValue
|
from src.GlobalValue import GlobalValue
|
||||||
from src.DataLayout import DataLayout
|
from src.DataLayout import DataLayout
|
||||||
from src.TargetTransformInfo import (ScalarTargetTransformInfo,
|
|
||||||
VectorTargetTransformInfo)
|
if LLVM_VERSION < (3, 3):
|
||||||
|
from src.TargetTransformInfo import (ScalarTargetTransformInfo,
|
||||||
|
VectorTargetTransformInfo)
|
||||||
from src.PassManager import PassManagerBase
|
from src.PassManager import PassManagerBase
|
||||||
from src.Support.FormattedStream import formatted_raw_ostream
|
from src.Support.FormattedStream import formatted_raw_ostream
|
||||||
|
|
||||||
|
|
@ -39,9 +41,11 @@ class TargetMachine:
|
||||||
setMCUseDwarfDirectory = Method(Void, cast(bool, Bool))
|
setMCUseDwarfDirectory = Method(Void, cast(bool, Bool))
|
||||||
|
|
||||||
getDataLayout = Method(const(ownedptr(DataLayout)))
|
getDataLayout = Method(const(ownedptr(DataLayout)))
|
||||||
getScalarTargetTransformInfo = Method(const(
|
|
||||||
|
if LLVM_VERSION < (3, 3):
|
||||||
|
getScalarTargetTransformInfo = Method(const(
|
||||||
ownedptr(ScalarTargetTransformInfo)))
|
ownedptr(ScalarTargetTransformInfo)))
|
||||||
getVectorTargetTransformInfo = Method(const(
|
getVectorTargetTransformInfo = Method(const(
|
||||||
ownedptr(VectorTargetTransformInfo)))
|
ownedptr(VectorTargetTransformInfo)))
|
||||||
|
|
||||||
addPassesToEmitFile = Method(cast(bool, Bool),
|
addPassesToEmitFile = Method(cast(bool, Bool),
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,10 @@ from binding import *
|
||||||
from src.namespace import llvm
|
from src.namespace import llvm
|
||||||
from src.Pass import ImmutablePass
|
from src.Pass import ImmutablePass
|
||||||
|
|
||||||
llvm.includes.add('llvm/TargetTransformInfo.h')
|
if LLVM_VERSION >= (3, 3):
|
||||||
|
llvm.includes.add('llvm/Analysis/TargetTransformInfo.h')
|
||||||
|
else:
|
||||||
|
llvm.includes.add('llvm/TargetTransformInfo.h')
|
||||||
|
|
||||||
TargetTransformInfo = llvm.Class(ImmutablePass)
|
TargetTransformInfo = llvm.Class(ImmutablePass)
|
||||||
ScalarTargetTransformInfo = llvm.Class()
|
ScalarTargetTransformInfo = llvm.Class()
|
||||||
|
|
@ -11,14 +14,17 @@ VectorTargetTransformInfo = llvm.Class()
|
||||||
|
|
||||||
@ScalarTargetTransformInfo
|
@ScalarTargetTransformInfo
|
||||||
class ScalarTargetTransformInfo:
|
class ScalarTargetTransformInfo:
|
||||||
delete = Destructor()
|
if LLVM_VERSION < (3, 3):
|
||||||
|
delete = Destructor()
|
||||||
|
|
||||||
@VectorTargetTransformInfo
|
@VectorTargetTransformInfo
|
||||||
class VectorTargetTransformInfo:
|
class VectorTargetTransformInfo:
|
||||||
delete = Destructor()
|
if LLVM_VERSION < (3, 3):
|
||||||
|
delete = Destructor()
|
||||||
|
|
||||||
@TargetTransformInfo
|
@TargetTransformInfo
|
||||||
class TargetTransformInfo:
|
class TargetTransformInfo:
|
||||||
new = Constructor(ptr(ScalarTargetTransformInfo),
|
if LLVM_VERSION < (3, 3):
|
||||||
ptr(VectorTargetTransformInfo))
|
new = Constructor(ptr(ScalarTargetTransformInfo),
|
||||||
|
ptr(VectorTargetTransformInfo))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,11 @@ class PassManagerBuilder:
|
||||||
DisableSimplifyLibCalls = _attr_bool()
|
DisableSimplifyLibCalls = _attr_bool()
|
||||||
DisableUnitAtATime = _attr_bool()
|
DisableUnitAtATime = _attr_bool()
|
||||||
DisableUnrollLoops = _attr_bool()
|
DisableUnrollLoops = _attr_bool()
|
||||||
Vectorize = _attr_bool()
|
if LLVM_VERSION >= (3, 3):
|
||||||
|
BBVectorize = _attr_bool()
|
||||||
|
SLPVectorize = _attr_bool()
|
||||||
|
else:
|
||||||
|
Vectorize = _attr_bool()
|
||||||
LoopVectorize = _attr_bool()
|
LoopVectorize = _attr_bool()
|
||||||
|
|
||||||
LibraryInfo = Attr(getter=ownedptr(TargetLibraryInfo),
|
LibraryInfo = Attr(getter=ownedptr(TargetLibraryInfo),
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,10 @@ VectorType = llvm.Class(SequentialType)
|
||||||
|
|
||||||
@Type
|
@Type
|
||||||
class Type:
|
class Type:
|
||||||
_include_ = 'llvm/Type.h'
|
if LLVM_VERSION >= (3, 3):
|
||||||
|
_include_ = 'llvm/IR/Type.h'
|
||||||
|
else:
|
||||||
|
_include_ = 'llvm/Type.h'
|
||||||
|
|
||||||
TypeID = Enum('''
|
TypeID = Enum('''
|
||||||
VoidTyID, HalfTyID, FloatTyID, DoubleTyID,
|
VoidTyID, HalfTyID, FloatTyID, DoubleTyID,
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,10 @@ from .ADT.StringRef import StringRef
|
||||||
|
|
||||||
@ValueSymbolTable
|
@ValueSymbolTable
|
||||||
class ValueSymbolTable:
|
class ValueSymbolTable:
|
||||||
_include_ = 'llvm/ValueSymbolTable.h'
|
if LLVM_VERSION >= (3, 3):
|
||||||
|
_include_ = 'llvm/IR/ValueSymbolTable.h'
|
||||||
|
else:
|
||||||
|
_include_ = 'llvm/ValueSymbolTable.h'
|
||||||
new = Constructor()
|
new = Constructor()
|
||||||
delete = Destructor()
|
delete = Destructor()
|
||||||
lookup = Method(ptr(Value), cast(str, StringRef))
|
lookup = Method(ptr(Value), cast(str, StringRef))
|
||||||
|
|
|
||||||
7
setup.py
7
setup.py
|
|
@ -61,7 +61,12 @@ def auto_intrinsic_gen(incdir):
|
||||||
# let's do auto intrinsic generation
|
# let's do auto intrinsic generation
|
||||||
print("Generate intrinsic IDs")
|
print("Generate intrinsic IDs")
|
||||||
from tools import intrgen
|
from tools import intrgen
|
||||||
path = "%s/llvm/Intrinsics.gen" % incdir
|
|
||||||
|
if llvm_version >= (3, 3):
|
||||||
|
path = "%s/llvm/IR/Intrinsics.gen" % incdir
|
||||||
|
else:
|
||||||
|
path = "%s/llvm/Intrinsics.gen" % incdir
|
||||||
|
|
||||||
with open('llvm/_intrinsic_ids.py', 'w') as fout:
|
with open('llvm/_intrinsic_ids.py', 'w') as fout:
|
||||||
intrgen.gen(path, fout)
|
intrgen.gen(path, fout)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue