Migrate to LLVM 2.8 (rc2)
git-svn-id: http://llvm-py.googlecode.com/svn/trunk@96 8d1e9007-1d4e-0410-b67e-1979fd6579aa
This commit is contained in:
parent
7df2fc911a
commit
ab4ef428b6
12 changed files with 940 additions and 832 deletions
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
0.7, in progress:
|
||||
|
||||
* Migrate to LLVM 2.8.
|
||||
* Fix ffi link issue on darwin (Albert Mietus) (Issue #29).
|
||||
* LLVM tutorial ported (Max Shawabkeh) (Issue #33).
|
||||
|
||||
|
||||
|
|
|
|||
27
README
27
README
|
|
@ -7,34 +7,41 @@ llvm-py provides Python bindings for LLVM.
|
|||
|
||||
Home page:
|
||||
----------
|
||||
http://mdevan.nfshost.com/llvm-py/
|
||||
http://www.mdevan.org/llvm-py/
|
||||
|
||||
|
||||
Versions:
|
||||
---------
|
||||
This package will work only with LLVM 2.7, and Python 2.4 or later,
|
||||
(not Python 3.x).
|
||||
This package will work only with LLVM 2.8rc2, and Python 2.4 or later,
|
||||
(not Python 3.x). Note that LLVM 2.8 is not released yet, and neither
|
||||
is this package.
|
||||
|
||||
|
||||
Quickstart:
|
||||
-----------
|
||||
1. Get 2.7 version of LLVM, build it. Make sure '--enable-pic' is passed to
|
||||
LLVM's 'configure'.
|
||||
1. Get 2.8rc2 version of LLVM, build it. Make sure '--enable-pic' is
|
||||
passed to LLVM's 'configure'.
|
||||
|
||||
2. Get llvm-py and install it:
|
||||
|
||||
$ wget http://llvm-py.googlecode.com/files/llvm-py-0.6.tar.bz2
|
||||
$ tar jxvf llvm-py-0.6.tar.bz2
|
||||
# To get from SVN:
|
||||
$ svn checkout http://llvm-py.googlecode.com/svn/trunk/ llvm-py
|
||||
|
||||
# To get the stable release X.Y:
|
||||
$ wget http://llvm-py.googlecode.com/files/llvm-py-X.Y.tar.bz2
|
||||
$ tar jxvf llvm-py-X.Y.tar.bz2
|
||||
|
||||
# To build and install:
|
||||
$ cd llvm-py
|
||||
# Locate llvm-config, usually under <llvm>/Release/bin
|
||||
$ python setup.py install --user --llvm-config=/path/to/llvm-config
|
||||
|
||||
3. See examples under 'test' directory.
|
||||
3. See documentation at 'www/src/index.html' and examples under 'test'.
|
||||
|
||||
|
||||
LICENSE:
|
||||
--------
|
||||
llvm-py is distributed under the new BSD license, which is similar to
|
||||
the LLVM license itself. See the file called LICENSE for the full license
|
||||
text.
|
||||
the LLVM license itself. See the file called LICENSE for the full
|
||||
license text.
|
||||
|
||||
|
|
|
|||
11
llvm/_core.c
11
llvm/_core.c
|
|
@ -855,12 +855,9 @@ _wrap_pass( Reassociate )
|
|||
_wrap_pass( ScalarEvolutionAliasAnalysis )
|
||||
_wrap_pass( ScalarReplAggregates )
|
||||
_wrap_pass( SCCP )
|
||||
_wrap_pass( SCCVN )
|
||||
_wrap_pass( SimplifyHalfPowrLibCalls )
|
||||
_wrap_pass( SimplifyLibCalls )
|
||||
_wrap_pass( SingleLoopExtractor )
|
||||
_wrap_pass( SSI )
|
||||
_wrap_pass( SSIEverything )
|
||||
_wrap_pass( StripDeadPrototypes )
|
||||
_wrap_pass( StripNonDebugSymbols )
|
||||
_wrap_pass( StripSymbols )
|
||||
|
|
@ -869,7 +866,7 @@ _wrap_pass( TailCallElimination )
|
|||
_wrap_pass( TailDuplication )
|
||||
_wrap_pass( UnifyFunctionExitNodes )
|
||||
|
||||
_wrap_pass( Internalize )
|
||||
_wrap_pass( Internalize2 )
|
||||
|
||||
/*===----------------------------------------------------------------------===*/
|
||||
/* Target Data */
|
||||
|
|
@ -1546,7 +1543,6 @@ static PyMethodDef core_methods[] = {
|
|||
|
||||
/* Passes */
|
||||
_pass( AAEval )
|
||||
_pass( ABCD )
|
||||
_pass( AggressiveDCE )
|
||||
_pass( AliasAnalysisCounter )
|
||||
_pass( AlwaysInliner )
|
||||
|
|
@ -1620,12 +1616,9 @@ static PyMethodDef core_methods[] = {
|
|||
_pass( ScalarEvolutionAliasAnalysis )
|
||||
_pass( ScalarReplAggregates )
|
||||
_pass( SCCP )
|
||||
_pass( SCCVN )
|
||||
_pass( SimplifyHalfPowrLibCalls )
|
||||
_pass( SimplifyLibCalls )
|
||||
_pass( SingleLoopExtractor )
|
||||
_pass( SSI )
|
||||
_pass( SSIEverything )
|
||||
_pass( StripDeadPrototypes )
|
||||
_pass( StripNonDebugSymbols )
|
||||
_pass( StripSymbols )
|
||||
|
|
@ -1634,7 +1627,7 @@ static PyMethodDef core_methods[] = {
|
|||
_pass( TailDuplication )
|
||||
_pass( UnifyFunctionExitNodes )
|
||||
|
||||
_pass( Internalize )
|
||||
_pass( Internalize2 )
|
||||
|
||||
/* Target Data */
|
||||
_method( LLVMCreateTargetData )
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
53
llvm/core.py
53
llvm/core.py
|
|
@ -59,7 +59,6 @@ TYPE_POINTER = 11
|
|||
TYPE_OPAQUE = 12
|
||||
TYPE_VECTOR = 13
|
||||
TYPE_METADATA = 14
|
||||
TYPE_UNION = 15
|
||||
|
||||
# value IDs (llvm::Value::ValueTy enum)
|
||||
VALUE_ARGUMENT = 0
|
||||
|
|
@ -75,16 +74,14 @@ 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
|
||||
VALUE_CONSTANT_VECTOR = 13
|
||||
VALUE_CONSTANT_POINTER_NULL = 14
|
||||
VALUE_MD_NODE = 15
|
||||
VALUE_MD_STRING = 16
|
||||
VALUE_INLINE_ASM = 17
|
||||
VALUE_PSEUDO_SOURCE_VALUE = 18
|
||||
VALUE_FIXED_STACK_PSEUDO_SOURCE_VALUE = 19
|
||||
VALUE_INSTRUCTION = 20
|
||||
|
||||
# instruction opcodes (from include/llvm/Instruction.def)
|
||||
OPCODE_RET = 1
|
||||
|
|
@ -135,7 +132,7 @@ OPCODE_CALL = 45
|
|||
OPCODE_SELECT = 46
|
||||
OPCODE_USEROP1 = 47
|
||||
OPCODE_USEROP2 = 48
|
||||
OPCODE_VAARG = 59
|
||||
OPCODE_VAARG = 49
|
||||
OPCODE_EXTRACTELEMENT = 50
|
||||
OPCODE_INSERTELEMENT = 51
|
||||
OPCODE_SHUFFLEVECTOR = 52
|
||||
|
|
@ -210,21 +207,23 @@ RPRED_UNE = FCMP_UNE
|
|||
RPRED_TRUE = FCMP_TRUE
|
||||
|
||||
# linkages (see llvm-c/Core.h)
|
||||
LINKAGE_EXTERNAL = 0
|
||||
LINKAGE_AVAILABLE_EXTERNALLY = 1
|
||||
LINKAGE_LINKONCE_ANY = 2
|
||||
LINKAGE_LINKONCE_ODR = 3
|
||||
LINKAGE_WEAK_ANY = 4
|
||||
LINKAGE_WEAK_ODR = 5
|
||||
LINKAGE_APPENDING = 6
|
||||
LINKAGE_INTERNAL = 7
|
||||
LINKAGE_PRIVATE = 8
|
||||
LINKAGE_DLLIMPORT = 9
|
||||
LINKAGE_DLLEXPORT = 10
|
||||
LINKAGE_EXTERNAL_WEAK = 11
|
||||
LINKAGE_GHOST = 12
|
||||
LINKAGE_COMMON = 13
|
||||
LINKAGE_LINKER_PRIVATE = 14
|
||||
LINKAGE_EXTERNAL = 0
|
||||
LINKAGE_AVAILABLE_EXTERNALLY = 1
|
||||
LINKAGE_LINKONCE_ANY = 2
|
||||
LINKAGE_LINKONCE_ODR = 3
|
||||
LINKAGE_WEAK_ANY = 4
|
||||
LINKAGE_WEAK_ODR = 5
|
||||
LINKAGE_APPENDING = 6
|
||||
LINKAGE_INTERNAL = 7
|
||||
LINKAGE_PRIVATE = 8
|
||||
LINKAGE_DLLIMPORT = 9
|
||||
LINKAGE_DLLEXPORT = 10
|
||||
LINKAGE_EXTERNAL_WEAK = 11
|
||||
LINKAGE_GHOST = 12
|
||||
LINKAGE_COMMON = 13
|
||||
LINKAGE_LINKER_PRIVATE = 14
|
||||
LINKAGE_LINKER_PRIVATE_WEAK = 15
|
||||
LINKAGE_LINKER_PRIVATE_WEAK_DEF_AUTO = 16
|
||||
|
||||
# visibility (see llvm/GlobalValue.h)
|
||||
VISIBILITY_DEFAULT = 0
|
||||
|
|
|
|||
|
|
@ -368,8 +368,10 @@ LLVMModuleRef LLVMGetModuleFromBitcode(const char *bitcode, unsigned bclen,
|
|||
assert(bitcode);
|
||||
assert(out);
|
||||
|
||||
llvm::StringRef as_str(bitcode, bclen);
|
||||
|
||||
llvm::MemoryBuffer *mbp;
|
||||
if (!(mbp = llvm::MemoryBuffer::getMemBufferCopy(bitcode, bitcode+bclen)))
|
||||
if (!(mbp = llvm::MemoryBuffer::getMemBufferCopy(as_str)))
|
||||
return NULL;
|
||||
|
||||
std::string msg;
|
||||
|
|
@ -457,7 +459,8 @@ int LLVMInlineFunction(LLVMValueRef call)
|
|||
|
||||
llvm::CallSite cs = llvm::CallSite::get(callp);
|
||||
|
||||
return llvm::InlineFunction(cs);
|
||||
llvm::InlineFunctionInfo unused;
|
||||
return llvm::InlineFunction(cs, unused);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -474,7 +477,6 @@ void LLVMAdd ## P ## Pass (LLVMPassManagerRef passmgr) { \
|
|||
}
|
||||
|
||||
define_pass( AAEval )
|
||||
define_pass( ABCD )
|
||||
define_pass( AliasAnalysisCounter )
|
||||
define_pass( AlwaysInliner )
|
||||
define_pass( BasicAliasAnalysis )
|
||||
|
|
@ -494,7 +496,6 @@ define_pass( GEPSplitter )
|
|||
define_pass( GlobalsModRef )
|
||||
define_pass( InstCount )
|
||||
define_pass( InstructionNamer )
|
||||
define_pass( IPSCCP )
|
||||
define_pass( LazyValueInfo )
|
||||
define_pass( LCSSA )
|
||||
define_pass( LiveValues )
|
||||
|
|
@ -518,17 +519,14 @@ 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 )
|
||||
llvm::ModulePass *createInternalize2Pass() { return llvm::createInternalizePass(true); }
|
||||
define_pass( Internalize2 )
|
||||
|
||||
|
|
|
|||
|
|
@ -190,7 +190,6 @@ int LLVMInlineFunction(LLVMValueRef call);
|
|||
void LLVMAdd ## P ## Pass (LLVMPassManagerRef PM);
|
||||
|
||||
declare_pass( AAEval )
|
||||
declare_pass( ABCD )
|
||||
declare_pass( AliasAnalysisCounter )
|
||||
declare_pass( AlwaysInliner )
|
||||
declare_pass( BasicAliasAnalysis )
|
||||
|
|
@ -210,7 +209,6 @@ declare_pass( GEPSplitter )
|
|||
declare_pass( GlobalsModRef )
|
||||
declare_pass( InstCount )
|
||||
declare_pass( InstructionNamer )
|
||||
declare_pass( IPSCCP )
|
||||
declare_pass( LazyValueInfo )
|
||||
declare_pass( LCSSA )
|
||||
declare_pass( LiveValues )
|
||||
|
|
@ -234,17 +232,14 @@ 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( TailDuplication )
|
||||
declare_pass( UnifyFunctionExitNodes )
|
||||
|
||||
declare_pass( Internalize )
|
||||
declare_pass( Internalize2 )
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
|
|
|||
|
|
@ -43,7 +43,6 @@ import llvm._core as _core # C wrappers
|
|||
|
||||
# passes
|
||||
PASS_AAEVAL = 1
|
||||
PASS_ABCD = 2
|
||||
PASS_AGGRESSIVE_DCE = 3
|
||||
PASS_ALIAS_ANALYSIS_COUNTER = 4
|
||||
PASS_ALWAYS_INLINER = 5
|
||||
|
|
@ -116,13 +115,10 @@ 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
|
||||
|
|
@ -140,7 +136,6 @@ PASS_INTERNALIZE = 89
|
|||
|
||||
_pass_creator = {
|
||||
PASS_AAEVAL : _core.LLVMAddAAEvalPass,
|
||||
PASS_ABCD : _core.LLVMAddABCDPass,
|
||||
PASS_AGGRESSIVE_DCE : _core.LLVMAddAggressiveDCEPass,
|
||||
PASS_ALIAS_ANALYSIS_COUNTER : _core.LLVMAddAliasAnalysisCounterPass,
|
||||
PASS_ALWAYS_INLINER : _core.LLVMAddAlwaysInlinerPass,
|
||||
|
|
@ -213,13 +208,10 @@ _pass_creator = {
|
|||
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,
|
||||
|
|
@ -227,7 +219,7 @@ _pass_creator = {
|
|||
PASS_TAIL_CALL_ELIMINATION : _core.LLVMAddTailCallEliminationPass,
|
||||
PASS_TAIL_DUPLICATION : _core.LLVMAddTailDuplicationPass,
|
||||
PASS_UNIFY_FUNCTION_EXIT_NODES : _core.LLVMAddUnifyFunctionExitNodesPass,
|
||||
PASS_INTERNALIZE : _core.LLVMAddInternalizePass,
|
||||
PASS_INTERNALIZE : _core.LLVMAddInternalize2Pass,
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ def test_jit_ctypes():
|
|||
|
||||
bb = mult.append_basic_block("entry")
|
||||
builder = Builder.new(bb)
|
||||
tmp = builder.mul( mult.args[0], mult.args[1] )
|
||||
tmp = builder.fmul( mult.args[0], mult.args[1] )
|
||||
builder.store( tmp, mult.args[2] )
|
||||
builder.ret(llvm.core.Constant.int(ty_errcode, 0))
|
||||
|
||||
|
|
|
|||
|
|
@ -576,10 +576,11 @@ def do_passmanager():
|
|||
print " Testing class PassManager"
|
||||
pm = PassManager.new()
|
||||
pm.add(TargetData.new(''))
|
||||
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)
|
||||
for i in [getattr(llvm.passes, x) for x in \
|
||||
dir(llvm.passes) if x.startswith('PASS_') and x not in \
|
||||
('PASS_OPTIMAL_EDGE_PROFILER', 'PASS_EDGE_PROFILER', \
|
||||
'PASS_PROFILE_LOADER', 'PASS_AAEVAL')]:
|
||||
pm.add(i)
|
||||
pm.run(Module.new('a'))
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,9 @@ a patch.
|
|||
News
|
||||
----
|
||||
|
||||
30-Sep-2010::
|
||||
SVN r96 now works with LLVM 2.8rc2. Please test.
|
||||
|
||||
26-Sep-2010::
|
||||
LLVM tutorial link:examples.html#kaleidoscope[ported] by Max Shawabkeh!
|
||||
|
||||
|
|
|
|||
|
|
@ -52,6 +52,14 @@ a patch.</p></div>
|
|||
<div class="sectionbody">
|
||||
<div class="dlist"><dl>
|
||||
<dt class="hdlist1">
|
||||
30-Sep-2010
|
||||
</dt>
|
||||
<dd>
|
||||
<p>
|
||||
SVN r96 now works with LLVM 2.8rc2. Please test.
|
||||
</p>
|
||||
</dd>
|
||||
<dt class="hdlist1">
|
||||
26-Sep-2010
|
||||
</dt>
|
||||
<dd>
|
||||
|
|
@ -73,7 +81,7 @@ a patch.</p></div>
|
|||
<div id="footer">
|
||||
<div id="footer-text">
|
||||
Web pages © Mahadevan R. Generated with <a href="http://www.methods.co.nz/asciidoc/">asciidoc</a>.
|
||||
Last updated 2010-09-26.
|
||||
Last updated 2010-09-30.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue