Merge branch 'master' of github.com:llvmpy/llvmpy

This commit is contained in:
Maggie Mari 2012-08-23 11:17:10 -05:00
commit 212ff672c9
4 changed files with 31 additions and 2 deletions

View file

@ -752,6 +752,9 @@ _wrap_objobjstr2obj(LLVMBuildLoad, LLVMBuilderRef, LLVMValueRef, LLVMValueRef)
_wrap_objobjobj2obj(LLVMBuildStore, LLVMBuilderRef, LLVMValueRef, LLVMValueRef, LLVMValueRef) _wrap_objobjobj2obj(LLVMBuildStore, LLVMBuilderRef, LLVMValueRef, LLVMValueRef, LLVMValueRef)
_wrap_objobjliststr2obj(LLVMBuildGEP, LLVMBuilderRef, LLVMValueRef, LLVMValueRef, LLVMValueRef) _wrap_objobjliststr2obj(LLVMBuildGEP, LLVMBuilderRef, LLVMValueRef, LLVMValueRef, LLVMValueRef)
_wrap_objint2none(LLVMLdSetAlignment, LLVMValueRef)
_wrap_objint2none(LLVMStSetAlignment, LLVMValueRef)
/* Casts */ /* Casts */
_wrap_objobjobjstr2obj(LLVMBuildTrunc, LLVMBuilderRef, LLVMValueRef, LLVMTypeRef, LLVMValueRef) _wrap_objobjobjstr2obj(LLVMBuildTrunc, LLVMBuilderRef, LLVMValueRef, LLVMTypeRef, LLVMValueRef)
@ -1753,6 +1756,9 @@ static PyMethodDef core_methods[] = {
_method( LLVMBuildStore ) _method( LLVMBuildStore )
_method( LLVMBuildGEP ) _method( LLVMBuildGEP )
_method( LLVMLdSetAlignment )
_method( LLVMStSetAlignment )
/* Casts */ /* Casts */
_method( LLVMBuildTrunc ) _method( LLVMBuildTrunc )
_method( LLVMBuildZExt ) _method( LLVMBuildZExt )

View file

@ -1840,17 +1840,21 @@ class Builder(object):
check_is_value(ptr) check_is_value(ptr)
return _make_value(_core.LLVMBuildFree(self.ptr, ptr.ptr)) return _make_value(_core.LLVMBuildFree(self.ptr, ptr.ptr))
def load(self, ptr, name="", volatile=False): def load(self, ptr, name="", align=0, volatile=False):
check_is_value(ptr) check_is_value(ptr)
inst = _make_value(_core.LLVMBuildLoad(self.ptr, ptr.ptr, name)) inst = _make_value(_core.LLVMBuildLoad(self.ptr, ptr.ptr, name))
if align:
_core.LLVMLdSetAlignment(inst.ptr, align)
if volatile: if volatile:
inst.set_volatile(volatile) inst.set_volatile(volatile)
return inst return inst
def store(self, value, ptr, volatile=False): def store(self, value, ptr, align=0, volatile=False):
check_is_value(value) check_is_value(value)
check_is_value(ptr) check_is_value(ptr)
inst = _make_value(_core.LLVMBuildStore(self.ptr, value.ptr, ptr.ptr)) inst = _make_value(_core.LLVMBuildStore(self.ptr, value.ptr, ptr.ptr))
if align:
_core.LLVMStSetAlignment(inst.ptr, align)
if volatile: if volatile:
inst.set_volatile(volatile) inst.set_volatile(volatile)
return inst return inst

View file

@ -126,6 +126,15 @@ const CodeGenOpt::Level OptLevelMap[] = {
}; };
} // end anony namespace } // end anony namespace
void LLVMLdSetAlignment(LLVMValueRef inst, unsigned align)
{
return llvm::unwrap<LoadInst>(inst)->setAlignment(align);
}
void LLVMStSetAlignment(LLVMValueRef inst, unsigned align)
{
return llvm::unwrap<StoreInst>(inst)->setAlignment(align);
}
const char * LLVMGetHostCPUName() const char * LLVMGetHostCPUName()
{ {

View file

@ -55,6 +55,16 @@
extern "C" { extern "C" {
#endif #endif
/*
* Wraps LoadInst::SetAlignment
*/
void LLVMLdSetAlignment(LLVMValueRef inst, unsigned align);
/*
* Wraps StoreInst::SetAlignment
*/
void LLVMStSetAlignment(LLVMValueRef inst, unsigned align);
const char * LLVMGetHostCPUName(); const char * LLVMGetHostCPUName();
int LLVMInitializeNativeTargetAsmPrinter(); int LLVMInitializeNativeTargetAsmPrinter();