Add thread local
This commit is contained in:
parent
16b833be2b
commit
cc12434f57
2 changed files with 14 additions and 4 deletions
|
|
@ -559,10 +559,11 @@ _wrap_obj2none(LLVMDeleteGlobal, LLVMValueRef)
|
|||
_wrap_obj2obj(LLVMHasInitializer, LLVMValueRef, int)
|
||||
_wrap_obj2obj(LLVMGetInitializer, LLVMValueRef, LLVMValueRef)
|
||||
_wrap_objobj2none(LLVMSetInitializer, LLVMValueRef, LLVMValueRef)
|
||||
_wrap_objint2none(LLVMSetThreadLocal, LLVMValueRef)
|
||||
_wrap_objint2none(LLVMSetGlobalConstant, LLVMValueRef)
|
||||
_wrap_obj2obj(LLVMIsThreadLocal, LLVMValueRef, int)
|
||||
_wrap_obj2obj(LLVMIsGlobalConstant, LLVMValueRef, int)
|
||||
_wrap_objint2none(LLVMSetThreadLocal, LLVMValueRef)
|
||||
_wrap_obj2obj(LLVMIsThreadLocal, LLVMValueRef, int)
|
||||
|
||||
|
||||
/*===-- Functions --------------------------------------------------------===*/
|
||||
|
||||
|
|
@ -1655,8 +1656,8 @@ static PyMethodDef core_methods[] = {
|
|||
_method( LLVMGetInitializer )
|
||||
_method( LLVMSetInitializer )
|
||||
_method( LLVMSetThreadLocal )
|
||||
_method( LLVMSetGlobalConstant )
|
||||
_method( LLVMIsThreadLocal )
|
||||
_method( LLVMSetGlobalConstant )
|
||||
_method( LLVMIsGlobalConstant )
|
||||
|
||||
/* Functions */
|
||||
|
|
|
|||
11
llvm/core.py
11
llvm/core.py
|
|
@ -1265,7 +1265,6 @@ class GlobalValue(Constant):
|
|||
def module(self):
|
||||
return Module(_core.LLVMGetGlobalParent(self.ptr))
|
||||
|
||||
|
||||
class GlobalVariable(GlobalValue):
|
||||
|
||||
@staticmethod
|
||||
|
|
@ -1298,6 +1297,9 @@ class GlobalVariable(GlobalValue):
|
|||
check_is_constant(const)
|
||||
_core.LLVMSetInitializer(self.ptr, const.ptr)
|
||||
|
||||
def _del_initializer(self):
|
||||
check_is_constant(const)
|
||||
|
||||
initializer = property(_get_initializer, _set_initializer)
|
||||
|
||||
def _get_is_global_constant(self):
|
||||
|
|
@ -1310,6 +1312,13 @@ class GlobalVariable(GlobalValue):
|
|||
global_constant = \
|
||||
property(_get_is_global_constant, _set_is_global_constant)
|
||||
|
||||
def _get_thread_local(self):
|
||||
return bool(_core.LLVMIsThreadLocal(self.ptr))
|
||||
def _set_thread_local(self, value):
|
||||
value = _to_int(value)
|
||||
_core.LLVMSetThreadLocal(self.ptr, value)
|
||||
|
||||
thread_local = property(_get_thread_local, _set_thread_local)
|
||||
|
||||
class Argument(Value):
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue