diff --git a/llvm/_core.c b/llvm/_core.c index 2da9cf2..6f4dcfc 100644 --- a/llvm/_core.c +++ b/llvm/_core.c @@ -87,8 +87,6 @@ _wrap_obj2str(LLVMGetDataLayout, LLVMModuleRef) _wrap_objstr2none(LLVMSetDataLayout, LLVMModuleRef) _wrap_obj2str(LLVMGetTarget, LLVMModuleRef) _wrap_objstr2none(LLVMSetTarget, LLVMModuleRef) -_wrap_objstrobj2obj(LLVMAddTypeName, LLVMModuleRef, LLVMTypeRef, int) -_wrap_objstr2none(LLVMDeleteTypeName, LLVMModuleRef) _wrap_objstr2obj(LLVMGetTypeByName, LLVMModuleRef, LLVMTypeRef) _wrap_obj2none(LLVMDumpModule, LLVMModuleRef) _wrap_obj2none(LLVMDisposeModule, LLVMModuleRef) @@ -189,8 +187,9 @@ _wLLVMLinkModules(PyObject *self, PyObject *args) PyObject *dest_obj, *src_obj, *ret; LLVMModuleRef dest, src; char *errmsg; + unsigned int mode = 0; - if (!PyArg_ParseTuple(args, "OO", &dest_obj, &src_obj)) + if (!PyArg_ParseTuple(args, "OO|I", &dest_obj, &src_obj, &mode)) return NULL; #ifdef LLVM_PY_USE_PYCAPSULE @@ -201,7 +200,7 @@ _wLLVMLinkModules(PyObject *self, PyObject *args) src = (LLVMModuleRef) PyCObject_AsVoidPtr(src_obj); #endif - if (!LLVMLinkModules(dest, src, &errmsg)) { + if (!LLVMLinkModules(dest, src, mode, &errmsg)) { if (errmsg) { ret = PyBytes_FromString(errmsg); LLVMDisposeMessage(errmsg); @@ -326,14 +325,14 @@ _wrap_obj2obj(LLVMGetVectorSize, LLVMTypeRef, int) _wrap_none2obj(LLVMVoidType, LLVMTypeRef) _wrap_none2obj(LLVMLabelType, LLVMTypeRef) -_wrap_none2obj(LLVMOpaqueType, LLVMTypeRef) /*===-- Type handles -----------------------------------------------------===*/ +/* _wrap_obj2obj(LLVMCreateTypeHandle, LLVMTypeRef, LLVMTypeHandleRef) -_wrap_objobj2none(LLVMRefineType, LLVMTypeRef, LLVMTypeRef) _wrap_obj2obj(LLVMResolveTypeHandle, LLVMTypeHandleRef, LLVMTypeRef) _wrap_obj2none(LLVMDisposeTypeHandle, LLVMTypeHandleRef) +*/ /*===----------------------------------------------------------------------===*/ @@ -706,7 +705,6 @@ _wLLVMBuildInvoke(PyObject *self, PyObject *args) return ctor_LLVMValueRef(inst); } -_wrap_obj2obj(LLVMBuildUnwind, LLVMBuilderRef, LLVMValueRef) _wrap_obj2obj(LLVMBuildUnreachable, LLVMBuilderRef, LLVMValueRef) /* Add a case to the switch instruction */ @@ -870,7 +868,6 @@ _wrap_pass( DeadArgElimination ) _wrap_pass( DeadCodeElimination ) _wrap_pass( DeadInstElimination ) _wrap_pass( DeadStoreElimination ) -_wrap_pass( DeadTypeElimination ) _wrap_pass( DemoteRegisterToMemory ) _wrap_pass( DomOnlyPrinter ) _wrap_pass( DomOnlyViewer ) @@ -905,7 +902,6 @@ _wrap_pass( LoopStrengthReduce ) _wrap_pass( LoopUnroll ) _wrap_pass( LoopUnswitch ) _wrap_pass( LowerInvoke ) -_wrap_pass( LowerSetJmp ) _wrap_pass( LowerSwitch ) _wrap_pass( MemCpyOpt ) _wrap_pass( MergeFunctions ) @@ -1323,8 +1319,6 @@ static PyMethodDef core_methods[] = { _method( LLVMSetDataLayout ) _method( LLVMGetTarget ) _method( LLVMSetTarget ) - _method( LLVMAddTypeName ) - _method( LLVMDeleteTypeName ) _method( LLVMGetTypeByName ) _method( LLVMDumpModule ) _method( LLVMDisposeModule ) @@ -1388,13 +1382,12 @@ static PyMethodDef core_methods[] = { /* Other types */ _method( LLVMVoidType ) _method( LLVMLabelType ) - _method( LLVMOpaqueType ) /* Type handles */ - _method( LLVMCreateTypeHandle ) - _method( LLVMRefineType ) + /* _method( LLVMResolveTypeHandle ) _method( LLVMDisposeTypeHandle ) + */ /* Values */ @@ -1592,7 +1585,6 @@ static PyMethodDef core_methods[] = { _method( LLVMBuildCondBr ) _method( LLVMBuildSwitch ) _method( LLVMBuildInvoke ) - _method( LLVMBuildUnwind ) _method( LLVMBuildUnreachable ) /* Add a case to the switch instruction */ @@ -1690,7 +1682,6 @@ static PyMethodDef core_methods[] = { _pass( DeadCodeElimination ) _pass( DeadInstElimination ) _pass( DeadStoreElimination ) - _pass( DeadTypeElimination ) _pass( DemoteRegisterToMemory ) _pass( DomOnlyPrinter ) _pass( DomOnlyViewer ) @@ -1725,7 +1716,6 @@ static PyMethodDef core_methods[] = { _pass( LoopUnroll ) _pass( LoopUnswitch ) _pass( LowerInvoke ) - _pass( LowerSetJmp ) _pass( LowerSwitch ) _pass( MemCpyOpt ) _pass( MergeFunctions ) diff --git a/llvm/core.py b/llvm/core.py index ec839d2..5201c6e 100644 --- a/llvm/core.py +++ b/llvm/core.py @@ -440,23 +440,6 @@ class Module(llvm.Ownable, llvm.Cacheable): # Do not try to destroy the other module's llvm::Module*. other._own(llvm.DummyOwner()) - def add_type_name(self, name, ty): - """Map a string to a type. - - Similar to C's struct/typedef declarations. Returns True - if entry already existed (in which case nothing is changed), - False otherwise. - """ - check_is_type(ty) - return _core.LLVMAddTypeName(self.ptr, name, ty.ptr) != 0 - - def delete_type_name(self, name): - """Removes a named type. - - Undoes what add_type_name() does. - """ - _core.LLVMDeleteTypeName(self.ptr, name) - def get_type_named(self, name): """Return a Type object with the given name.""" ptr = _core.LLVMGetTypeByName(self.ptr, name) @@ -650,13 +633,6 @@ class Type(object): """Create a label type.""" return _make_type(_core.LLVMLabelType(), TYPE_LABEL) - @staticmethod - def opaque(): - """Create an opaque type. - - Opaque types are used to create self-referencing types.""" - return _make_type(_core.LLVMOpaqueType(), TYPE_OPAQUE) - def __init__(self, ptr, kind): """DO NOT CALL DIRECTLY. @@ -683,17 +659,6 @@ class Type(object): def __ne__(self, rhs): return not self == rhs - def refine(self, dest): - """Refine the abstract type represented by self into a concrete class. - - This object is no longer valid after refining, so do not hold - references to it after calling. See the user guide for examples on how - to use this.""" - - check_is_type(dest) - _core.LLVMRefineType(self.ptr, dest.ptr) - self.ptr = None - class IntegerType(Type): """Represents an integer type.""" @@ -1656,9 +1621,6 @@ class Builder(object): _core.LLVMBuildInvoke(self.ptr, func.ptr, args2, then_blk.ptr, catch_blk.ptr, name)) - def unwind(self): - return _make_value(_core.LLVMBuildUnwind(self.ptr)) - def unreachable(self): return _make_value(_core.LLVMBuildUnreachable(self.ptr)) diff --git a/llvm/extra.cpp b/llvm/extra.cpp index 57ce418..ca4f0b8 100644 --- a/llvm/extra.cpp +++ b/llvm/extra.cpp @@ -48,7 +48,7 @@ #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" #include "llvm/GlobalVariable.h" -#include "llvm/TypeSymbolTable.h" +//#include "llvm/TypeSymbolTable.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/CallSite.h" #include "llvm/IntrinsicInst.h" @@ -330,7 +330,7 @@ LLVMValueRef LLVMGetIntrinsic(LLVMModuleRef module, int id, { assert(types); - std::vector types_vec; + std::vector< llvm::ArrayRef > types_vec; unwrap_cvec(types, n_types, types_vec); llvm::Module *modulep = llvm::unwrap(module); @@ -384,7 +384,8 @@ LLVMModuleRef LLVMGetModuleFromBitcode(const char *bitcode, unsigned bclen, return wrap(modulep); } -unsigned LLVMLinkModules(LLVMModuleRef dest, LLVMModuleRef src, char **out) +unsigned LLVMLinkModules(LLVMModuleRef dest, LLVMModuleRef src, unsigned int mode, + char **out) { llvm::Module *sourcep = llvm::unwrap(src); assert(sourcep); @@ -392,7 +393,7 @@ unsigned LLVMLinkModules(LLVMModuleRef dest, LLVMModuleRef src, char **out) assert(destinationp); std::string msg; - if (llvm::Linker::LinkModules(destinationp, sourcep, &msg)) { + if (llvm::Linker::LinkModules(destinationp, sourcep, mode, &msg)) { *out = strdup(msg.c_str()); return 0; } @@ -544,8 +545,8 @@ define_pass( ScalarEvolutionAliasAnalysis ) //define_pass( SimplifyHalfPowrLibCalls ) define_pass( SingleLoopExtractor ) define_pass( StripNonDebugSymbols ) -define_pass( StructRetPromotion ) -define_pass( TailDuplication ) +//define_pass( StructRetPromotion ) +//define_pass( TailDuplication ) define_pass( UnifyFunctionExitNodes ) /* we support only internalize(true) */ diff --git a/llvm/extra.h b/llvm/extra.h index fb80233..6382309 100644 --- a/llvm/extra.h +++ b/llvm/extra.h @@ -163,7 +163,8 @@ LLVMModuleRef LLVMGetModuleFromBitcode(const char *bc, unsigned bclen, /* Wraps llvm::Linker::LinkModules(). Returns 0 on failure (with errmsg * filled in) and 1 on success. Dispose error message after use with * LLVMDisposeMessage(). */ -unsigned LLVMLinkModules(LLVMModuleRef dest, LLVMModuleRef src, char **errmsg); +unsigned LLVMLinkModules(LLVMModuleRef dest, LLVMModuleRef src, + unsigned int, char **errmsg); /* Returns pointer to a heap-allocated block of `*len' bytes containing bit code * for the given module. NULL on error. */ diff --git a/llvm/passes.py b/llvm/passes.py index 32c0907..6f1a4e6 100644 --- a/llvm/passes.py +++ b/llvm/passes.py @@ -187,7 +187,6 @@ _pass_creator = { PASS_LOOP_UNROLL : _core.LLVMAddLoopUnrollPass, PASS_LOOP_UNSWITCH : _core.LLVMAddLoopUnswitchPass, PASS_LOWER_INVOKE : _core.LLVMAddLowerInvokePass, - PASS_LOWER_SET_JMP : _core.LLVMAddLowerSetJmpPass, PASS_LOWER_SWITCH : _core.LLVMAddLowerSwitchPass, PASS_MEM_CPY_OPT : _core.LLVMAddMemCpyOptPass, PASS_MERGE_FUNCTIONS : _core.LLVMAddMergeFunctionsPass, diff --git a/llvm/wrap.c b/llvm/wrap.c index 4e02516..9bd7e5b 100644 --- a/llvm/wrap.c +++ b/llvm/wrap.c @@ -68,7 +68,6 @@ PyObject * ctor_ ## typ ( typ p) \ _define_std_ctor(LLVMModuleRef) _define_std_ctor(LLVMTypeRef) _define_std_ctor(LLVMValueRef) -_define_std_ctor(LLVMTypeHandleRef) _define_std_ctor(LLVMBasicBlockRef) _define_std_ctor(LLVMBuilderRef) _define_std_ctor(LLVMMemoryBufferRef) diff --git a/llvm/wrap.h b/llvm/wrap.h index 3467ae0..f45f8b6 100644 --- a/llvm/wrap.h +++ b/llvm/wrap.h @@ -75,7 +75,6 @@ PyObject * ctor_ ## typ ( typ p); _declare_std_ctor(LLVMModuleRef) _declare_std_ctor(LLVMTypeRef) _declare_std_ctor(LLVMValueRef) -_declare_std_ctor(LLVMTypeHandleRef) _declare_std_ctor(LLVMBasicBlockRef) _declare_std_ctor(LLVMBuilderRef) _declare_std_ctor(LLVMMemoryBufferRef)