Updated for LLVM 2.7 (will not work with LLVM 2.6). Work-in-progress.
git-svn-id: http://llvm-py.googlecode.com/svn/trunk@86 8d1e9007-1d4e-0410-b67e-1979fd6579aa
This commit is contained in:
parent
43998cc2df
commit
d51eb76fec
10 changed files with 1136 additions and 1012 deletions
|
|
@ -1,6 +1,7 @@
|
|||
|
||||
0.6, in progress:
|
||||
|
||||
* Migrate to LLVM 2.7.
|
||||
* Migrate to LLVM 2.6 (KS Sreeram) (Issue #25).
|
||||
* Inline function (Corrado Zoccolo).
|
||||
* Get pointer to function (Corrado Zoccolo).
|
||||
|
|
|
|||
6
README
6
README
|
|
@ -12,13 +12,13 @@ Home page:
|
|||
|
||||
Versions:
|
||||
---------
|
||||
This package will work only with LLVM 2.6. If you need llvm-py for LLVM
|
||||
2.5, use SVN r82 or older.
|
||||
This package will work only with LLVM 2.7, and Python 2.4 or later,
|
||||
but not 3.x.
|
||||
|
||||
|
||||
Quickstart:
|
||||
-----------
|
||||
1. Get 2.6 version of LLVM, build it. Make sure '--enable-pic' is passed to
|
||||
1. Get 2.7 version of LLVM, build it. Make sure '--enable-pic' is passed to
|
||||
LLVM's 'configure'.
|
||||
|
||||
2. Get llvm-py from SVN, install it:
|
||||
|
|
|
|||
152
llvm/_core.c
152
llvm/_core.c
|
|
@ -70,6 +70,7 @@ _wrap_obj2str(LLVMGetTarget, LLVMModuleRef)
|
|||
_wrap_objstr2none(LLVMSetTarget, LLVMModuleRef)
|
||||
_wrap_objstrobj2obj(LLVMAddTypeName, LLVMModuleRef, LLVMTypeRef, int)
|
||||
_wrap_objstr2none(LLVMDeleteTypeName, LLVMModuleRef)
|
||||
_wrap_objstr2obj(LLVMGetTypeByName, LLVMModuleRef, LLVMTypeRef)
|
||||
_wrap_obj2none(LLVMDumpModule, LLVMModuleRef)
|
||||
_wrap_obj2none(LLVMDisposeModule, LLVMModuleRef)
|
||||
_wrap_dumper(LLVMDumpModuleToString, LLVMModuleRef)
|
||||
|
|
@ -783,69 +784,96 @@ _wrap_obj2none(LLVMDisposePassManager, LLVMPassManagerRef)
|
|||
#define _wrap_pass(P) \
|
||||
_wrap_obj2none( LLVMAdd ## P ## Pass, LLVMPassManagerRef)
|
||||
|
||||
_wrap_pass( AAEval )
|
||||
_wrap_pass( ABCD )
|
||||
_wrap_pass( AggressiveDCE )
|
||||
_wrap_pass( AliasAnalysisCounter )
|
||||
_wrap_pass( AlwaysInliner )
|
||||
_wrap_pass( ArgumentPromotion )
|
||||
_wrap_pass( BasicAliasAnalysis )
|
||||
_wrap_pass( BlockPlacement )
|
||||
_wrap_pass( BreakCriticalEdges )
|
||||
_wrap_pass( CFGSimplification )
|
||||
_wrap_pass( CodeGenPrepare )
|
||||
_wrap_pass( CondPropagation )
|
||||
_wrap_pass( ConstantMerge )
|
||||
_wrap_pass( ConstantPropagation )
|
||||
_wrap_pass( DeadCodeElimination )
|
||||
_wrap_pass( DbgInfoPrinter )
|
||||
_wrap_pass( DeadArgElimination )
|
||||
_wrap_pass( DeadTypeElimination )
|
||||
_wrap_pass( DeadCodeElimination )
|
||||
_wrap_pass( DeadInstElimination )
|
||||
_wrap_pass( DeadStoreElimination )
|
||||
/* _wrap_pass( GCSE ): removed in LLVM 2.4. */
|
||||
_wrap_pass( DeadTypeElimination )
|
||||
_wrap_pass( DemoteRegisterToMemory )
|
||||
_wrap_pass( DomOnlyPrinter )
|
||||
_wrap_pass( DomOnlyViewer )
|
||||
_wrap_pass( DomPrinter )
|
||||
_wrap_pass( DomViewer )
|
||||
_wrap_pass( EdgeProfiler )
|
||||
_wrap_pass( FunctionAttrs )
|
||||
_wrap_pass( FunctionInlining )
|
||||
_wrap_pass( GEPSplitter )
|
||||
_wrap_pass( GlobalDCE )
|
||||
_wrap_pass( GlobalOptimizer )
|
||||
_wrap_pass( GlobalsModRef )
|
||||
_wrap_pass( GVN )
|
||||
_wrap_pass( GVNPRE )
|
||||
_wrap_pass( IndMemRem )
|
||||
_wrap_pass( IndVarSimplify )
|
||||
_wrap_pass( FunctionInlining )
|
||||
_wrap_pass( BlockProfiler )
|
||||
_wrap_pass( EdgeProfiler )
|
||||
_wrap_pass( FunctionProfiler )
|
||||
_wrap_pass( NullProfilerRS )
|
||||
_wrap_pass( RSProfiling )
|
||||
_wrap_pass( InstCount )
|
||||
_wrap_pass( InstructionCombining )
|
||||
_wrap_pass( Internalize )
|
||||
_wrap_pass( InstructionNamer )
|
||||
_wrap_pass( IPConstantPropagation )
|
||||
_wrap_pass( IPSCCP )
|
||||
_wrap_pass( JumpThreading )
|
||||
_wrap_pass( LazyValueInfo )
|
||||
_wrap_pass( LCSSA )
|
||||
_wrap_pass( LICM )
|
||||
_wrap_pass( LiveValues )
|
||||
_wrap_pass( LoopDeletion )
|
||||
_wrap_pass( LoopDependenceAnalysis )
|
||||
_wrap_pass( LoopExtractor )
|
||||
_wrap_pass( SingleLoopExtractor )
|
||||
_wrap_pass( LoopIndexSplit )
|
||||
_wrap_pass( LoopStrengthReduce )
|
||||
_wrap_pass( LoopRotate )
|
||||
_wrap_pass( LoopSimplify )
|
||||
_wrap_pass( LoopStrengthReduce )
|
||||
_wrap_pass( LoopUnroll )
|
||||
_wrap_pass( LoopUnswitch )
|
||||
_wrap_pass( LoopSimplify )
|
||||
_wrap_pass( LowerAllocations )
|
||||
_wrap_pass( LowerInvoke )
|
||||
_wrap_pass( LowerSetJmp )
|
||||
_wrap_pass( LowerSwitch )
|
||||
_wrap_pass( PromoteMemoryToRegister )
|
||||
_wrap_pass( MemCpyOpt )
|
||||
_wrap_pass( UnifyFunctionExitNodes )
|
||||
_wrap_pass( PredicateSimplifier )
|
||||
_wrap_pass( MergeFunctions )
|
||||
_wrap_pass( NoAA )
|
||||
_wrap_pass( NoProfileInfo )
|
||||
_wrap_pass( OptimalEdgeProfiler )
|
||||
_wrap_pass( PartialInlining )
|
||||
_wrap_pass( PartialSpecialization )
|
||||
_wrap_pass( PostDomOnlyPrinter )
|
||||
_wrap_pass( PostDomOnlyViewer )
|
||||
_wrap_pass( PostDomPrinter )
|
||||
_wrap_pass( PostDomViewer )
|
||||
_wrap_pass( ProfileEstimator )
|
||||
_wrap_pass( ProfileLoader )
|
||||
_wrap_pass( ProfileVerifier )
|
||||
_wrap_pass( PromoteMemoryToRegister )
|
||||
_wrap_pass( PruneEH )
|
||||
_wrap_pass( RaiseAllocations )
|
||||
_wrap_pass( Reassociate )
|
||||
_wrap_pass( DemoteRegisterToMemory )
|
||||
_wrap_pass( ScalarEvolutionAliasAnalysis )
|
||||
_wrap_pass( ScalarReplAggregates )
|
||||
_wrap_pass( SCCP )
|
||||
_wrap_pass( SCCVN )
|
||||
_wrap_pass( SimplifyHalfPowrLibCalls )
|
||||
_wrap_pass( SimplifyLibCalls )
|
||||
_wrap_pass( CFGSimplification )
|
||||
_wrap_pass( StripSymbols )
|
||||
_wrap_pass( SingleLoopExtractor )
|
||||
_wrap_pass( SSI )
|
||||
_wrap_pass( SSIEverything )
|
||||
_wrap_pass( StripDeadPrototypes )
|
||||
_wrap_pass( StripNonDebugSymbols )
|
||||
_wrap_pass( StripSymbols )
|
||||
_wrap_pass( StructRetPromotion )
|
||||
_wrap_pass( TailCallElimination )
|
||||
_wrap_pass( TailDuplication )
|
||||
_wrap_pass( UnifyFunctionExitNodes )
|
||||
|
||||
_wrap_pass( Internalize )
|
||||
|
||||
/*===----------------------------------------------------------------------===*/
|
||||
/* Target Data */
|
||||
|
|
@ -1143,6 +1171,7 @@ static PyMethodDef core_methods[] = {
|
|||
_method( LLVMSetTarget )
|
||||
_method( LLVMAddTypeName )
|
||||
_method( LLVMDeleteTypeName )
|
||||
_method( LLVMGetTypeByName )
|
||||
_method( LLVMDumpModule )
|
||||
_method( LLVMDisposeModule )
|
||||
_method( LLVMDumpModuleToString )
|
||||
|
|
@ -1485,69 +1514,96 @@ static PyMethodDef core_methods[] = {
|
|||
_method( LLVMDisposePassManager )
|
||||
|
||||
/* Passes */
|
||||
_pass( AAEval )
|
||||
_pass( ABCD )
|
||||
_pass( AggressiveDCE )
|
||||
_pass( AliasAnalysisCounter )
|
||||
_pass( AlwaysInliner )
|
||||
_pass( ArgumentPromotion )
|
||||
_pass( BasicAliasAnalysis )
|
||||
_pass( BlockPlacement )
|
||||
_pass( BreakCriticalEdges )
|
||||
_pass( CFGSimplification )
|
||||
_pass( CodeGenPrepare )
|
||||
_pass( CondPropagation )
|
||||
_pass( ConstantMerge )
|
||||
_pass( ConstantPropagation )
|
||||
_pass( DeadCodeElimination )
|
||||
_pass( DbgInfoPrinter )
|
||||
_pass( DeadArgElimination )
|
||||
_pass( DeadTypeElimination )
|
||||
_pass( DeadCodeElimination )
|
||||
_pass( DeadInstElimination )
|
||||
_pass( DeadStoreElimination )
|
||||
/* _pass( GCSE ): removed in LLVM 2.4. */
|
||||
_pass( DeadTypeElimination )
|
||||
_pass( DemoteRegisterToMemory )
|
||||
_pass( DomOnlyPrinter )
|
||||
_pass( DomOnlyViewer )
|
||||
_pass( DomPrinter )
|
||||
_pass( DomViewer )
|
||||
_pass( EdgeProfiler )
|
||||
_pass( FunctionAttrs )
|
||||
_pass( FunctionInlining )
|
||||
_pass( GEPSplitter )
|
||||
_pass( GlobalDCE )
|
||||
_pass( GlobalOptimizer )
|
||||
_pass( GlobalsModRef )
|
||||
_pass( GVN )
|
||||
_pass( GVNPRE )
|
||||
_pass( IndMemRem )
|
||||
_pass( IndVarSimplify )
|
||||
_pass( FunctionInlining )
|
||||
_pass( BlockProfiler )
|
||||
_pass( EdgeProfiler )
|
||||
_pass( FunctionProfiler )
|
||||
_pass( NullProfilerRS )
|
||||
_pass( RSProfiling )
|
||||
_pass( InstCount )
|
||||
_pass( InstructionCombining )
|
||||
_pass( Internalize )
|
||||
_pass( InstructionNamer )
|
||||
_pass( IPConstantPropagation )
|
||||
_pass( IPSCCP )
|
||||
_pass( JumpThreading )
|
||||
_pass( LazyValueInfo )
|
||||
_pass( LCSSA )
|
||||
_pass( LICM )
|
||||
_pass( LiveValues )
|
||||
_pass( LoopDeletion )
|
||||
_pass( LoopDependenceAnalysis )
|
||||
_pass( LoopExtractor )
|
||||
_pass( SingleLoopExtractor )
|
||||
_pass( LoopIndexSplit )
|
||||
_pass( LoopStrengthReduce )
|
||||
_pass( LoopRotate )
|
||||
_pass( LoopSimplify )
|
||||
_pass( LoopStrengthReduce )
|
||||
_pass( LoopUnroll )
|
||||
_pass( LoopUnswitch )
|
||||
_pass( LoopSimplify )
|
||||
_pass( LowerAllocations )
|
||||
_pass( LowerInvoke )
|
||||
_pass( LowerSetJmp )
|
||||
_pass( LowerSwitch )
|
||||
_pass( PromoteMemoryToRegister )
|
||||
_pass( MemCpyOpt )
|
||||
_pass( UnifyFunctionExitNodes )
|
||||
_pass( PredicateSimplifier )
|
||||
_pass( MergeFunctions )
|
||||
_pass( NoAA )
|
||||
_pass( NoProfileInfo )
|
||||
_pass( OptimalEdgeProfiler )
|
||||
_pass( PartialInlining )
|
||||
_pass( PartialSpecialization )
|
||||
_pass( PostDomOnlyPrinter )
|
||||
_pass( PostDomOnlyViewer )
|
||||
_pass( PostDomPrinter )
|
||||
_pass( PostDomViewer )
|
||||
_pass( ProfileEstimator )
|
||||
_pass( ProfileLoader )
|
||||
_pass( ProfileVerifier )
|
||||
_pass( PromoteMemoryToRegister )
|
||||
_pass( PruneEH )
|
||||
_pass( RaiseAllocations )
|
||||
_pass( Reassociate )
|
||||
_pass( DemoteRegisterToMemory )
|
||||
_pass( ScalarEvolutionAliasAnalysis )
|
||||
_pass( ScalarReplAggregates )
|
||||
_pass( SCCP )
|
||||
_pass( SCCVN )
|
||||
_pass( SimplifyHalfPowrLibCalls )
|
||||
_pass( SimplifyLibCalls )
|
||||
_pass( CFGSimplification )
|
||||
_pass( StripSymbols )
|
||||
_pass( SingleLoopExtractor )
|
||||
_pass( SSI )
|
||||
_pass( SSIEverything )
|
||||
_pass( StripDeadPrototypes )
|
||||
_pass( StripNonDebugSymbols )
|
||||
_pass( StripSymbols )
|
||||
_pass( StructRetPromotion )
|
||||
_pass( TailCallElimination )
|
||||
_pass( TailDuplication )
|
||||
_pass( UnifyFunctionExitNodes )
|
||||
|
||||
_pass( Internalize )
|
||||
|
||||
/* Target Data */
|
||||
_method( LLVMCreateTargetData )
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
233
llvm/core.py
233
llvm/core.py
|
|
@ -51,93 +51,96 @@ TYPE_X86_FP80 = 3
|
|||
TYPE_FP128 = 4
|
||||
TYPE_PPC_FP128 = 5
|
||||
TYPE_LABEL = 6
|
||||
TYPE_METADATA = 7
|
||||
TYPE_INTEGER = 8
|
||||
TYPE_FUNCTION = 9
|
||||
TYPE_STRUCT = 10
|
||||
TYPE_ARRAY = 11
|
||||
TYPE_POINTER = 12
|
||||
TYPE_OPAQUE = 13
|
||||
TYPE_VECTOR = 14
|
||||
TYPE_INTEGER = 7
|
||||
TYPE_FUNCTION = 8
|
||||
TYPE_STRUCT = 9
|
||||
TYPE_ARRAY = 10
|
||||
TYPE_POINTER = 11
|
||||
TYPE_OPAQUE = 12
|
||||
TYPE_VECTOR = 13
|
||||
TYPE_METADATA = 14
|
||||
TYPE_UNION = 15
|
||||
|
||||
# value IDs (llvm::Value::ValueTy enum)
|
||||
VALUE_ARGUMENT = 0
|
||||
VALUE_BASIC_BLOCK = 1
|
||||
VALUE_FUNCTION = 2
|
||||
VALUE_GLOBAL_ALIAS = 3
|
||||
VALUE_GLOBAL_VARIABLE = 4
|
||||
VALUE_UNDEF_VALUE = 5
|
||||
VALUE_CONSTANT_EXPR = 6
|
||||
VALUE_CONSTANT_AGGREGATE_ZERO = 7
|
||||
VALUE_CONSTANT_INT = 8
|
||||
VALUE_CONSTANT_FP = 9
|
||||
VALUE_CONSTANT_ARRAY = 10
|
||||
VALUE_CONSTANT_STRUCT = 11
|
||||
VALUE_CONSTANT_VECTOR = 12
|
||||
VALUE_CONSTANT_POINTER_NULL = 13
|
||||
VALUE_MD_NODE = 14
|
||||
VALUE_MD_STRING = 15
|
||||
VALUE_NAMED_MD_NODE = 16
|
||||
VALUE_INLINE_ASM = 17
|
||||
VALUE_PSEUDO_SOURCE_VALUE = 18
|
||||
VALUE_INSTRUCTION = 19
|
||||
VALUE_ARGUMENT = 0
|
||||
VALUE_BASIC_BLOCK = 1
|
||||
VALUE_FUNCTION = 2
|
||||
VALUE_GLOBAL_ALIAS = 3
|
||||
VALUE_GLOBAL_VARIABLE = 4
|
||||
VALUE_UNDEF_VALUE = 5
|
||||
VALUE_BLOCK_ADDRESS = 6
|
||||
VALUE_CONSTANT_EXPR = 7
|
||||
VALUE_CONSTANT_AGGREGATE_ZERO = 8
|
||||
VALUE_CONSTANT_INT = 9
|
||||
VALUE_CONSTANT_FP = 10
|
||||
VALUE_CONSTANT_ARRAY = 11
|
||||
VALUE_CONSTANT_STRUCT = 12
|
||||
VALUE_CONSTANT_UNION = 13
|
||||
VALUE_CONSTANT_VECTOR = 14
|
||||
VALUE_CONSTANT_POINTER_NULL = 15
|
||||
VALUE_MD_NODE = 16
|
||||
VALUE_MD_STRING = 17
|
||||
VALUE_NAMED_MD_NODE = 18
|
||||
VALUE_INLINE_ASM = 19
|
||||
VALUE_PSEUDO_SOURCE_VALUE = 20
|
||||
VALUE_FIXED_STACK_PSEUDO_SOURCE_VALUE = 21
|
||||
VALUE_INSTRUCTION = 22
|
||||
|
||||
# instruction opcodes (from include/llvm/Instruction.def)
|
||||
OPCODE_RET = 1
|
||||
OPCODE_BR = 2
|
||||
OPCODE_SWITCH = 3
|
||||
OPCODE_INVOKE = 4
|
||||
OPCODE_UNWIND = 5
|
||||
OPCODE_UNREACHABLE = 6
|
||||
OPCODE_ADD = 7
|
||||
OPCODE_FADD = 8
|
||||
OPCODE_SUB = 9
|
||||
OPCODE_FSUB = 10
|
||||
OPCODE_MUL = 11
|
||||
OPCODE_FMUL = 12
|
||||
OPCODE_UDIV = 13
|
||||
OPCODE_SDIV = 14
|
||||
OPCODE_FDIV = 15
|
||||
OPCODE_UREM = 16
|
||||
OPCODE_SREM = 17
|
||||
OPCODE_FREM = 18
|
||||
OPCODE_SHL = 19
|
||||
OPCODE_LSHR = 20
|
||||
OPCODE_ASHR = 21
|
||||
OPCODE_AND = 22
|
||||
OPCODE_OR = 23
|
||||
OPCODE_XOR = 24
|
||||
OPCODE_MALLOC = 25
|
||||
OPCODE_FREE = 26
|
||||
OPCODE_ALLOCA = 27
|
||||
OPCODE_LOAD = 28
|
||||
OPCODE_STORE = 29
|
||||
OPCODE_GETELEMENTPTR = 30
|
||||
OPCODE_TRUNC = 31
|
||||
OPCODE_ZEXT = 32
|
||||
OPCODE_SEXT = 33
|
||||
OPCODE_FPTOUI = 34
|
||||
OPCODE_FPTOSI = 35
|
||||
OPCODE_UITOFP = 36
|
||||
OPCODE_SITOFP = 37
|
||||
OPCODE_FPTRUNC = 38
|
||||
OPCODE_FPEXT = 39
|
||||
OPCODE_PTRTOINT = 40
|
||||
OPCODE_INTTOPTR = 41
|
||||
OPCODE_BITCAST = 42
|
||||
OPCODE_ICMP = 43
|
||||
OPCODE_FCMP = 44
|
||||
OPCODE_PHI = 45
|
||||
OPCODE_CALL = 46
|
||||
OPCODE_SELECT = 47
|
||||
OPCODE_USEROP1 = 48
|
||||
OPCODE_USEROP2 = 49
|
||||
OPCODE_VAARG = 50
|
||||
OPCODE_EXTRACTELEMENT = 51
|
||||
OPCODE_INSERTELEMENT = 52
|
||||
OPCODE_SHUFFLEVECTOR = 53
|
||||
OPCODE_EXTRACTVALUE = 54
|
||||
OPCODE_INSERTVALUE = 55
|
||||
OPCODE_INDIRECT_BR = 4
|
||||
OPCODE_INVOKE = 5
|
||||
OPCODE_UNWIND = 6
|
||||
OPCODE_UNREACHABLE = 7
|
||||
OPCODE_ADD = 8
|
||||
OPCODE_FADD = 9
|
||||
OPCODE_SUB = 10
|
||||
OPCODE_FSUB = 11
|
||||
OPCODE_MUL = 12
|
||||
OPCODE_FMUL = 13
|
||||
OPCODE_UDIV = 14
|
||||
OPCODE_SDIV = 15
|
||||
OPCODE_FDIV = 16
|
||||
OPCODE_UREM = 17
|
||||
OPCODE_SREM = 18
|
||||
OPCODE_FREM = 19
|
||||
OPCODE_SHL = 20
|
||||
OPCODE_LSHR = 21
|
||||
OPCODE_ASHR = 22
|
||||
OPCODE_AND = 23
|
||||
OPCODE_OR = 24
|
||||
OPCODE_XOR = 25
|
||||
OPCODE_ALLOCA = 26
|
||||
OPCODE_LOAD = 27
|
||||
OPCODE_STORE = 28
|
||||
OPCODE_GETELEMENTPTR = 29
|
||||
OPCODE_TRUNC = 30
|
||||
OPCODE_ZEXT = 31
|
||||
OPCODE_SEXT = 32
|
||||
OPCODE_FPTOUI = 33
|
||||
OPCODE_FPTOSI = 34
|
||||
OPCODE_UITOFP = 35
|
||||
OPCODE_SITOFP = 36
|
||||
OPCODE_FPTRUNC = 37
|
||||
OPCODE_FPEXT = 38
|
||||
OPCODE_PTRTOINT = 39
|
||||
OPCODE_INTTOPTR = 40
|
||||
OPCODE_BITCAST = 41
|
||||
OPCODE_ICMP = 42
|
||||
OPCODE_FCMP = 43
|
||||
OPCODE_PHI = 44
|
||||
OPCODE_CALL = 45
|
||||
OPCODE_SELECT = 46
|
||||
OPCODE_USEROP1 = 47
|
||||
OPCODE_USEROP2 = 48
|
||||
OPCODE_VAARG = 59
|
||||
OPCODE_EXTRACTELEMENT = 50
|
||||
OPCODE_INSERTELEMENT = 51
|
||||
OPCODE_SHUFFLEVECTOR = 52
|
||||
OPCODE_EXTRACTVALUE = 53
|
||||
OPCODE_INSERTVALUE = 54
|
||||
|
||||
# calling conventions
|
||||
CC_C = 0
|
||||
|
|
@ -206,7 +209,7 @@ RPRED_ULE = FCMP_ULE
|
|||
RPRED_UNE = FCMP_UNE
|
||||
RPRED_TRUE = FCMP_TRUE
|
||||
|
||||
# linkages
|
||||
# linkages (see llvm-c/Core.h)
|
||||
LINKAGE_EXTERNAL = 0
|
||||
LINKAGE_AVAILABLE_EXTERNALLY = 1
|
||||
LINKAGE_LINKONCE_ANY = 2
|
||||
|
|
@ -216,39 +219,41 @@ LINKAGE_WEAK_ODR = 5
|
|||
LINKAGE_APPENDING = 6
|
||||
LINKAGE_INTERNAL = 7
|
||||
LINKAGE_PRIVATE = 8
|
||||
LINKAGE_LINKER_PRIVATE = 9
|
||||
LINKAGE_DLLIMPORT = 10
|
||||
LINKAGE_DLLEXPORT = 11
|
||||
LINKAGE_EXTERNAL_WEAK = 12
|
||||
LINKAGE_GHOST = 13
|
||||
LINKAGE_COMMON = 14
|
||||
LINKAGE_DLLIMPORT = 9
|
||||
LINKAGE_DLLEXPORT = 10
|
||||
LINKAGE_EXTERNAL_WEAK = 11
|
||||
LINKAGE_GHOST = 12
|
||||
LINKAGE_COMMON = 13
|
||||
LINKAGE_LINKER_PRIVATE = 14
|
||||
|
||||
# visibility
|
||||
VISIBILITY_DEFAULT = 0
|
||||
VISIBILITY_HIDDEN = 1
|
||||
# visibility (see llvm/GlobalValue.h)
|
||||
VISIBILITY_DEFAULT = 0
|
||||
VISIBILITY_HIDDEN = 1
|
||||
VISIBILITY_PROTECTED = 2
|
||||
|
||||
# parameter attributes (see llvm/Attributes.h)
|
||||
ATTR_ZEXT = 1
|
||||
ATTR_SEXT = 2
|
||||
ATTR_NO_RETURN = 4
|
||||
ATTR_IN_REG = 8
|
||||
ATTR_STRUCT_RET = 16
|
||||
ATTR_NO_UNWIND = 32
|
||||
ATTR_NO_ALIAS = 64
|
||||
ATTR_BY_VAL = 128
|
||||
ATTR_NEST = 256
|
||||
ATTR_READ_NONE = 512
|
||||
ATTR_READONLY = 1024
|
||||
ATTR_NO_INLINE = 1<<11
|
||||
ATTR_ALWAYS_INLINE = 1<<12
|
||||
ATTR_OPTIMIZE_FOR_SIZE = 1<<13
|
||||
ATTR_STACK_PROTECT = 1<<14
|
||||
ATTR_STACK_PROTECT_REQ = 1<<15
|
||||
ATTR_NO_CAPTURE = 1<<21
|
||||
ATTR_NO_REDZONE = 1<<22
|
||||
ATTR_NO_IMPLICIT_FLOAT = 1<<23
|
||||
ATTR_NAKED = 1<<24
|
||||
ATTR_NONE = 0
|
||||
ATTR_ZEXT = 1
|
||||
ATTR_SEXT = 2
|
||||
ATTR_NO_RETURN = 4
|
||||
ATTR_IN_REG = 8
|
||||
ATTR_STRUCT_RET = 16
|
||||
ATTR_NO_UNWIND = 32
|
||||
ATTR_NO_ALIAS = 64
|
||||
ATTR_BY_VAL = 128
|
||||
ATTR_NEST = 256
|
||||
ATTR_READ_NONE = 512
|
||||
ATTR_READONLY = 1024
|
||||
ATTR_NO_INLINE = 1<<11
|
||||
ATTR_ALWAYS_INLINE = 1<<12
|
||||
ATTR_OPTIMIZE_FOR_SIZE = 1<<13
|
||||
ATTR_STACK_PROTECT = 1<<14
|
||||
ATTR_STACK_PROTECT_REQ = 1<<15
|
||||
ATTR_NO_CAPTURE = 1<<21
|
||||
ATTR_NO_REDZONE = 1<<22
|
||||
ATTR_NO_IMPLICIT_FLOAT = 1<<23
|
||||
ATTR_NAKED = 1<<24
|
||||
ATTR_INLINE_HINT = 1<<25
|
||||
|
||||
# intrinsic IDs
|
||||
from llvm._intrinsic_ids import *
|
||||
|
|
@ -439,6 +444,14 @@ class Module(llvm.Ownable, llvm.Cacheable):
|
|||
"""
|
||||
_core.LLVMDeleteTypeName(self.ptr, name)
|
||||
|
||||
def get_type_named(self, name):
|
||||
"""Return a Type object with the given name."""
|
||||
ptr = _core.LLVMGetTypeByName(self.ptr, name)
|
||||
if ptr:
|
||||
kind = _core.LLVMGetTypeKind(ptr)
|
||||
return _make_type(ptr, kind)
|
||||
return None
|
||||
|
||||
def add_global_variable(self, ty, name):
|
||||
"""Add a global variable of given type with given name."""
|
||||
return GlobalVariable.new(self, ty, name)
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@
|
|||
#include <sstream>
|
||||
|
||||
// LLVM includes
|
||||
#include "llvm/LLVMContext.h"
|
||||
#include "llvm/Bitcode/ReaderWriter.h"
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
#include "llvm/Support/Casting.h"
|
||||
|
|
@ -48,7 +49,6 @@
|
|||
#include "llvm/DerivedTypes.h"
|
||||
#include "llvm/GlobalVariable.h"
|
||||
#include "llvm/TypeSymbolTable.h"
|
||||
#include "llvm/ModuleProvider.h"
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
#include "llvm/Support/CallSite.h"
|
||||
#include "llvm/IntrinsicInst.h"
|
||||
|
|
@ -58,6 +58,8 @@
|
|||
#include "llvm/PassManager.h"
|
||||
#include "llvm/ExecutionEngine/ExecutionEngine.h"
|
||||
#include "llvm/Analysis/LoopPass.h"
|
||||
#include "llvm/Analysis/Passes.h"
|
||||
#include "llvm/Analysis/DomPrinter.h"
|
||||
#include "llvm/Transforms/Scalar.h"
|
||||
#include "llvm/Transforms/IPO.h"
|
||||
#include "llvm/Transforms/Utils/UnifyFunctionExitNodes.h"
|
||||
|
|
@ -461,13 +463,6 @@ int LLVMInlineFunction(LLVMValueRef call)
|
|||
|
||||
/* Passes. A few passes (listed below) are used directly from LLVM-C,
|
||||
* rest are defined here.
|
||||
*
|
||||
* ConstantPropagation
|
||||
* GVN
|
||||
* InstructionCombining
|
||||
* PromoteMemoryToRegister
|
||||
* Reassociate
|
||||
* CFGSimplification
|
||||
*/
|
||||
|
||||
#define define_pass(P) \
|
||||
|
|
@ -478,47 +473,62 @@ void LLVMAdd ## P ## Pass (LLVMPassManagerRef passmgr) { \
|
|||
pmp->add( create ## P ## Pass ()); \
|
||||
}
|
||||
|
||||
define_pass( ArgumentPromotion )
|
||||
define_pass( AAEval )
|
||||
define_pass( ABCD )
|
||||
define_pass( AliasAnalysisCounter )
|
||||
define_pass( AlwaysInliner )
|
||||
define_pass( BasicAliasAnalysis )
|
||||
define_pass( BlockPlacement )
|
||||
define_pass( BreakCriticalEdges )
|
||||
define_pass( CodeGenPrepare )
|
||||
define_pass( ConstantMerge )
|
||||
define_pass( DbgInfoPrinter )
|
||||
define_pass( DeadCodeElimination )
|
||||
define_pass( DeadArgElimination )
|
||||
define_pass( DeadTypeElimination )
|
||||
define_pass( DeadInstElimination )
|
||||
/* define_pass( GCSE ): removed in LLVM 2.4 */
|
||||
define_pass( GlobalDCE )
|
||||
define_pass( GlobalOptimizer )
|
||||
define_pass( GVNPRE )
|
||||
define_pass( IndMemRem )
|
||||
define_pass( FunctionInlining )
|
||||
define_pass( BlockProfiler )
|
||||
define_pass( DemoteRegisterToMemory )
|
||||
define_pass( DomOnlyPrinter )
|
||||
define_pass( DomOnlyViewer )
|
||||
define_pass( DomPrinter )
|
||||
define_pass( DomViewer )
|
||||
define_pass( EdgeProfiler )
|
||||
define_pass( FunctionProfiler )
|
||||
define_pass( NullProfilerRS )
|
||||
define_pass( RSProfiling )
|
||||
define_pass( GEPSplitter )
|
||||
define_pass( GlobalsModRef )
|
||||
define_pass( InstCount )
|
||||
define_pass( InstructionNamer )
|
||||
define_pass( IPSCCP )
|
||||
define_pass( LazyValueInfo )
|
||||
define_pass( LCSSA )
|
||||
define_pass( LiveValues )
|
||||
define_pass( LoopDependenceAnalysis )
|
||||
define_pass( LoopExtractor )
|
||||
define_pass( LoopSimplify )
|
||||
define_pass( LoopStrengthReduce )
|
||||
define_pass( LowerInvoke )
|
||||
define_pass( LowerSwitch )
|
||||
define_pass( MergeFunctions )
|
||||
define_pass( NoAA )
|
||||
define_pass( NoProfileInfo )
|
||||
define_pass( OptimalEdgeProfiler )
|
||||
define_pass( PartialInlining )
|
||||
define_pass( PartialSpecialization )
|
||||
define_pass( PostDomOnlyPrinter )
|
||||
define_pass( PostDomOnlyViewer )
|
||||
define_pass( PostDomPrinter )
|
||||
define_pass( PostDomViewer )
|
||||
define_pass( ProfileEstimator )
|
||||
define_pass( ProfileLoader )
|
||||
define_pass( ProfileVerifier )
|
||||
define_pass( ScalarEvolutionAliasAnalysis )
|
||||
define_pass( SCCVN )
|
||||
define_pass( SimplifyHalfPowrLibCalls )
|
||||
define_pass( SingleLoopExtractor )
|
||||
define_pass( SSI )
|
||||
define_pass( SSIEverything )
|
||||
define_pass( StripNonDebugSymbols )
|
||||
define_pass( StructRetPromotion )
|
||||
define_pass( TailDuplication )
|
||||
define_pass( UnifyFunctionExitNodes )
|
||||
|
||||
/* we support only internalize(true) */
|
||||
llvm::ModulePass *createInternalizePass() { return llvm::createInternalizePass(true); }
|
||||
define_pass( Internalize )
|
||||
define_pass( IPConstantPropagation )
|
||||
define_pass( IPSCCP )
|
||||
define_pass( LCSSA )
|
||||
define_pass( LoopExtractor )
|
||||
define_pass( SingleLoopExtractor )
|
||||
define_pass( LoopStrengthReduce )
|
||||
define_pass( LoopSimplify )
|
||||
define_pass( LowerAllocations )
|
||||
define_pass( LowerInvoke )
|
||||
define_pass( LowerSetJmp )
|
||||
define_pass( LowerSwitch )
|
||||
define_pass( UnifyFunctionExitNodes )
|
||||
define_pass( PredicateSimplifier )
|
||||
define_pass( PruneEH )
|
||||
define_pass( RaiseAllocations )
|
||||
define_pass( DemoteRegisterToMemory )
|
||||
define_pass( StripSymbols )
|
||||
define_pass( StripDeadPrototypes )
|
||||
define_pass( StructRetPromotion )
|
||||
define_pass( TailDuplication )
|
||||
|
||||
|
|
|
|||
109
llvm/extra.h
109
llvm/extra.h
|
|
@ -183,77 +183,68 @@ void *LLVMGetPointerToFunction(LLVMExecutionEngineRef ee, LLVMValueRef fn);
|
|||
* containing the call is still in a proper state (not changed). */
|
||||
int LLVMInlineFunction(LLVMValueRef call);
|
||||
|
||||
/* Passes. A few passes (listed below) are used directly from LLVM-C,
|
||||
* rest are declared here.
|
||||
*
|
||||
* ConstantPropagation
|
||||
* GVN
|
||||
* InstructionCombining
|
||||
* PromoteMemoryToRegister
|
||||
* Reassociate
|
||||
* CFGSimplification
|
||||
*/
|
||||
/* Passes. Some passes are used directly from LLVM-C, rest are declared
|
||||
* here. */
|
||||
|
||||
#define declare_pass(P) \
|
||||
void LLVMAdd ## P ## Pass (LLVMPassManagerRef PM);
|
||||
|
||||
declare_pass( AggressiveDCE )
|
||||
declare_pass( ArgumentPromotion )
|
||||
declare_pass( AAEval )
|
||||
declare_pass( ABCD )
|
||||
declare_pass( AliasAnalysisCounter )
|
||||
declare_pass( AlwaysInliner )
|
||||
declare_pass( BasicAliasAnalysis )
|
||||
declare_pass( BlockPlacement )
|
||||
declare_pass( BreakCriticalEdges )
|
||||
declare_pass( CodeGenPrepare )
|
||||
declare_pass( CondPropagation )
|
||||
declare_pass( ConstantMerge )
|
||||
declare_pass( DbgInfoPrinter )
|
||||
declare_pass( DeadCodeElimination )
|
||||
declare_pass( DeadArgElimination )
|
||||
declare_pass( DeadTypeElimination )
|
||||
declare_pass( DeadInstElimination )
|
||||
declare_pass( DeadStoreElimination )
|
||||
/* declare_pass( GCSE ): removed in LLVM 2.4. */
|
||||
declare_pass( GlobalDCE )
|
||||
declare_pass( GlobalOptimizer )
|
||||
declare_pass( GVNPRE )
|
||||
declare_pass( IndMemRem )
|
||||
declare_pass( IndVarSimplify )
|
||||
declare_pass( FunctionInlining )
|
||||
declare_pass( BlockProfiler )
|
||||
declare_pass( EdgeProfiler )
|
||||
declare_pass( FunctionProfiler )
|
||||
declare_pass( NullProfilerRS )
|
||||
declare_pass( RSProfiling )
|
||||
declare_pass( Internalize )
|
||||
declare_pass( IPConstantPropagation )
|
||||
declare_pass( IPSCCP )
|
||||
declare_pass( JumpThreading )
|
||||
declare_pass( LCSSA )
|
||||
declare_pass( LICM )
|
||||
declare_pass( LoopDeletion )
|
||||
declare_pass( LoopExtractor )
|
||||
declare_pass( SingleLoopExtractor )
|
||||
declare_pass( LoopIndexSplit )
|
||||
declare_pass( LoopStrengthReduce )
|
||||
declare_pass( LoopRotate )
|
||||
declare_pass( LoopUnroll )
|
||||
declare_pass( LoopUnswitch )
|
||||
declare_pass( LoopSimplify )
|
||||
declare_pass( LowerAllocations )
|
||||
declare_pass( LowerInvoke )
|
||||
declare_pass( LowerSetJmp )
|
||||
declare_pass( LowerSwitch )
|
||||
declare_pass( MemCpyOpt )
|
||||
declare_pass( UnifyFunctionExitNodes )
|
||||
declare_pass( PredicateSimplifier )
|
||||
declare_pass( PruneEH )
|
||||
declare_pass( RaiseAllocations )
|
||||
declare_pass( DemoteRegisterToMemory )
|
||||
declare_pass( ScalarReplAggregates )
|
||||
declare_pass( SCCP )
|
||||
declare_pass( SimplifyLibCalls )
|
||||
declare_pass( StripSymbols )
|
||||
declare_pass( StripDeadPrototypes )
|
||||
declare_pass( DomOnlyPrinter )
|
||||
declare_pass( DomOnlyViewer )
|
||||
declare_pass( DomPrinter )
|
||||
declare_pass( DomViewer )
|
||||
declare_pass( EdgeProfiler )
|
||||
declare_pass( GEPSplitter )
|
||||
declare_pass( GlobalsModRef )
|
||||
declare_pass( InstCount )
|
||||
declare_pass( InstructionNamer )
|
||||
declare_pass( IPSCCP )
|
||||
declare_pass( LazyValueInfo )
|
||||
declare_pass( LCSSA )
|
||||
declare_pass( LiveValues )
|
||||
declare_pass( LoopDependenceAnalysis )
|
||||
declare_pass( LoopExtractor )
|
||||
declare_pass( LoopSimplify )
|
||||
declare_pass( LoopStrengthReduce )
|
||||
declare_pass( LowerInvoke )
|
||||
declare_pass( LowerSwitch )
|
||||
declare_pass( MergeFunctions )
|
||||
declare_pass( NoAA )
|
||||
declare_pass( NoProfileInfo )
|
||||
declare_pass( OptimalEdgeProfiler )
|
||||
declare_pass( PartialInlining )
|
||||
declare_pass( PartialSpecialization )
|
||||
declare_pass( PostDomOnlyPrinter )
|
||||
declare_pass( PostDomOnlyViewer )
|
||||
declare_pass( PostDomPrinter )
|
||||
declare_pass( PostDomViewer )
|
||||
declare_pass( ProfileEstimator )
|
||||
declare_pass( ProfileLoader )
|
||||
declare_pass( ProfileVerifier )
|
||||
declare_pass( ScalarEvolutionAliasAnalysis )
|
||||
declare_pass( SCCVN )
|
||||
declare_pass( SimplifyHalfPowrLibCalls )
|
||||
declare_pass( SingleLoopExtractor )
|
||||
declare_pass( SSI )
|
||||
declare_pass( SSIEverything )
|
||||
declare_pass( StripNonDebugSymbols )
|
||||
declare_pass( StructRetPromotion )
|
||||
declare_pass( TailCallElimination )
|
||||
declare_pass( TailDuplication )
|
||||
declare_pass( UnifyFunctionExitNodes )
|
||||
|
||||
declare_pass( Internalize )
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
|
|
|||
304
llvm/passes.py
304
llvm/passes.py
|
|
@ -42,69 +42,95 @@ import llvm._core as _core # C wrappers
|
|||
|
||||
|
||||
# passes
|
||||
PASS_AGGRESSIVE_DCE = 1
|
||||
PASS_ARGUMENT_PROMOTION = 2
|
||||
PASS_BLOCK_PLACEMENT = 3
|
||||
PASS_BREAK_CRITICAL_EDGES = 4
|
||||
PASS_CODE_GEN_PREPARE = 5
|
||||
PASS_COND_PROPAGATION = 6
|
||||
PASS_CONSTANT_MERGE = 7
|
||||
PASS_CONSTANT_PROPAGATION = 8
|
||||
PASS_DEAD_CODE_ELIMINATION = 9
|
||||
PASS_DEAD_ARG_ELIMINATION = 10
|
||||
PASS_DEAD_TYPE_ELIMINATION = 11
|
||||
PASS_DEAD_INST_ELIMINATION = 12
|
||||
PASS_DEAD_STORE_ELIMINATION = 13
|
||||
# PASS_GCSE = 14: removed in LLVM 2.4
|
||||
PASS_GLOBAL_DCE = 15
|
||||
PASS_GLOBAL_OPTIMIZER = 16
|
||||
PASS_GVN = 17
|
||||
PASS_GVNPRE = 18
|
||||
PASS_IND_MEM_REM = 19
|
||||
PASS_IND_VAR_SIMPLIFY = 20
|
||||
PASS_FUNCTION_INLINING = 21
|
||||
PASS_BLOCK_PROFILER = 22
|
||||
PASS_EDGE_PROFILER = 23
|
||||
PASS_FUNCTION_PROFILER = 24
|
||||
PASS_NULL_PROFILER_RS = 25
|
||||
PASS_RS_PROFILING = 26
|
||||
PASS_INSTRUCTION_COMBINING = 27
|
||||
PASS_INTERNALIZE = 28
|
||||
PASS_IP_CONSTANT_PROPAGATION = 29
|
||||
PASS_IPSCCP = 30
|
||||
PASS_JUMP_THREADING = 31
|
||||
PASS_LCSSA = 32
|
||||
PASS_LICM = 33
|
||||
PASS_LOOP_DELETION = 34
|
||||
PASS_LOOP_EXTRACTOR = 35
|
||||
PASS_SINGLE_LOOP_EXTRACTOR = 36
|
||||
PASS_LOOP_INDEX_SPLIT = 37
|
||||
PASS_LOOP_STRENGTH_REDUCE = 38
|
||||
PASS_LOOP_ROTATE = 39
|
||||
PASS_LOOP_UNROLL = 40
|
||||
PASS_LOOP_UNSWITCH = 41
|
||||
PASS_LOOP_SIMPLIFY = 42
|
||||
PASS_LOWER_ALLOCATIONS = 43
|
||||
PASS_LOWER_INVOKE = 44
|
||||
PASS_LOWER_SET_JMP = 45
|
||||
PASS_LOWER_SWITCH = 46
|
||||
PASS_PROMOTE_MEMORY_TO_REGISTER = 47
|
||||
PASS_MEM_CPY_OPT = 48
|
||||
PASS_UNIFY_FUNCTION_EXIT_NODES = 49
|
||||
PASS_PREDICATE_SIMPLIFIER = 50
|
||||
PASS_PRUNE_EH = 51
|
||||
PASS_RAISE_ALLOCATIONS = 52
|
||||
PASS_REASSOCIATE = 53
|
||||
PASS_DEMOTE_REGISTER_TO_MEMORY = 54
|
||||
PASS_SCALAR_REPL_AGGREGATES = 55
|
||||
PASS_SCCP = 56
|
||||
PASS_SIMPLIFY_LIB_CALLS = 57
|
||||
PASS_CFG_SIMPLIFICATION = 58
|
||||
PASS_STRIP_SYMBOLS = 59
|
||||
PASS_STRIP_DEAD_PROTOTYPES = 60
|
||||
PASS_STRUCT_RET_PROMOTION = 61
|
||||
PASS_TAIL_CALL_ELIMINATION = 62
|
||||
PASS_TAIL_DUPLICATION = 63
|
||||
PASS_AAEVAL = 1
|
||||
PASS_ABCD = 2
|
||||
PASS_AGGRESSIVE_DCE = 3
|
||||
PASS_ALIAS_ANALYSIS_COUNTER = 4
|
||||
PASS_ALWAYS_INLINER = 5
|
||||
PASS_ARGUMENT_PROMOTION = 6
|
||||
PASS_BASIC_ALIAS_ANALYSIS = 7
|
||||
PASS_BLOCK_PLACEMENT = 8
|
||||
PASS_BREAK_CRITICAL_EDGES = 9
|
||||
PASS_CFG_SIMPLIFICATION = 10
|
||||
PASS_CODE_GEN_PREPARE = 11
|
||||
PASS_CONSTANT_MERGE = 12
|
||||
PASS_CONSTANT_PROPAGATION = 13
|
||||
PASS_DBG_INFO_PRINTER = 14
|
||||
PASS_DEAD_ARG_ELIMINATION = 15
|
||||
PASS_DEAD_CODE_ELIMINATION = 16
|
||||
PASS_DEAD_INST_ELIMINATION = 17
|
||||
PASS_DEAD_STORE_ELIMINATION = 18
|
||||
PASS_DEAD_TYPE_ELIMINATION = 19
|
||||
PASS_DEMOTE_REGISTER_TO_MEMORY = 20
|
||||
PASS_DOM_ONLY_PRINTER = 21
|
||||
PASS_DOM_ONLY_VIEWER = 22
|
||||
PASS_DOM_PRINTER = 23
|
||||
PASS_DOM_VIEWER = 24
|
||||
PASS_EDGE_PROFILER = 25
|
||||
PASS_FUNCTION_ATTRS = 26
|
||||
PASS_FUNCTION_INLINING = 27
|
||||
PASS_GEP_SPLITTER = 28
|
||||
PASS_GLOBAL_DCE = 29
|
||||
PASS_GLOBAL_OPTIMIZER = 30
|
||||
PASS_GLOBALS_MOD_REF = 31
|
||||
PASS_GVN = 32
|
||||
PASS_IND_VAR_SIMPLIFY = 33
|
||||
PASS_INST_COUNT = 34
|
||||
PASS_INSTRUCTION_COMBINING = 35
|
||||
PASS_INSTRUCTION_NAMER = 36
|
||||
PASS_IP_CONSTANT_PROPAGATION = 37
|
||||
PASS_IPSCCP = 38
|
||||
PASS_JUMP_THREADING = 39
|
||||
PASS_LAZY_VALUE_INFO = 40
|
||||
PASS_LCSSA = 41
|
||||
PASS_LICM = 42
|
||||
PASS_LIVE_VALUES = 43
|
||||
PASS_LOOP_DELETION = 44
|
||||
PASS_LOOP_DEPENDENCE_ANALYSIS = 45
|
||||
PASS_LOOP_EXTRACTOR = 46
|
||||
PASS_LOOP_INDEX_SPLIT = 47
|
||||
PASS_LOOP_ROTATE = 48
|
||||
PASS_LOOP_SIMPLIFY = 49
|
||||
PASS_LOOP_STRENGTH_REDUCE = 50
|
||||
PASS_LOOP_UNROLL = 51
|
||||
PASS_LOOP_UNSWITCH = 52
|
||||
PASS_LOWER_INVOKE = 53
|
||||
PASS_LOWER_SET_JMP = 54
|
||||
PASS_LOWER_SWITCH = 55
|
||||
PASS_MEM_CPY_OPT = 56
|
||||
PASS_MERGE_FUNCTIONS = 57
|
||||
PASS_NO_AA = 58
|
||||
PASS_NO_PROFILE_INFO = 59
|
||||
PASS_OPTIMAL_EDGE_PROFILER = 60
|
||||
PASS_PARTIAL_INLINING = 61
|
||||
PASS_PARTIAL_SPECIALIZATION = 62
|
||||
PASS_POST_DOM_ONLY_PRINTER = 63
|
||||
PASS_POST_DOM_ONLY_VIEWER = 64
|
||||
PASS_POST_DOM_PRINTER = 65
|
||||
PASS_POST_DOM_VIEWER = 66
|
||||
PASS_PROFILE_ESTIMATOR = 67
|
||||
PASS_PROFILE_LOADER = 68
|
||||
PASS_PROFILE_VERIFIER = 69
|
||||
PASS_PROMOTE_MEMORY_TO_REGISTER = 70
|
||||
PASS_PRUNE_EH = 71
|
||||
PASS_REASSOCIATE = 72
|
||||
PASS_SCALAR_EVOLUTION_ALIAS_ANALYSIS = 73
|
||||
PASS_SCALAR_REPL_AGGREGATES = 74
|
||||
PASS_SCCVN = 75
|
||||
PASS_SCCP = 76
|
||||
PASS_SIMPLIFY_HALF_POWR_LIB_CALLS = 77
|
||||
PASS_SIMPLIFY_LIB_CALLS = 78
|
||||
PASS_SINGLE_LOOP_EXTRACTOR = 79
|
||||
PASS_SSI = 80
|
||||
PASS_SSI_EVERYTHING = 81
|
||||
PASS_STRIP_DEAD_PROTOTYPES = 82
|
||||
PASS_STRIP_NON_DEBUG_SYMBOLS = 83
|
||||
PASS_STRIP_SYMBOLS = 84
|
||||
PASS_STRUCT_RET_PROMOTION = 85
|
||||
PASS_TAIL_CALL_ELIMINATION = 86
|
||||
PASS_TAIL_DUPLICATION = 87
|
||||
PASS_UNIFY_FUNCTION_EXIT_NODES = 88
|
||||
PASS_INTERNALIZE = 89
|
||||
|
||||
|
||||
|
||||
|
|
@ -113,69 +139,95 @@ PASS_TAIL_DUPLICATION = 63
|
|||
#===----------------------------------------------------------------------===
|
||||
|
||||
_pass_creator = {
|
||||
PASS_AGGRESSIVE_DCE : _core.LLVMAddAggressiveDCEPass,
|
||||
PASS_ARGUMENT_PROMOTION : _core.LLVMAddArgumentPromotionPass,
|
||||
PASS_BLOCK_PLACEMENT : _core.LLVMAddBlockPlacementPass,
|
||||
PASS_BREAK_CRITICAL_EDGES : _core.LLVMAddBreakCriticalEdgesPass,
|
||||
PASS_CODE_GEN_PREPARE : _core.LLVMAddCodeGenPreparePass,
|
||||
PASS_COND_PROPAGATION : _core.LLVMAddCondPropagationPass,
|
||||
PASS_CONSTANT_MERGE : _core.LLVMAddConstantMergePass,
|
||||
PASS_CONSTANT_PROPAGATION : _core.LLVMAddConstantPropagationPass,
|
||||
PASS_DEAD_CODE_ELIMINATION : _core.LLVMAddDeadCodeEliminationPass,
|
||||
PASS_DEAD_ARG_ELIMINATION : _core.LLVMAddDeadArgEliminationPass,
|
||||
PASS_DEAD_TYPE_ELIMINATION : _core.LLVMAddDeadTypeEliminationPass,
|
||||
PASS_DEAD_INST_ELIMINATION : _core.LLVMAddDeadInstEliminationPass,
|
||||
PASS_DEAD_STORE_ELIMINATION : _core.LLVMAddDeadStoreEliminationPass,
|
||||
# PASS_GCSE : _core.LLVMAddGCSEPass,: removed in LLVM 2.4.
|
||||
PASS_GLOBAL_DCE : _core.LLVMAddGlobalDCEPass,
|
||||
PASS_GLOBAL_OPTIMIZER : _core.LLVMAddGlobalOptimizerPass,
|
||||
PASS_GVN : _core.LLVMAddGVNPass,
|
||||
PASS_GVNPRE : _core.LLVMAddGVNPREPass,
|
||||
PASS_IND_MEM_REM : _core.LLVMAddIndMemRemPass,
|
||||
PASS_IND_VAR_SIMPLIFY : _core.LLVMAddIndVarSimplifyPass,
|
||||
PASS_FUNCTION_INLINING : _core.LLVMAddFunctionInliningPass,
|
||||
PASS_BLOCK_PROFILER : _core.LLVMAddBlockProfilerPass,
|
||||
PASS_EDGE_PROFILER : _core.LLVMAddEdgeProfilerPass,
|
||||
PASS_FUNCTION_PROFILER : _core.LLVMAddFunctionProfilerPass,
|
||||
PASS_NULL_PROFILER_RS : _core.LLVMAddNullProfilerRSPass,
|
||||
PASS_RS_PROFILING : _core.LLVMAddRSProfilingPass,
|
||||
PASS_INSTRUCTION_COMBINING : _core.LLVMAddInstructionCombiningPass,
|
||||
PASS_INTERNALIZE : _core.LLVMAddInternalizePass,
|
||||
PASS_IP_CONSTANT_PROPAGATION : _core.LLVMAddIPConstantPropagationPass,
|
||||
PASS_IPSCCP : _core.LLVMAddIPSCCPPass,
|
||||
PASS_JUMP_THREADING : _core.LLVMAddJumpThreadingPass,
|
||||
PASS_LCSSA : _core.LLVMAddLCSSAPass,
|
||||
PASS_LICM : _core.LLVMAddLICMPass,
|
||||
PASS_LOOP_DELETION : _core.LLVMAddLoopDeletionPass,
|
||||
PASS_LOOP_EXTRACTOR : _core.LLVMAddLoopExtractorPass,
|
||||
PASS_SINGLE_LOOP_EXTRACTOR : _core.LLVMAddSingleLoopExtractorPass,
|
||||
PASS_LOOP_INDEX_SPLIT : _core.LLVMAddLoopIndexSplitPass,
|
||||
PASS_LOOP_STRENGTH_REDUCE : _core.LLVMAddLoopStrengthReducePass,
|
||||
PASS_LOOP_ROTATE : _core.LLVMAddLoopRotatePass,
|
||||
PASS_LOOP_UNROLL : _core.LLVMAddLoopUnrollPass,
|
||||
PASS_LOOP_UNSWITCH : _core.LLVMAddLoopUnswitchPass,
|
||||
PASS_LOOP_SIMPLIFY : _core.LLVMAddLoopSimplifyPass,
|
||||
PASS_LOWER_ALLOCATIONS : _core.LLVMAddLowerAllocationsPass,
|
||||
PASS_LOWER_INVOKE : _core.LLVMAddLowerInvokePass,
|
||||
PASS_LOWER_SET_JMP : _core.LLVMAddLowerSetJmpPass,
|
||||
PASS_LOWER_SWITCH : _core.LLVMAddLowerSwitchPass,
|
||||
PASS_PROMOTE_MEMORY_TO_REGISTER : _core.LLVMAddPromoteMemoryToRegisterPass,
|
||||
PASS_MEM_CPY_OPT : _core.LLVMAddMemCpyOptPass,
|
||||
PASS_UNIFY_FUNCTION_EXIT_NODES : _core.LLVMAddUnifyFunctionExitNodesPass,
|
||||
PASS_PREDICATE_SIMPLIFIER : _core.LLVMAddPredicateSimplifierPass,
|
||||
PASS_PRUNE_EH : _core.LLVMAddPruneEHPass,
|
||||
PASS_RAISE_ALLOCATIONS : _core.LLVMAddRaiseAllocationsPass,
|
||||
PASS_REASSOCIATE : _core.LLVMAddReassociatePass,
|
||||
PASS_DEMOTE_REGISTER_TO_MEMORY : _core.LLVMAddDemoteRegisterToMemoryPass,
|
||||
PASS_SCALAR_REPL_AGGREGATES : _core.LLVMAddScalarReplAggregatesPass,
|
||||
PASS_SCCP : _core.LLVMAddSCCPPass,
|
||||
PASS_SIMPLIFY_LIB_CALLS : _core.LLVMAddSimplifyLibCallsPass,
|
||||
PASS_CFG_SIMPLIFICATION : _core.LLVMAddCFGSimplificationPass,
|
||||
PASS_STRIP_SYMBOLS : _core.LLVMAddStripSymbolsPass,
|
||||
PASS_STRIP_DEAD_PROTOTYPES : _core.LLVMAddStripDeadPrototypesPass,
|
||||
PASS_STRUCT_RET_PROMOTION : _core.LLVMAddStructRetPromotionPass,
|
||||
PASS_TAIL_CALL_ELIMINATION : _core.LLVMAddTailCallEliminationPass,
|
||||
PASS_TAIL_DUPLICATION : _core.LLVMAddTailDuplicationPass,
|
||||
PASS_AAEVAL : _core.LLVMAddAAEvalPass,
|
||||
PASS_ABCD : _core.LLVMAddABCDPass,
|
||||
PASS_AGGRESSIVE_DCE : _core.LLVMAddAggressiveDCEPass,
|
||||
PASS_ALIAS_ANALYSIS_COUNTER : _core.LLVMAddAliasAnalysisCounterPass,
|
||||
PASS_ALWAYS_INLINER : _core.LLVMAddAlwaysInlinerPass,
|
||||
PASS_ARGUMENT_PROMOTION : _core.LLVMAddArgumentPromotionPass,
|
||||
PASS_BASIC_ALIAS_ANALYSIS : _core.LLVMAddBasicAliasAnalysisPass,
|
||||
PASS_BLOCK_PLACEMENT : _core.LLVMAddBlockPlacementPass,
|
||||
PASS_BREAK_CRITICAL_EDGES : _core.LLVMAddBreakCriticalEdgesPass,
|
||||
PASS_CFG_SIMPLIFICATION : _core.LLVMAddCFGSimplificationPass,
|
||||
PASS_CODE_GEN_PREPARE : _core.LLVMAddCodeGenPreparePass,
|
||||
PASS_CONSTANT_MERGE : _core.LLVMAddConstantMergePass,
|
||||
PASS_CONSTANT_PROPAGATION : _core.LLVMAddConstantPropagationPass,
|
||||
PASS_DBG_INFO_PRINTER : _core.LLVMAddDbgInfoPrinterPass,
|
||||
PASS_DEAD_ARG_ELIMINATION : _core.LLVMAddDeadArgEliminationPass,
|
||||
PASS_DEAD_CODE_ELIMINATION : _core.LLVMAddDeadCodeEliminationPass,
|
||||
PASS_DEAD_INST_ELIMINATION : _core.LLVMAddDeadInstEliminationPass,
|
||||
PASS_DEAD_STORE_ELIMINATION : _core.LLVMAddDeadStoreEliminationPass,
|
||||
PASS_DEAD_TYPE_ELIMINATION : _core.LLVMAddDeadTypeEliminationPass,
|
||||
PASS_DEMOTE_REGISTER_TO_MEMORY : _core.LLVMAddDemoteRegisterToMemoryPass,
|
||||
PASS_DOM_ONLY_PRINTER : _core.LLVMAddDomOnlyPrinterPass,
|
||||
PASS_DOM_ONLY_VIEWER : _core.LLVMAddDomOnlyViewerPass,
|
||||
PASS_DOM_PRINTER : _core.LLVMAddDomPrinterPass,
|
||||
PASS_DOM_VIEWER : _core.LLVMAddDomViewerPass,
|
||||
PASS_EDGE_PROFILER : _core.LLVMAddEdgeProfilerPass,
|
||||
PASS_FUNCTION_ATTRS : _core.LLVMAddFunctionAttrsPass,
|
||||
PASS_FUNCTION_INLINING : _core.LLVMAddFunctionInliningPass,
|
||||
PASS_GEP_SPLITTER : _core.LLVMAddGEPSplitterPass,
|
||||
PASS_GLOBAL_DCE : _core.LLVMAddGlobalDCEPass,
|
||||
PASS_GLOBAL_OPTIMIZER : _core.LLVMAddGlobalOptimizerPass,
|
||||
PASS_GLOBALS_MOD_REF : _core.LLVMAddGlobalsModRefPass,
|
||||
PASS_GVN : _core.LLVMAddGVNPass,
|
||||
PASS_IND_VAR_SIMPLIFY : _core.LLVMAddIndVarSimplifyPass,
|
||||
PASS_INST_COUNT : _core.LLVMAddInstCountPass,
|
||||
PASS_INSTRUCTION_COMBINING : _core.LLVMAddInstructionCombiningPass,
|
||||
PASS_INSTRUCTION_NAMER : _core.LLVMAddInstructionNamerPass,
|
||||
PASS_IP_CONSTANT_PROPAGATION : _core.LLVMAddIPConstantPropagationPass,
|
||||
PASS_IPSCCP : _core.LLVMAddIPSCCPPass,
|
||||
PASS_JUMP_THREADING : _core.LLVMAddJumpThreadingPass,
|
||||
PASS_LAZY_VALUE_INFO : _core.LLVMAddLazyValueInfoPass,
|
||||
PASS_LCSSA : _core.LLVMAddLCSSAPass,
|
||||
PASS_LICM : _core.LLVMAddLICMPass,
|
||||
PASS_LIVE_VALUES : _core.LLVMAddLiveValuesPass,
|
||||
PASS_LOOP_DELETION : _core.LLVMAddLoopDeletionPass,
|
||||
PASS_LOOP_DEPENDENCE_ANALYSIS : _core.LLVMAddLoopDependenceAnalysisPass,
|
||||
PASS_LOOP_EXTRACTOR : _core.LLVMAddLoopExtractorPass,
|
||||
PASS_LOOP_INDEX_SPLIT : _core.LLVMAddLoopIndexSplitPass,
|
||||
PASS_LOOP_ROTATE : _core.LLVMAddLoopRotatePass,
|
||||
PASS_LOOP_SIMPLIFY : _core.LLVMAddLoopSimplifyPass,
|
||||
PASS_LOOP_STRENGTH_REDUCE : _core.LLVMAddLoopStrengthReducePass,
|
||||
PASS_LOOP_UNROLL : _core.LLVMAddLoopUnrollPass,
|
||||
PASS_LOOP_UNSWITCH : _core.LLVMAddLoopUnswitchPass,
|
||||
PASS_LOWER_INVOKE : _core.LLVMAddLowerInvokePass,
|
||||
PASS_LOWER_SET_JMP : _core.LLVMAddLowerSetJmpPass,
|
||||
PASS_LOWER_SWITCH : _core.LLVMAddLowerSwitchPass,
|
||||
PASS_MEM_CPY_OPT : _core.LLVMAddMemCpyOptPass,
|
||||
PASS_MERGE_FUNCTIONS : _core.LLVMAddMergeFunctionsPass,
|
||||
PASS_NO_AA : _core.LLVMAddNoAAPass,
|
||||
PASS_NO_PROFILE_INFO : _core.LLVMAddNoProfileInfoPass,
|
||||
PASS_OPTIMAL_EDGE_PROFILER : _core.LLVMAddOptimalEdgeProfilerPass,
|
||||
PASS_PARTIAL_INLINING : _core.LLVMAddPartialInliningPass,
|
||||
PASS_PARTIAL_SPECIALIZATION : _core.LLVMAddPartialSpecializationPass,
|
||||
PASS_POST_DOM_ONLY_PRINTER : _core.LLVMAddPostDomOnlyPrinterPass,
|
||||
PASS_POST_DOM_ONLY_VIEWER : _core.LLVMAddPostDomOnlyViewerPass,
|
||||
PASS_POST_DOM_PRINTER : _core.LLVMAddPostDomPrinterPass,
|
||||
PASS_POST_DOM_VIEWER : _core.LLVMAddPostDomViewerPass,
|
||||
PASS_PROFILE_ESTIMATOR : _core.LLVMAddProfileEstimatorPass,
|
||||
PASS_PROFILE_LOADER : _core.LLVMAddProfileLoaderPass,
|
||||
PASS_PROFILE_VERIFIER : _core.LLVMAddProfileVerifierPass,
|
||||
PASS_PROMOTE_MEMORY_TO_REGISTER : _core.LLVMAddPromoteMemoryToRegisterPass,
|
||||
PASS_PRUNE_EH : _core.LLVMAddPruneEHPass,
|
||||
PASS_REASSOCIATE : _core.LLVMAddReassociatePass,
|
||||
PASS_SCALAR_EVOLUTION_ALIAS_ANALYSIS : _core.LLVMAddScalarEvolutionAliasAnalysisPass,
|
||||
PASS_SCALAR_REPL_AGGREGATES : _core.LLVMAddScalarReplAggregatesPass,
|
||||
PASS_SCCVN : _core.LLVMAddSCCVNPass,
|
||||
PASS_SCCP : _core.LLVMAddSCCPPass,
|
||||
PASS_SIMPLIFY_HALF_POWR_LIB_CALLS : _core.LLVMAddSimplifyHalfPowrLibCallsPass,
|
||||
PASS_SIMPLIFY_LIB_CALLS : _core.LLVMAddSimplifyLibCallsPass,
|
||||
PASS_SINGLE_LOOP_EXTRACTOR : _core.LLVMAddSingleLoopExtractorPass,
|
||||
PASS_SSI : _core.LLVMAddSSIPass,
|
||||
PASS_SSI_EVERYTHING : _core.LLVMAddSSIEverythingPass,
|
||||
PASS_STRIP_DEAD_PROTOTYPES : _core.LLVMAddStripDeadPrototypesPass,
|
||||
PASS_STRIP_NON_DEBUG_SYMBOLS : _core.LLVMAddStripNonDebugSymbolsPass,
|
||||
PASS_STRIP_SYMBOLS : _core.LLVMAddStripSymbolsPass,
|
||||
PASS_STRUCT_RET_PROMOTION : _core.LLVMAddStructRetPromotionPass,
|
||||
PASS_TAIL_CALL_ELIMINATION : _core.LLVMAddTailCallEliminationPass,
|
||||
PASS_TAIL_DUPLICATION : _core.LLVMAddTailDuplicationPass,
|
||||
PASS_UNIFY_FUNCTION_EXIT_NODES : _core.LLVMAddUnifyFunctionExitNodesPass,
|
||||
PASS_INTERNALIZE : _core.LLVMAddInternalizePass,
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
2
setup.py
2
setup.py
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright (c) 2008, Mahadevan R All rights reserved.
|
||||
# Copyright (c) 2008-10, Mahadevan R All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
|
|
|
|||
|
|
@ -573,8 +573,10 @@ def do_passmanager():
|
|||
print " Testing class PassManager"
|
||||
pm = PassManager.new()
|
||||
pm.add(TargetData.new(''))
|
||||
for i in range(1, 10):
|
||||
pm.add(i)
|
||||
for i in range(1, 90):
|
||||
if i not in (PASS_OPTIMAL_EDGE_PROFILER,
|
||||
PASS_EDGE_PROFILER, PASS_PROFILE_LOADER, PASS_AAEVAL):
|
||||
pm.add(i)
|
||||
pm.run(Module.new('a'))
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue