Added pointer_size and get_or_insert_function to Module

git-svn-id: http://llvm-py.googlecode.com/svn/trunk@43 8d1e9007-1d4e-0410-b67e-1979fd6579aa
This commit is contained in:
mdevan.foobar 2008-09-16 17:03:21 +00:00
commit 2780d9fc10
5 changed files with 53 additions and 1 deletions

View file

@ -822,6 +822,14 @@ class Module(llvm.Ownable):
"""
)
@property
def pointer_size(self):
"""Pointer size of target platform.
Can be 0, 32 or 64. Zero represents
llvm::Module::AnyPointerSize."""
return _core.LLVMModuleGetPointerSize(self.ptr)
def add_type_name(self, name, ty):
"""Map a string to a type.
@ -868,6 +876,9 @@ class Module(llvm.Ownable):
"""Return a Function object representing function with given name."""
return Function.get(self, name)
def get_or_insert_function(self, ty, name):
return Function.get_or_insert(self, ty, name)
@property
def functions(self):
"""All functions in this module.
@ -1603,7 +1614,15 @@ class Function(GlobalValue):
def new(module, func_ty, name):
check_is_module(module)
check_is_type(func_ty)
return Function(_core.LLVMAddFunction(module.ptr, name, func_ty.ptr), module)
return Function(_core.LLVMAddFunction(module.ptr, name, \
func_ty.ptr), module)
@staticmethod
def get_or_insert(module, func_ty, name):
check_is_module(module)
check_is_type(func_ty)
return Function(_core.LLVMModuleGetOrInsertFunction(module.ptr, \
name, func_ty.ptr), module)
@staticmethod
def get(module, name):