Revive inline_function()
This commit is contained in:
parent
c439c2fb40
commit
78cde30883
5 changed files with 44 additions and 12 deletions
|
|
@ -1431,7 +1431,7 @@ _wLLVMParseEnvOpts(PyObject *self, PyObject *args)
|
|||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
//_wrap_obj2obj(LLVMInlineFunction, LLVMValueRef, int)
|
||||
_wrap_obj2obj(LLVMInlineFunction, LLVMValueRef, int)
|
||||
|
||||
/* Expose the void* inside a PyCObject as a PyLong. This allows us to
|
||||
* use it as a unique ID. */
|
||||
|
|
@ -2038,7 +2038,7 @@ static PyMethodDef core_methods[] = {
|
|||
_method( LLVMLoadLibraryPermanently )
|
||||
_method( LLVMParseEnvOpts )
|
||||
|
||||
//_method( LLVMInlineFunction )
|
||||
_method( LLVMInlineFunction )
|
||||
_method( PyCObjectVoidPtrToPyLong )
|
||||
{ NULL }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2157,7 +2157,7 @@ def load_library_permanently(filename):
|
|||
|
||||
def inline_function(call):
|
||||
check_is_value(call)
|
||||
return _core.LLVMInlineFunction(call.ptr)
|
||||
return bool(_core.LLVMInlineFunction(call.ptr))
|
||||
|
||||
def parse_environment_options(progname, envname):
|
||||
_core.LLVMParseEnvOpts(progname, envname)
|
||||
|
|
|
|||
|
|
@ -1032,16 +1032,15 @@ int LLVMInlineFunction(LLVMValueRef call)
|
|||
llvm::Value *callp = llvm::unwrap(call);
|
||||
assert(callp);
|
||||
|
||||
// llvm::CallSite cs = llvm::CallSite::get(callp);
|
||||
llvm::CallSite cs;
|
||||
llvm::InlineFunctionInfo unused;
|
||||
|
||||
llvm::Instruction *II = llvm::dyn_cast<llvm::Instruction>(callp);
|
||||
if (II->getOpcode() == llvm::Instruction::Call)
|
||||
cs = llvm::CallSite(static_cast<llvm::CallInst*>(II));
|
||||
return llvm::InlineFunction(static_cast<llvm::CallInst*>(II), unused);
|
||||
else if (II->getOpcode() == llvm::Instruction::Invoke)
|
||||
cs = llvm::CallSite(static_cast<llvm::InvokeInst*>(II));
|
||||
|
||||
llvm::InlineFunctionInfo unused;
|
||||
return llvm::InlineFunction(cs, unused);
|
||||
return llvm::InlineFunction(static_cast<llvm::InvokeInst*>(II), unused);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned LLVMGetParamAlignment(LLVMValueRef arg)
|
||||
|
|
|
|||
|
|
@ -449,8 +449,9 @@ void *LLVMGetPointerToFunction(LLVMExecutionEngineRef ee, LLVMValueRef fn);
|
|||
|
||||
/* Wraps llvm::InlineFunction(). Inlines a function. C is the call
|
||||
* instruction, created by LLVMBuildCall. Even if it fails, the Function
|
||||
* containing the call is still in a proper state (not changed). */
|
||||
//int LLVMInlineFunction(LLVMValueRef call);
|
||||
* containing the call is still in a proper state (not changed).
|
||||
*/
|
||||
int LLVMInlineFunction(LLVMValueRef call);
|
||||
|
||||
/* Wraps llvm::getAlignmentFromAttrs from Attributes.h. Compliments the
|
||||
* already available LLVMSetParamAlignment(). */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue