Add control to alignment of ld/st inst
This commit is contained in:
parent
16860436d4
commit
d78253ebe3
4 changed files with 31 additions and 2 deletions
|
|
@ -752,6 +752,9 @@ _wrap_objobjstr2obj(LLVMBuildLoad, LLVMBuilderRef, LLVMValueRef, LLVMValueRef)
|
|||
_wrap_objobjobj2obj(LLVMBuildStore, LLVMBuilderRef, LLVMValueRef, LLVMValueRef, LLVMValueRef)
|
||||
_wrap_objobjliststr2obj(LLVMBuildGEP, LLVMBuilderRef, LLVMValueRef, LLVMValueRef, LLVMValueRef)
|
||||
|
||||
_wrap_objint2none(LLVMLdSetAlignment, LLVMValueRef)
|
||||
_wrap_objint2none(LLVMStSetAlignment, LLVMValueRef)
|
||||
|
||||
/* Casts */
|
||||
|
||||
_wrap_objobjobjstr2obj(LLVMBuildTrunc, LLVMBuilderRef, LLVMValueRef, LLVMTypeRef, LLVMValueRef)
|
||||
|
|
@ -1753,6 +1756,9 @@ static PyMethodDef core_methods[] = {
|
|||
_method( LLVMBuildStore )
|
||||
_method( LLVMBuildGEP )
|
||||
|
||||
_method( LLVMLdSetAlignment )
|
||||
_method( LLVMStSetAlignment )
|
||||
|
||||
/* Casts */
|
||||
_method( LLVMBuildTrunc )
|
||||
_method( LLVMBuildZExt )
|
||||
|
|
|
|||
|
|
@ -1840,17 +1840,21 @@ class Builder(object):
|
|||
check_is_value(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)
|
||||
inst = _make_value(_core.LLVMBuildLoad(self.ptr, ptr.ptr, name))
|
||||
if align:
|
||||
_core.LLVMLdSetAlignment(inst.ptr, align)
|
||||
if volatile:
|
||||
inst.set_volatile(volatile)
|
||||
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(ptr)
|
||||
inst = _make_value(_core.LLVMBuildStore(self.ptr, value.ptr, ptr.ptr))
|
||||
if align:
|
||||
_core.LLVMStSetAlignment(inst.ptr, align)
|
||||
if volatile:
|
||||
inst.set_volatile(volatile)
|
||||
return inst
|
||||
|
|
|
|||
|
|
@ -126,6 +126,15 @@ const CodeGenOpt::Level OptLevelMap[] = {
|
|||
};
|
||||
} // 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()
|
||||
{
|
||||
|
|
|
|||
10
llvm/extra.h
10
llvm/extra.h
|
|
@ -55,6 +55,16 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Wraps LoadInst::SetAlignment
|
||||
*/
|
||||
void LLVMLdSetAlignment(LLVMValueRef inst, unsigned align);
|
||||
|
||||
/*
|
||||
* Wraps StoreInst::SetAlignment
|
||||
*/
|
||||
void LLVMStSetAlignment(LLVMValueRef inst, unsigned align);
|
||||
|
||||
const char * LLVMGetHostCPUName();
|
||||
|
||||
int LLVMInitializeNativeTargetAsmPrinter();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue