Hello community, here is the log from the commit of package python3-llvmlite for openSUSE:Factory checked in at 2016-11-21 14:26:24 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python3-llvmlite (Old) and /work/SRC/openSUSE:Factory/.python3-llvmlite.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python3-llvmlite" Changes: -------- --- /work/SRC/openSUSE:Factory/python3-llvmlite/python3-llvmlite.changes 2016-11-13 22:51:03.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.python3-llvmlite.new/python3-llvmlite.changes 2016-11-21 14:26:26.000000000 +0100 @@ -1,0 +2,11 @@ +Sat Nov 5 22:00:25 UTC 2016 - [email protected] + +- specfile: + * removed hardcoded version in %files section + +- update to version 0.14.0: + * PR #104: Add binding to get and view function control-flow graph. + * PR #210: Improve llvmdev recipe. + * PR #212: Add initializer for the native assembly parser. + +------------------------------------------------------------------- Old: ---- llvmlite-0.13.0.tar.gz New: ---- llvmlite-0.14.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python3-llvmlite.spec ++++++ --- /var/tmp/diff_new_pack.u51IXb/_old 2016-11-21 14:26:26.000000000 +0100 +++ /var/tmp/diff_new_pack.u51IXb/_new 2016-11-21 14:26:26.000000000 +0100 @@ -16,7 +16,7 @@ Name: python3-llvmlite -Version: 0.13.0 +Version: 0.14.0 Release: 0 License: BSD-2-Clause Summary: Lightweight wrapper around basic LLVM functionality @@ -79,6 +79,6 @@ %defattr(-,root,root,-) %doc README.rst LICENSE %{python3_sitearch}/llvmlite/ -%{python3_sitearch}/llvmlite-0.13.0-py3.5.egg-info +%{python3_sitearch}/llvmlite-%{version}-*.egg-info %changelog ++++++ llvmlite-0.13.0.tar.gz -> llvmlite-0.14.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/llvmlite-0.13.0/PKG-INFO new/llvmlite-0.14.0/PKG-INFO --- old/llvmlite-0.13.0/PKG-INFO 2016-08-24 16:55:53.000000000 +0200 +++ new/llvmlite-0.14.0/PKG-INFO 2016-10-18 16:24:22.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: llvmlite -Version: 0.13.0 +Version: 0.14.0 Summary: lightweight wrapper around basic LLVM functionality Home-page: http://llvmlite.pydata.org Author: Continuum Analytics, Inc. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/llvmlite-0.13.0/ffi/value.cpp new/llvmlite-0.14.0/ffi/value.cpp --- old/llvmlite-0.13.0/ffi/value.cpp 2016-08-18 10:10:30.000000000 +0200 +++ new/llvmlite-0.14.0/ffi/value.cpp 2016-09-12 16:47:23.000000000 +0200 @@ -2,6 +2,9 @@ #include "llvm-c/Core.h" #include "core.h" +// the following is needed for WriteGraph() +#include "llvm/Analysis/CFGPrinter.h" + extern "C" { API_EXPORT(void) @@ -83,4 +86,19 @@ return LLVMIsDeclaration(GV); } + +API_EXPORT(void) +LLVMPY_WriteCFG(LLVMValueRef Fval, const char **OutStr, int ShowInst) { + using namespace llvm; + Function *F = unwrap<Function>(Fval); + std::string buffer; + raw_string_ostream stream(buffer); + // Note: The (const Function*)F is necessary to trigger the right behavior. + // A non constant Function* will result in the instruction not + // printed regardless of the value in the 3rd argument. + WriteGraph(stream, (const Function*)F, !ShowInst); + *OutStr = LLVMPY_CreateString(stream.str().c_str()); +} + + } // end extern "C" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/llvmlite-0.13.0/llvmlite/_version.py new/llvmlite-0.14.0/llvmlite/_version.py --- old/llvmlite-0.13.0/llvmlite/_version.py 2016-08-24 16:55:53.000000000 +0200 +++ new/llvmlite-0.14.0/llvmlite/_version.py 2016-10-18 16:24:22.000000000 +0200 @@ -4,8 +4,8 @@ # unpacked source archive. Distribution tarballs contain a pre-generated copy # of this file. -version_version = '0.13.0' -version_full = 'e924ffa17a010bf6648b54adc6f8d4b4b7ec8755' +version_version = '0.14.0' +version_full = '2dad935106b4ad224d9175ccefe8e265ef6be6b8' def get_versions(default={}, verbose=False): return {'version': version_version, 'full': version_full} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/llvmlite-0.13.0/llvmlite/binding/__init__.py new/llvmlite-0.14.0/llvmlite/binding/__init__.py --- old/llvmlite-0.13.0/llvmlite/binding/__init__.py 2014-11-06 16:29:20.000000000 +0100 +++ new/llvmlite-0.14.0/llvmlite/binding/__init__.py 2016-09-12 16:47:23.000000000 +0200 @@ -13,3 +13,4 @@ from .targets import * from .transforms import * from .value import * +from .analysis import * diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/llvmlite-0.13.0/llvmlite/binding/analysis.py new/llvmlite-0.14.0/llvmlite/binding/analysis.py --- old/llvmlite-0.13.0/llvmlite/binding/analysis.py 1970-01-01 01:00:00.000000000 +0100 +++ new/llvmlite-0.14.0/llvmlite/binding/analysis.py 2016-09-12 16:47:23.000000000 +0200 @@ -0,0 +1,71 @@ +""" +A collection of analysis utils +""" + +from __future__ import absolute_import, print_function + +from ctypes import POINTER, c_char_p, c_int + +from llvmlite import ir +from . import ffi +from .module import parse_assembly + + +def get_function_cfg(func, show_inst=True): + """Return a string of the control-flow graph of the function in DOT + format. If the input `func` is not a materialized function, the module + containing the function is parsed to create an actual LLVM module. + The `show_inst` flag controls whether the instructions of each block + are printed. + """ + assert func is not None + if isinstance(func, ir.Function): + mod = parse_assembly(str(func.module)) + func = mod.get_function(func.name) + + # Assume func is a materialized function + with ffi.OutputString() as dotstr: + ffi.lib.LLVMPY_WriteCFG(func, dotstr, show_inst) + return str(dotstr) + + +def view_dot_graph(graph, filename=None, view=False): + """ + View the given DOT source. If view is True, the image is rendered + and viewed by the default application in the system. The file path of + the output is returned. If view is False, a graphviz.Source object is + returned. If view is False and the environment is in a IPython session, + an IPython image object is returned and can be displayed inline in the + notebook. + + This function requires the graphviz package. + + Args + ---- + - graph [str]: a DOT source code + - filename [str]: optional. if given and view is True, this specifies + the file path for the rendered output to write to. + - view [bool]: if True, opens the rendered output file. + + """ + # Optionally depends on graphviz package + import graphviz as gv + + src = gv.Source(graph) + if view: + # Returns the output file path + return src.render(filename, view=view) + else: + # Attempts to show the graph in IPython notebook + try: + __IPYTHON__ + except NameError: + return src + else: + import IPython.display as display + format = 'svg' + return display.SVG(data=src.pipe(format)) + + +# Ctypes binding +ffi.lib.LLVMPY_WriteCFG.argtypes = [ffi.LLVMValueRef, POINTER(c_char_p), c_int] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/llvmlite-0.13.0/llvmlite/binding/executionengine.py new/llvmlite-0.14.0/llvmlite/binding/executionengine.py --- old/llvmlite-0.13.0/llvmlite/binding/executionengine.py 2016-03-10 13:42:26.000000000 +0100 +++ new/llvmlite-0.14.0/llvmlite/binding/executionengine.py 2016-09-14 15:22:31.000000000 +0200 @@ -1,10 +1,9 @@ from __future__ import print_function, absolute_import -from ctypes import (byref, POINTER, c_char_p, c_bool, c_uint, c_void_p, +from ctypes import (POINTER, c_char_p, c_bool, c_void_p, c_int, c_uint64, c_size_t, CFUNCTYPE, string_at, cast, py_object, Structure) import warnings -import weakref from . import ffi, targets diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/llvmlite-0.13.0/llvmlite/binding/initfini.py new/llvmlite-0.14.0/llvmlite/binding/initfini.py --- old/llvmlite-0.13.0/llvmlite/binding/initfini.py 2016-06-16 15:22:02.000000000 +0200 +++ new/llvmlite-0.14.0/llvmlite/binding/initfini.py 2016-10-17 16:12:33.000000000 +0200 @@ -43,6 +43,13 @@ ffi.lib.LLVMPY_InitializeNativeAsmPrinter() +def initialize_native_asmparser(): + """ + Initialize the native ASM parser. + """ + ffi.lib.LLVMPY_InitializeNativeAsmParser() + + def shutdown(): ffi.lib.LLVMPY_Shutdown() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/llvmlite-0.13.0/llvmlite/binding/module.py new/llvmlite-0.14.0/llvmlite/binding/module.py --- old/llvmlite-0.13.0/llvmlite/binding/module.py 2016-07-29 20:45:20.000000000 +0200 +++ new/llvmlite-0.14.0/llvmlite/binding/module.py 2016-09-14 15:22:31.000000000 +0200 @@ -1,6 +1,6 @@ from __future__ import print_function, absolute_import from ctypes import (c_char_p, byref, POINTER, c_bool, create_string_buffer, - c_void_p, c_size_t, cast, string_at) + c_size_t, string_at) from . import ffi from .linker import link_modules diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/llvmlite-0.13.0/llvmlite/binding/targets.py new/llvmlite-0.14.0/llvmlite/binding/targets.py --- old/llvmlite-0.13.0/llvmlite/binding/targets.py 2016-06-27 15:12:02.000000000 +0200 +++ new/llvmlite-0.14.0/llvmlite/binding/targets.py 2016-09-14 15:22:31.000000000 +0200 @@ -1,9 +1,8 @@ from __future__ import print_function, absolute_import -import collections import os from ctypes import (POINTER, c_char_p, c_longlong, c_int, c_size_t, - c_void_p, string_at, byref) + c_void_p, string_at) from . import ffi from .common import _decode_string, _encode_string diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/llvmlite-0.13.0/llvmlite/binding/value.py new/llvmlite-0.14.0/llvmlite/binding/value.py --- old/llvmlite-0.13.0/llvmlite/binding/value.py 2016-02-16 20:51:36.000000000 +0100 +++ new/llvmlite-0.14.0/llvmlite/binding/value.py 2016-09-14 15:22:31.000000000 +0200 @@ -1,7 +1,6 @@ from ctypes import POINTER, c_char_p, c_int import enum -import itertools from . import ffi from .common import _decode_string, _encode_string @@ -157,6 +156,7 @@ """ return ffi.lib.LLVMPY_IsDeclaration(self) + # FFI ffi.lib.LLVMPY_PrintValueToString.argtypes = [ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/llvmlite-0.13.0/llvmlite/ir/instructions.py new/llvmlite-0.14.0/llvmlite/ir/instructions.py --- old/llvmlite-0.13.0/llvmlite/ir/instructions.py 2016-08-18 10:20:06.000000000 +0200 +++ new/llvmlite-0.14.0/llvmlite/ir/instructions.py 2016-09-29 18:28:38.000000000 +0200 @@ -4,7 +4,6 @@ from __future__ import print_function, absolute_import -from ..six import StringIO from . import types from .values import (Block, Function, Value, NamedValue, Constant, MetaDataArgument, MetaDataString, AttributeSet) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/llvmlite-0.13.0/llvmlite/ir/values.py new/llvmlite-0.14.0/llvmlite/ir/values.py --- old/llvmlite-0.13.0/llvmlite/ir/values.py 2016-08-18 10:20:06.000000000 +0200 +++ new/llvmlite-0.14.0/llvmlite/ir/values.py 2016-09-14 15:22:31.000000000 +0200 @@ -8,7 +8,6 @@ import string from .. import six -from ..six import StringIO from . import types, _utils from ._utils import _StrCaching, _StringReferenceCaching, _HasMetadata diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/llvmlite-0.13.0/llvmlite/tests/customize.py new/llvmlite-0.14.0/llvmlite/tests/customize.py --- old/llvmlite-0.13.0/llvmlite/tests/customize.py 2014-10-20 19:57:02.000000000 +0200 +++ new/llvmlite-0.14.0/llvmlite/tests/customize.py 2016-09-14 15:22:31.000000000 +0200 @@ -1,6 +1,5 @@ # XXX Ripped off from numba.tests; we should factor it out somewhere? -import argparse import collections import contextlib import cProfile diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/llvmlite-0.13.0/llvmlite/tests/test_binding.py new/llvmlite-0.14.0/llvmlite/tests/test_binding.py --- old/llvmlite-0.13.0/llvmlite/tests/test_binding.py 2016-07-29 20:45:20.000000000 +0200 +++ new/llvmlite-0.14.0/llvmlite/tests/test_binding.py 2016-10-17 16:12:33.000000000 +0200 @@ -1,7 +1,7 @@ from __future__ import print_function, absolute_import import ctypes -from ctypes import * +from ctypes import CFUNCTYPE, c_int from ctypes.util import find_library import gc import locale @@ -111,6 +111,18 @@ }} """ + +asm_inlineasm = r""" + ; ModuleID = '<string>' + target triple = "{triple}" + + define void @foo() {{ + call void asm sideeffect "nop", ""() + ret void + }} + """ + + class BaseTest(TestCase): def setUp(self): @@ -991,6 +1003,44 @@ llvm.load_library_permanently(libm) +class TestAnalysis(BaseTest): + def build_ir_module(self): + m = ir.Module() + ft = ir.FunctionType(ir.IntType(32), [ir.IntType(32), ir.IntType(32)]) + fn = ir.Function(m, ft, "foo") + bd = ir.IRBuilder(fn.append_basic_block()) + x, y = fn.args + z = bd.add(x, y) + bd.ret(z) + return m + + def test_get_function_cfg_on_ir(self): + mod = self.build_ir_module() + foo = mod.get_global('foo') + dot_showing_inst = llvm.get_function_cfg(foo) + dot_without_inst = llvm.get_function_cfg(foo, show_inst=False) + inst = "%.5 = add i32 %.1, %.2" + self.assertIn(inst, dot_showing_inst) + self.assertNotIn(inst, dot_without_inst) + + def test_function_cfg_on_llvm_value(self): + defined = self.module().get_function('sum') + dot_showing_inst = llvm.get_function_cfg(defined, show_inst=True) + dot_without_inst = llvm.get_function_cfg(defined, show_inst=False) + # Check "digraph" + prefix = 'digraph' + self.assertIn(prefix, dot_showing_inst) + self.assertIn(prefix, dot_without_inst) + # Check function name + fname = "CFG for 'sum' function" + self.assertIn(fname, dot_showing_inst) + self.assertIn(fname, dot_without_inst) + # Check instruction + inst = "%.3 = add i32 %.1, %.2" + self.assertIn(inst, dot_showing_inst) + self.assertNotIn(inst, dot_without_inst) + + class TestGlobalVariables(BaseTest): def check_global_variable_linkage(self, linkage, has_undef=True): # This test default initializer on global variables with different @@ -1046,5 +1096,15 @@ self.check_global_variable_linkage('weak_odr') [email protected](platform.machine().startswith('x86'), "only on x86") +class TestInlineAsm(BaseTest): + def test_inlineasm(self): + llvm.initialize_native_asmparser() + m = self.module(asm=asm_inlineasm) + tm = self.target_machine() + asm = tm.emit_assembly(m) + self.assertIn('nop', asm) + + if __name__ == "__main__": unittest.main() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/llvmlite-0.13.0/llvmlite/tests/test_ir.py new/llvmlite-0.14.0/llvmlite/tests/test_ir.py --- old/llvmlite-0.13.0/llvmlite/tests/test_ir.py 2016-08-18 10:20:06.000000000 +0200 +++ new/llvmlite-0.14.0/llvmlite/tests/test_ir.py 2016-09-14 15:22:31.000000000 +0200 @@ -10,13 +10,10 @@ import re import textwrap import unittest -from array import array -from collections import OrderedDict from . import TestCase from llvmlite import ir from llvmlite import binding as llvm -from llvmlite import six int1 = ir.IntType(1) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/llvmlite-0.13.0/llvmlite/utils.py new/llvmlite-0.14.0/llvmlite/utils.py --- old/llvmlite-0.13.0/llvmlite/utils.py 2014-11-25 12:34:23.000000000 +0100 +++ new/llvmlite-0.14.0/llvmlite/utils.py 2016-09-14 15:22:31.000000000 +0200 @@ -1,6 +1,5 @@ import os -import shutil import sys
