does not throw property for Function (Andrew Straw)
git-svn-id: http://llvm-py.googlecode.com/svn/trunk@79 8d1e9007-1d4e-0410-b67e-1979fd6579aa
This commit is contained in:
parent
d0e4e09a5d
commit
6cb58c97d7
5 changed files with 33 additions and 1 deletions
|
|
@ -505,6 +505,8 @@ _wrap_obj2obj(LLVMGetFunctionCallConv, LLVMValueRef, int)
|
||||||
_wrap_objint2none(LLVMSetFunctionCallConv, LLVMValueRef)
|
_wrap_objint2none(LLVMSetFunctionCallConv, LLVMValueRef)
|
||||||
_wrap_obj2str(LLVMGetGC, LLVMValueRef)
|
_wrap_obj2str(LLVMGetGC, LLVMValueRef)
|
||||||
_wrap_objstr2none(LLVMSetGC, LLVMValueRef)
|
_wrap_objstr2none(LLVMSetGC, LLVMValueRef)
|
||||||
|
_wrap_obj2obj(LLVMGetDoesNotThrow, LLVMValueRef, int)
|
||||||
|
_wrap_objint2none(LLVMSetDoesNotThrow, LLVMValueRef)
|
||||||
_wrap_obj2none(LLVMViewFunctionCFG, LLVMValueRef)
|
_wrap_obj2none(LLVMViewFunctionCFG, LLVMValueRef)
|
||||||
_wrap_obj2none(LLVMViewFunctionCFGOnly, LLVMValueRef)
|
_wrap_obj2none(LLVMViewFunctionCFGOnly, LLVMValueRef)
|
||||||
|
|
||||||
|
|
@ -1324,6 +1326,8 @@ static PyMethodDef core_methods[] = {
|
||||||
_method( LLVMSetFunctionCallConv )
|
_method( LLVMSetFunctionCallConv )
|
||||||
_method( LLVMGetGC )
|
_method( LLVMGetGC )
|
||||||
_method( LLVMSetGC )
|
_method( LLVMSetGC )
|
||||||
|
_method( LLVMGetDoesNotThrow )
|
||||||
|
_method( LLVMSetDoesNotThrow )
|
||||||
_method( LLVMVerifyFunction )
|
_method( LLVMVerifyFunction )
|
||||||
_method( LLVMViewFunctionCFG )
|
_method( LLVMViewFunctionCFG )
|
||||||
_method( LLVMViewFunctionCFGOnly )
|
_method( LLVMViewFunctionCFGOnly )
|
||||||
|
|
|
||||||
|
|
@ -1286,6 +1286,11 @@ class Function(GlobalValue):
|
||||||
def _set_coll(self, value): _core.LLVMSetGC(self.ptr, value)
|
def _set_coll(self, value): _core.LLVMSetGC(self.ptr, value)
|
||||||
collector = property(_get_coll, _set_coll)
|
collector = property(_get_coll, _set_coll)
|
||||||
|
|
||||||
|
# the nounwind attribute:
|
||||||
|
def _get_does_not_throw(self): return _core.LLVMGetDoesNotThrow(self.ptr)
|
||||||
|
def _set_does_not_throw(self,value): _core.LLVMSetDoesNotThrow(self.ptr, value)
|
||||||
|
does_not_throw = property(_get_does_not_throw, _set_does_not_throw)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def args(self):
|
def args(self):
|
||||||
return _util.wrapiter(_core.LLVMGetFirstParam,
|
return _util.wrapiter(_core.LLVMGetFirstParam,
|
||||||
|
|
@ -1324,7 +1329,6 @@ class Function(GlobalValue):
|
||||||
# failure, it appears to print result to stderr and abort.
|
# failure, it appears to print result to stderr and abort.
|
||||||
return _core.LLVMVerifyFunction(self.ptr) != 0
|
return _core.LLVMVerifyFunction(self.ptr) != 0
|
||||||
|
|
||||||
|
|
||||||
#===----------------------------------------------------------------------===
|
#===----------------------------------------------------------------------===
|
||||||
# Instruction
|
# Instruction
|
||||||
#===----------------------------------------------------------------------===
|
#===----------------------------------------------------------------------===
|
||||||
|
|
|
||||||
|
|
@ -365,6 +365,22 @@ LLVMValueRef LLVMUserGetOperand(LLVMValueRef user, unsigned idx)
|
||||||
return llvm::wrap(operand);
|
return llvm::wrap(operand);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned LLVMGetDoesNotThrow(LLVMValueRef fn)
|
||||||
|
{
|
||||||
|
llvm::Function *fnp = llvm::unwrap<llvm::Function>(fn);
|
||||||
|
assert(fnp);
|
||||||
|
|
||||||
|
return fnp->doesNotThrow();
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLVMSetDoesNotThrow(LLVMValueRef fn, int DoesNotThrow)
|
||||||
|
{
|
||||||
|
llvm::Function *fnp = llvm::unwrap<llvm::Function>(fn);
|
||||||
|
assert(fnp);
|
||||||
|
|
||||||
|
return fnp->setDoesNotThrow((bool)DoesNotThrow);
|
||||||
|
}
|
||||||
|
|
||||||
LLVMValueRef LLVMGetIntrinsic(LLVMModuleRef module, int id,
|
LLVMValueRef LLVMGetIntrinsic(LLVMModuleRef module, int id,
|
||||||
LLVMTypeRef *types, unsigned n_types)
|
LLVMTypeRef *types, unsigned n_types)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -107,6 +107,12 @@ LLVMValueRef LLVMBuildVFCmp(LLVMBuilderRef builder, LLVMRealPredicate predicate,
|
||||||
LLVMValueRef LLVMGetIntrinsic(LLVMModuleRef builder, int id,
|
LLVMValueRef LLVMGetIntrinsic(LLVMModuleRef builder, int id,
|
||||||
LLVMTypeRef *types, unsigned n_types);
|
LLVMTypeRef *types, unsigned n_types);
|
||||||
|
|
||||||
|
/* Wraps llvm::Function::doesNotThrow(). */
|
||||||
|
unsigned LLVMGetDoesNotThrow(LLVMValueRef fn);
|
||||||
|
|
||||||
|
/* Wraps llvm::Function::setDoesNotThrow(). */
|
||||||
|
void LLVMSetDoesNotThrow(LLVMValueRef fn, int DoesNotThrow);
|
||||||
|
|
||||||
/* Wraps llvm::Module::getPointerSize(). */
|
/* Wraps llvm::Module::getPointerSize(). */
|
||||||
unsigned LLVMModuleGetPointerSize(LLVMModuleRef module);
|
unsigned LLVMModuleGetPointerSize(LLVMModuleRef module);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -282,6 +282,8 @@ def do_function():
|
||||||
f.delete()
|
f.delete()
|
||||||
ft = Type.function(ti, [ti]*20)
|
ft = Type.function(ti, [ti]*20)
|
||||||
f = Function.new(m, ft, 'func2')
|
f = Function.new(m, ft, 'func2')
|
||||||
|
has_nounwind = f.does_not_throw
|
||||||
|
f.does_not_throw = True
|
||||||
f2 = Function.intrinsic(m, INTR_COS, [ti])
|
f2 = Function.intrinsic(m, INTR_COS, [ti])
|
||||||
g = f.intrinsic_id
|
g = f.intrinsic_id
|
||||||
f.calling_convenion = CC_FASTCALL
|
f.calling_convenion = CC_FASTCALL
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue