diff --git a/CHANGELOG b/CHANGELOG index fb85a17..3580079 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,8 @@ -0.6, in progress: +0.6, 31-Aug-2010: + * Add and remove function attributes (Krzysztof Goj) (Issue #21). + * Wrap fadd,fsub,fmul (Aaron S Lav) (Issue #31). * Migrate to LLVM 2.7. * Migrate to LLVM 2.6 (KS Sreeram) (Issue #25). * Inline function (Corrado Zoccolo). diff --git a/LICENSE b/LICENSE index 9a4b9b5..579d556 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -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: diff --git a/README b/README index 4c496c1..21b8d67 100644 --- a/README +++ b/README @@ -13,7 +13,7 @@ Home page: Versions: --------- This package will work only with LLVM 2.7, and Python 2.4 or later, - but not 3.x. + (not Python 3.x). Quickstart: @@ -21,12 +21,13 @@ Quickstart: 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: + 2. Get llvm-py and install it: - $ svn co http://llvm-py.googlecode.com/svn/trunk/ llvm-py + $ wget http://llvm-py.googlecode.com/files/llvm-py-0.6.tar.bz2 + $ tar jxvf llvm-py-0.6.tar.bz2 $ cd llvm-py # Locate llvm-config, usually under /Release/bin - $ sudo python setup.py install --llvm-config=/path/to/llvm-config + $ python setup.py install --user --llvm-config=/path/to/llvm-config 3. See examples under 'test' directory. diff --git a/llvm/__init__.py b/llvm/__init__.py index e94848e..da8dcce 100644 --- a/llvm/__init__.py +++ b/llvm/__init__.py @@ -1,5 +1,5 @@ # -# 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: diff --git a/llvm/_intrinsic_ids.py b/llvm/_intrinsic_ids.py index 1a9c278..a56e7f5 100644 --- a/llvm/_intrinsic_ids.py +++ b/llvm/_intrinsic_ids.py @@ -1,5 +1,5 @@ # -# 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: diff --git a/llvm/_util.py b/llvm/_util.py index 2ffa9d9..690c378 100644 --- a/llvm/_util.py +++ b/llvm/_util.py @@ -1,5 +1,5 @@ # -# 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: diff --git a/llvm/core.py b/llvm/core.py index afc7a51..e330421 100644 --- a/llvm/core.py +++ b/llvm/core.py @@ -1,5 +1,5 @@ # -# 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: diff --git a/llvm/extra.cpp b/llvm/extra.cpp index 3df195c..f51aa42 100644 --- a/llvm/extra.cpp +++ b/llvm/extra.cpp @@ -1,5 +1,5 @@ /* - * 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: diff --git a/llvm/extra.h b/llvm/extra.h index fa73ca3..359f19b 100644 --- a/llvm/extra.h +++ b/llvm/extra.h @@ -1,5 +1,5 @@ /* - * 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: diff --git a/llvm/wrap.c b/llvm/wrap.c index d3eee21..a0a54a6 100644 --- a/llvm/wrap.c +++ b/llvm/wrap.c @@ -1,5 +1,5 @@ /* - * 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: diff --git a/llvm/wrap.h b/llvm/wrap.h index 0449212..8c6f328 100644 --- a/llvm/wrap.h +++ b/llvm/wrap.h @@ -1,5 +1,5 @@ /* - * 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: diff --git a/tools/intrs_for_doc.py b/tools/intrs_for_doc.py index ec34625..170d12e 100755 --- a/tools/intrs_for_doc.py +++ b/tools/intrs_for_doc.py @@ -2,10 +2,15 @@ import os +NCOLS = 4 +INF = '../llvm/_intrinsic_ids.py' +OUTF = '../www/src/intrinsics.csv' + intrs = [] -for line in file('../llvm/_intrinsic_ids.py'): +for line in file(INF): if line.startswith('INTR_'): - if 'INTR_ARM_' not in line and \ + if 'INTR_ALPHA_' not in line and \ + 'INTR_ARM_' not in line and \ 'INTR_BFIN_' not in line and \ 'INTR_PPC_' not in line and \ 'INTR_SPU_' not in line and \ @@ -13,7 +18,8 @@ for line in file('../llvm/_intrinsic_ids.py'): 'INTR_XCORE_' not in line: intrs.append(line.split()[0]) +outf = open(OUTF, 'wt') i = 0 while i < len(intrs): - print "`" + "`,`".join(intrs[i:min(i+3,len(intrs)+1)]) + "`" - i += 3 + print >>outf, "`" + "`,`".join(intrs[i:min(i+NCOLS,len(intrs)+1)]) + "`" + i += NCOLS diff --git a/www/src/about.txt b/www/src/about.txt index 3c10584..3364c95 100644 --- a/www/src/about.txt +++ b/www/src/about.txt @@ -2,7 +2,7 @@ About ===== llvm-py is developed and maintained by Mahadevan R, with contributions from -many users all over the world. He can be reached at mdevan.foobar@gmail.com, +many users all over the world. He can be reached at mdevan@mdevan.org, on the llvm-dev mailing list and (sometimes) as mdevan on irc.oftc.net#llvm. Many thanks to the guys over at LLVM for all the nifty software, for all diff --git a/www/src/download.txt b/www/src/download.txt index 337bd88..34c5fb4 100644 --- a/www/src/download.txt +++ b/www/src/download.txt @@ -1,12 +1,12 @@ Download ======== -The latest release is 0.6, released 28-Oct-2009 (link:#changelog[Changelog] -below). 0.6 works only with LLVM 2.6. +The latest release is 0.6, released 31-Aug-2010 (link:#changelog[Changelog] +below). 0.6 works only with LLVM 2.7. Download it here: -- http://llvm-py.googlecode.com/files/llvm-py-0.6.tar.bz2[llvm-py-0.6.tar.bz2] (primary) -- link:llvm-py-0.6.tar.bz2[llvm-py-0.6.tar.bz2] (mirror) +* http://llvm-py.googlecode.com/files/llvm-py-0.6.tar.bz2[llvm-py-0.6.tar.bz2] (primary) +* link:llvm-py-0.6.tar.bz2[llvm-py-0.6.tar.bz2] (mirror) Older versions are available http://llvm-py.googlecode.com/files/[here]. diff --git a/www/src/example.inc b/www/src/example.inc index f1afb87..f8010fb 100644 --- a/www/src/example.inc +++ b/www/src/example.inc @@ -102,14 +102,9 @@ builder = Builder.new(bb) tmp = builder.add(f_sum.args[0], f_sum.args[1], "tmp") builder.ret(tmp) -# Create a module provider object first. Modules can come from -# in-memory IRs like what we created now, or from bitcode (.bc) -# files. The module provider abstracts this detail. -mp = ModuleProvider.new(my_module) - # Create an execution engine object. This will create a JIT compiler # on platforms that support it, or an interpreter otherwise. -ee = ExecutionEngine.new(mp) +ee = ExecutionEngine.new(my_module) # The arguments needs to be passed as "GenericValue" objects. arg1 = GenericValue.int(ty_int, 100) diff --git a/www/src/index.txt b/www/src/index.txt index da63fc5..21da732 100644 --- a/www/src/index.txt +++ b/www/src/index.txt @@ -18,6 +18,6 @@ a patch. News ---- -28-Oct-2009:: - SVN r83 works with LLVM 2.6. Website updated. +31-Aug-2010:: + 0.6 released, works with LLVM 2.7. diff --git a/www/src/instrset.inc b/www/src/instrset.inc deleted file mode 100644 index ade818c..0000000 --- a/www/src/instrset.inc +++ /dev/null @@ -1,118 +0,0 @@ -.LLVM Instruction Set - -[frame="all",grid="all"] -`30`70~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Category, Instructions -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Terminator instructions,\ -"http://www.llvm.org/docs/LangRef.html#i_ret[ret], \ -http://www.llvm.org/docs/LangRef.html#i_br[br], \ -http://www.llvm.org/docs/LangRef.html#i_switch[switch], \ -http://www.llvm.org/docs/LangRef.html#i_invoke[invoke], \ -http://www.llvm.org/docs/LangRef.html#i_unwind[unwind], \ -http://www.llvm.org/docs/LangRef.html#i_unreachable[unreachable]" -Binary operations,\ -"http://www.llvm.org/docs/LangRef.html#i_add[add], \ -http://www.llvm.org/docs/LangRef.html#i_sub[sub], \ -http://www.llvm.org/docs/LangRef.html#i_mul[mul], \ -http://www.llvm.org/docs/LangRef.html#i_udiv[udiv], \ -http://www.llvm.org/docs/LangRef.html#i_sdiv[sdiv], \ -http://www.llvm.org/docs/LangRef.html#i_fdiv[fdiv], \ -http://www.llvm.org/docs/LangRef.html#i_urem[urem], \ -http://www.llvm.org/docs/LangRef.html#i_srem[srem], \ -http://www.llvm.org/docs/LangRef.html#i_frem[frem]" -Bitwise binary operations,\ -"http://www.llvm.org/docs/LangRef.html#i_shl[shl], \ -http://www.llvm.org/docs/LangRef.html#i_lshr[lshr], \ -http://www.llvm.org/docs/LangRef.html#i_ashr[ashr], \ -http://www.llvm.org/docs/LangRef.html#i_and[and], \ -http://www.llvm.org/docs/LangRef.html#i_or[or], \ -http://www.llvm.org/docs/LangRef.html#i_xor[xor]" -Vector operations,\ -"http://www.llvm.org/docs/LangRef.html#i_extractelement[extractelement], \ -http://www.llvm.org/docs/LangRef.html#i_insertelement[insertelement], \ -http://www.llvm.org/docs/LangRef.html#i_shufflevector[shufflevector]" -Aggregate operations,\ -"http://www.llvm.org/docs/LangRef.html#i_extractvalue[extractvalue], \ -http://www.llvm.org/docs/LangRef.html#i_insertvalue[insertvalue]" -Memory access and addressing operations,\ -"http://www.llvm.org/docs/LangRef.html#i_malloc[malloc], \ -http://www.llvm.org/docs/LangRef.html#i_free[free], \ -http://www.llvm.org/docs/LangRef.html#i_alloca[alloca], \ -http://www.llvm.org/docs/LangRef.html#i_load[load], \ -http://www.llvm.org/docs/LangRef.html#i_store[store], \ -http://www.llvm.org/docs/LangRef.html#i_getelementptr[getelementptr]" -Conversion operations,\ -"http://www.llvm.org/docs/LangRef.html#i_trunc[trunc], \ -http://www.llvm.org/docs/LangRef.html#i_zext[zext], \ -http://www.llvm.org/docs/LangRef.html#i_sext[sext], \ -http://www.llvm.org/docs/LangRef.html#i_fptrunc[fptrunc], \ -http://www.llvm.org/docs/LangRef.html#i_fpext[fpext], \ -http://www.llvm.org/docs/LangRef.html#i_fptoui[fptoui], \ -http://www.llvm.org/docs/LangRef.html#i_fptosi[fptosi], \ -http://www.llvm.org/docs/LangRef.html#i_uitofp[uitofp], \ -http://www.llvm.org/docs/LangRef.html#i_sitofp[sitofp], \ -http://www.llvm.org/docs/LangRef.html#i_ptrtoint[ptrtoint], \ -http://www.llvm.org/docs/LangRef.html#i_inttoptr[inttoptr], \ -http://www.llvm.org/docs/LangRef.html#i_bitcast[bitcast]" -Other operations,\ -"http://www.llvm.org/docs/LangRef.html#i_icmp[icmp], \ -http://www.llvm.org/docs/LangRef.html#i_fcmp[fcmp], \ -http://www.llvm.org/docs/LangRef.html#i_vicmp[vicmp], \ -http://www.llvm.org/docs/LangRef.html#i_vfcmp[vfcmp], \ -http://www.llvm.org/docs/LangRef.html#i_phi[phi], \ -http://www.llvm.org/docs/LangRef.html#i_select[select], \ -http://www.llvm.org/docs/LangRef.html#i_call[call], \ -http://www.llvm.org/docs/LangRef.html#i_va_arg[va_arg], \ -http://www.llvm.org/docs/LangRef.html#i_getresult[getresult]" -Variable argument handling intrinsics,\ -"http://www.llvm.org/docs/LangRef.html#int_va_start[llvm.va_start], \ -http://www.llvm.org/docs/LangRef.html#int_va_end[llvm.va_end], \ -http://www.llvm.org/docs/LangRef.html#int_va_copy[llvm.va_copy]" -Accurate garbage collection intrinsics,\ -"http://www.llvm.org/docs/LangRef.html#int_returnaddress[llvm.returnaddress], \ -http://www.llvm.org/docs/LangRef.html#int_frameaddress[llvm.frameaddress], \ -http://www.llvm.org/docs/LangRef.html#int_stacksave[llvm.stacksave], \ -http://www.llvm.org/docs/LangRef.html#int_stackrestore[llvm.stackrestore], \ -http://www.llvm.org/docs/LangRef.html#int_prefetch[llvm.prefetch], \ -http://www.llvm.org/docs/LangRef.html#int_pcmarker[llvm.pcmarker], \ -http://www.llvm.org/docs/LangRef.html#int_readcyclecounter[llvm.readcyclecounter]" -Standard C library intrinsics,\ -"http://www.llvm.org/docs/LangRef.html#int_memcpy[llvm.memcpy.\*], \ -http://www.llvm.org/docs/LangRef.html#int_memmove[llvm.memmove.\*], \ -http://www.llvm.org/docs/LangRef.html#int_memset[llvm.memset.\*], \ -http://www.llvm.org/docs/LangRef.html#int_sqrt[llvm.sqrt.\*], \ -http://www.llvm.org/docs/LangRef.html#int_powi[llvm.powi.\*], \ -http://www.llvm.org/docs/LangRef.html#int_sin[llvm.sin.\*], \ -http://www.llvm.org/docs/LangRef.html#int_cos[llvm.cos.\*], \ -http://www.llvm.org/docs/LangRef.html#int_pow[llvm.pow.\*]" -Bit manipulation intrinsics,\ -"http://www.llvm.org/docs/LangRef.html#int_bswap[llvm.bswap.\*], \ -http://www.llvm.org/docs/LangRef.html#int_ctpop[llvm.ctpop.\*], \ -http://www.llvm.org/docs/LangRef.html#int_ctlz[llvm.ctlz.\*], \ -http://www.llvm.org/docs/LangRef.html#int_cttz[llvm.cttz.\*], \ -http://www.llvm.org/docs/LangRef.html#int_part_select[llvm.part.select.\*], \ -http://www.llvm.org/docs/LangRef.html#int_part_set[llvm.part.set.\*]" -Debugger intrinsics,\ -"http://www.llvm.org/docs/SourceLevelDebugging.html#format_common_stoppoint[llvm.dbg.stoppoint], \ -http://www.llvm.org/docs/SourceLevelDebugging.html#format_common_func_start[llvm.dbg.func.start], \ -http://www.llvm.org/docs/SourceLevelDebugging.html#format_common_region_start[llvm.dbg.region.start], \ -http://www.llvm.org/docs/SourceLevelDebugging.html#format_common_region_end[llvm.dbg.region.end], \ -http://www.llvm.org/docs/SourceLevelDebugging.html#format_common_declare[llvm.dbg.declare]" -Exception handling intrinsics,\ -"http://www.llvm.org/docs/ExceptionHandling.html#llvm_eh_exception[llvm.eh_exception], \ -http://www.llvm.org/docs/ExceptionHandling.html#llvm_eh_selector[llvm.eh_selector], \ -http://www.llvm.org/docs/ExceptionHandling.html#llvm_eh_typeid_for[llvm.eh_typeid_for]" -Trampoline intrinsics,\ -"http://www.llvm.org/docs/LangRef.html#int_it[llvm.init.trampoline]" -Atomic intrinsics,\ -"http://www.llvm.org/docs/LangRef.html#int_memory_barrier[llvm.memory.barrier], \ -http://www.llvm.org/docs/LangRef.html#int_atomic_lcs[llvm.atomic.lcs], \ -http://www.llvm.org/docs/LangRef.html#int_atomic_las[llvm.atomic.las], \ -http://www.llvm.org/docs/LangRef.html#int_atomic_swap[llvm.atomic.swap]" -General intrinsics,\ -"http://www.llvm.org/docs/LangRef.html#int_var_annotation[llvm.var.annotation], \ -http://www.llvm.org/docs/LangRef.html#int_annotation[llvm.annotation.\*], \ -http://www.llvm.org/docs/LangRef.html#int_trap[llvm.trap]" -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - diff --git a/www/src/intrinsics.csv b/www/src/intrinsics.csv new file mode 100644 index 0000000..31e9b35 --- /dev/null +++ b/www/src/intrinsics.csv @@ -0,0 +1,22 @@ +`INTR_ANNOTATION`,`INTR_ATOMIC_CMP_SWAP`,`INTR_ATOMIC_LOAD_ADD`,`INTR_ATOMIC_LOAD_AND` +`INTR_ATOMIC_LOAD_MAX`,`INTR_ATOMIC_LOAD_MIN`,`INTR_ATOMIC_LOAD_NAND`,`INTR_ATOMIC_LOAD_OR` +`INTR_ATOMIC_LOAD_SUB`,`INTR_ATOMIC_LOAD_UMAX`,`INTR_ATOMIC_LOAD_UMIN`,`INTR_ATOMIC_LOAD_XOR` +`INTR_ATOMIC_SWAP`,`INTR_BSWAP`,`INTR_CONVERTFF`,`INTR_CONVERTFSI` +`INTR_CONVERTFUI`,`INTR_CONVERTSIF`,`INTR_CONVERTSS`,`INTR_CONVERTSU` +`INTR_CONVERTUIF`,`INTR_CONVERTUS`,`INTR_CONVERTUU`,`INTR_COS` +`INTR_CTLZ`,`INTR_CTPOP`,`INTR_CTTZ`,`INTR_DBG_DECLARE` +`INTR_DBG_VALUE`,`INTR_EH_DWARF_CFA`,`INTR_EH_EXCEPTION`,`INTR_EH_RETURN_I32` +`INTR_EH_RETURN_I64`,`INTR_EH_SELECTOR`,`INTR_EH_SJLJ_CALLSITE`,`INTR_EH_SJLJ_LONGJMP` +`INTR_EH_SJLJ_LSDA`,`INTR_EH_SJLJ_SETJMP`,`INTR_EH_TYPEID_FOR`,`INTR_EH_UNWIND_INIT` +`INTR_EXP`,`INTR_EXP2`,`INTR_FLT_ROUNDS`,`INTR_FRAMEADDRESS` +`INTR_GCREAD`,`INTR_GCROOT`,`INTR_GCWRITE`,`INTR_INIT_TRAMPOLINE` +`INTR_INVARIANT_END`,`INTR_INVARIANT_START`,`INTR_LIFETIME_END`,`INTR_LIFETIME_START` +`INTR_LOG`,`INTR_LOG10`,`INTR_LOG2`,`INTR_LONGJMP` +`INTR_MEMCPY`,`INTR_MEMMOVE`,`INTR_MEMORY_BARRIER`,`INTR_MEMSET` +`INTR_OBJECTSIZE`,`INTR_PCMARKER`,`INTR_POW`,`INTR_POWI` +`INTR_PREFETCH`,`INTR_PTR_ANNOTATION`,`INTR_READCYCLECOUNTER`,`INTR_RETURNADDRESS` +`INTR_SADD_WITH_OVERFLOW`,`INTR_SETJMP`,`INTR_SIGLONGJMP`,`INTR_SIGSETJMP` +`INTR_SIN`,`INTR_SMUL_WITH_OVERFLOW`,`INTR_SQRT`,`INTR_SSUB_WITH_OVERFLOW` +`INTR_STACKPROTECTOR`,`INTR_STACKRESTORE`,`INTR_STACKSAVE`,`INTR_TRAP` +`INTR_UADD_WITH_OVERFLOW`,`INTR_UMUL_WITH_OVERFLOW`,`INTR_USUB_WITH_OVERFLOW`,`INTR_VACOPY` +`INTR_VAEND`,`INTR_VAR_ANNOTATION`,`INTR_VASTART` diff --git a/www/src/userguide.txt b/www/src/userguide.txt index bb6470d..1540977 100644 --- a/www/src/userguide.txt +++ b/www/src/userguide.txt @@ -38,7 +38,7 @@ flavours, *BSD, Mac OS X; on i386 and amd64 architectures. Windows is not supported, for a variety of reasons. .Versions -llvm-py 0.6 requires verion 2.6 of LLVM. It will not work with previous +llvm-py 0.6 requires verion 2.7 of LLVM. It will not work with previous versions. llvm-py has been built and tested with Python 2.6. It should work with @@ -112,7 +112,7 @@ llvm-py this way: ----------------------------------------------------------------------- $ tar jxvf llvm-py-0.6.tar.bz2 $ cd llvm-py-0.6 -$ sudo python setup.py install +$ python setup.py install --user ----------------------------------------------------------------------- If you need to tell the build script where +llvm-config+ is, do it this @@ -121,7 +121,7 @@ way: ----------------------------------------------------------------------- $ tar jxvf llvm-py-0.6.tar.bz2 $ cd llvm-py-0.6 -$ sudo python setup.py install --llvm-config=/home/mdevan/llvm/Release/bin/llvm-config +$ python setup.py install --user --llvm-config=/home/mdevan/llvm/Release/bin/llvm-config ----------------------------------------------------------------------- To build a debug version of llvm-py, that links against the debug @@ -131,7 +131,7 @@ libraries of LLVM, use this: $ tar jxvf llvm-py-0.6.tar.bz2 $ cd llvm-py-0.6 $ python setup.py build -g --llvm-config=/home/mdevan/llvm/Debug/bin/llvm-config -$ sudo python setup.py install --llvm-config=/home/mdevan/llvm/Debug/bin/llvm-config +$ python setup.py install --user --llvm-config=/home/mdevan/llvm/Debug/bin/llvm-config ----------------------------------------------------------------------- Be warned that debug binaries will be huge (100MB+) ! They are required @@ -147,17 +147,21 @@ Python Modules] for more information on such scripts. Uninstall ~~~~~~~~~ -To get rid of llvm-py completely, if you wish to do so: +If you'd installed llvm-py with the `--user` option, then llvm-py +would be present under `~/.local/lib/python2.6/site-packages`. +Otherwise, it might be under `/usr/lib/python2.6/site-packages` +or `/usr/local/lib/python2.6/site-packages`. The directory would +vary with your Python version and OS flavour. Look around. + +Once you've located the site-packages directory, the modules and +the "egg" can be removed like so: ---- -# rm -rf /usr/lib/python2.6/site-packages/llvm -# rm -f /usr/lib/python2.6/site-packages/llvm_py-0.6-py2.6.egg-info +$ rm -rf /llvm /llvm_py-0.6-py2.6.egg-info ---- -- You need to be root to do this. -- Python site package path might be different on your system. -- Note that there are version numbers (both Python's and llvm-py's) - which you might need to change to suit your system. +See the http://docs.python.org/install/index.html[Python +documentation] for more information. The Concepts @@ -269,33 +273,33 @@ source~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The corresponding LLVM assembly: ----------------------------------------------------------------------- -; ModuleID = '/tmp/webcompile/_22154_0.bc' -target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32" -target triple = "i386-pc-linux-gnu" +; ModuleID = '/tmp/webcompile/_7149_0.bc' +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" +target triple = "x86_64-linux-gnu" define i32 @sum(i32 %n) nounwind readnone { entry: - %0 = icmp eq i32 %n, 0 ; [#uses=1] - br i1 %0, label %bb2, label %bb1 + %0 = icmp eq i32 %n, 0 ; [#uses=1] + br i1 %0, label %bb2, label %bb1 -bb1: ; preds = %entry - %1 = add i32 %n, -1 ; [#uses=2] - %2 = icmp eq i32 %1, 0 ; [#uses=1] - br i1 %2, label %sum.exit, label %bb1.i +bb1: ; preds = %entry + %1 = add i32 %n, -1 ; [#uses=2] + %2 = icmp eq i32 %1, 0 ; [#uses=1] + br i1 %2, label %sum.exit, label %bb1.i -bb1.i: ; preds = %bb1 - %3 = add i32 %n, -2 ; [#uses=1] - %4 = tail call i32 @sum(i32 %3) nounwind ; [#uses=1] - %5 = add i32 %4, %1 ; [#uses=1] - br label %sum.exit +bb1.i: ; preds = %bb1 + %3 = add i32 %n, -2 ; [#uses=1] + %4 = tail call i32 @sum(i32 %3) nounwind ; [#uses=1] + %5 = add i32 %4, %1 ; [#uses=1] + br label %sum.exit -sum.exit: ; preds = %bb1.i, %bb1 - %6 = phi i32 [ %5, %bb1.i ], [ 0, %bb1 ] ; [#uses=1] - %7 = add i32 %6, %n ; [#uses=1] - ret i32 %7 +sum.exit: ; preds = %bb1.i, %bb1 + %6 = phi i32 [ %5, %bb1.i ], [ 0, %bb1 ] ; [#uses=1] + %7 = add i32 %6, %n ; [#uses=1] + ret i32 %7 -bb2: ; preds = %entry - ret i32 0 +bb2: ; preds = %entry + ret i32 0 } ----------------------------------------------------------------------- @@ -398,7 +402,7 @@ Here is a quick overview of the contents of each package: manager - constants +TYPE_*+ that represents various types - constants +CC_*+ that represent calling conventions -- constants +IPRED_*+ and +RPRED_*+ that represent integer and real +- constants +ICMP_*+ and +FCMP_*+ that represent integer and real comparison predicates (like less than, greater than etc.) - constants +LINKAGE_*+ that represent linkage of symbols (external, internal etc.) @@ -524,6 +528,9 @@ stringifying them (see below). A string representing the ABI of the platform. `target`:: A string like `i386-pc-linux-gnu` or `i386-pc-solaris2.8`. +`pointer_size` [read-only]:: + The size in bits of pointers, of the target platform. A value of + zero represents `llvm::Module::AnyPointerSize`. `global_variables` [read-only]:: An iterable that yields `GlobalVariable` objects, that represent the global variables of the module. @@ -532,6 +539,8 @@ stringifying them (see below). in the module. .Methods +`get_type_named(name)`:: + Return a `Type` object for the given alias name (typedef). `add_type_name(name, ty)`:: Add an alias (typedef) for the type `ty` with the name `name`. `delete_type_name(name)`:: @@ -549,12 +558,20 @@ stringifying them (see below). `get_function_named(name)`:: Get a `Function` object corresponding to the function with the name `name`. Raises `LLVMException` if such a function does not exist. +`get_or_insert_function(ty, name)`:: + Like `get_function_named`, but adds the function first, if not + present (like `add_function`). `verify()`:: Verify the correctness of the module. Raises `LLVMException` on errors. `to_bitcode(fileobj)`:: Write the bitcode representation of the module to the file-like object `fileobj`. +`link_in(other)`:: + Link in another module `other` into this module. Global variables, + functions etc. are matched and resolved. The `other` module is no + longer valid and should not be used after this operation. This API + might be replaced with a full-fledged Linker class in the future. .Special Methods `__str__`:: @@ -570,7 +587,7 @@ stringifying them (see below). .Convention ======================================================================= *All* llvm-py objects (where it makes sense), when stringified, return -the LLVM assembly representation. `` `print module_obj` '' for example, +the LLVM assembly representation. `print module_obj` for example, prints the LLVM assembly form of the entire module. Such objects, when compared for equality, internally compare these @@ -675,6 +692,7 @@ The class-level documentation follows: + [python] source~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# Warning: do not rely on actual numerical values! TYPE_VOID = 0 TYPE_FLOAT = 1 TYPE_DOUBLE = 2 @@ -682,14 +700,15 @@ 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 source~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Example: @@ -811,7 +830,7 @@ source~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ `address_space` [read-only]:: The address space of the pointer. `pointee` [read-only]:: - TODO *missing* + A `Type` object representing the type of the value pointed to. ======================================================================= @@ -896,7 +915,8 @@ which gives the output: ----------------------------------------------------------------------- ; ModuleID = 'mod1' - %struct.node = type { i32, %struct.node* } + +%struct.node = type { i32, %struct.node* } ----------------------------------------------------------------------- For more details on what is going on here, please refer the LLVM @@ -1049,8 +1069,8 @@ Method, Operation `k.and_(k2)`, "Bitwise and of `k` and `k2`. Note trailing underscore." `k.or_(k2)`, "Bitwise or of `k` and `k2`. Note trailing underscore." `k.xor(k2)`, "Bitwise exclusive-or of `k` and `k2`." -"`k.icmp(ipred, k2)`", "Compare `k` with `k2` using the predicate `ipred`. See table link:#ipred[below] for list of predicates for integer operands." -"`k.fcmp(rpred, k2)`", "Compare `k` with `k2` using the predicate `rpred`. See table link:#rpred[below] for list of predicates for real operands." +"`k.icmp(icmp, k2)`", "Compare `k` with `k2` using the predicate `icmp`. See table link:#icmp[below] for list of predicates for integer operands." +"`k.fcmp(fcmp, k2)`", "Compare `k` with `k2` using the predicate `fcmp`. See table link:#fcmp[below] for list of predicates for real operands." `k.shl(k2)`, "Shift `k` left by `k2` bits." `k.lshr(k2)`, "Shift `k` logically right by `k2` bits (new bits are 0s)." `k.ashr(k2)`, "Shift `k` arithmetically right by `k2` bits (new bits are same as previous sign bit)." @@ -1073,48 +1093,48 @@ Method, Operation "`k.shuffle_vector(k2,mask)`", "Shuffle vector constant `k` based on vector constants `k2` and `mask`." |====================================================================== -[[ipred]] +[[icmp]] Predicates for use with `icmp` instruction are listed below. All of these are integer constants defined in the `llvm.core` module. [frame="all",grid="all",format="csv",cols="2",options="header"] |====================================================================== Value, Meaning -`IPRED_EQ`, Equality -`IPRED_NE`, Inequality -`IPRED_UGT`, Unsigned greater than -`IPRED_UGE`, Unsigned greater than or equal -`IPRED_ULT`, Unsigned less than -`IPRED_ULE`, Unsigned less than or equal -`IPRED_SGT`, Signed greater than -`IPRED_SGE`, Signed greater than or equal -`IPRED_SLT`, Signed less than -`IPRED_SLE`, Signed less than or equal +`ICMP_EQ`, Equality +`ICMP_NE`, Inequality +`ICMP_UGT`, Unsigned greater than +`ICMP_UGE`, Unsigned greater than or equal +`ICMP_ULT`, Unsigned less than +`ICMP_ULE`, Unsigned less than or equal +`ICMP_SGT`, Signed greater than +`ICMP_SGE`, Signed greater than or equal +`ICMP_SLT`, Signed less than +`ICMP_SLE`, Signed less than or equal |====================================================================== -[[rpred]] +[[fcmp]] Predicates for use with `fcmp` instruction are listed below. All of these are integer constants defined in the `llvm.core` module. [frame="all",grid="all",format="csv",cols="2",options="header"] |====================================================================== Value, Meaning -`RPRED_FALSE`, Always false -`RPRED_OEQ`, True if ordered and equal -`RPRED_OGT`, True if ordered and greater than -`RPRED_OGE`, True if ordered and greater than or equal -`RPRED_OLT`, True if ordered and less than -`RPRED_OLE`, True if ordered and less than or equal -`RPRED_ONE`, True if ordered and operands are unequal -`RPRED_ORD`, True if ordered (no NaNs) -`RPRED_UNO`, True if unordered: `isnan(X) | isnan(Y)` -`RPRED_UEQ`, True if unordered or equal -`RPRED_UGT`, True if unordered or greater than -`RPRED_UGE`, "True if unordered, greater than or equal" -`RPRED_ULT`, "True if unordered, or less than" -`RPRED_ULE`, "True if unordered, less than or equal" -`RPRED_UNE`, True if unordered or not equal -`RPRED_TRUE `, Always true +`FCMP_FALSE`, Always false +`FCMP_OEQ`, True if ordered and equal +`FCMP_OGT`, True if ordered and greater than +`FCMP_OGE`, True if ordered and greater than or equal +`FCMP_OLT`, True if ordered and less than +`FCMP_OLE`, True if ordered and less than or equal +`FCMP_ONE`, True if ordered and operands are unequal +`FCMP_ORD`, True if ordered (no NaNs) +`FCMP_UNO`, True if unordered: `isnan(X) | isnan(Y)` +`FCMP_UEQ`, True if unordered or equal +`FCMP_UGT`, True if unordered or greater than +`FCMP_UGE`, "True if unordered, greater than or equal" +`FCMP_ULT`, "True if unordered, or less than" +`FCMP_ULE`, "True if unordered, less than or equal" +`FCMP_UNE`, True if unordered or not equal +`FCMP_TRUE `, Always true |====================================================================== .llvm.core.Constant @@ -1157,12 +1177,12 @@ Value, Equivalent LLVM Assembly Keyword `LINKAGE_APPENDING`, `appending` `LINKAGE_INTERNAL`, `internal` `LINKAGE_PRIVATE`, `private` -`LINKAGE_LINKER_PRIVATE`, `linker_private` `LINKAGE_DLLIMPORT`, `dllimport` `LINKAGE_DLLEXPORT`, `dllexport` `LINKAGE_EXTERNAL_WEAK`, `extern_weak` +`LINKAGE_GHOST`, deprecated -- do not use `LINKAGE_COMMON`, `common` -`LINKAGE_GHOST`, Stand-in functions +`LINKAGE_LINKER_PRIVATE`, `linker_private` |====================================================================== The `section` property can be assigned strings (like ".rodata"), which @@ -1350,39 +1370,12 @@ http://www.llvm.org/docs/LangRef.html#int_bswap[llvm.bswap]. The integer argument. The list of intrinsic IDs defined as integer constants in `llvm.core`. These are: -[format="csv",cols="3"] +[format="csv",cols="4"] |====================================================================== -`INTR_ALPHA_UMULH`,`INTR_ANNOTATION`,`INTR_ATOMIC_CMP_SWAP` -`INTR_ATOMIC_LOAD_ADD`,`INTR_ATOMIC_LOAD_AND`,`INTR_ATOMIC_LOAD_MAX` -`INTR_ATOMIC_LOAD_MIN`,`INTR_ATOMIC_LOAD_NAND`,`INTR_ATOMIC_LOAD_OR` -`INTR_ATOMIC_LOAD_SUB`,`INTR_ATOMIC_LOAD_UMAX`,`INTR_ATOMIC_LOAD_UMIN` -`INTR_ATOMIC_LOAD_XOR`,`INTR_ATOMIC_SWAP`,`INTR_BSWAP` -`INTR_CONVERTFF`,`INTR_CONVERTFSI`,`INTR_CONVERTFUI` -`INTR_CONVERTSIF`,`INTR_CONVERTSS`,`INTR_CONVERTSU` -`INTR_CONVERTUIF`,`INTR_CONVERTUS`,`INTR_CONVERTUU` -`INTR_COS`,`INTR_CTLZ`,`INTR_CTPOP` -`INTR_CTTZ`,`INTR_DBG_DECLARE`,`INTR_DBG_FUNC_START` -`INTR_DBG_REGION_END`,`INTR_DBG_REGION_START`,`INTR_DBG_STOPPOINT` -`INTR_EH_DWARF_CFA`,`INTR_EH_EXCEPTION`,`INTR_EH_RETURN_I32` -`INTR_EH_RETURN_I64`,`INTR_EH_SELECTOR_I32`,`INTR_EH_SELECTOR_I64` -`INTR_EH_SJLJ_LONGJMP`,`INTR_EH_SJLJ_LSDA`,`INTR_EH_SJLJ_SETJMP` -`INTR_EH_TYPEID_FOR_I32`,`INTR_EH_TYPEID_FOR_I64`,`INTR_EH_UNWIND_INIT` -`INTR_EXP`,`INTR_EXP2`,`INTR_FLT_ROUNDS` -`INTR_FRAMEADDRESS`,`INTR_GCREAD`,`INTR_GCROOT` -`INTR_GCWRITE`,`INTR_INIT_TRAMPOLINE`,`INTR_LOG` -`INTR_LOG10`,`INTR_LOG2`,`INTR_LONGJMP` -`INTR_MEMCPY`,`INTR_MEMMOVE`,`INTR_MEMORY_BARRIER` -`INTR_MEMSET`,`INTR_PCMARKER`,`INTR_POW` -`INTR_POWI`,`INTR_PREFETCH`,`INTR_PTR_ANNOTATION` -`INTR_READCYCLECOUNTER`,`INTR_RETURNADDRESS`,`INTR_SADD_WITH_OVERFLOW` -`INTR_SETJMP`,`INTR_SIGLONGJMP`,`INTR_SIGSETJMP` -`INTR_SIN`,`INTR_SMUL_WITH_OVERFLOW`,`INTR_SQRT` -`INTR_SSUB_WITH_OVERFLOW`,`INTR_STACKPROTECTOR`,`INTR_STACKRESTORE` -`INTR_STACKSAVE`,`INTR_TRAP`,`INTR_UADD_WITH_OVERFLOW` -`INTR_UMUL_WITH_OVERFLOW`,`INTR_USUB_WITH_OVERFLOW`,`INTR_VACOPY` -`INTR_VAEND`,`INTR_VAR_ANNOTATION`,`INTR_VASTART` +include::intrinsics.csv[] |====================================================================== +`ATTR_ZEXT`, `zeroext` There are also target-specific intrinsics (which correspond to that target's CPU instructions) available, but are omitted here for brevity. Full list can be seen from @@ -1463,11 +1456,30 @@ Functions can be deleted using the method `delete`. This deletes them from their containing module. All references to the function object should be dropped after `delete` has been called. -Functions can be verified with the `verify` method. This does not work -properly yet (aborts on errors), investigation pending. +Functions can be verified with the `verify` method. Note that this may +not work properly (aborts on errors). TODO function attributes +[frame="all",grid="all"] +`25`75~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Value, Equivalent LLVM Assembly Keyword +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~a +`ATTR_ALWAYS_INLINE`,`alwaysinline` +`ATTR_INLINE_HINT`,`inlinehint` +`ATTR_NO_INLINE`,`noinline` +`ATTR_OPTIMIZE_FOR_SIZE`,`optsize` +`ATTR_NO_RETURN`,`noreturn` +`ATTR_NO_UNWIND`,`nounwind` +`ATTR_READ_NONE`,`readnone` +`ATTR_READONLY`,`readonly` +`ATTR_STACK_PROTECT`,`ssp` +`ATTR_STACK_PROTECT_REQ`,`sspreq` +`ATTR_NO_REDZONE`,`noredzone` +`ATTR_NO_IMPLICIT_FLOAT`,`noimplicitfloat` +`ATTR_NAKED`,`naked` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Argument (llvm.core) ~~~~~~~~~~~~~~~~~~~~ @@ -1485,23 +1497,20 @@ Value, Equivalent LLVM Assembly Keyword ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ `ATTR_ZEXT`, `zeroext` `ATTR_SEXT`, `signext` -`ATTR_NO_RETURN`, `noreturn` `ATTR_IN_REG`, `inreg` -`ATTR_STRUCT_RET`, `sret` -`ATTR_NO_UNWIND`, `nounwind` -`ATTR_NO_ALIAS`, `noalias` `ATTR_BY_VAL`, `byval` +`ATTR_STRUCT_RET`, `sret` +`ATTR_NO_ALIAS`, `noalias` +`ATTR_NO_CAPTURE`, `nocapture` `ATTR_NEST`, `nest` -`ATTR_READ_NONE`, `readnone` -`ATTR_READONLY`, `readonly` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The corresponding http://www.llvm.org/docs/LangRef.html#paramattrs[LLVM docs] provide more information. -The alignment of any parameter can also be set via `set_argument(a)` -where `a` is a power of 2. +The alignment of any parameter can be set via the `alignment` +property, to any power of 2. Basic Block (llvm.core) ~~~~~~~~~~~~~~~~~~~~~~~ @@ -1521,12 +1530,6 @@ Instructions (llvm.core) TODO -Module Provider (llvm.core) -~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -TODO - - Target Data (llvm.ee) ~~~~~~~~~~~~~~~~~~~~~ @@ -1539,8 +1542,8 @@ Execution Engine (llvm.ee) TODO. For now, see `test/example-jit.py`. -Pass Managers and Passes (llvm.passes) -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Pass Manager and Passes (llvm.passes) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ TODO. For now, see `test/passes.py`. @@ -1549,7 +1552,7 @@ About the llvm-py Project --------------------------- llvm-py lives at -http://mdevan.nfshost.com/llvm-py/[http://mdevan.nfshost.com/llvm-py/]. +http://www.mdevan.org/llvm-py/[http://www.mdevan.org/llvm-py/]. The code (subversion repository) and the issue tracker are hosted on the Google code hosting service, at http://code.google.com/p/llvm-py/[http://code.google.com/p/llvm-py/]. @@ -1571,5 +1574,5 @@ are most welcome. You can checkout the latest SVN HEAD from http://code.google.com/p/llvm-py/source/checkout[here]. Mahadevan R wrote llvm-py and works on it in his spare time. He can be -reached at _mdevan.foobar@gmail.com_. +reached at _mdevan@mdevan.org_. diff --git a/www/web/about.html b/www/web/about.html index 56ef552..26794c5 100644 --- a/www/web/about.html +++ b/www/web/about.html @@ -2,7 +2,7 @@ - + @@ -34,7 +34,7 @@

llvm-py is developed and maintained by Mahadevan R, with contributions from -many users all over the world. He can be reached at mdevan.foobar@gmail.com, +many users all over the world. He can be reached at mdevan@mdevan.org, on the llvm-dev mailing list and (sometimes) as mdevan on irc.oftc.net#llvm.

Many thanks to the guys over at LLVM for all the nifty software, for all the llvm-py contributors.

@@ -43,7 +43,7 @@ the llvm-py contributors.

diff --git a/www/web/contribute.html b/www/web/contribute.html index b7a57ee..9e2b7c0 100644 --- a/www/web/contribute.html +++ b/www/web/contribute.html @@ -2,7 +2,7 @@ - + @@ -91,7 +91,7 @@ update and merge before sending patches etc.

diff --git a/www/web/download.html b/www/web/download.html index 0b43079..613152f 100644 --- a/www/web/download.html +++ b/www/web/download.html @@ -2,7 +2,7 @@ - + @@ -33,11 +33,11 @@
-

The latest release is 0.6, released 28-Oct-2009 (Changelog -below). 0.6 works only with LLVM 2.6.

+

The latest release is 0.6, released 31-Aug-2010 (Changelog +below). 0.6 works only with LLVM 2.7.

Download it here: -- llvm-py-0.6.tar.bz2 (primary) -- llvm-py-0.6.tar.bz2 (mirror)

+* llvm-py-0.6.tar.bz2 (primary) +* llvm-py-0.6.tar.bz2 (mirror)

Older versions are available here.

The latest code can be checked out from SVN like so:

@@ -52,8 +52,11 @@ package.

-
0.6, in progress:
+
0.6, 31-Aug-2010:
 
+  * Add and remove function attributes (Krzysztof Goj) (Issue #21).
+  * Wrap fadd,fsub,fmul (Aaron S Lav) (Issue #31).
+  * Migrate to LLVM 2.7.
   * Migrate to LLVM 2.6 (KS Sreeram) (Issue #25).
   * Inline function (Corrado Zoccolo).
   * Get pointer to function (Corrado Zoccolo).
@@ -129,7 +132,7 @@ package.

diff --git a/www/web/examples.html b/www/web/examples.html index 8accc86..aba1de7 100644 --- a/www/web/examples.html +++ b/www/web/examples.html @@ -2,7 +2,7 @@ - + @@ -37,7 +37,7 @@

Let’s create a (LLVM) module containing a single function, corresponding to the C function:

-
@@ -47,7 +47,7 @@ http://www.gnu.org/software/src-highlite --> }

Here’s how it looks like:

-
@@ -109,7 +109,7 @@ entry:

Adding JIT Compilation

Let’s compile this function in-memory and run it.

-
@@ -132,14 +132,9 @@ builder = Builder= builder.add(f_sum.args[0], f_sum.args[1], "tmp") builder.ret(tmp) -# Create a module provider object first. Modules can come from -# in-memory IRs like what we created now, or from bitcode (.bc) -# files. The module provider abstracts this detail. -mp = ModuleProvider.new(my_module) - # Create an execution engine object. This will create a JIT compiler # on platforms that support it, or an interpreter otherwise. -ee = ExecutionEngine.new(mp) +ee = ExecutionEngine.new(my_module) # The arguments needs to be passed as "GenericValue" objects. arg1 = GenericValue.int(ty_int, 100) @@ -224,7 +219,7 @@ Conclusion and other useful LLVM tidbits (TODO)
diff --git a/www/web/examples/JITTutorial1.html b/www/web/examples/JITTutorial1.html index 245d5d7..b3b2c5b 100644 --- a/www/web/examples/JITTutorial1.html +++ b/www/web/examples/JITTutorial1.html @@ -1,4 +1,4 @@ - diff --git a/www/web/examples/JITTutorial2.html b/www/web/examples/JITTutorial2.html index 02afb25..bab1b5d 100644 --- a/www/web/examples/JITTutorial2.html +++ b/www/web/examples/JITTutorial2.html @@ -1,4 +1,4 @@ - diff --git a/www/web/index.html b/www/web/index.html index f9f57f6..6b9bbe5 100644 --- a/www/web/index.html +++ b/www/web/index.html @@ -2,7 +2,7 @@ - + @@ -51,11 +51,11 @@ a patch.

-28-Oct-2009 +31-Aug-2010

- SVN r83 works with LLVM 2.6. Website updated. + 0.6 released, works with LLVM 2.7.

@@ -63,7 +63,7 @@ a patch.

diff --git a/www/web/license.html b/www/web/license.html index e9b8e73..18574df 100644 --- a/www/web/license.html +++ b/www/web/license.html @@ -2,7 +2,7 @@ - + @@ -42,7 +42,7 @@ where-ever and how-ever you’re able to use LLVM itself.

file in the distribution, and is reproduced here:

-
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:
@@ -74,7 +74,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/www/web/userguide.html b/www/web/userguide.html index 234da97..cb3f252 100644 --- a/www/web/userguide.html +++ b/www/web/userguide.html @@ -2,7 +2,7 @@ - + @@ -71,7 +71,7 @@ information is available here.

Platforms

llvm-py has been built/tested/reported to work on various GNU/Linux flavours, *BSD, Mac OS X; on i386 and amd64 architectures. Windows is not supported, for a variety of reasons.

-
Versions

llvm-py 0.6 requires verion 2.6 of LLVM. It will not work with previous +

Versions

llvm-py 0.6 requires verion 2.7 of LLVM. It will not work with previous versions.

llvm-py has been built and tested with Python 2.6. It should work with Python 2.4 and 2.5. It has not been tried with Python 3.x (patches welcome).

@@ -142,7 +142,7 @@ llvm-py this way:

$ tar jxvf llvm-py-0.6.tar.bz2
 $ cd llvm-py-0.6
-$ sudo python setup.py install
+$ python setup.py install --user

If you need to tell the build script where llvm-config is, do it this way:

@@ -150,7 +150,7 @@ way:

$ tar jxvf llvm-py-0.6.tar.bz2
 $ cd llvm-py-0.6
-$ sudo python setup.py install --llvm-config=/home/mdevan/llvm/Release/bin/llvm-config
+$ python setup.py install --user --llvm-config=/home/mdevan/llvm/Release/bin/llvm-config

To build a debug version of llvm-py, that links against the debug libraries of LLVM, use this:

@@ -159,7 +159,7 @@ libraries of LLVM, use this:

$ tar jxvf llvm-py-0.6.tar.bz2
 $ cd llvm-py-0.6
 $ python setup.py build -g --llvm-config=/home/mdevan/llvm/Debug/bin/llvm-config
-$ sudo python setup.py install --llvm-config=/home/mdevan/llvm/Debug/bin/llvm-config
+$ python setup.py install --user --llvm-config=/home/mdevan/llvm/Debug/bin/llvm-config

Be warned that debug binaries will be huge (100MB+) ! They are required only if you need to debug into LLVM also.

@@ -168,30 +168,19 @@ documentation regarding Installi Python Modules and Distributing Python Modules for more information on such scripts.

Uninstall

-

To get rid of llvm-py completely, if you wish to do so:

+

If you’d installed llvm-py with the --user option, then llvm-py +would be present under ~/.local/lib/python2.6/site-packages. +Otherwise, it might be under /usr/lib/python2.6/site-packages +or /usr/local/lib/python2.6/site-packages. The directory would +vary with your Python version and OS flavour. Look around.

+

Once you’ve located the site-packages directory, the modules and +the "egg" can be removed like so:

-
# rm -rf /usr/lib/python2.6/site-packages/llvm
-# rm -f /usr/lib/python2.6/site-packages/llvm_py-0.6-py2.6.egg-info
+
$ rm -rf <site-packages>/llvm <site-packages>/llvm_py-0.6-py2.6.egg-info
-
    -
  • -

    -You need to be root to do this. -

    -
  • -
  • -

    -Python site package path might be different on your system. -

    -
  • -
  • -

    -Note that there are version numbers (both Python’s and llvm-py’s) - which you might need to change to suit your system. -

    -
  • -
+

See the Python +documentation for more information.

The Concepts

@@ -298,7 +287,7 @@ language code.

Just to get a feel of the LLVM assembly language, here’s a function in C, and the corresponding LLVM assembly (as generated by the demo page):

-
@@ -313,33 +302,33 @@ http://www.gnu.org/software/src-highlite -->

The corresponding LLVM assembly:

-
; ModuleID = '/tmp/webcompile/_22154_0.bc'
-target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
-target triple = "i386-pc-linux-gnu"
+
; ModuleID = '/tmp/webcompile/_7149_0.bc'
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
+target triple = "x86_64-linux-gnu"
 
 define i32 @sum(i32 %n) nounwind readnone {
 entry:
-    %0 = icmp eq i32 %n, 0      ; <i1> [#uses=1]
-    br i1 %0, label %bb2, label %bb1
+  %0 = icmp eq i32 %n, 0                          ; <i1> [#uses=1]
+  br i1 %0, label %bb2, label %bb1
 
-bb1:        ; preds = %entry
-    %1 = add i32 %n, -1     ; <i32> [#uses=2]
-    %2 = icmp eq i32 %1, 0      ; <i1> [#uses=1]
-    br i1 %2, label %sum.exit, label %bb1.i
+bb1:                                              ; preds = %entry
+  %1 = add i32 %n, -1                             ; <i32> [#uses=2]
+  %2 = icmp eq i32 %1, 0                          ; <i1> [#uses=1]
+  br i1 %2, label %sum.exit, label %bb1.i
 
-bb1.i:      ; preds = %bb1
-    %3 = add i32 %n, -2     ; <i32> [#uses=1]
-    %4 = tail call i32 @sum(i32 %3) nounwind        ; <i32> [#uses=1]
-    %5 = add i32 %4, %1     ; <i32> [#uses=1]
-    br label %sum.exit
+bb1.i:                                            ; preds = %bb1
+  %3 = add i32 %n, -2                             ; <i32> [#uses=1]
+  %4 = tail call i32 @sum(i32 %3) nounwind        ; <i32> [#uses=1]
+  %5 = add i32 %4, %1                             ; <i32> [#uses=1]
+  br label %sum.exit
 
-sum.exit:       ; preds = %bb1.i, %bb1
-    %6 = phi i32 [ %5, %bb1.i ], [ 0, %bb1 ]        ; <i32> [#uses=1]
-    %7 = add i32 %6, %n     ; <i32> [#uses=1]
-    ret i32 %7
+sum.exit:                                         ; preds = %bb1.i, %bb1
+  %6 = phi i32 [ %5, %bb1.i ], [ 0, %bb1 ]        ; <i32> [#uses=1]
+  %7 = add i32 %6, %n                             ; <i32> [#uses=1]
+  ret i32 %7
 
-bb2:        ; preds = %entry
-    ret i32 0
+bb2:                                              ; preds = %entry
+  ret i32 0
 }

Note the usage of SSA form. The long string called target datalayout is a @@ -499,7 +488,7 @@ constants CC_* that represent calling conventions

  • -constants IPRED_* and RPRED_* that represent integer and real +constants ICMP_* and FCMP_* that represent integer and real comparison predicates (like less than, greater than etc.)

  • @@ -556,7 +545,7 @@ constants PASS_* that represent various passes llvm.core"
    . However, you might find it more convenient to import llvm-py modules thus:

    -
    @@ -581,7 +570,7 @@ to get online help. (Note: not complete yet!) object first, before you can add global variables, aliases or functions. Modules are created using the static method Module.new:

    -
    @@ -613,7 +602,7 @@ object as argument, i.e., it should have a read() method that returns the entire data in a single call, as is the case with the builtin file object. Here is an example:

    -
    @@ -622,7 +611,7 @@ bcfile = = Module.from_bitcode(bcfile)

    There is corresponding serialization method also, called to_bitcode:

    -
    @@ -634,7 +623,7 @@ The static method from_assembly can be used for this. Similar to the from_bitcode method, this one also takes a file-like object as argument:

    -
    @@ -693,6 +682,15 @@ stringifying them (see below).

    +pointer_size [read-only] +
    +
    +

    + The size in bits of pointers, of the target platform. A value of + zero represents llvm::Module::AnyPointerSize. +

    +
    +
    global_variables [read-only]
    @@ -713,6 +711,14 @@ stringifying them (see below).

    Methods
    +get_type_named(name) +
    +
    +

    + Return a Type object for the given alias name (typedef). +

    +
    +
    add_type_name(name, ty)
    @@ -766,6 +772,15 @@ stringifying them (see below).

    +get_or_insert_function(ty, name) +
    +
    +

    + Like get_function_named, but adds the function first, if not + present (like add_function). +

    +
    +
    verify()
    @@ -783,6 +798,17 @@ stringifying them (see below).

    object fileobj.

    +
    +link_in(other) +
    +
    +

    + Link in another module other into this module. Global variables, + functions etc. are matched and resolved. The other module is no + longer valid and should not be used after this operation. This API + might be replaced with a full-fledged Linker class in the future. +

    +
    Special Methods
    @@ -814,7 +840,7 @@ stringifying them (see below).

    Convention

    All llvm-py objects (where it makes sense), when stringified, return -the LLVM assembly representation. ‘` `print module_obj` '’ for example, +the LLVM assembly representation. print module_obj for example, prints the LLVM assembly form of the entire module.

    Such objects, when compared for equality, internally compare these string representations.

    @@ -1074,28 +1100,30 @@ cellspacing="0" cellpadding="4"> one of the following constants defined in llvm.core:

    -
    -
    TYPE_VOID       = 0
    +
    # Warning: do not rely on actual numerical values!
    +TYPE_VOID       = 0
     TYPE_FLOAT      = 1
     TYPE_DOUBLE     = 2
     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

    Example:

    -
    @@ -1194,7 +1222,7 @@ http://www.gnu.org/software/src-highlite --> function. Used like this:

    -
    @@ -1243,7 +1271,7 @@ http://www.gnu.org/software/src-highlite --> Used like this:

    -
    @@ -1316,7 +1344,7 @@ http://www.gnu.org/software/src-highlite -->

    - TODO missing + A Type object representing the type of the value pointed to.

    @@ -1352,7 +1380,7 @@ http://www.gnu.org/software/src-highlite -->

    Here is an example that demonstrates the creation of types:

    -
    @@ -1396,7 +1424,7 @@ printf = Type.<

    TypeHandle objects are used to create recursive types, like this linked list node structure in C:

    -
    @@ -1432,7 +1460,8 @@ print m
    ; ModuleID = 'mod1'
    -        %struct.node = type { i32, %struct.node* }
    + +%struct.node = type { i32, %struct.node* }

    For more details on what is going on here, please refer the LLVM Programmer’s Manual section @@ -1549,7 +1578,7 @@ created from Python constants. A constant expression is also a constant &# etc) can be specified, to yield a new Constant object. Let’s see some examples:

    -
    @@ -1710,12 +1739,12 @@ cellspacing="0" cellpadding="4">

    Bitwise exclusive-or of k and k2.

    -

    k.icmp(ipred, k2)

    -

    Compare k with k2 using the predicate ipred. See table below for list of predicates for integer operands.

    +

    k.icmp(icmp, k2)

    +

    Compare k with k2 using the predicate icmp. See table below for list of predicates for integer operands.

    -

    k.fcmp(rpred, k2)

    -

    Compare k with k2 using the predicate rpred. See table below for list of predicates for real operands.

    +

    k.fcmp(fcmp, k2)

    +

    Compare k with k2 using the predicate fcmp. See table below for list of predicates for real operands.

    k.shl(k2)

    @@ -1800,7 +1829,7 @@ cellspacing="0" cellpadding="4">
    -

    Predicates for use with icmp instruction are listed below. All +

    Predicates for use with icmp instruction are listed below. All of these are integer constants defined in the llvm.core module.

    - + - + - + - + - + - + - + - + - + - +

    IPRED_EQ

    ICMP_EQ

    Equality

    IPRED_NE

    ICMP_NE

    Inequality

    IPRED_UGT

    ICMP_UGT

    Unsigned greater than

    IPRED_UGE

    ICMP_UGE

    Unsigned greater than or equal

    IPRED_ULT

    ICMP_ULT

    Unsigned less than

    IPRED_ULE

    ICMP_ULE

    Unsigned less than or equal

    IPRED_SGT

    ICMP_SGT

    Signed greater than

    IPRED_SGE

    ICMP_SGE

    Signed greater than or equal

    IPRED_SLT

    ICMP_SLT

    Signed less than

    IPRED_SLE

    ICMP_SLE

    Signed less than or equal

    -

    Predicates for use with fcmp instruction are listed below. All +

    Predicates for use with fcmp instruction are listed below. All of these are integer constants defined in the llvm.core module.

    - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -2016,10 +2045,6 @@ cellspacing="0" cellpadding="4"> - - - - @@ -2032,12 +2057,16 @@ cellspacing="0" cellpadding="4"> + + + + - - + +

    RPRED_FALSE

    FCMP_FALSE

    Always false

    RPRED_OEQ

    FCMP_OEQ

    True if ordered and equal

    RPRED_OGT

    FCMP_OGT

    True if ordered and greater than

    RPRED_OGE

    FCMP_OGE

    True if ordered and greater than or equal

    RPRED_OLT

    FCMP_OLT

    True if ordered and less than

    RPRED_OLE

    FCMP_OLE

    True if ordered and less than or equal

    RPRED_ONE

    FCMP_ONE

    True if ordered and operands are unequal

    RPRED_ORD

    FCMP_ORD

    True if ordered (no NaNs)

    RPRED_UNO

    FCMP_UNO

    True if unordered: isnan(X) | isnan(Y)

    RPRED_UEQ

    FCMP_UEQ

    True if unordered or equal

    RPRED_UGT

    FCMP_UGT

    True if unordered or greater than

    RPRED_UGE

    FCMP_UGE

    True if unordered, greater than or equal

    RPRED_ULT

    FCMP_ULT

    True if unordered, or less than

    RPRED_ULE

    FCMP_ULE

    True if unordered, less than or equal

    RPRED_UNE

    FCMP_UNE

    True if unordered or not equal

    `RPRED_TRUE `

    `FCMP_TRUE `

    Always true

    private

    LINKAGE_LINKER_PRIVATE

    linker_private

    LINKAGE_DLLIMPORT

    dllimport

    extern_weak

    LINKAGE_GHOST

    deprecated — do not use

    LINKAGE_COMMON

    common

    LINKAGE_GHOST

    Stand-in functions

    LINKAGE_LINKER_PRIVATE

    linker_private

    @@ -2151,7 +2180,7 @@ variables can be created either by using the add_global_variable method of the Module class (see above), or by using the static method GlobalVariable.new.

    -
    @@ -2165,7 +2194,7 @@ gv2 = GlobalVariable -
    @@ -2185,7 +2214,7 @@ can be used to indicate that the variable is a global constant.

    Global variables can be delete using the delete method. Do not use the object after calling delete on it.

    -
    @@ -2267,7 +2296,7 @@ References to functions already present in a module can be retrieved via Function.get. All functions in a module can be enumerated by iterating over module_obj.functions.

    -
    @@ -2297,7 +2326,7 @@ called with a module object, an instrinic ID (which is a numeric constant) and a list of the types of arguments (which LLVM uses to resolve overloaded intrinsic functions).

    -
    @@ -2317,21 +2346,19 @@ in llvm.core. These are:

    width="100%" frame="border" cellspacing="0" cellpadding="4"> - - - + + + + -

    INTR_ALPHA_UMULH

    INTR_ANNOTATION

    INTR_ATOMIC_CMP_SWAP

    - -

    INTR_ATOMIC_LOAD_ADD

    INTR_ATOMIC_LOAD_AND

    -

    INTR_ATOMIC_LOAD_MAX

    +

    INTR_ATOMIC_LOAD_MAX

    INTR_ATOMIC_LOAD_MIN

    INTR_ATOMIC_LOAD_NAND

    INTR_ATOMIC_LOAD_OR

    @@ -2340,18 +2367,16 @@ cellspacing="0" cellpadding="4">

    INTR_ATOMIC_LOAD_SUB

    INTR_ATOMIC_LOAD_UMAX

    INTR_ATOMIC_LOAD_UMIN

    +

    INTR_ATOMIC_LOAD_XOR

    -

    INTR_ATOMIC_LOAD_XOR

    INTR_ATOMIC_SWAP

    INTR_BSWAP

    - -

    INTR_CONVERTFF

    INTR_CONVERTFSI

    -

    INTR_CONVERTFUI

    +

    INTR_CONVERTFUI

    INTR_CONVERTSIF

    INTR_CONVERTSS

    INTR_CONVERTSU

    @@ -2360,58 +2385,52 @@ cellspacing="0" cellpadding="4">

    INTR_CONVERTUIF

    INTR_CONVERTUS

    INTR_CONVERTUU

    +

    INTR_COS

    -

    INTR_COS

    INTR_CTLZ

    INTR_CTPOP

    - -

    INTR_CTTZ

    INTR_DBG_DECLARE

    -

    INTR_DBG_FUNC_START

    - - -

    INTR_DBG_REGION_END

    -

    INTR_DBG_REGION_START

    -

    INTR_DBG_STOPPOINT

    +

    INTR_DBG_VALUE

    INTR_EH_DWARF_CFA

    INTR_EH_EXCEPTION

    INTR_EH_RETURN_I32

    INTR_EH_RETURN_I64

    -

    INTR_EH_SELECTOR_I32

    -

    INTR_EH_SELECTOR_I64

    +

    INTR_EH_SELECTOR

    +

    INTR_EH_SJLJ_CALLSITE

    +

    INTR_EH_SJLJ_LONGJMP

    -

    INTR_EH_SJLJ_LONGJMP

    INTR_EH_SJLJ_LSDA

    INTR_EH_SJLJ_SETJMP

    - - -

    INTR_EH_TYPEID_FOR_I32

    -

    INTR_EH_TYPEID_FOR_I64

    +

    INTR_EH_TYPEID_FOR

    INTR_EH_UNWIND_INIT

    INTR_EXP

    INTR_EXP2

    INTR_FLT_ROUNDS

    +

    INTR_FRAMEADDRESS

    -

    INTR_FRAMEADDRESS

    INTR_GCREAD

    INTR_GCROOT

    - -

    INTR_GCWRITE

    INTR_INIT_TRAMPOLINE

    -

    INTR_LOG

    +

    INTR_INVARIANT_END

    +

    INTR_INVARIANT_START

    +

    INTR_LIFETIME_END

    +

    INTR_LIFETIME_START

    + + +

    INTR_LOG

    INTR_LOG10

    INTR_LOG2

    INTR_LONGJMP

    @@ -2420,23 +2439,22 @@ cellspacing="0" cellpadding="4">

    INTR_MEMCPY

    INTR_MEMMOVE

    INTR_MEMORY_BARRIER

    +

    INTR_MEMSET

    -

    INTR_MEMSET

    +

    INTR_OBJECTSIZE

    INTR_PCMARKER

    INTR_POW

    +

    INTR_POWI

    -

    INTR_POWI

    INTR_PREFETCH

    INTR_PTR_ANNOTATION

    - -

    INTR_READCYCLECOUNTER

    INTR_RETURNADDRESS

    -

    INTR_SADD_WITH_OVERFLOW

    +

    INTR_SADD_WITH_OVERFLOW

    INTR_SETJMP

    INTR_SIGLONGJMP

    INTR_SIGSETJMP

    @@ -2445,18 +2463,16 @@ cellspacing="0" cellpadding="4">

    INTR_SIN

    INTR_SMUL_WITH_OVERFLOW

    INTR_SQRT

    +

    INTR_SSUB_WITH_OVERFLOW

    -

    INTR_SSUB_WITH_OVERFLOW

    INTR_STACKPROTECTOR

    INTR_STACKRESTORE

    - -

    INTR_STACKSAVE

    INTR_TRAP

    -

    INTR_UADD_WITH_OVERFLOW

    +

    INTR_UADD_WITH_OVERFLOW

    INTR_UMUL_WITH_OVERFLOW

    INTR_USUB_WITH_OVERFLOW

    INTR_VACOPY

    @@ -2469,7 +2485,8 @@ cellspacing="0" cellpadding="4">
    -

    There are also target-specific intrinsics (which correspond to that +

    ATTR_ZEXT, zeroext +There are also target-specific intrinsics (which correspond to that target’s CPU instructions) available, but are omitted here for brevity. Full list can be seen from _intrinsic_ids.py. @@ -2551,7 +2568,7 @@ set or got with the property collector.

    got using the read-only property args. These can be iterated over, and also be indexed via integers. An example:

    -
    @@ -2572,7 +2589,7 @@ can be got via basic_block_count method. Note that get_entry_basic_block is slightly faster than basic_blocks[0] and so is basic_block_count, over len(f.basic_blocks).

    -
    @@ -2593,9 +2610,138 @@ n =

    Functions can be deleted using the method delete. This deletes them from their containing module. All references to the function object should be dropped after delete has been called.

    -

    Functions can be verified with the verify method. This does not work -properly yet (aborts on errors), investigation pending.

    +

    Functions can be verified with the verify method. Note that this may +not work properly (aborts on errors).

    TODO function attributes

    +
    + +++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + Value + + Equivalent LLVM Assembly Keyword +
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~a + +
    + ATTR_ALWAYS_INLINE + + alwaysinline +
    + ATTR_INLINE_HINT + + inlinehint +
    + ATTR_NO_INLINE + + noinline +
    + ATTR_OPTIMIZE_FOR_SIZE + + optsize +
    + ATTR_NO_RETURN + + noreturn +
    + ATTR_NO_UNWIND + + nounwind +
    + ATTR_READ_NONE + + readnone +
    + ATTR_READONLY + + readonly +
    + ATTR_STACK_PROTECT + + ssp +
    + ATTR_STACK_PROTECT_REQ + + sspreq +
    + ATTR_NO_REDZONE + + noredzone +
    + ATTR_NO_IMPLICIT_FLOAT + + noimplicitfloat +
    + ATTR_NAKED + + naked +
    +

    Argument (llvm.core)

    The args property of llvm.core.Function objects yields llvm.core.Argument objects. This allows for setting attributes for @@ -2636,14 +2782,6 @@ cellspacing="0" cellpadding="4"> signext - - - ATTR_NO_RETURN - - - noreturn - - ATTR_IN_REG @@ -2652,30 +2790,6 @@ cellspacing="0" cellpadding="4"> inreg - - - ATTR_STRUCT_RET - - - sret - - - - - ATTR_NO_UNWIND - - - nounwind - - - - - ATTR_NO_ALIAS - - - noalias - - ATTR_BY_VAL @@ -2684,6 +2798,30 @@ cellspacing="0" cellpadding="4"> byval + + + ATTR_STRUCT_RET + + + sret + + + + + ATTR_NO_ALIAS + + + noalias + + + + + ATTR_NO_CAPTURE + + + nocapture + + ATTR_NEST @@ -2692,49 +2830,31 @@ cellspacing="0" cellpadding="4"> nest - - - ATTR_READ_NONE - - - readnone - - - - - ATTR_READONLY - - - readonly - -

    The corresponding LLVM docs provide more information.

    -

    The alignment of any parameter can also be set via set_argument(a) -where a is a power of 2.

    +

    The alignment of any parameter can be set via the alignment +property, to any power of 2.

    Basic Block (llvm.core)

    TODO

    Builder (llvm.core)

    TODO

    Instructions (llvm.core)

    TODO

    -

    Module Provider (llvm.core)

    -

    TODO

    Target Data (llvm.ee)

    TODO

    Execution Engine (llvm.ee)

    TODO. For now, see test/example-jit.py.

    -

    Pass Managers and Passes (llvm.passes)

    +

    Pass Manager and Passes (llvm.passes)

    TODO. For now, see test/passes.py.

    About the llvm-py Project

    llvm-py lives at -http://mdevan.nfshost.com/llvm-py/. +http://www.mdevan.org/llvm-py/. The code (subversion repository) and the issue tracker are hosted on the Google code hosting service, at http://code.google.com/p/llvm-py/. @@ -2752,12 +2872,12 @@ distribution.

    are most welcome. You can checkout the latest SVN HEAD from here.

    Mahadevan R wrote llvm-py and works on it in his spare time. He can be -reached at mdevan.foobar@gmail.com.

    +reached at mdevan@mdevan.org.