Migrated to LLVM 2.4.
git-svn-id: http://llvm-py.googlecode.com/svn/trunk@50 8d1e9007-1d4e-0410-b67e-1979fd6579aa
This commit is contained in:
parent
09e1748a19
commit
95cef74480
9 changed files with 699 additions and 634 deletions
32
llvm/_core.c
32
llvm/_core.c
|
|
@ -453,8 +453,8 @@ _wrap_obj2none(LLVMDeleteFunction, LLVMValueRef)
|
|||
_wrap_obj2obj(LLVMGetIntrinsicID, LLVMValueRef, int)
|
||||
_wrap_obj2obj(LLVMGetFunctionCallConv, LLVMValueRef, int)
|
||||
_wrap_objint2none(LLVMSetFunctionCallConv, LLVMValueRef)
|
||||
_wrap_obj2str(LLVMGetCollector, LLVMValueRef)
|
||||
_wrap_objstr2none(LLVMSetCollector, LLVMValueRef)
|
||||
_wrap_obj2str(LLVMGetGC, LLVMValueRef)
|
||||
_wrap_objstr2none(LLVMSetGC, LLVMValueRef)
|
||||
_wrap_obj2none(LLVMViewFunctionCFG, LLVMValueRef)
|
||||
_wrap_obj2none(LLVMViewFunctionCFGOnly, LLVMValueRef)
|
||||
|
||||
|
|
@ -476,8 +476,8 @@ _wrap_obj2obj(LLVMCountParams, LLVMValueRef, int)
|
|||
_wrap_obj2obj(LLVMGetFirstParam, LLVMValueRef, LLVMValueRef)
|
||||
_wrap_obj2obj(LLVMGetNextParam, LLVMValueRef, LLVMValueRef)
|
||||
_wrap_obj2obj(LLVMGetParamParent, LLVMValueRef, LLVMValueRef)
|
||||
_wrap_objint2none(LLVMAddParamAttr, LLVMValueRef)
|
||||
_wrap_objint2none(LLVMRemoveParamAttr, LLVMValueRef)
|
||||
_wrap_objint2none(LLVMAddAttribute, LLVMValueRef)
|
||||
_wrap_objint2none(LLVMRemoveAttribute, LLVMValueRef)
|
||||
_wrap_objint2none(LLVMSetParamAlignment, LLVMValueRef)
|
||||
|
||||
/*===-- Basic Blocks -----------------------------------------------------===*/
|
||||
|
|
@ -513,8 +513,8 @@ _wrap_obj2str(LLVMInstGetOpcodeName, LLVMValueRef)
|
|||
|
||||
_wrap_objint2none(LLVMSetInstructionCallConv, LLVMValueRef)
|
||||
_wrap_obj2obj(LLVMGetInstructionCallConv, LLVMValueRef, int)
|
||||
_wrap_objintint2none(LLVMAddInstrParamAttr, LLVMValueRef)
|
||||
_wrap_objintint2none(LLVMRemoveInstrParamAttr, LLVMValueRef)
|
||||
_wrap_objintint2none(LLVMAddInstrAttribute, LLVMValueRef)
|
||||
_wrap_objintint2none(LLVMRemoveInstrAttribute, LLVMValueRef)
|
||||
_wrap_objintint2none(LLVMSetInstrParamAlignment, LLVMValueRef)
|
||||
|
||||
/*===-- PHI Nodes --------------------------------------------------------===*/
|
||||
|
|
@ -737,7 +737,7 @@ _wrap_pass( DeadArgElimination )
|
|||
_wrap_pass( DeadTypeElimination )
|
||||
_wrap_pass( DeadInstElimination )
|
||||
_wrap_pass( DeadStoreElimination )
|
||||
_wrap_pass( GCSE )
|
||||
/* _wrap_pass( GCSE ): removed in LLVM 2.4. */
|
||||
_wrap_pass( GlobalDCE )
|
||||
_wrap_pass( GlobalOptimizer )
|
||||
_wrap_pass( GVN )
|
||||
|
|
@ -837,7 +837,7 @@ _wLLVMCreateExecutionEngine(PyObject *self, PyObject *args)
|
|||
if (force_interpreter)
|
||||
error = LLVMCreateInterpreter(&ee, mp, &outmsg);
|
||||
else
|
||||
error = LLVMCreateJITCompiler(&ee, mp, &outmsg);
|
||||
error = LLVMCreateJITCompiler(&ee, mp, 1 /*fast*/, &outmsg);
|
||||
|
||||
if (error) {
|
||||
ret = PyString_FromString(outmsg);
|
||||
|
|
@ -1174,9 +1174,9 @@ static PyMethodDef core_methods[] = {
|
|||
_method( LLVMDeleteFunction )
|
||||
_method( LLVMGetIntrinsicID )
|
||||
_method( LLVMGetFunctionCallConv )
|
||||
_method( LLVMSetFunctionCallConv )
|
||||
_method( LLVMGetCollector )
|
||||
_method( LLVMSetCollector )
|
||||
_method( LLVMSetFunctionCallConv )
|
||||
_method( LLVMGetGC )
|
||||
_method( LLVMSetGC )
|
||||
_method( LLVMVerifyFunction )
|
||||
_method( LLVMViewFunctionCFG )
|
||||
_method( LLVMViewFunctionCFGOnly )
|
||||
|
|
@ -1186,8 +1186,8 @@ static PyMethodDef core_methods[] = {
|
|||
_method( LLVMGetFirstParam )
|
||||
_method( LLVMGetNextParam )
|
||||
_method( LLVMGetParamParent )
|
||||
_method( LLVMAddParamAttr )
|
||||
_method( LLVMRemoveParamAttr )
|
||||
_method( LLVMAddAttribute )
|
||||
_method( LLVMRemoveAttribute )
|
||||
_method( LLVMSetParamAlignment )
|
||||
|
||||
/* Basic Blocks */
|
||||
|
|
@ -1219,8 +1219,8 @@ static PyMethodDef core_methods[] = {
|
|||
/* Call Sites (Call or Invoke) */
|
||||
_method( LLVMSetInstructionCallConv )
|
||||
_method( LLVMGetInstructionCallConv )
|
||||
_method( LLVMAddInstrParamAttr )
|
||||
_method( LLVMRemoveInstrParamAttr )
|
||||
_method( LLVMAddInstrAttribute )
|
||||
_method( LLVMRemoveInstrAttribute )
|
||||
_method( LLVMSetInstrParamAlignment )
|
||||
|
||||
/* PHI Nodes */
|
||||
|
|
@ -1343,7 +1343,7 @@ static PyMethodDef core_methods[] = {
|
|||
_pass( DeadTypeElimination )
|
||||
_pass( DeadInstElimination )
|
||||
_pass( DeadStoreElimination )
|
||||
_pass( GCSE )
|
||||
/* _pass( GCSE ): removed in LLVM 2.4. */
|
||||
_pass( GlobalDCE )
|
||||
_pass( GlobalOptimizer )
|
||||
_pass( GVN )
|
||||
|
|
|
|||
1204
llvm/core.py
1204
llvm/core.py
File diff suppressed because it is too large
Load diff
|
|
@ -82,7 +82,11 @@ char *do_print(W obj)
|
|||
|
||||
char *LLVMDumpModuleToString(LLVMModuleRef module)
|
||||
{
|
||||
return do_print<LLVMModuleRef, llvm::Module>(module);
|
||||
std::ostringstream buf;
|
||||
llvm::Module *p = llvm::unwrap(module);
|
||||
assert(p);
|
||||
p->print(buf, NULL);
|
||||
return strdup(buf.str().c_str());
|
||||
}
|
||||
|
||||
char *LLVMDumpTypeToString(LLVMTypeRef type)
|
||||
|
|
@ -123,6 +127,14 @@ LLVMValueRef LLVMModuleGetOrInsertFunction(LLVMModuleRef module,
|
|||
return wrap(f);
|
||||
}
|
||||
|
||||
int LLVMHasInitializer(LLVMValueRef global_var)
|
||||
{
|
||||
llvm::GlobalVariable *gvp = llvm::unwrap<llvm::GlobalVariable>(global_var);
|
||||
assert(gvp);
|
||||
|
||||
return gvp->hasInitializer();
|
||||
}
|
||||
|
||||
#define inst_checkfn(ourfn, llvmfn) \
|
||||
unsigned ourfn (LLVMValueRef v) { \
|
||||
llvm::Instruction *ip = llvm::unwrap<llvm::Instruction>(v); \
|
||||
|
|
@ -191,10 +203,10 @@ LLVMValueRef LLVMBuildRetMultiple(LLVMBuilderRef builder,
|
|||
std::vector<llvm::Value *> values_vec;
|
||||
unwrap_vec(values, n_values, values_vec);
|
||||
|
||||
llvm::IRBuilder *builderp = llvm::unwrap(builder);
|
||||
llvm::IRBuilder<> *builderp = llvm::unwrap(builder);
|
||||
assert(builderp);
|
||||
|
||||
return wrap(builderp->CreateRet(&values_vec[0], values_vec.size()));
|
||||
return llvm::wrap(builderp->CreateAggregateRet(&values_vec[0], values_vec.size()));
|
||||
}
|
||||
|
||||
LLVMValueRef LLVMBuildGetResult(LLVMBuilderRef builder,
|
||||
|
|
@ -202,10 +214,10 @@ LLVMValueRef LLVMBuildGetResult(LLVMBuilderRef builder,
|
|||
{
|
||||
assert(name);
|
||||
|
||||
llvm::IRBuilder *builderp = llvm::unwrap(builder);
|
||||
llvm::IRBuilder<> *builderp = llvm::unwrap(builder);
|
||||
assert(builderp);
|
||||
|
||||
return wrap(builderp->CreateGetResult(llvm::unwrap(value), index, name));
|
||||
return llvm::wrap(builderp->CreateExtractValue(llvm::unwrap(value), index, name));
|
||||
}
|
||||
|
||||
LLVMValueRef LLVMGetIntrinsic(LLVMModuleRef module, int id,
|
||||
|
|
@ -333,7 +345,7 @@ define_pass( DeadArgElimination )
|
|||
define_pass( DeadTypeElimination )
|
||||
define_pass( DeadInstElimination )
|
||||
define_pass( DeadStoreElimination )
|
||||
define_pass( GCSE )
|
||||
/* define_pass( GCSE ): removed in LLVM 2.4 */
|
||||
define_pass( GlobalDCE )
|
||||
define_pass( GlobalOptimizer )
|
||||
define_pass( GVNPRE )
|
||||
|
|
|
|||
|
|
@ -77,6 +77,9 @@ unsigned LLVMModuleGetPointerSize(LLVMModuleRef module);
|
|||
LLVMValueRef LLVMModuleGetOrInsertFunction(LLVMModuleRef module,
|
||||
const char *name, LLVMTypeRef function_type);
|
||||
|
||||
/* Wraps llvm::GlobalVariable::hasInitializer(). */
|
||||
int LLVMHasInitializer(LLVMValueRef global_var);
|
||||
|
||||
/* The following functions wrap various llvm::Instruction::isXXX() functions.
|
||||
* All of them take an instruction and return 0 (isXXX returned false) or 1
|
||||
* (isXXX returned false). */
|
||||
|
|
@ -143,7 +146,7 @@ declare_pass( DeadArgElimination )
|
|||
declare_pass( DeadTypeElimination )
|
||||
declare_pass( DeadInstElimination )
|
||||
declare_pass( DeadStoreElimination )
|
||||
declare_pass( GCSE )
|
||||
/* declare_pass( GCSE ): removed in LLVM 2.4. */
|
||||
declare_pass( GlobalDCE )
|
||||
declare_pass( GlobalOptimizer )
|
||||
declare_pass( GVNPRE )
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ PASS_DEAD_ARG_ELIMINATION = 10
|
|||
PASS_DEAD_TYPE_ELIMINATION = 11
|
||||
PASS_DEAD_INST_ELIMINATION = 12
|
||||
PASS_DEAD_STORE_ELIMINATION = 13
|
||||
PASS_GCSE = 14
|
||||
# PASS_GCSE = 14: removed in LLVM 2.4
|
||||
PASS_GLOBAL_DCE = 15
|
||||
PASS_GLOBAL_OPTIMIZER = 16
|
||||
PASS_GVN = 17
|
||||
|
|
@ -127,7 +127,7 @@ _pass_creator = {
|
|||
PASS_DEAD_TYPE_ELIMINATION : _core.LLVMAddDeadTypeEliminationPass,
|
||||
PASS_DEAD_INST_ELIMINATION : _core.LLVMAddDeadInstEliminationPass,
|
||||
PASS_DEAD_STORE_ELIMINATION : _core.LLVMAddDeadStoreEliminationPass,
|
||||
PASS_GCSE : _core.LLVMAddGCSEPass,
|
||||
# PASS_GCSE : _core.LLVMAddGCSEPass,: removed in LLVM 2.4.
|
||||
PASS_GLOBAL_DCE : _core.LLVMAddGlobalDCEPass,
|
||||
PASS_GLOBAL_OPTIMIZER : _core.LLVMAddGlobalOptimizerPass,
|
||||
PASS_GVN : _core.LLVMAddGVNPass,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue