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

@ -84,6 +84,24 @@ LLVMValueRef LLVMBuildVFCmp(LLVMBuilderRef B, LLVMRealPredicate Op,
}
#endif
unsigned LLVMModuleGetPointerSize(LLVMModuleRef M)
{
Module::PointerSize p = unwrap(M)->getPointerSize();
if (p == Module::Pointer32)
return 32;
else if (p == Module::Pointer64)
return 64;
return 0;
}
LLVMValueRef LLVMModuleGetOrInsertFunction(LLVMModuleRef M,
const char *Name, LLVMTypeRef FunctionTy)
{
FunctionType *ft = unwrap<FunctionType>(FunctionTy);
Constant *f = unwrap(M)->getOrInsertFunction(Name, ft);
return wrap(f);
}
#define inst_checkfn(ourfn, llvmfn) \
unsigned ourfn (LLVMValueRef I) { \
return unwrap<Instruction>(I)-> llvmfn () ? 1 : 0; \