Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • inducer/islpy
  • isuruf/islpy
  • kaushikcfd/islpy
  • mattwala/islpy
4 results
Show changes
Showing with 2023 additions and 4168 deletions
# -*- coding: utf-8 -*-
#
# islpy documentation build configuration file, created by
# sphinx-quickstart on Sun Jul 10 16:41:50 2011.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
import re
from urllib.request import urlopen
#import sys, os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
_conf_url = \
"https://raw.githubusercontent.com/inducer/sphinxconfig/main/sphinxconfig.py"
with urlopen(_conf_url) as _inf:
exec(compile(_inf.read(), _conf_url, "exec"), globals())
# -- General configuration -----------------------------------------------------
extensions.remove("sphinx.ext.linkcode") # noqa: F821
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'
copyright = "2011-21, Andreas Kloeckner"
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx', 'sphinx.ext.pngmath']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix of source filenames.
source_suffix = '.rst'
# The encoding of source files.
#source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'islpy'
copyright = u'2011-15, Andreas Kloeckner'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
ver_dic = {}
exec(compile(open("../islpy/version.py").read(), "../islpy/version.py", 'exec'), ver_dic)
with open("../islpy/version.py") as vfile:
exec(compile(vfile.read(), "../islpy/version.py", "exec"), ver_dic)
version = ".".join(str(x) for x in ver_dic["VERSION"])
# The full version, including alpha/beta/rc tags.
release = ver_dic["VERSION_TEXT"]
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['_build']
# The reST default role (used for this markup: `text`) to use for all documents.
#default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []
# -- Options for HTML output ---------------------------------------------------
try:
import sphinx_bootstrap_theme
except:
from warnings import warn
warn("I would like to use the sphinx bootstrap theme, but can't find it.\n"
"'pip install sphinx_bootstrap_theme' to fix.")
else:
# Activate the theme.
html_theme = 'bootstrap'
html_theme_path = sphinx_bootstrap_theme.get_html_theme_path()
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
html_theme_options = {
"navbar_fixed_top": "true",
"navbar_site_name": "Contents",
'bootstrap_version': '3',
'source_link_position': 'footer',
}
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = []
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
#html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = None
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}
# If false, no module index is generated.
#html_domain_indices = True
# If false, no index is generated.
#html_use_index = True
# If true, the index is split into individual pages for each letter.
#html_split_index = False
# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = None
# Output file base name for HTML help builder.
htmlhelp_basename = 'islpydoc'
# -- Options for LaTeX output --------------------------------------------------
# The paper size ('letter' or 'a4').
#latex_paper_size = 'letter'
# The font size ('10pt', '11pt' or '12pt').
#latex_font_size = '10pt'
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('index', 'islpy.tex', u'islpy Documentation',
u'Andreas Kloeckner', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False
# If true, show page references after internal links.
#latex_show_pagerefs = False
# If true, show URL addresses after external links.
#latex_show_urls = False
# Additional stuff for the LaTeX preamble.
#latex_preamble = ''
# Documents to append as an appendix to all manuals.
#latex_appendices = []
# If false, no module index is generated.
#latex_domain_indices = True
# -- Options for manual page output --------------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'islpy', u'islpy Documentation',
[u'Andreas Kloeckner'], 1)
]
# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'http://docs.python.org/': None}
intersphinx_mapping = {
"python": ("https://docs.python.org/3/", None),
}
def autodoc_process_signature(app, what, name, obj, options, signature,
......@@ -256,24 +41,55 @@ def autodoc_process_signature(app, what, name, obj, options, signature,
def autodoc_process_docstring(app, what, name, obj, options, lines):
from inspect import isclass, isroutine, ismethod
UNDERSCORE_WHITELIST = ["__len__", "__hash__", "__eq__", "__ne__"]
# clear out redundant pybind-generated member list
if any("Members" in ln for ln in lines):
del lines[:]
arg_list_re = re.compile(r"^([a-zA-Z0-9_]+)\((.*?)\)")
from inspect import isclass, isroutine
UNDERSCORE_WHITELIST = ["__len__", "__hash__", "__eq__", "__ne__"] # noqa: N806
if isclass(obj) and obj.__name__[0].isupper():
methods = [nm for nm in dir(obj)
if isroutine(getattr(obj, nm))
and (not nm.startswith("_") or nm in UNDERSCORE_WHITELIST)]
def gen_method_string(meth):
result = ":meth:`%s`" % meth
if not ismethod(getattr(obj, meth)):
result += " (static)"
def gen_method_string(meth_name):
try:
result = ":meth:`%s`" % meth_name
meth_obj = getattr(obj, meth_name)
if meth_obj.__doc__ is None:
return result
doc_match = arg_list_re.match(meth_obj.__doc__)
if doc_match is None:
# print(f"'{meth_obj.__doc__}' did not match arg list RE")
return result
arg_list = doc_match.group(2).split(", ")
if "self" not in arg_list:
result += " (static)"
return result
return result
except Exception:
from traceback import print_exc
print_exc()
raise
if methods:
lines[:] = [".. hlist::", " :columns: 3", ""] + [
" * "+gen_method_string(meth)
for meth in methods] + lines
lines[:] = [".. hlist::", " :columns: 2", ""] + [
" * "+gen_method_string(meth_name)
for meth_name in methods] + lines
for nm in methods:
underscore_autodoc = []
if nm in UNDERSCORE_WHITELIST:
underscore_autodoc.append(".. automethod:: %s" % nm)
if underscore_autodoc:
lines.append("")
lines.extend(underscore_autodoc)
def setup(app):
......
......@@ -2,7 +2,7 @@ Welcome to islpy's documentation!
=================================
islpy is a Python wrapper around Sven Verdoolaege's `isl
<http://isl.gforge.inria.fr/>`_, a library for manipulating sets and
<https://libisl.sourceforge.io/>`_, a library for manipulating sets and
relations of integer points bounded by linear constraints.
Supported operations on sets include
......@@ -52,7 +52,7 @@ Overview
This manual will not try to teach you much about the isl itself, it simply
lists, in a reference fashion, all the entrypoints available in :mod:`islpy`.
To get information on how to use the isl, see the real `isl manual
<http://isl.gforge.inria.fr/manual.pdf>`_. The `manual
<https://libisl.sourceforge.io/manual.pdf>`_. The `manual
<http://barvinok.gforge.inria.fr/barvinok.pdf>`_ for the `barvinok
package <http://barvinok.gforge.inria.fr/>`_ is also quite helpful to get
an idea.
......@@ -62,6 +62,16 @@ an idea.
misc
reference
ref_fundamental
ref_expr
ref_set
ref_geo
ref_ast
ref_flow
ref_schedule
ref_containers
🚀 Github <https://github.com/inducer/islpy>
💾 Download Releases <https://pypi.python.org/pypi/islpy>
Indices and tables
------------------
......
......@@ -86,14 +86,28 @@ See also :ref:`gen-remarks`.
User-visible Changes
====================
Version 2014.3
Version 2016.2
--------------
.. note::
This version is currently in development and can be obtained from
islpy's version control.
* Update for isl 0.17
* Add :func:`islpy.make_zero_and_vars`
Version 2016.1.1
----------------
* Add :func:`islpy.make_zero_and_vars`
* Do not turn on small-integer optimization by default
(to avoid build trouble on old compilers)
Version 2016.1
--------------
* Update for isl 0.16
Version 2014.2.1
----------------
......@@ -104,7 +118,7 @@ Version 2014.2
* A large number of previously unavailable functions are now exposed.
* Sebastian Pop's `imath <https://github.com/creachadair/imath>`_ support has
* Sebastian Pop's `imath <https://github.com/creachadair/imath>`__ support has
been merged into the version of isl that ships with :mod:`islpy`. This means
that unless a user specifically requests a build against GMP, :mod:`islpy`
is (a) entirely self-contained and depends only on a C++ compiler and
......@@ -119,7 +133,7 @@ Version 2014.1
incompatible changes as well.
Now :class:`islpy.Val` is used to represent all numbers going
into and out of :mod:`islpy`. :mod:`gmpy` is no longer a dependency
into and out of :mod:`islpy`. ``gmpy`` is no longer a dependency
of :mod:`islpy`. The following rules apply for this interface change:
* You can pass (up to ``long int``-sized) integers to methods of
......@@ -142,13 +156,13 @@ Version 2011.3
--------------
* Add :meth:`islpy.Set.project_out_except` and friends.
* Add :meth:`islpy.Set.remove_divs_of_dim_type` and friends.
* :class:`islpy.Dim` was renamed to :class:`islpy.Space` in isl.
* :class:`islpy.Div` was removed and replaced by :class:`islpy.Aff`
* Add ``islpy.Set.remove_divs_of_dim_type`` and friends.
* ``islpy.Dim`` was renamed to :class:`islpy.Space` in isl.
* ``islpy.Div`` was removed and replaced by :class:`islpy.Aff`
wherever it was used previously.
* :meth:`islpy.BasicSet.as_set`
* ``islpy.BasicSet.as_set`
and
:meth:`islpy.BasicMap.as_map`
``islpy.BasicMap.as_map``
were removed.
* :ref:`automatic-casts` were added.
* Support for more Python :class:`set`-like behavior was added. In particular,
......@@ -172,3 +186,22 @@ Version 2011.1
--------------
* Initial release.
Documentation Cross-References
------------------------------
.. class:: unsigned
See :class:`int`.
.. class:: long
See :class:`int`.
.. class:: size_t
See :class:`int`.
.. class:: double
See :class:`float`.
Reference: Abstract Syntax Trees
================================
.. currentmodule:: islpy
.. versionadded:: 2014.1
Symbolic Constants
------------------
.. autoclass:: ast_expr_op_type
:members:
:undoc-members:
:exclude-members: @entries
.. autoclass:: ast_expr_type
:members:
:undoc-members:
:exclude-members: @entries
.. autoclass:: ast_node_type
:members:
:undoc-members:
:exclude-members: @entries
.. autoclass:: ast_loop_type
:members:
:undoc-members:
:exclude-members: @entries
AST Expression
--------------
.. autoclass:: AstExpr
:members:
AST Node
--------
.. autoclass:: AstNode
:members:
AST Build
---------
.. autoclass:: AstBuild
:members:
AST Print Options
-----------------
.. autoclass:: AstPrintOptions
:members:
Canonical Names for Internal Module
-----------------------------------
.. ::
This should switch to using ``:canonical:`` once Sphinx 4.0 is released.
.. currentmodule:: islpy._isl
.. class:: ast_expr_op_type
See :class:`islpy.ast_expr_op_type`.
.. class:: ast_expr_type
See :class:`islpy.ast_expr_type`.
.. class:: ast_node_type
See :class:`islpy.ast_node_type`.
.. class:: ast_loop_type
See :class:`islpy.ast_loop_type`.
.. class:: AstExpr
See :class:`islpy.AstExpr`.
.. class:: AstNode
See :class:`islpy.AstNode`.
.. class:: AstBuild
See :class:`islpy.AstBuild`.
.. class:: AstPrintOptions
See :class:`islpy.AstPrintOptions`.
Reference: Containers
=====================
.. currentmodule:: islpy
Lists
^^^^^
.. autoclass:: IdList
:members:
.. autoclass:: ValList
:members:
.. autoclass:: BasicSetList
:members:
.. autoclass:: AffList
:members:
.. autoclass:: PwAffList
:members:
.. autoclass:: PwMultiAffList
:members:
.. autoclass:: UnionPwAffList
:members:
.. autoclass:: UnionPwMultiAffList
:members:
.. autoclass:: ConstraintList
:members:
.. autoclass:: BasicMapList
:members:
.. autoclass:: SetList
:members:
.. autoclass:: MapList
:members:
.. autoclass:: UnionSetList
:members:
.. autoclass:: UnionMapList
:members:
.. autoclass:: AstExprList
:members:
.. autoclass:: AstNodeList
:members:
.. autoclass:: QPolynomialList
:members:
.. autoclass:: PwQPolynomialList
:members:
.. autoclass:: PwQPolynomialFoldList
:members:
Dictionaries
^^^^^^^^^^^^
.. autoclass:: IdToAstExpr
:members:
Multi Types
-----------
Canonical Names for Internal Module
-----------------------------------
.. ::
This should switch to using ``:canonical:`` once Sphinx 4.0 is released.
.. currentmodule:: islpy._isl
.. class:: IdList
See :class:`islpy.IdList`.
.. class:: ValList
See :class:`islpy.ValList`.
.. class:: BasicSetList
See :class:`islpy.BasicSetList`.
.. class:: AffList
See :class:`islpy.AffList`.
.. class:: PwAffList
See :class:`islpy.PwAffList`.
.. class:: PwMultiAffList
See :class:`islpy.PwMultiAffList`.
.. class:: UnionPwAffList
See :class:`islpy.UnionPwAffList`.
.. class:: UnionPwMultiAffList
See :class:`islpy.UnionPwMultiAffList`.
.. class:: ConstraintList
See :class:`islpy.ConstraintList`.
.. class:: BasicMapList
See :class:`islpy.BasicMapList`.
.. class:: SetList
See :class:`islpy.SetList`.
.. class:: MapList
See :class:`islpy.MapList`.
.. class:: UnionSetList
See :class:`islpy.UnionSetList`.
.. class:: UnionMapList
See :class:`islpy.UnionMapList`.
.. class:: AstExprList
See :class:`islpy.AstExprList`.
.. class:: AstNodeList
See :class:`islpy.AstNodeList`.
.. class:: IdToAstExpr
See :class:`islpy.IdToAstExpr`.
.. class:: PwQPolynomialList
See :class:`islpy.PwQPolynomialList`.
.. class:: PwQPolynomialFoldList
See :class:`islpy.PwQPolynomialFoldList`.
.. vim: sw=4
Reference: Expression-like Objects
==================================
.. currentmodule:: islpy
Quasi-Affine Expressions
^^^^^^^^^^^^^^^^^^^^^^^^
Quasi-Affine Expression
-----------------------
.. autoclass:: Aff
:members:
Piecewise Quasi-Affine Expression
---------------------------------
.. autoclass:: PwAff
:members:
Union of Piecewise Quasi-Affine Expressions
-------------------------------------------
.. autoclass:: UnionPwAff
:members:
Multiple Union of Piecewise Quasi-Affine Expressions
----------------------------------------------------
.. autoclass:: MultiUnionPwAff
:members:
Multiple Affine Expressions
^^^^^^^^^^^^^^^^^^^^^^^^^^^
Multiple Affine Expression
--------------------------
.. autoclass:: MultiAff
:members:
Piecewise Multiple Affine Expression
------------------------------------
.. autoclass:: PwMultiAff
:members:
Multiple Piecewise Affine Expression
------------------------------------
.. autoclass:: MultiPwAff
:members:
Union of Piecewise Multiple Affine Expressions
----------------------------------------------
.. autoclass:: UnionPwMultiAff
:members:
Quasipolynomials
^^^^^^^^^^^^^^^^
Term
----
.. autoclass:: Term
:members:
QPolynomial
-----------
.. autoclass:: QPolynomial
:members:
PwQPolynomial
-------------
.. autoclass:: PwQPolynomial
:members:
UnionPwQPolynomial
------------------
.. autoclass:: UnionPwQPolynomial
:members:
QPolynomialFold
---------------
.. autoclass:: QPolynomialFold
:members:
PwQPolynomial
-------------
.. autoclass:: PwQPolynomialFold
:members:
UnionPwQPolynomialFold
----------------------
.. autoclass:: UnionPwQPolynomialFold
:members:
Dataflow
^^^^^^^^
.. currentmodule:: islpy
Access Info
-----------
.. autoclass:: AccessInfo
:members:
Union Access Info
-----------------
.. autoclass:: UnionAccessInfo
:members:
Restriction
-----------
.. autoclass:: Restriction
:members:
Flow
----
.. autoclass:: Flow
:members:
Union Flow
----------
.. autoclass:: UnionFlow
:members:
Canonical Names for Internal Module
-----------------------------------
.. ::
This should switch to using ``:canonical:`` once Sphinx 4.0 is released.
.. currentmodule:: islpy._isl
.. class:: AccessInfo
See :class:`islpy.AccessInfo`.
.. class:: UnionAccessInfo
See :class:`islpy.UnionAccessInfo`.
.. class:: Restriction
See :class:`islpy.Restriction`.
.. class:: Flow
See :class:`islpy.Flow`.
.. class:: UnionFlow
See :class:`islpy.UnionFlow`.
Reference: Basic Building Blocks
================================
.. currentmodule:: islpy
Context
-------
.. autoclass:: Context()
:members:
Id
--
.. autoclass:: Id
:members:
.. autoclass:: MultiId
:members:
Space
-----
(formerly called ``Dim``. A compatibility alias is in place.)
.. autoclass:: Space
:members:
Local Space
-----------
.. autoclass:: LocalSpace
:members:
Constraints
-----------
.. autoclass:: Constraint
:members:
Value
-----
.. autoclass:: Val
:members:
.. automethod:: to_python
Multi-Value
-----------
.. autoclass:: MultiVal
:members:
Vector
------
.. autoclass:: Vec
:members:
Matrix
------
.. autoclass:: Mat
:members:
Canonical Names for Internal Module
-----------------------------------
.. ::
This should switch to using ``:canonical:`` once Sphinx 4.0 is released.
.. currentmodule:: islpy._isl
.. class:: Context
See :class:`islpy.Context`.
.. class:: Id
See :class:`islpy.Id`.
.. class:: MultiId
See :class:`islpy.MultiId`.
.. class:: Space
See :class:`islpy.Space`.
.. class:: LocalSpace
See :class:`islpy.LocalSpace`.
.. class:: Constraint
See :class:`islpy.Constraint`.
.. class:: Val
See :class:`islpy.Val`.
.. class:: MultiVal
See :class:`islpy.MultiVal`.
.. class:: Vec
See :class:`islpy.Vec`.
.. class:: Mat
See :class:`islpy.Mat`.
.. class:: BasicSet
See :class:`islpy.BasicSet`.
.. class:: BasicMap
See :class:`islpy.BasicMap`.
.. class:: Set
See :class:`islpy.Set`.
.. class:: Map
See :class:`islpy.Map`.
.. class:: UnionSet
See :class:`islpy.UnionSet`.
.. class:: UnionMap
See :class:`islpy.UnionMap`.
.. class:: Point
See :class:`islpy.Point`.
.. class:: Vertex
See :class:`islpy.Vertex`.
.. class:: Vertices
See :class:`islpy.Vertices`.
.. class:: StrideInfo
See :class:`islpy.StrideInfo`.
.. class:: Cell
See :class:`islpy.Cell`.
.. class:: FixedBox
See :class:`islpy.FixedBox`.
.. class:: Aff
See :class:`islpy.Aff`.
.. class:: Div
See :class:`islpy.Aff` (not a typo!).
.. class:: PwAff
See :class:`islpy.PwAff`.
.. class:: UnionPwAff
See :class:`islpy.UnionPwAff`.
.. class:: MultiUnionPwAff
See :class:`islpy.MultiUnionPwAff`.
.. class:: MultiAff
See :class:`islpy.MultiAff`.
.. class:: PwMultiAff
See :class:`islpy.PwMultiAff`.
.. class:: MultiPwAff
See :class:`islpy.MultiPwAff`.
.. class:: UnionPwMultiAff
See :class:`islpy.UnionPwMultiAff`.
.. class:: Term
See :class:`islpy.Term`.
.. class:: QPolynomial
See :class:`islpy.QPolynomial`.
.. class:: PwQPolynomial
See :class:`islpy.PwQPolynomial`.
.. class:: UnionPwQPolynomial
See :class:`islpy.UnionPwQPolynomial`.
.. class:: QPolynomialFold
See :class:`islpy.QPolynomialFold`.
.. class:: PwQPolynomialFold
See :class:`islpy.PwQPolynomialFold`.
.. class:: UnionPwQPolynomialFold
See :class:`islpy.UnionPwQPolynomialFold`.
Reference: Geometric Entities
=============================
.. currentmodule:: islpy
Point
-----
.. autoclass:: Point
:members:
Vertex
------
.. autoclass:: Vertex
:members:
Vertices
--------
.. autoclass:: Vertices
:members:
StrideInfo
----------
.. autoclass:: StrideInfo
:members:
Cell
----
.. autoclass:: Cell
:members:
Fixed Box
---------
.. autoclass:: FixedBox
:members:
Reference: Scheduling
=====================
.. currentmodule:: islpy
Schedule
--------
.. autoclass:: schedule_node_type
:members:
:undoc-members:
:exclude-members: @entries
.. autoclass:: Schedule
:members:
Schedule Node
-------------
.. autoclass:: ScheduleNode
:members:
ScheduleConstraints
-------------------
.. autoclass:: ScheduleConstraints
:members:
Canonical Names for Internal Module
-----------------------------------
.. ::
This should switch to using ``:canonical:`` once Sphinx 4.0 is released.
.. currentmodule:: islpy._isl
.. class:: schedule_node_type
See :class:`islpy.schedule_node_type`.
.. class:: Schedule
See :class:`islpy.Schedule`.
.. class:: ScheduleNode
See :class:`islpy.ScheduleNode`.
.. class:: ScheduleConstraints
See :class:`islpy.ScheduleConstraints`.
Reference: Sets and Maps
========================
.. currentmodule:: islpy
Basic Set
---------
.. autoclass:: BasicSet
:members:
Basic Map
---------
.. autoclass:: BasicMap
:members:
Set
---
.. autoclass:: Set
:members:
Map
---
.. autoclass:: Map
:members:
Union Set
---------
.. autoclass:: UnionSet
:members:
Union Map
---------
.. autoclass:: UnionMap
:members:
Reference guide
===============
Reference guide: Overview
=========================
.. module:: islpy
.. moduleauthor:: Andreas Kloeckner <inform@tiker.net>
.. _gen-remarks:
Table of Contents
^^^^^^^^^^^^^^^^^
.. toctree::
:maxdepth: 3
reference
.. Referring to this document makes sphinx spew 'circular reference' warnings.
.. "self" would apparently be the correct way, but it does not work.
General Remarks
^^^^^^^^^^^^^^^
......@@ -68,20 +57,38 @@ lists:
Called with Argument Type
==================== ==========================
:class:`BasicSet` :class:`Set`
:class:`BasicMap` :class:`Map`
:class:`Set` :class:`UnionSet`
:class:`BasicMap` :class:`Map`
:class:`Map` :class:`UnionMap`
:class:`Space` :class:`LocalSpace`
:class:`Aff` :class:`PwAff`
:class:`PwAff` :class:`UnionPwAff`
:class:`MultiAff` :class:`PwMultiAff`
:class:`PwMultiAff` :class:`UnionPwMultiAff`
:class:`Space` :class:`LocalSpace`
==================== ==========================
as well as casts contained in the transitive closure of this 'casting graph'.
Version Info
------------
.. data:: version
.. function:: isl_version
Error Reporting
---------------
.. exception:: Error
Convenience
^^^^^^^^^^^
.. autofunction:: make_zero_and_vars
.. autofunction:: affs_from_space
Lifetime Helpers
^^^^^^^^^^^^^^^^
......@@ -96,7 +103,7 @@ Global Data
.. data:: DEFAULT_CONTEXT
ISL objects being unpickled or initialized from strings will be instatiated
ISL objects being unpickled or initialized from strings will be instantiated
within this :class:`Context`.
.. versionadded:: 2015.2
......@@ -107,389 +114,73 @@ Symbolic Constants
.. autoclass:: error
:members:
:undoc-members:
:exclude-members: names, values
:exclude-members: names, values, @entries
.. autoclass:: dim_type
:members:
:undoc-members:
:exclude-members: names, values
:exclude-members: names, values, @entries
.. autoclass:: fold
:members:
:undoc-members:
:exclude-members: names, values
.. autoclass:: ast_op_type
:members:
:undoc-members:
.. autoclass:: ast_expr_type
:members:
:undoc-members:
.. autoclass:: ast_node_type
:members:
:undoc-members:
:exclude-members: names, values, @entries
.. autoclass:: format
:members:
:undoc-members:
:undoc-members: @entries
.. autoclass:: yaml_style
:members:
:undoc-members:
Basic Building Blocks
^^^^^^^^^^^^^^^^^^^^^
Context
-------
.. class:: Context()
Id
--
.. autoclass:: Id
:members:
Space
-----
(formerly called :class:`Dim`. A compatibility alias is in place.)
.. autoclass:: Space
:members:
Local Space
-----------
.. autoclass:: LocalSpace
:members:
Constraints
-----------
.. autoclass:: Constraint
:members:
Value
-----
.. autoclass:: Val
:members:
Multi-Value
-----------
.. autoclass:: MultiVal
:members:
Vector
------
.. autoclass:: Vec
:members:
Matrix
------
.. autoclass:: Mat
:members:
Sets and Maps
^^^^^^^^^^^^^
Basic Set
---------
.. autoclass:: BasicSet
:members:
Basic Map
---------
.. autoclass:: BasicMap
:members:
Set
---
.. autoclass:: Set
:members:
Map
---
.. autoclass:: Map
:members:
Union Set
---------
.. autoclass:: UnionSet
:members:
Union Map
---------
.. autoclass:: UnionMap
:members:
Geometric Entities
^^^^^^^^^^^^^^^^^^
Point
-----
.. autoclass:: Point
:members:
Vertex
------
.. autoclass:: Vertex
:members:
Vertices
--------
.. autoclass:: Vertices
:members:
Cell
----
.. autoclass:: Cell
:members:
Quasi-Affine Expressions
^^^^^^^^^^^^^^^^^^^^^^^^
Quasi-Affine Expression
-----------------------
.. autoclass:: Aff
:members:
Piecewise Quasi-Affine Expression
---------------------------------
.. autoclass:: PwAff
:members:
Union of Piecewise Quasi-Affine Expressions
-------------------------------------------
.. autoclass:: UnionPwAff
:members:
:undoc-members: @entries
Multiple Union of Piecewise Quasi-Affine Expressions
----------------------------------------------------
.. autoclass:: MultiUnionPwAff
:members:
Multiple Affine Expressions
^^^^^^^^^^^^^^^^^^^^^^^^^^^
Multiple Affine Expression
--------------------------
.. autoclass:: MultiAff
:members:
Piecewise Multiple Affine Expression
------------------------------------
.. autoclass:: PwMultiAff
:members:
Union of Piecewise Multiple Affine Expressions
----------------------------------------------
Output
^^^^^^
.. autoclass:: UnionPwMultiAff
.. autoclass:: Printer
:members:
Quasipolynomials
Helper functions
^^^^^^^^^^^^^^^^
Term
----
.. autoclass:: Term
:members:
QPolynomial
-----------
.. autoclass:: QPolynomial
:members:
PwQPolynomial
-------------
.. autoclass:: PwQPolynomial
:members:
UnionPwQPolynomial
------------------
.. autoclass:: UnionPwQPolynomial
:members:
QPolynomialFold
---------------
.. autoclass:: QPolynomialFold
:members:
PwQPolynomial
-------------
.. autoclass:: PwQPolynomialFold
:members:
UnionPwQPolynomialFold
----------------------
.. autoclass:: UnionPwQPolynomialFold
:members:
Scheduling
^^^^^^^^^^
Band
----
.. autoclass:: Band
:members:
Schedule
--------
.. autoclass:: Schedule
:members:
.. autoclass:: ScheduleNode
:members:
ScheduleConstraints
-------------------
.. autoclass:: ScheduleConstraints
:members:
Dataflow
^^^^^^^^
Access Info
-----------
.. autoclass:: AccessInfo
:members:
.. autoclass:: UnionAccessInfo
:members:
Restriction
-----------
.. autoclass:: Restriction
:members:
Flow
----
.. autoclass:: Flow
:members:
.. autoclass:: UnionFlow
:members:
Abstract Syntax Trees
^^^^^^^^^^^^^^^^^^^^^
.. versionadded:: 2014.1
AST Expression
--------------
.. autoclass:: AstExpr
:members:
AST Node
--------
.. autoclass:: AstNode
:members:
AST Build
---------
.. autoclass:: AstBuild
:members:
AST Print Options
-----------------
.. autoclass:: AstPrintOptions
:members:
.. autofunction:: align_spaces
.. autofunction:: align_two
Lists
^^^^^
Canonical Names for Internal Module
-----------------------------------
.. autoclass:: IdList
:members:
.. ::
.. autoclass:: ValList
:members:
This should switch to using ``:canonical:`` once Sphinx 4.0 is released.
.. autoclass:: BasicSetList
:members:
.. currentmodule:: islpy._isl
.. autoclass:: BasicMapList
:members:
.. class:: stat
.. autoclass:: SetList
:members:
A status result.
.. autoclass:: MapList
:members:
.. class:: error
.. autoclass:: UnionSetList
:members:
See :class:`islpy.error`.
.. autoclass:: AffList
:members:
.. class:: dim_type
.. autoclass:: UnionPwAffList
:members:
See :class:`islpy.dim_type`.
.. autoclass:: BandList
:members:
.. class:: fold
.. autoclass:: AstExprList
:members:
.. autoclass:: AstNodeList
:members:
See :class:`islpy.fold`.
Dictionaries
^^^^^^^^^^^^
.. class:: format
.. autoclass:: IdToAstExpr
:members:
See :class:`islpy.format`.
Output
^^^^^^
.. class:: yaml_style
.. autoclass:: Printer
:members:
See :class:`islpy.yaml_style`.
Helper functions
^^^^^^^^^^^^^^^^
.. class:: Printer
.. autofunction:: align_spaces
.. autofunction:: align_two
See :class:`islpy.Printer`.
.. vim: sw=4
#! /bin/sh
rsync --progress --verbose --archive --delete _build/html/* doc-upload:doc/islpy
rsync --verbose --archive --delete _build/html/ doc-upload:doc/islpy
import islpy as isl
ctx = isl.Context()
space = isl.Space.create_from_names(ctx, set=["x", "y"])
space = isl.Space.create_from_names(isl.DEFAULT_CONTEXT, set=["x", "y"])
bset = (isl.BasicSet.universe(space)
.add_constraint(isl.Constraint.ineq_from_names(space, {1: -1, "x": 1}))
......@@ -35,8 +35,7 @@ def plot_basic_set(bset, *args, **kwargs):
for v in vertices:
points = []
myset = (isl.Map.from_basic_map(isl.BasicMap.from_multi_aff(v.get_expr()))
.range())
myset = isl.BasicSet.from_multi_aff(v.get_expr())
myset.foreach_point(points.append)
point, = points
vertex_pts.append([
......@@ -55,8 +54,8 @@ def plot_basic_set(bset, *args, **kwargs):
if plot_vert:
pt.plot(vertex_pts[:, 0], vertex_pts[:, 1], "o")
import matplotlib.path as mpath
import matplotlib.patches as mpatches
import matplotlib.path as mpath
Path = mpath.Path # noqa
......@@ -73,14 +72,14 @@ def plot_basic_set(bset, *args, **kwargs):
pt.gca().add_patch(patch)
plot_basic_set(bset, facecolor='red', edgecolor='black', alpha=0.3)
plot_basic_set(bset2, facecolor='green', edgecolor='black', alpha=0.2)
plot_basic_set(bset, facecolor="red", edgecolor="black", alpha=0.3)
plot_basic_set(bset2, facecolor="green", edgecolor="black", alpha=0.2)
pt.grid()
pt.xlim([-1, 6])
pt.ylim([-1, 8])
#pt.show()
# pt.show()
pt.savefig("before-union.png", dpi=50)
plot_basic_set(union, facecolor='blue', edgecolor='yellow',
plot_basic_set(union, facecolor="blue", edgecolor="yellow",
alpha=0.5, plot_vert=True)
pt.savefig("after-union.png", dpi=50)
from __future__ import print_function
__copyright__ = "Copyright (C) 2011-15 Andreas Kloeckner"
__copyright__ = "Copyright (C) 2011-20 Andreas Kloeckner"
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
......@@ -22,9 +20,13 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
"""
import os
import re
import sys
from py_codegen import PythonCodeGenerator, Indentation
from dataclasses import dataclass
from os.path import join
from typing import ClassVar, List, Mapping, Sequence
SEM_TAKE = "take"
SEM_GIVE = "give"
......@@ -39,7 +41,7 @@ ISL_SEM_TO_SEM = {
}
NON_COPYABLE = ["ctx", "printer", "access_info"]
NON_COPYABLE_WITH_ISL_PREFIX = ["isl_"+i for i in NON_COPYABLE]
NON_COPYABLE_WITH_ISL_PREFIX = [f"isl_{i}" for i in NON_COPYABLE]
PYTHON_RESERVED_WORDS = """
and del from not while
......@@ -52,67 +54,91 @@ def for lambda try
""".split()
class Retry(RuntimeError): # noqa: N818
pass
class BadArg(ValueError): # noqa: N818
pass
class Undocumented(ValueError): # noqa: N818
pass
class SignatureNotSupported(ValueError): # noqa: N818
pass
def to_py_class(cls):
if cls.startswith("isl_"):
cls = cls[4:]
if cls == "ctx":
return "Context"
upper_next = True
result = ""
for c in cls:
if c == "_":
upper_next = True
else:
if upper_next:
result += c.upper()
upper_next = False
else:
result += c
result = result.replace("Qpoly", "QPoly")
return result
# {{{ data model
@dataclass
class Argument:
def __init__(self, name, semantics, decl_words, base_type, ptr):
self.name = name
self.semantics = semantics
assert isinstance(decl_words, list)
self.decl_words = decl_words
self.base_type = base_type
self.ptr = ptr
def c_declarator(self):
return "{decl_words} {type} {ptr}{name}".format(
decl_words=" ".join(self.decl_words),
type=self.base_type,
ptr=self.ptr,
name=self.name)
is_const: bool
name: str
semantics: str
base_type: str
ptr: str
@dataclass
class CallbackArgument:
def __init__(self, name,
return_semantics, return_decl_words, return_base_type, return_ptr, args):
self.name = name
self.return_semantics = return_semantics
assert isinstance(return_decl_words, list)
self.return_decl_words = return_decl_words
self.return_base_type = return_base_type
self.return_ptr = return_ptr
self.args = args
def c_declarator(self):
return "{decl_words} {type} {ptr}(*{name})({args})".format(
decl_words=" ".join(self.return_decl_words),
type=self.return_base_type,
ptr=self.return_ptr,
name=self.name,
args=", ".join(arg.c_declarator() for arg in self.args))
name: str
return_semantics: str
return_decl_words: List[str]
return_base_type: str
return_ptr: str
args: Sequence[Argument]
@dataclass
class Method:
def __init__(self, cls, name, c_name,
return_semantics, return_decl_words, return_base_type, return_ptr,
args, is_exported, is_constructor):
self.cls = cls
self.name = name
self.c_name = c_name
self.return_semantics = return_semantics
self.return_decl_words = return_decl_words
self.return_base_type = return_base_type
self.return_ptr = return_ptr
self.args = args
self.mutator_veto = False
self.is_exported = is_exported
self.is_constructor = is_constructor
cls: str
name: str
c_name: str
return_semantics: str
return_base_type: str
return_ptr: str
args: Sequence[Argument]
is_exported: bool
is_constructor: bool
mutator_veto: bool = False
def __post_init__(self):
assert self.name
if not self.is_static:
self.args[0].name = "self"
@property
def is_static(self):
return not (self.args and self.args[0].base_type.startswith("isl_"+self.cls))
return not (self.args
and self.args[0].base_type.startswith(f"isl_{self.cls}"))
@property
def is_mutator(self):
......@@ -125,360 +151,128 @@ class Method:
and self.args[0].base_type in NON_COPYABLE_WITH_ISL_PREFIX)
def __repr__(self):
return "<method %s>" % self.c_name
return f"<method {self.c_name}>"
# }}}
CLASSES = [
# /!\ Order matters, class names that are prefixes of others should go last.
"options",
"ctx",
# lists
"id_list", "val_list",
"basic_set_list", "basic_map_list", "set_list", "map_list",
"union_set_list",
"constraint_list",
"aff_list", "pw_aff_list", "band_list",
"ast_expr_list", "ast_node_list",
# maps
"id_to_ast_expr",
# others
"printer", "val", "multi_val", "vec", "mat",
"aff", "pw_aff", "union_pw_aff",
"multi_aff", "multi_pw_aff", "pw_multi_aff", "union_pw_multi_aff",
"union_pw_aff_list",
"multi_union_pw_aff",
"id",
"constraint", "space", "local_space",
"basic_set", "basic_map",
"set", "map",
"union_map", "union_set",
"point", "vertex", "cell", "vertices",
"qpolynomial_fold", "pw_qpolynomial_fold",
"union_pw_qpolynomial_fold",
"union_pw_qpolynomial",
"qpolynomial", "pw_qpolynomial",
"term",
"band", "schedule_constraints", "schedule",
"schedule_node",
"access_info", "flow", "restriction",
"union_access_info", "union_flow",
"ast_expr", "ast_node", "ast_print_options",
"ast_build",
# {{{ PART_TO_CLASSES
PART_TO_CLASSES = {
# If you change this, change:
# - islpy/__init__.py
# - src/wrapper/wrap_isl.hpp to add WRAP_CLASS(...)
# - src/wrapper/wrap_isl_partN.hpp to add MAKE_WRAP(...)
# - doc/reference.rst
"part1": [
# lists
"id_list", "val_list",
"basic_set_list", "basic_map_list", "set_list", "map_list",
"constraint_list",
"aff_list", "pw_aff_list", "pw_multi_aff_list",
"ast_expr_list", "ast_node_list",
"qpolynomial_list",
"pw_qpolynomial_list",
"pw_qpolynomial_fold_list",
"union_pw_aff_list",
"union_pw_multi_aff_list",
"union_set_list",
"union_map_list",
# maps
"id_to_ast_expr",
# others
"ctx",
"printer", "val", "multi_val", "vec", "mat", "fixed_box",
"aff", "pw_aff", "union_pw_aff",
"multi_aff", "multi_pw_aff", "pw_multi_aff", "union_pw_multi_aff",
"multi_union_pw_aff",
"id", "multi_id",
"constraint", "space", "local_space",
],
"part2": [
"basic_set", "basic_map",
"set", "map",
"union_map", "union_set",
"point", "vertex", "cell", "vertices",
"stride_info",
],
"part3": [
"qpolynomial", "pw_qpolynomial",
"qpolynomial_fold", "pw_qpolynomial_fold",
"union_pw_qpolynomial_fold",
"union_pw_qpolynomial",
"term",
"schedule", "schedule_constraints",
"schedule_node",
"access_info", "flow", "restriction",
"union_access_info", "union_flow",
"ast_expr", "ast_node", "ast_print_options",
"ast_build",
]
}
CLASSES = []
for cls_list in PART_TO_CLASSES.values():
CLASSES.extend(cls_list)
UNTYPEDEFD_CLASSES = ["options"]
CLASS_MAP = {
"equality": "constraint",
"inequality": "constraint",
"options": "ctx",
}
# }}}
IMPLICIT_CONVERSIONS = {
"isl_set": [("isl_basic_set", "from_basic_set")],
"isl_map": [("isl_basic_map", "from_basic_map")],
"isl_union_set": [("isl_set", "from_set")],
"isl_union_map": [("isl_map", "from_map")],
"isl_local_space": [("isl_space", "from_space")],
"isl_pw_aff": [("isl_aff", "from_aff")],
}
# {{{ enums
ENUMS = {
# ctx.h
"isl_error": """
isl_error_none,
isl_error_abort,
isl_error_alloc,
isl_error_unknown,
isl_error_internal,
isl_error_invalid,
isl_error_quota,
isl_error_unsupported,
""",
"isl_stat": """
isl_stat_error,
isl_stat_ok,
""",
"isl_bool": """
isl_bool_error,
isl_bool_false,
isl_bool_true,
""",
"isl_error",
"isl_stat",
"isl_bool",
# space.h
"isl_dim_type": """
isl_dim_cst,
isl_dim_param,
isl_dim_in,
isl_dim_out,
isl_dim_set,
isl_dim_div,
isl_dim_all,
""",
"isl_dim_type",
# schedule_type.h
"isl_schedule_node_type",
# ast_type.h
"isl_ast_op_type": """
isl_ast_op_error,
isl_ast_op_and,
isl_ast_op_and_then,
isl_ast_op_or,
isl_ast_op_or_else,
isl_ast_op_max,
isl_ast_op_min,
isl_ast_op_minus,
isl_ast_op_add,
isl_ast_op_sub,
isl_ast_op_mul,
isl_ast_op_div,
isl_ast_op_fdiv_q,
isl_ast_op_pdiv_q,
isl_ast_op_pdiv_r,
isl_ast_op_zdiv_r,
isl_ast_op_cond,
isl_ast_op_select,
isl_ast_op_eq,
isl_ast_op_le,
isl_ast_op_lt,
isl_ast_op_ge,
isl_ast_op_gt,
isl_ast_op_call,
isl_ast_op_access,
isl_ast_op_member,
isl_ast_op_address_of,
""",
"isl_ast_expr_type": """
isl_ast_expr_error,
isl_ast_expr_op,
isl_ast_expr_id,
isl_ast_expr_int,
""",
"isl_ast_node_type": """
isl_ast_node_error,
isl_ast_node_for,
isl_ast_node_if,
isl_ast_node_block,
isl_ast_node_mark,
isl_ast_node_user,
""",
"isl_ast_loop_type": """
isl_ast_loop_error,
isl_ast_loop_default,
isl_ast_loop_atomic,
isl_ast_loop_unroll,
isl_ast_loop_separate,
""",
"isl_ast_expr_op_type",
"isl_ast_expr_type",
"isl_ast_node_type",
"isl_ast_loop_type",
# polynomial_type.h
"isl_fold": """
isl_fold_min,
isl_fold_max,
isl_fold_list,
""",
# printer.h
"isl_format": """
ISL_FORMAT_ISL,
ISL_FORMAT_POLYLIB,
ISL_FORMAT_POLYLIB_CONSTRAINTS,
ISL_FORMAT_OMEGA,
ISL_FORMAT_C,
ISL_FORMAT_LATEX,
ISL_FORMAT_EXT_POLYLIB,
""",
"isl_yaml_style": """
ISL_YAML_STYLE_BLOCK,
ISL_YAML_STYLE_FLOW,
""",
"isl_fold",
}
TYPEDEFD_ENUMS = ["isl_stat", "isl_bool"]
MACRO_ENUMS = ["isl_format", "isl_yaml_style"]
HEADER_PREAMBLE = """
// flow.h
typedef int (*isl_access_level_before)(void *first, void *second);
typedef isl_restriction *(*isl_access_restrict)(
isl_map *source_map, isl_set *sink,
void *source_user, void *user);
"""
PY_PREAMBLE = """
from __future__ import print_function
import six
import sys
import signal
import logging
_PY3 = sys.version_info >= (3,)
from islpy._isl_cffi import ffi
lib = ffi.dlopen(None)
from cffi import FFI
libc_ffi = FFI()
libc_ffi.cdef('''
char *strdup(const char *s);
void free(void *ptr);
''')
libc = libc_ffi.dlopen(None)
class Error(Exception):
pass
class IslTypeError(Error, TypeError):
pass
_context_use_map = {}
def _deref_ctx(ctx_data, ctx_iptr):
_context_use_map[ctx_iptr] -= 1
if _context_use_map[ctx_iptr] == 0:
del _context_use_map[ctx_iptr]
lib.isl_ctx_free(ctx_data)
class _ISLObjectBase(object):
def __init__(self, _data):
self._setup(_data)
def _setup(self, data):
assert not hasattr(self, "data")
assert isinstance(data, ffi.CData)
self.data = data
self._set_ctx_data()
iptr = self._ctx_iptr
_context_use_map[iptr] = _context_use_map.get(iptr, 0) + 1
def _reset(self, data):
assert self.data is not None
assert isinstance(data, ffi.CData)
_deref_ctx(self._ctx_data, self._ctx_iptr)
self.data = data
self._set_ctx_data()
iptr = self._ctx_iptr
_context_use_map[iptr] = _context_use_map.get(iptr, 0) + 1
def _set_ctx_data(self):
self._ctx_data = self._get_ctx_data()
self._ctx_iptr = int(ffi.cast("intptr_t", self._get_ctx_data()))
def _release(self):
if self.data is None:
raise Error("cannot release already-released object")
data = self.data
if _deref_ctx is not None:
_deref_ctx(self._ctx_data, self._ctx_iptr)
else:
# This can happen if we're called super-late in cleanup.
# Since everything else is already mopped up, we really
# can't do what it takes to mop up this context.
# So we leak it (i.e. leave it for the OS to clean up.)
pass
self.data = None
return data
def __eq__(self, other):
return (type(self) == type(other) and self.data == other.data)
def __ne__(self, other):
return not self.__eq__(other)
class _EnumBase(object):
@classmethod
def find_value(cls, v):
for name in dir(cls):
if getattr(cls, name) == v:
return name
raise ValueError("Value '%s' not found in enum" % v)
class _ManagedCString(object):
def __init__(self, cdata):
self.data = libc.strdup(cdata)
if self.data == libc_ffi.NULL:
raise Error("strdup() failed")
def release(self):
if self.data is None:
raise Error("cannot release already-released object")
data = self.data
self.data = None
return data
def __del__(self):
libc.free(self.data)
class DelayedKeyboardInterrupt(object):
def __enter__(self):
self.signal_received = False
self.old_handler = signal.getsignal(signal.SIGINT)
signal.signal(signal.SIGINT, self.handler)
def handler(self, signal, frame):
self.signal_received = (signal, frame)
logging.debug('SIGINT received. Delaying KeyboardInterrupt.')
def __exit__(self, type, value, traceback):
signal.signal(signal.SIGINT, self.old_handler)
if self.signal_received:
self.old_handler(*self.signal_received)
"""
CLASS_MAP = {
"equality": "constraint",
"inequality": "constraint",
"options": "ctx",
}
SAFE_TYPES = list(ENUMS) + ["int", "unsigned", "uint32_t", "size_t", "double",
"long", "unsigned long"]
SAFE_IN_TYPES = SAFE_TYPES + ["const char *", "char *"]
SPECIAL_CLASS_NAME_MAP = {
"ctx": "Context"
}
def isl_class_to_py_class(cls_name):
if cls_name.startswith("isl_"):
cls_name = cls_name[4:]
MACRO_ENUMS = [
"isl_format", "isl_yaml_style",
"isl_bound", "isl_on_error", "isl_schedule_algorithm",
]
try:
return SPECIAL_CLASS_NAME_MAP[cls_name]
except KeyError:
result = cls_name.title().replace("_", "")
result = result.replace("Qpoly", "QPoly")
return result
# }}}
SAFE_TYPES = [*list(ENUMS), "int", "unsigned", "uint32_t", "size_t", "double", "long",
"unsigned long", "isl_size"]
SAFE_IN_TYPES = [*SAFE_TYPES, "const char *", "char *"]
# {{{ parser
# {{{ parser helpers
DECL_RE = re.compile(r"""
(?:__isl_overload\s*)?
((?:\w+\s+)*) (\**) \s* (?# return type)
(\w+) (?# func name)
\(
......@@ -494,9 +288,15 @@ FUNC_PTR_RE = re.compile(r"""
\)
""",
re.VERBOSE)
STRUCT_DECL_RE = re.compile(r"(__isl_export\s+)?struct\s+([a-z_A-Z0-9]+)\s*;")
ARG_RE = re.compile(r"^((?:\w+)\s+)+(\**)\s*(\w+)$")
STRUCT_DECL_RE = re.compile(
r"(__isl_export\s+)?struct\s+(__isl_export\s+)?([a-z_A-Z0-9]+)\s*;")
ARG_RE = re.compile(r"^((?:const\s+)?(?:\w+\s+)+)(\**)\s*(\w+)$")
INLINE_SEMICOLON_RE = re.compile(r"\;[ \t]*(?=\w)")
SUBCLASS_RE = re.compile(
r"__isl_subclass\s*"
r"\(\s*"
r"[0-9a-zA-Z_]+"
r"\s*\)")
def filter_semantics(words):
......@@ -535,26 +335,10 @@ def split_at_unparenthesized_commas(s):
yield s[last_start:i]
class BadArg(ValueError):
pass
class Retry(ValueError):
pass
class Undocumented(ValueError):
pass
class SignatureNotSupported(ValueError):
pass
def parse_arg(arg):
if "(*" in arg:
arg_match = FUNC_PTR_RE.match(arg)
assert arg_match is not None, "fptr: %s" % arg
assert arg_match is not None, f"fptr: {arg}"
return_semantics, ret_words = filter_semantics(
arg_match.group(1).split())
......@@ -576,57 +360,150 @@ def parse_arg(arg):
words = arg.split()
semantics, words = filter_semantics(words)
decl_words = []
if words[0] in ["struct", "enum"]:
decl_words.append(words.pop(0))
words = [w for w in words if w not in ["struct", "enum"]]
is_const = False
if words[0] == "const":
is_const = True
del words[0]
rebuilt_arg = " ".join(words)
arg_match = ARG_RE.match(rebuilt_arg)
base_type = arg_match.group(1).strip()
if base_type == "isl_args":
raise BadArg("isl_args not supported")
assert arg_match is not None, rebuilt_arg
return Argument(
is_const=is_const,
name=arg_match.group(3),
semantics=semantics,
decl_words=decl_words,
base_type=base_type,
base_type=arg_match.group(1).strip(),
ptr=arg_match.group(2).strip())
def preprocess_with_macros(macro_header_contents, code):
try:
from pcpp.preprocessor import (
Action,
OutputDirective,
Preprocessor as PreprocessorBase,
)
except ImportError as err:
raise RuntimeError("pcpp was not found. Please install pcpp before "
"installing islpy. 'pip install pcpp' should do the job.") from err
class MacroExpandingCPreprocessor(PreprocessorBase):
def on_directive_handle(self, directive, toks, ifpassthru, precedingtoks):
if directive.value == "include":
raise OutputDirective(action=Action.IgnoreAndPassThrough)
elif directive.value == "define":
assert toks
macro_name = toks[0].value
if macro_name in ISL_SEM_TO_SEM:
raise OutputDirective(action=Action.IgnoreAndRemove)
return super().on_directive_handle(
directive, toks, ifpassthru, precedingtoks)
cpp = MacroExpandingCPreprocessor()
from io import StringIO
# read macro definitions, but don't output resulting code
for macro_header in macro_header_contents:
cpp.parse(macro_header)
cpp.write(StringIO())
sio_output = StringIO()
cpp.parse(code)
cpp.write(sio_output)
return sio_output.getvalue()
# }}}
# {{{ FunctionData (includes parser)
class FunctionData:
INVALID_PY_IDENTIFIER_RENAMING_MAP: ClassVar[Mapping[str, str]] = {
"2exp": "two_exp"
}
def __init__(self, include_dirs):
self.classes_to_methods = {}
self.include_dirs = include_dirs
self.seen_c_names = set()
self.headers = []
def read_header(self, fname):
self.headers.append(fname)
def get_header_contents(self, fname):
from os.path import join
success = False
for inc_dir in self.include_dirs:
try:
inf = open(join(inc_dir, fname), "rt")
except IOError:
inf = open(join(inc_dir, fname))
except OSError:
pass
else:
success = True
break
if not success:
raise RuntimeError("header '%s' not found" % fname)
raise RuntimeError(f"header '{fname}' not found")
try:
lines = inf.readlines()
return inf.read()
finally:
inf.close()
def get_header_hashes(self, fnames):
import hashlib
h = hashlib.sha256()
h.update(b"v1-")
for fname in fnames:
h.update(self.get_header_contents(fname).encode())
return h.hexdigest()
preprocessed_dir = "preproc-headers"
macro_headers: ClassVar[Sequence[str]] = ["isl/multi.h", "isl/list.h"]
def get_preprocessed_header(self, fname):
header_hash = self.get_header_hashes(
[*self.macro_headers, fname])
# cache preprocessed headers to avoid install-time
# dependency on pcpp
import errno
try:
os.mkdir(self.preprocessed_dir)
except OSError as err:
if err.errno == errno.EEXIST:
pass
else:
raise
prepro_fname = join(self.preprocessed_dir, header_hash)
try:
with open(prepro_fname) as inf:
return inf.read()
except OSError:
pass
print(f"preprocessing {fname}...")
macro_header_contents = [
self.get_header_contents(mh)
for mh in self.macro_headers]
prepro_header = preprocess_with_macros(
macro_header_contents, self.get_header_contents(fname))
with open(prepro_fname, "w") as outf:
outf.write(prepro_header)
return prepro_header
# {{{ read_header
def read_header(self, fname):
lines = self.get_preprocessed_header(fname).split("\n")
# heed continuations, split at semicolons
new_lines = []
i = 0
......@@ -634,6 +511,7 @@ class FunctionData:
my_line = lines[i].strip()
i += 1
my_line, _ = SUBCLASS_RE.subn("", my_line)
while my_line.endswith("\\"):
my_line = my_line[:-1] + lines[i].strip()
i += 1
......@@ -647,41 +525,41 @@ class FunctionData:
i = 0
while i < len(lines):
l = lines[i].strip()
line = lines[i].strip()
if (not l
or l.startswith("extern")
or STRUCT_DECL_RE.search(l)
or l.startswith("typedef")
or l == "}"):
if (not line
or line.startswith("extern")
or STRUCT_DECL_RE.search(line)
or line.startswith("typedef")
or line == "}"):
i += 1
elif "/*" in l:
elif "/*" in line:
while True:
if "*/" in l:
if "*/" in line:
i += 1
break
i += 1
l = lines[i].strip()
elif l.endswith("{"):
line = lines[i].strip()
elif line.endswith("{"):
while True:
if "}" in l:
if "}" in line:
i += 1
break
i += 1
l = lines[i].strip()
line = lines[i].strip()
elif not l:
elif not line:
i += 1
else:
decl = ""
while True:
decl = decl + l
decl = decl + line
if decl:
decl += " "
i += 1
......@@ -692,15 +570,19 @@ class FunctionData:
close_par_count = sum(1 for i in decl if i == ")")
if open_par_count and open_par_count == close_par_count:
break
l = lines[i].strip()
line = lines[i].strip()
if not STRUCT_DECL_RE.search(decl):
self.parse_decl(decl)
# }}}
# {{{ parse_decl
def parse_decl(self, decl):
decl_match = DECL_RE.match(decl)
if decl_match is None:
print("WARNING: func decl regexp not matched: %s" % decl)
print(f"WARNING: func decl regexp not matched: {decl}")
return
return_base_type = decl_match.group(1)
......@@ -720,9 +602,20 @@ class FunctionData:
"ISL_DECLARE_LIST_FN",
"isl_ast_op_type_print_macro",
"ISL_DECLARE_MULTI",
"ISL_DECLARE_MULTI_CMP",
"ISL_DECLARE_MULTI_NEG",
"ISL_DECLARE_MULTI_DIMS",
"ISL_DECLARE_MULTI_WITH_DOMAIN",
"ISL_DECLARE_EXPORTED_LIST_FN",
"ISL_DECLARE_MULTI_IDENTITY",
"ISL_DECLARE_MULTI_ARITH",
"ISL_DECLARE_MULTI_ZERO",
"ISL_DECLARE_MULTI_NAN",
"ISL_DECLARE_MULTI_DIM_ID",
"ISL_DECLARE_MULTI_TUPLE_ID",
"ISL_DECLARE_MULTI_BIND_DOMAIN",
"ISL_DECLARE_MULTI_PARAM",
"ISL_DECLARE_MULTI_DROP_DIMS",
"isl_malloc_or_die",
"isl_calloc_or_die",
"isl_realloc_or_die",
......@@ -733,17 +626,13 @@ class FunctionData:
assert c_name.startswith("isl_"), c_name
name = c_name[4:]
found_class = False
for cls in CLASSES:
if name.startswith(cls):
found_class = True
break
if found_class:
name = name[len(cls)+1:]
if name.startswith("2"):
name = "two_"+name[1:]
# find longest class name match
class_name = None
for it_cls_name in CLASSES:
if (name.startswith(it_cls_name)
and (class_name is None
or len(class_name) < len(it_cls_name))):
class_name = it_cls_name
# Don't be tempted to chop off "_val"--the "_val" versions of
# some methods are incompatible with the isl_int ones.
......@@ -755,26 +644,52 @@ class FunctionData:
# To avoid breaking user code in non-obvious ways, the new
# names are carried over to the Python level.
if not found_class:
for fake_cls, cls in CLASS_MAP.items():
if name.startswith(fake_cls):
found_class = True
break
assert found_class, name
if class_name is not None:
name = name[len(class_name)+1:]
else:
if name.startswith("bool_"):
return
if name.startswith("options_"):
class_name = "ctx"
name = name[len("options_"):]
elif name.startswith("equality_") or name.startswith("inequality_"):
class_name = "constraint"
elif name == "ast_op_type_set_print_name":
class_name = "printer"
name = "ast_op_type_set_print_name"
assert class_name is not None
if class_name == "ctx":
if name in ["alloc", "ref", "deref"]:
return
if "last_error" in name:
return
if name in ["set_error", "reset_error"]:
return
if name in ["free", "cow", "ref", "deref"]:
return
try:
args = [parse_arg(arg) for arg in args]
except BadArg:
print("SKIP: %s %s" % (cls, name))
print(f"SKIP: {class_name} {name}")
return
if name in PYTHON_RESERVED_WORDS:
name = name + "_"
if cls == "options":
assert name.startswith("set_") or name.startswith("get_")
name = name[:4]+"option_"+name[4:]
name = self.INVALID_PY_IDENTIFIER_RENAMING_MAP.get(name, name)
if name[0].isdigit():
print(f"SKIP: {class_name} {name} "
"(unhandled invalid python identifier)")
return
if class_name == "options":
assert name.startswith("set_") or name.startswith("get_"), (name, c_name)
name = f"{name[:4]}option_{name[4:]}"
words = return_base_type.split()
......@@ -787,474 +702,395 @@ class FunctionData:
words.remove("__isl_constructor")
return_semantics, words = filter_semantics(words)
return_decl_words = []
if words[0] in ["struct", "enum"]:
return_decl_words.append(words.pop(0))
words = [w for w in words if w not in ["struct", "enum"]]
return_base_type = " ".join(words)
cls_meth_list = self.classes_to_methods.setdefault(cls, [])
cls_meth_list = self.classes_to_methods.setdefault(class_name, [])
if c_name in self.seen_c_names:
return
cls_meth_list.append(Method(
cls, name, c_name,
return_semantics, return_decl_words, return_base_type, return_ptr,
class_name, name, c_name,
return_semantics, return_base_type, return_ptr,
args, is_exported=is_exported, is_constructor=is_constructor))
self.seen_c_names.add(c_name)
# }}}
# {{{ header writer
def write_enums_to_header(header_f):
for enum_name, value_str in ENUMS.items():
values = [v.strip() for v in value_str.split(",") if v.strip()]
if enum_name not in MACRO_ENUMS:
if enum_name in TYPEDEFD_ENUMS:
pattern = "typedef enum {{ {values}, ... }} {name};\n"
else:
pattern = "enum {name} {{ {values}, ... }};\n"
header_f.write(
pattern.format(
name=enum_name,
values=", ".join(values)))
else:
for v in values:
header_f.write("static const int {name};".format(name=v))
def write_classes_to_header(header_f):
for cls_name in CLASSES:
header_f.write("struct isl_{name};\n".format(name=cls_name))
if cls_name not in UNTYPEDEFD_CLASSES:
header_f.write(
"typedef struct isl_{name} isl_{name};\n"
.format(name=cls_name))
def write_method_header(header_f, method):
header_f.write(
"{return_decl_words} {ret_type} {ret_ptr}{name}({args});\n"
.format(
return_decl_words=" ".join(method.return_decl_words),
ret_type=method.return_base_type,
ret_ptr=method.return_ptr,
name=method.c_name,
args=", ".join(arg.c_declarator() for arg in method.args)))
# }}}
# }}}
# {{{ python wrapper writer
def write_enums_to_wrapper(wrapper_f):
gen = PythonCodeGenerator()
gen("")
gen("# {{{ enums")
gen("")
for enum_name, value_str in ENUMS.items():
values = [v.strip() for v in value_str.split(",") if v.strip()]
assert enum_name.startswith("isl_")
name = enum_name[4:]
# {{{ get_callback
if name == "bool":
continue
from os.path import commonprefix
common_len = len(commonprefix(values))
gen("class {name}(_EnumBase):".format(name=name))
with Indentation(gen):
for val in values:
py_name = val[common_len:]
if py_name in PYTHON_RESERVED_WORDS:
py_name += "_"
gen(
"{py_name} = lib.{val}"
.format(
val=val,
py_name=py_name,
))
gen("")
gen("# }}}")
gen("")
wrapper_f.write(gen.get())
def write_classes_to_wrapper(wrapper_f):
gen = PythonCodeGenerator()
gen("# {{{ declare classes")
gen("")
for cls_name in CLASSES:
py_cls = isl_class_to_py_class(cls_name)
gen("class {cls}(_ISLObjectBase):".format(cls=py_cls))
with Indentation(gen):
gen("_base_name = "+repr(cls_name))
gen("")
if cls_name == "ctx":
gen("""
def _get_ctx_data(self):
return self.data
def __del__(self):
if self.data is not None:
self._release()
""")
gen("")
else:
gen("""
def _get_ctx_data(self):
return lib.isl_{cls}_get_ctx(self.data)
def __del__(self):
if self.data is not None:
lib.isl_{cls}_free(self.data)
_deref_ctx(self._ctx_data, self._ctx_iptr)
"""
.format(cls=cls_name))
gen("")
if cls_name not in NON_COPYABLE:
gen("""
def _copy(self):
assert self.data is not None
data = lib.isl_{cls}_copy(self.data)
if data == ffi.NULL:
raise Error("failed to copy instance of {py_cls}")
return {py_cls}(_data=data)
"""
.format(cls=cls_name, py_cls=py_cls))
gen("")
gen("")
gen("# }}}")
gen("")
gen("")
wrapper_f.write(gen.get())
def gen_conversions(gen, tgt_cls, name):
conversions = IMPLICIT_CONVERSIONS.get(tgt_cls, [])
for src_cls, conversion_method in conversions:
gen_conversions(gen, src_cls, name)
gen("""
if isinstance({name}, {py_src_cls}):
{name} = {py_cls}.{conversion_method}({name})
"""
.format(
name=name,
py_src_cls=isl_class_to_py_class(src_cls),
py_cls=isl_class_to_py_class(tgt_cls),
conversion_method=conversion_method))
def gen_callback_wrapper(gen, cb, func_name, has_userptr):
def get_callback(cb_name, cb):
pre_call = []
passed_args = []
input_args = []
post_call = []
if has_userptr:
assert cb.args[-1].name == "user"
pre_call = PythonCodeGenerator()
post_call = PythonCodeGenerator()
assert cb.args[-1].name == "user"
for arg in cb.args[:-1]:
if arg.base_type.startswith("isl_") and arg.ptr == "*":
input_args.append(arg.name)
passed_args.append("_py_%s" % arg.name)
if arg.base_type.startswith("isl_"):
if arg.ptr != "*":
raise SignatureNotSupported(
f"unsupported callback arg: {arg.base_type} {arg.ptr}")
arg_cls = arg.base_type[4:]
pre_call(
"_py_{name} = {py_cls}(_data={name})"
.format(
name=arg.name,
py_cls=isl_class_to_py_class(arg.base_type)))
passed_args.append(f"arg_{arg.name}")
pre_call.append(f"""
{arg_cls} *wrapped_arg_{arg.name}(new {arg_cls}(c_arg_{arg.name}));
py::object arg_{arg.name}(
handle_from_new_ptr(wrapped_arg_{arg.name}));
""")
if arg.semantics is SEM_TAKE:
# We (the callback) are supposed to free the object, so
# just keep it attached to its wrapper until GC gets
# rid of it.
# just let the unique_ptr get rid of it.
pass
elif arg.semantics is SEM_KEEP:
# The caller wants to keep this object, so we'll stop managing
# it.
post_call("_py_{name}._release()".format(name=arg.name))
# The caller wants to keep this object, so we simply tell our
# wrapper to stop managing it after the call completes.
post_call.append(f"""
wrapped_arg_{arg.name}->invalidate();
""")
else:
raise SignatureNotSupported(
"callback arg semantics not understood: %s" % arg.semantics)
raise SignatureNotSupported("unsupported callback arg semantics")
else:
raise SignatureNotSupported("unsupported callback arg: %s %s" % (
arg.base_type, arg.ptr))
if has_userptr:
input_args.append("user")
if cb.return_base_type in SAFE_IN_TYPES and cb.return_ptr == "":
failure_return = "lib.isl_stat_error"
post_call("""
if _result is None:
_result = lib.isl_stat_ok
""")
raise SignatureNotSupported(
"unsupported callback arg: {arg.base_type} {arg.ptr}")
if cb.return_base_type in SAFE_IN_TYPES and not cb.return_ptr:
ret_type = f"{cb.return_base_type} {cb.return_ptr}"
if cb.return_base_type == "isl_stat":
post_call.append("""
if (retval.ptr() == Py_None)
{
return isl_stat_ok;
}
""")
else:
post_call.append("""
if (retval.ptr() == Py_None)
{
throw isl::error("callback returned None");
}
""")
if cb.return_base_type == "isl_bool":
post_call.append("""
else
return static_cast<isl_bool>(py::cast<bool>(retval));
""")
else:
post_call.append(f"""
else
return py::cast<{ret_type}>(retval);
""")
if cb.return_base_type == "isl_bool":
error_return = "isl_bool_error"
else:
error_return = "isl_stat_error"
elif cb.return_base_type.startswith("isl_") and cb.return_ptr == "*":
failure_return = "ffi.NULL"
ret_py_cls = isl_class_to_py_class(cb.return_base_type)
if cb.return_semantics is None:
raise SignatureNotSupported("callback return with unspecified semantics")
elif cb.return_semantics is not SEM_GIVE:
raise SignatureNotSupported("callback return with non-GIVE semantics")
post_call("""
if _result is None:
_result = ffi.NULL
elif not isinstance(_result, {py_cls}):
raise IslTypeError("return value is not a {py_cls}")
else:
_result = _result._release()
"""
.format(py_cls=ret_py_cls))
ret_type = f"{cb.return_base_type} {cb.return_ptr}"
post_call.append("""
if (retval.ptr() == Py_None)
{
return nullptr;
}
else
{
isl::%(ret_type_name)s *wrapper_retval =
py::cast<isl::%(ret_type_name)s *>(retval);
isl_%(ret_type_name)s *unwrapped_retval =
wrapper_retval->m_data;
wrapper_retval->invalidate();
return unwrapped_retval;
}
""" % {"ret_type_name": cb.return_base_type[4:]})
error_return = "nullptr"
else:
raise SignatureNotSupported("unsupported callback signature")
gen(
"def {func_name}({input_args}):"
.format(
func_name=func_name,
input_args=", ".join(input_args)))
with Indentation(gen):
gen("try:")
with Indentation(gen):
gen.extend(pre_call)
gen(
"_result = {name}({passed_args})"
.format(name=cb.name, passed_args=", ".join(passed_args)))
gen.extend(post_call)
gen("return _result")
gen("""
except Exception as e:
import sys
sys.stderr.write("[WARNING] An exception occurred "
"in a callback function."
"This exception was ignored.\\n")
sys.stderr.flush()
import traceback
traceback.print_exc()
return {failure_return}
""".format(failure_return=failure_return))
gen("")
def write_method_wrapper(gen, cls_name, meth):
pre_call = PythonCodeGenerator()
# There are two post-call phases, "safety", and "check". The "safety"
# phase's job is to package up all the data returned by the function
# called. No exceptions may be raised before safety ends.
#
# Next, the "check" phase will perform error checking and may raise exceptions.
safety = PythonCodeGenerator()
check = PythonCodeGenerator()
raise SignatureNotSupported("non-int callback")
return """
static %(ret_type)s %(cb_name)s(%(input_args)s)
{
py::object py_cb = py::borrow<py::object>(
(PyObject *) c_arg_user);
try
{
%(pre_call)s
py::object retval = py_cb(%(passed_args)s);
%(post_call)s
}
catch (py::python_error &err)
{
std::cout << "[islpy warning] A Python exception occurred in "
"a call back function, ignoring:" << std::endl;
err.restore();
PyErr_Print();
PyErr_Clear();
return %(error_return)s;
}
catch (std::exception &e)
{
std::cerr << "[islpy] An exception occurred in "
"a Python callback query:" << std::endl
<< e.what() << std::endl;
std::cout << "[islpy] Aborting now." << std::endl;
return %(error_return)s;
}
}
""" % {
"ret_type": ret_type,
"cb_name": cb_name,
"input_args": (
", ".join(f"{arg.base_type} {arg.ptr}c_arg_{arg.name}"
for arg in cb.args)),
"pre_call": "\n".join(pre_call),
"passed_args": ", ".join(passed_args),
"post_call": "\n".join(post_call),
"error_return": error_return,
}
# }}}
# {{{ wrapper generator
def write_wrapper(outf, meth):
body = []
checks = []
docs = []
passed_args = []
input_args = []
doc_args = []
ret_vals = []
ret_descrs = []
post_call = []
extra_ret_vals = []
extra_ret_descrs = []
preamble = []
arg_names = []
checks.append("isl_ctx *islpy_ctx = nullptr;")
arg_idx = 0
while arg_idx < len(meth.args):
arg = meth.args[arg_idx]
arg_names.append(arg.name)
if isinstance(arg, CallbackArgument):
has_userptr = (
arg_idx + 1 < len(meth.args)
and meth.args[arg_idx+1].name == "user")
if has_userptr:
and meth.args[arg_idx+1].name.endswith("user"))
if not has_userptr:
raise SignatureNotSupported(
"callback signature without user pointer")
else:
arg_idx += 1
cb_wrapper_name = "_cb_wrapper_"+arg.name
gen_callback_wrapper(pre_call, arg, cb_wrapper_name, has_userptr)
if meth.args[arg_idx].name != "user":
raise SignatureNotSupported("unexpected callback signature")
pre_call(
'_cb_{name} = ffi.callback("{cb_decl}")({cb_wrapper_name})'
.format(
name=arg.name, cb_decl=arg.c_declarator(),
cb_wrapper_name=cb_wrapper_name
))
cb_name = f"cb_{meth.cls}_{meth.name}_{arg.name}"
if (meth.cls in ["ast_build", "ast_print_options"]
and meth.name.startswith("set_")):
# These callbacks need to outlive the set call.
# Store them on the instance.
ret_vals.append("_cb_"+arg.name)
ret_descrs.append(":class:`ffi_callback_handle`")
input_args.append(arg.name)
passed_args.append("_cb_"+arg.name)
if has_userptr:
passed_args.append("ffi.NULL")
docs.append(":param %s: callback(%s) -> %s"
% (
arg.name,
", ".join(
sub_arg.name
for sub_arg in arg.args
if sub_arg.name != "user"),
arg.return_base_type
))
extra_ret_vals.append(f"py_{arg.name}")
extra_ret_descrs.append("(opaque handle to "
"manage callback lifetime)")
input_args.append(f"py::object py_{arg.name}")
passed_args.append(cb_name)
passed_args.append(f"py_{arg.name}.ptr()")
preamble.append(get_callback(cb_name, arg))
docs.append(":param {name}: callback({args})".format(
name=arg.name,
args=", ".join(
sub_arg.name for sub_arg in arg.args
if sub_arg.name != "user")
))
elif arg.base_type in SAFE_IN_TYPES and not arg.ptr:
passed_args.append(arg.name)
input_args.append(arg.name)
doc_args.append(arg.name)
assert not arg.is_const
pre_call("# no argument processing for {0}".format(arg.name))
passed_args.append(f"arg_{arg.name}")
input_args.append(f"{arg.base_type} arg_{arg.name}")
doc_cls = arg.base_type
if doc_cls.startswith("isl_"):
doc_cls = doc_cls[4:]
if doc_cls == "unsigned long":
doc_cls = "int"
docs.append(":param %s: :class:`%s`" % (arg.name, doc_cls))
docs.append(f":param {arg.name}: :class:`{doc_cls}`")
elif arg.base_type in ["char", "const char"] and arg.ptr == "*":
c_name = "_cstr_"+arg.name
if arg.semantics is SEM_KEEP:
passed_args.append(f"strdup({arg.name})")
else:
passed_args.append(arg.name)
pre_call('{c_name} = ffi.new("char[]", {arg_name}.encode())'
.format(c_name=c_name, arg_name=arg.name))
def _arg_to_const_str(arg: Argument) -> str:
if arg.is_const:
return "const "
return ""
if arg.semantics is SEM_TAKE:
pre_call(
"{c_name} = _ManagedCString({c_name})"
.format(c_name=c_name))
passed_args.append(c_name + "._release()")
else:
passed_args.append(c_name)
input_args.append(arg.name)
input_args.append(f"{_arg_to_const_str(arg)}{arg.base_type} *{arg.name}")
docs.append(":param %s: string" % arg.name)
docs.append(f":param {arg.name}: string")
elif arg.base_type == "int" and arg.ptr == "*":
elif arg.base_type in ["int", "isl_bool"] and arg.ptr == "*":
if arg.name in ["exact", "tight"]:
c_name = "cint_"+arg.name
pre_call('{c_name} = ffi.new("int[1]")'.format(c_name=c_name))
passed_args.append(c_name)
ret_vals.append("{c_name}[0]".format(c_name=c_name))
ret_descrs.append("%s (integer)" % arg.name)
body.append(f"{arg.base_type} arg_{arg.name};")
passed_args.append(f"&arg_{arg.name}")
if arg.base_type == "isl_bool":
extra_ret_vals.append(f"(bool) arg_{arg.name}")
else:
extra_ret_vals.append(f"arg_{arg.name}")
extra_ret_descrs.append(
f"{arg.name} ({to_py_class(arg.base_type)})")
arg_names.pop()
else:
raise SignatureNotSupported("int *")
elif arg.base_type == "isl_val" and arg.ptr == "*" and arg_idx > 0:
# {{{ val input argument
val_name = "_val_" + arg.name
pre_call("""
if isinstance({name}, Val):
{val_name} = {name}._copy()
elif isinstance({name}, six.integer_types):
_cdata_{name} = lib.isl_val_int_from_si(
{arg0_name}._get_ctx_data(), {name})
if _cdata_{name} == ffi.NULL:
raise Error("isl_val_int_from_si failed")
{val_name} = Val(_data=_cdata_{name})
arg_descr = f":param {arg.name}: :class:`Val`"
input_args.append(f"py::object py_{arg.name}")
checks.append("""
std::unique_ptr<val> unique_arg_%(name)s;
try
{
val *arg_%(name)s = py::cast<val *>(py_%(name)s);
isl_val *tmp_ptr = isl_val_copy(arg_%(name)s->m_data);
if (!tmp_ptr)
throw isl::error("failed to copy arg %(name)s");
unique_arg_%(name)s = std::unique_ptr<val>(new val(tmp_ptr));
}
catch (py::cast_error &err)
{
// fall through to next case
}
try
{
if (!unique_arg_%(name)s.get())
{
isl_val *tmp_ptr = isl_val_int_from_si(islpy_ctx,
py::cast<long>(py_%(name)s));
if (!tmp_ptr)
throw isl::error("failed to create arg "
"%(name)s from integer");
unique_arg_%(name)s = std::unique_ptr<val>(new val(tmp_ptr));
}
}
catch (py::cast_error &err)
{
throw isl::error("unrecognized argument for %(name)s");
}
""" % {
"name": arg.name,
})
else:
raise IslTypeError("{name} is a %s and cannot "
"be cast to a Val" % type({name}))
"""
.format(
arg0_name=meth.args[0].name,
name=arg.name,
val_name=val_name))
if arg.semantics is None and arg.base_type != "isl_ctx":
raise Undocumented(meth)
if arg.semantics is SEM_TAKE:
passed_args.append(val_name + "._release()")
else:
passed_args.append(val_name + ".data")
input_args.append(arg.name)
post_call.append(f"unique_arg_{arg.name}.release();")
docs.append(":param %s: :class:`Val`" % arg.name)
passed_args.append(f"unique_arg_{arg.name}->m_data")
docs.append(arg_descr)
# }}}
elif arg.base_type.startswith("isl_") and arg.ptr == "*":
# {{{ isl types input arguments
gen_conversions(pre_call, arg.base_type, arg.name)
arg_py_cls = isl_class_to_py_class(arg.base_type)
pre_call("""
if not isinstance({name}, {py_cls}):
raise IslTypeError("{name} is not a {py_cls}")
"""
.format(name=arg.name, py_cls=arg_py_cls))
arg_cls = arg.base_type[4:]
arg_descr = ":param %s: :class:`%s`" % (
arg.name, isl_class_to_py_class(arg_cls))
arg_descr = f":param {arg.name}: :class:`{to_py_class(arg_cls)}`"
if arg_idx == 0 and meth.is_mutator:
arg_descr += " (mutated in-place)"
input_args.append(f"py::object py_{arg.name}")
checks.append("""
isl::%(cls)s &arg_%(name)s(
py::cast<isl::%(cls)s &>(py_%(name)s));
if (!arg_%(name)s.is_valid())
throw isl::error(
"passed invalid arg to isl_%(meth)s for %(name)s");
""" % {
"name": arg.name,
"meth": f"{meth.cls}_{meth.name}",
"cls": arg_cls})
passed_args.append(f"arg_{arg.name}.m_data")
post_call.append(f"arg_{arg.name}.invalidate();")
arg_descr += " (mutated in-place)"
if arg.semantics is None and arg.base_type != "isl_ctx":
raise Undocumented(meth)
copyable = arg_cls not in NON_COPYABLE
if arg.semantics is SEM_TAKE:
if copyable:
copy_name = "_copy_"+arg.name
pre_call('{copy_name} = {name}._copy()'
.format(copy_name=copy_name, name=arg.name))
passed_args.append(copy_name+"._release()")
else:
if arg.semantics is None and arg.base_type != "isl_ctx":
raise Undocumented(meth)
checks.append("""
if (!arg_%(name)s.is_valid())
throw isl::error(
"passed invalid arg to isl_%(meth)s for %(name)s");
""" % {"name": arg.name, "meth": f"{meth.cls}_{meth.name}"})
if arg.semantics is SEM_TAKE:
if arg_cls not in NON_COPYABLE:
input_args.append(
f"{arg_cls} const &arg_{arg.name}")
checks.append("""
std::unique_ptr<%(cls)s> auto_arg_%(name)s;
{
isl_%(cls)s *tmp_ptr =
isl_%(cls)s_copy(arg_%(name)s.m_data);
if (!tmp_ptr)
throw isl::error("failed to copy arg "
"%(name)s on entry to %(meth)s");
auto_arg_%(name)s = std::unique_ptr<%(cls)s>(
new %(cls)s(tmp_ptr));
}
""" % {
"name": arg.name,
"meth": f"{meth.cls}_{meth.name}",
"cls": arg_cls})
post_call.append(f"auto_arg_{arg.name}.release();")
passed_args.append(f"auto_arg_{arg.name}->m_data")
else:
if not (arg_idx == 0 and meth.is_mutator):
passed_args.append(arg.name+"._release()")
arg_descr += " (mutated in-place)"
else:
passed_args.append(arg.name+".data")
input_args.append(f"{arg_cls} &arg_{arg.name}")
post_call.append(f"arg_{arg.name}.invalidate();")
passed_args.append(f"arg_{arg.name}.m_data")
arg_descr += " (:ref:`becomes invalid <auto-invalidation>`)"
elif arg.semantics is SEM_KEEP or arg.semantics is None:
passed_args.append("%s.data" % arg.name)
else:
raise RuntimeError("unexpected semantics: %s" % arg.semantics)
input_args.append(arg.name)
else:
passed_args.append(f"arg_{arg.name}.m_data")
input_args.append(f"{arg_cls} const &arg_{arg.name}")
if arg_idx == 0:
if arg.base_type == "isl_ctx":
checks.append(f"""
islpy_ctx = arg_{arg.name}.m_data;
""")
else:
checks.append(f"""
islpy_ctx = {arg.base_type}_get_ctx(arg_{arg.name}.m_data);
""")
docs.append(arg_descr)
......@@ -1266,221 +1102,364 @@ def write_method_wrapper(gen, cls_name, meth):
if arg.semantics is not SEM_GIVE:
raise SignatureNotSupported("non-give secondary ptr return value")
pre_call(
'_retptr_{name} = ffi.new("{cls} *")'
.format(name=arg.name, cls=arg.base_type))
ret_cls = arg.base_type[4:]
passed_args.append("ffi.addressof(_retptr_{name})".format(name=arg.name))
arg_names.pop()
body.append(f"{arg.base_type} *ret_{arg.name};")
passed_args.append(f"&ret_{arg.name}")
py_cls = isl_class_to_py_class(arg.base_type)
safety("""
if _retptr_{name} == ffi.NULL:
_ret_{name} = None
else:
_ret_{name} = {py_cls}(_data=_retptr_{name})
"""
.format(name=arg.name, cls=arg.base_type, py_cls=py_cls))
post_call.append("""
py::object py_ret_%(name)s;
if (ret_%(name)s)
{
py_ret_%(name)s = handle_from_new_ptr(
new %(ret_cls)s(ret_%(name)s));
}
""" % {"name": arg.name, "ret_cls": ret_cls})
ret_vals.append("_ret_" + arg.name)
ret_descrs.append("%s (:class:`%s`)" % (arg.name, py_cls))
extra_ret_vals.append(f"py_ret_{arg.name}")
extra_ret_descrs.append(
f"{arg.name} (:class:`{to_py_class(ret_cls)}`)")
# }}}
elif arg.base_type == "FILE" and arg.ptr == "*":
raise SignatureNotSupported(
f"arg type {arg.base_type} {arg.ptr}")
passed_args.append(f"PyFile_AsFile(arg_{arg.name}.ptr())")
input_args.append(f"py::object arg_{arg.name}")
docs.append(f":param {arg.name}: :class:`file`-like "
"(NOTE: This will cease to be supported in Python 3.)")
elif (arg.base_type == "void"
and arg.ptr == "*"
and arg.name == "user"):
raise SignatureNotSupported("void pointer")
passed_args.append("ffi.NULL")
input_args.append(arg.name)
else:
raise SignatureNotSupported(f"arg type {arg.base_type} {arg.ptr}")
pre_call("""
if {name} is not None:
raise Error("passing non-None arguments for '{name}' "
"is not yet supported")
"""
.format(name=arg.name))
arg_idx += 1
docs.append(":param %s: None" % arg.name)
processed_return_type = f"{meth.return_base_type} {meth.return_ptr}"
else:
raise SignatureNotSupported("arg type %s %s" % (arg.base_type, arg.ptr))
if meth.return_base_type == "void" and not meth.return_ptr:
result_capture = ""
else:
result_capture = f"{meth.return_base_type} {meth.return_ptr}result = "
arg_idx += 1
pre_call("")
body = checks + body
body.append("if (islpy_ctx) isl_ctx_reset_error(islpy_ctx);")
body.append("{}{}({});".format(
result_capture, meth.c_name, ", ".join(passed_args)))
body += post_call
# {{{ return value processing
if meth.return_base_type == "isl_stat" and not meth.return_ptr:
check("if _result == lib.isl_stat_error:")
with Indentation(check):
check('raise Error("call to \\"{0}\\" failed")'.format(meth.c_name))
err_handling_body = f'handle_isl_error(islpy_ctx, "isl_{meth.cls}_{meth.name}");'
if meth.return_base_type == "int" and not meth.return_ptr:
# {{{ integer return
if meth.name.startswith("is_") or meth.name.startswith("has_"):
processed_return_type = "bool"
ret_descr = processed_return_type
if extra_ret_vals:
if len(extra_ret_vals) == 1:
processed_return_type = "py::object"
body.append(f"return py::object(result, {extra_ret_vals[0]});")
ret_descr = extra_ret_descrs[0]
else:
processed_return_type = "py::object"
body.append("return py::make_tuple(result, {});".format(
", ".join(extra_ret_vals)))
ret_descr = "tuple: ({})".format(", ".join(extra_ret_descrs))
else:
body.append("return result;")
# }}}
elif meth.return_base_type == "isl_stat" and not meth.return_ptr:
# {{{ error code
body.append(f"""
if (result == isl_stat_error)
{err_handling_body}
""")
assert not (meth.name.startswith("is_") or meth.name.startswith("has_"))
ret_descr = processed_return_type
if extra_ret_vals:
if len(extra_ret_vals) == 1:
processed_return_type = "py::object"
body.append(f"return py::object({extra_ret_vals[0]});")
ret_descr = extra_ret_descrs[0]
else:
processed_return_type = "py::object"
body.append("return py::make_tuple({});".format(
", ".join(extra_ret_vals)))
ret_descr = "tuple: ({})".format(", ".join(extra_ret_descrs))
else:
body.append("return result;")
# }}}
elif meth.return_base_type == "isl_bool" and not meth.return_ptr:
check("if _result == lib.isl_bool_error:")
with Indentation(check):
check('raise Error("call to \\"{0}\\" failed")'.format(meth.c_name))
# {{{ bool
body.append(f"""
if (result == isl_bool_error)
{err_handling_body}
""")
ret_vals.insert(0, "_result == lib.isl_bool_true")
ret_descrs.insert(0, "bool")
processed_return_type = "bool"
ret_descr = "bool"
if extra_ret_vals:
if len(extra_ret_vals) == 1:
processed_return_type = "py::object"
body.append(f"return py::object({extra_ret_vals[0]});")
ret_descr = extra_ret_descrs[0]
else:
processed_return_type = "py::object"
body.append("return py::make_tuple({});".format(
", ".join(extra_ret_vals)))
ret_descr = "tuple: ({})".format(", ".join(extra_ret_descrs))
else:
body.append("return result;")
# }}}
elif meth.return_base_type in SAFE_TYPES and not meth.return_ptr:
ret_vals.insert(0, "_result")
ret_descrs.insert(0, meth.return_base_type)
# {{{ enums etc
if extra_ret_vals:
raise NotImplementedError("extra ret val with safe type")
body.append("return result;")
ret_descr = processed_return_type
# }}}
elif (meth.return_base_type.startswith("isl_")
and meth.return_semantics is SEM_NULL):
assert not meth.is_mutator
elif meth.return_base_type.startswith("isl_"):
assert meth.return_ptr == "*", meth
elif meth.return_base_type.startswith("isl_") and meth.return_ptr == "*":
ret_cls = meth.return_base_type[4:]
if meth.is_mutator:
if ret_vals:
if extra_ret_vals:
meth.mutator_veto = True
raise Retry()
safety("%s._reset(_result)" % meth.args[0].name)
processed_return_type = "py::object"
body.append(f"arg_{meth.args[0].name}.take_possession_of(result);")
body.append(f"return py_{meth.args[0].name};")
ret_vals.insert(0, meth.args[0].name)
ret_descrs.insert(0,
":class:`%s` (self)" % isl_class_to_py_class(ret_cls))
ret_descr = f":class:`{to_py_class(ret_cls)}` (self)"
else:
processed_return_type = "py::object"
isl_obj_ret_val = \
"handle_from_new_ptr(uptr_result.release())"
if extra_ret_vals:
isl_obj_ret_val = "py::make_tuple({}, {})".format(
isl_obj_ret_val, ", ".join(extra_ret_vals))
ret_descr = "tuple: (:class:`{}`, {})".format(
to_py_class(ret_cls), ", ".join(extra_ret_descrs))
else:
ret_descr = f":class:`{to_py_class(ret_cls)}`"
if meth.return_semantics is None and ret_cls != "ctx":
raise Undocumented(meth)
if meth.return_semantics is not SEM_GIVE and ret_cls != "ctx":
raise SignatureNotSupported("non-give return")
py_ret_cls = isl_class_to_py_class(ret_cls)
safety(
"_result = None if _result == ffi.NULL else {0}(_data=_result)"
.format(py_ret_cls))
check("""
if _result is None:
raise Error("call to {c_method} failed")
"""
.format(c_method=meth.c_name))
ret_vals.insert(0, "_result")
ret_descrs.insert(0, ":class:`%s`" % py_ret_cls)
body.append(f"""
if (result)
{{
std::unique_ptr <isl::{ret_cls}>
uptr_result(new {ret_cls}(result));
return {isl_obj_ret_val};
}}
else
{err_handling_body}
""")
elif meth.return_base_type in ["const char", "char"] and meth.return_ptr == "*":
safety("""
if _result != ffi.NULL:
_str_ret = ffi.string(_result)
else:
_str_ret = None
if extra_ret_vals:
raise NotImplementedError("extra ret val with string")
processed_return_type = "py::object"
body.append("""
if (result)
return py::cast(result);
else
return py::none();
""")
if meth.return_semantics is SEM_GIVE:
safety("libc.free(_result)")
body.append("free(result);")
check("""
if _PY3 and _str_ret is not None:
_str_ret = _str_ret.decode()
""")
ret_vals.insert(0, "_str_ret")
ret_descrs.insert(0, "string")
ret_descr = "string"
elif (meth.return_base_type == "void"
and meth.return_ptr == "*"
and meth.name == "get_user"):
raise SignatureNotSupported("get_user")
# body.append("""
# return py::object(py::handle<>(py::borrowed((PyObject *) _result)));
# """)
# ret_descr = "a user-specified python object"
body.append("""
return py::borrow<py::object>((PyObject *) result);
""")
ret_descr = "a user-specified python object"
processed_return_type = "py::object"
elif meth.return_base_type == "void" and not meth.return_ptr:
pass
if extra_ret_vals:
processed_return_type = "py::object"
if len(extra_ret_vals) == 1:
body.append(f"return {extra_ret_vals[0]};")
ret_descr = extra_ret_descrs[0]
else:
body.append("return py::make_tuple({});".format(
", ".join(extra_ret_vals)))
ret_descr = "tuple: {}".format(", ".join(extra_ret_descrs))
else:
ret_descr = "None"
else:
raise SignatureNotSupported("ret type: %s %s in %s" % (
meth.return_base_type, meth.return_ptr, meth))
raise SignatureNotSupported(
f"ret type: {meth.return_base_type} {meth.return_ptr} in {meth}")
# }}}
assert len(ret_vals) == len(ret_descrs)
outf.write("""
{preamble}
{return_type} {cls}_{name}({inputs})
{{
{body}
}}
""".format(
preamble="\n".join(preamble),
return_type=processed_return_type, cls=meth.cls, name=meth.name,
inputs=", ".join(input_args),
body="\n".join(body)))
check("")
if len(ret_vals) == 0:
ret_descr = "(nothing)"
docs = (["{}({})".format(meth.name, ", ".join(arg_names)),
"", *docs, f":return: {ret_descr}"])
elif len(ret_vals) == 1:
check("return " + ret_vals[0])
ret_descr = ret_descrs[0]
return arg_names, "\n".join(docs)
# }}}
else:
check("return " + ", ".join(ret_vals))
ret_descr = "(%s)" % ", ".join(ret_descrs)
docs = (["%s(%s)" % (meth.name, ", ".join(input_args)), ""]
+ docs
+ [":return: %s" % ret_descr])
gen("def {name}({input_args}):"
.format(name=meth.name, input_args=", ".join(input_args)))
gen.indent()
gen(repr("\n".join(docs)))
gen("")
gen.extend(pre_call)
gen("")
gen("try:")
with Indentation(gen):
gen("with DelayedKeyboardInterrupt():")
with Indentation(gen):
gen("_result = None")
gen(
"_result = lib.{c_name}({args})"
.format(c_name=meth.c_name, args=", ".join(passed_args)))
gen("finally:")
with Indentation(gen):
gen(r"""
if _result is None:
# This should never happen.
sys.stderr.write("*** islpy was interrupted while collecting "
"a result. "
"System state is inconsistent as a result, aborting.\n")
sys.stderr.flush()
os._exit(-1)
""")
gen.extend(safety)
gen.extend(check)
gen.dedent()
gen("")
# {{{ exposer generator
method_val = meth.name
def write_exposer(outf, meth, arg_names, doc_str):
func_name = f"isl::{meth.cls}_{meth.name}"
py_name = meth.name
if meth.is_static:
method_val = "staticmethod(%s)" % method_val
if py_name == "size" and len(meth.args) == 1:
py_name = "__len__"
nonself_arg_names = arg_names
if not meth.is_static:
nonself_arg_names = nonself_arg_names[1:]
args_str = ", ".join(
f'py::arg("{arg_name}")' for arg_name in nonself_arg_names)
if args_str:
args_str = f", {args_str}"
gen("{py_cls}.{py_name} = {method_val}"
.format(
py_cls=isl_class_to_py_class(meth.cls),
py_name=py_name,
method_val=method_val))
gen("")
if meth.name == "size" and len(meth.args) == 1:
py_name = "__len__"
if meth.is_static:
gen("{py_cls}._{name}_is_static = True"
.format(
py_cls=isl_class_to_py_class(meth.cls),
name=py_name))
gen("")
if meth.name == "get_hash" and len(meth.args) == 1:
py_name = "__hash__"
# if meth.is_static:
# doc_str = "(static method)\n" + doc_str
if not meth.is_exported:
doc_str = doc_str + (
"\n\n.. warning::\n\n "
"This function is not part of the officially public isl API. "
"Use at your own risk.")
doc_str_arg = ', "{}"'.format(doc_str.replace("\n", "\\n"))
wrap_class = CLASS_MAP.get(meth.cls, meth.cls)
outf.write(f'wrap_{wrap_class}.def{"_static" if meth.is_static else ""}('
f'"{py_name}", {func_name}{args_str+doc_str_arg});\n')
if meth.name == "read_from_str":
assert meth.is_static
outf.write(f'wrap_{wrap_class}.def("__init__",'
f"[](isl::{wrap_class} *t, const char *s, isl::ctx *ctx_wrapper)"
"{"
" isl_ctx *ctx = nullptr;"
" if (ctx_wrapper && ctx_wrapper->is_valid())"
" ctx = ctx_wrapper->m_data;"
" if (!ctx) ctx = isl::get_default_context();"
" if (!ctx)"
f' throw isl::error("from-string conversion of {meth.cls}: "'
f' "no context available");'
f" isl_{wrap_class} *result = isl_{meth.cls}_read_from_str(ctx, s);"
" if (result)"
f" new (t) isl::{wrap_class}(result);"
" else"
f' isl::handle_isl_error(ctx, "isl_{meth.cls}_read_from_str");'
'}, py::arg("s"), py::arg("context").none(true)=py::none());\n')
# }}}
wrapped_isl_functions = set()
def write_wrappers(expf, wrapf, methods):
undoc = []
for meth in methods:
# print "TRY_WRAP:", meth
if meth.name.endswith("_si") or meth.name.endswith("_ui"):
val_versions = [
meth2
for meth2 in methods
if meth2.cls == meth.cls
and (
meth2.name == meth.name[:-3]
or meth2.name == meth.name[:-3] + "_val"
)
]
if val_versions:
# no need to expose C integer versions of things
print("SKIP (val version available): {} -> {}".format(
meth, ", ".join(str(s) for s in val_versions)))
continue
try:
arg_names, doc_str = write_wrapper(wrapf, meth)
write_exposer(expf, meth, arg_names, doc_str)
except Undocumented:
undoc.append(str(meth))
except Retry:
arg_names, doc_str = write_wrapper(wrapf, meth)
write_exposer(expf, meth, arg_names, doc_str)
except SignatureNotSupported:
_, e, _ = sys.exc_info()
print(f"SKIP (sig not supported: {e}): {meth}")
else:
wrapped_isl_functions.add(meth.name)
pass
print("SKIP ({} undocumented methods): {}".format(len(undoc), ", ".join(undoc)))
ADD_VERSIONS = {
"union_pw_aff": 15,
"multi_union_pw_aff": 15,
......@@ -1490,13 +1469,64 @@ ADD_VERSIONS = {
}
upcasts = {}
def add_upcasts(basic_class, special_class, fmap, expf):
def my_ismethod(method):
if method.name.endswith("_si") or method.name.endswith("_ui"):
return False
if method.name not in wrapped_isl_functions:
return False
if method.is_static:
return False
return True
expf.write(f"\n// {{{{{{ Upcasts from {basic_class} to {special_class}\n\n")
for special_method in fmap[special_class]:
if not my_ismethod(special_method):
continue
found = False
for basic_method in fmap[basic_class]:
if basic_method.name == special_method.name:
found = True
break
if found:
if not my_ismethod(basic_method):
continue
else:
if (basic_class in upcasts
and special_method.name in upcasts[basic_class]):
continue
upcasts.setdefault(basic_class, []).append(special_method.name)
doc_str = (f'"\\n\\nUpcast from :class:`{to_py_class(basic_class)}`'
+ f' to :class:`{to_py_class(special_class)}`\\n"')
expf.write(f'wrap_{basic_class}.def("{special_method.name}", '
f"isl::{special_class}_{special_method.name}, {doc_str});\n")
expf.write("\n// }}}\n\n")
def gen_wrapper(include_dirs, include_barvinok=False, isl_version=None):
fdata = FunctionData(["."] + include_dirs)
fdata = FunctionData([".", *include_dirs])
fdata.read_header("isl/ctx.h")
fdata.read_header("isl/id.h")
fdata.read_header("isl/space.h")
fdata.read_header("isl/set.h")
fdata.read_header("isl/map.h")
fdata.read_header("isl/map_type.h")
fdata.read_header("isl/local_space.h")
fdata.read_header("isl/aff.h")
fdata.read_header("isl/polynomial.h")
......@@ -1509,133 +1539,71 @@ def gen_wrapper(include_dirs, include_barvinok=False, isl_version=None):
fdata.read_header("isl/val.h")
fdata.read_header("isl/vec.h")
fdata.read_header("isl/mat.h")
fdata.read_header("isl/band.h")
fdata.read_header("isl/stride_info.h")
fdata.read_header("isl/schedule.h")
fdata.read_header("isl/schedule_node.h")
fdata.read_header("isl/flow.h")
fdata.read_header("isl/options.h")
fdata.read_header("isl/ast.h")
fdata.read_header("isl/ast_build.h")
if isl_version is None:
fdata.read_header("isl_declaration_macros_expanded.h")
else:
fdata.read_header("isl_declaration_macros_expanded_v%d.h"
% isl_version)
fdata.headers.pop()
fdata.read_header("isl/ast_type.h")
fdata.read_header("isl/ilp.h")
if include_barvinok:
fdata.read_header("barvinok/isl.h")
undoc = []
for part, classes in PART_TO_CLASSES.items():
expf = open(f"src/wrapper/gen-expose-{part}.inc", "w")
wrapf = open(f"src/wrapper/gen-wrap-{part}.inc", "w")
with open("wrapped-functions.h", "wt") as header_f:
with open("islpy/_isl.py", "wt") as wrapper_f:
header_f.write(
"// AUTOMATICALLY GENERATED by gen_wrap.py -- do not edit\n\n")
write_enums_to_header(header_f)
write_classes_to_header(header_f)
header_f.write(HEADER_PREAMBLE)
wrapper_f.write(
"# AUTOMATICALLY GENERATED by gen_wrap.py -- do not edit\n")
wrapper_f.write(PY_PREAMBLE)
write_enums_to_wrapper(wrapper_f)
write_classes_to_wrapper(wrapper_f)
wrapper_gen = PythonCodeGenerator()
wrapper_gen("# {{{ wrappers")
wrapper_gen("")
wrapper_gen("def _add_methods():")
with Indentation(wrapper_gen):
for cls_name in CLASSES:
if not (
isl_version is None
or ADD_VERSIONS.get(cls_name) is None
or ADD_VERSIONS.get(cls_name) <= isl_version):
continue
methods = [
meth
for meth in fdata.classes_to_methods.get(cls_name, [])]
wrapper_gen("# {{{ " + cls_name)
wrapper_gen("")
for meth in methods:
if meth.name.endswith("_si") or meth.name.endswith("_ui"):
val_versions = [
meth2
for meth2 in methods
if meth2.cls == meth.cls
and (
meth2.name == meth.name[:-3]
or meth2.name == meth.name[:-3] + "_val"
)
]
if val_versions:
# no need to expose C integer versions of things
print("SKIP (val version available): %s -> %s"
% (meth, ", ".join(str(s)
for s in val_versions)))
continue
write_method_header(header_f, meth)
if meth.name in ["free", "set_free_user"]:
continue
try:
write_method_wrapper(wrapper_gen, cls_name, meth)
except Retry:
write_method_wrapper(wrapper_gen, cls_name, meth)
except Undocumented:
undoc.append(str(meth))
except SignatureNotSupported:
_, e, _ = sys.exc_info()
print("SKIP (sig not supported: %s): %s" % (e, meth))
else:
#print "WRAPPED:", meth
pass
wrapper_gen("# }}}")
wrapper_gen("")
wrapper_gen("")
wrapper_gen("# }}}")
wrapper_gen("")
wrapper_gen("_add_methods()")
wrapper_f.write("\n" + wrapper_gen.get())
wrapper_f.write("\n\n# vim: fdm=marker\n")
with open("name_list.py", "wt") as clist_f:
py_classes = []
for cls_name in CLASSES:
py_cls = isl_class_to_py_class(cls_name)
py_classes.append(py_cls)
clist_f.write("{py_cls} = _isl.{py_cls}\n".format(py_cls=py_cls))
clist_f.write("\n")
for enum_name in ENUMS:
py_name = enum_name[4:]
if py_name == "bool":
continue
classes = [
cls
for cls in classes
if isl_version is None
or ADD_VERSIONS.get(cls) is None
or ADD_VERSIONS.get(cls) <= isl_version]
write_wrappers(expf, wrapf, [
meth
for cls in classes
for meth in fdata.classes_to_methods.get(cls, [])])
# {{{ add automatic 'self' upcasts
# note: automatic upcasts for method arguments are provided through
# 'implicitly_convertible'.
if part == "part1":
add_upcasts("aff", "pw_aff", fdata.classes_to_methods, expf)
add_upcasts("pw_aff", "union_pw_aff", fdata.classes_to_methods, expf)
add_upcasts("aff", "union_pw_aff", fdata.classes_to_methods, expf)
clist_f.write(
"{py_name} = _isl.{py_name}\n"
.format(py_name=py_name)
)
clist_f.write("\n")
add_upcasts("space", "local_space", fdata.classes_to_methods, expf)
add_upcasts("multi_aff", "pw_multi_aff", fdata.classes_to_methods, expf)
add_upcasts("pw_multi_aff", "union_pw_multi_aff",
fdata.classes_to_methods, expf)
add_upcasts("multi_aff", "union_pw_multi_aff",
fdata.classes_to_methods, expf)
elif part == "part2":
add_upcasts("basic_set", "set", fdata.classes_to_methods, expf)
add_upcasts("set", "union_set", fdata.classes_to_methods, expf)
add_upcasts("basic_set", "union_set", fdata.classes_to_methods, expf)
add_upcasts("basic_map", "map", fdata.classes_to_methods, expf)
add_upcasts("map", "union_map", fdata.classes_to_methods, expf)
add_upcasts("basic_map", "union_map", fdata.classes_to_methods, expf)
elif part == "part3":
# empty
pass
clist_f.write("ALL_CLASSES = [{0}]\n".format(", ".join(py_classes)))
# }}}
print("SKIP (%d undocumented methods): %s" % (len(undoc), ", ".join(undoc)))
expf.close()
wrapf.close()
return fdata.headers
if __name__ == "__main__":
from os.path import expanduser
......
Subproject commit 2c1b68581916666fb2bcc94c7bf8779807ed42d9
Subproject commit 80035e4c3fcbebf13a70752111f03d48a5e46dda
#define GIT_HEAD_ID "isl-0.00-0-included-with-islpy"
#define HAVE_DECL_MP_GET_MEMORY_FUNCTIONS 1
#define WARN_UNUSED /* nothing */
#ifdef __GNUC__
#define HAVE_DECL___BUILTIN_FFS 1
#else
#define HAVE_DECL_FFS 1
#endif
#include <isl_config_post.h>
#undef __isl_keep
#undef __isl_take
#undef __isl_give
#define __isl_keep __islpy_keep
#define __isl_take __islpy_take
#define __isl_give __islpy_give
// matches order in src/wrapper/wrap_isl.hpp
ISL_DECLARE_LIST(id)
ISL_DECLARE_LIST(val)
ISL_DECLARE_LIST(aff)
ISL_DECLARE_LIST(pw_aff)
ISL_DECLARE_LIST(constraint)
ISL_DECLARE_LIST(basic_set)
#if ISLPY_ISL_VERSION >= 15
ISL_DECLARE_LIST(basic_map)
#endif
ISL_DECLARE_LIST(set)
#if ISLPY_ISL_VERSION >= 15
ISL_DECLARE_LIST(map)
ISL_DECLARE_LIST(union_set)
#endif
ISL_DECLARE_LIST(ast_expr)
ISL_DECLARE_LIST(ast_node)
ISL_DECLARE_LIST(band)
ISL_DECLARE_MULTI(aff)
ISL_DECLARE_MULTI(pw_aff)
ISL_DECLARE_MULTI(val)
ISL_DECLARE_MULTI(union_pw_aff)
# 1 "isl_declaration_macros.h"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "./isl/include/isl/list.h" 1
# 13 "./isl/include/isl/list.h"
# 1 "isl/include/isl/ctx.h" 1
# 13 "isl/include/isl/ctx.h"
# 1 "/usr/include/stdio.h" 1 3 4
# 27 "/usr/include/stdio.h" 3 4
# 1 "/usr/include/features.h" 1 3 4
# 352 "/usr/include/features.h" 3 4
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 353 "/usr/include/features.h" 2 3 4
# 374 "/usr/include/features.h" 3 4
# 1 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 1 3 4
# 385 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 3 4
# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4
# 386 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 2 3 4
# 375 "/usr/include/features.h" 2 3 4
# 398 "/usr/include/features.h" 3 4
# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 1 3 4
# 10 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 3 4
# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs-64.h" 1 3 4
# 11 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 2 3 4
# 399 "/usr/include/features.h" 2 3 4
# 28 "/usr/include/stdio.h" 2 3 4
# 1 "/usr/lib/gcc/x86_64-linux-gnu/4.9/include/stddef.h" 1 3 4
# 212 "/usr/lib/gcc/x86_64-linux-gnu/4.9/include/stddef.h" 3 4
# 34 "/usr/include/stdio.h" 2 3 4
# 1 "/usr/include/x86_64-linux-gnu/bits/types.h" 1 3 4
# 27 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4
# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4
# 28 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4
# 121 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4
# 1 "/usr/include/x86_64-linux-gnu/bits/typesizes.h" 1 3 4
# 122 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4
# 36 "/usr/include/stdio.h" 2 3 4
# 44 "/usr/include/stdio.h" 3 4
# 64 "/usr/include/stdio.h" 3 4
# 74 "/usr/include/stdio.h" 3 4
# 1 "/usr/include/libio.h" 1 3 4
# 31 "/usr/include/libio.h" 3 4
# 1 "/usr/include/_G_config.h" 1 3 4
# 15 "/usr/include/_G_config.h" 3 4
# 1 "/usr/lib/gcc/x86_64-linux-gnu/4.9/include/stddef.h" 1 3 4
# 16 "/usr/include/_G_config.h" 2 3 4
# 1 "/usr/include/wchar.h" 1 3 4
# 82 "/usr/include/wchar.h" 3 4
# 21 "/usr/include/_G_config.h" 2 3 4
# 32 "/usr/include/libio.h" 2 3 4
# 49 "/usr/include/libio.h" 3 4
# 1 "/usr/lib/gcc/x86_64-linux-gnu/4.9/include/stdarg.h" 1 3 4
# 40 "/usr/lib/gcc/x86_64-linux-gnu/4.9/include/stdarg.h" 3 4
# 50 "/usr/include/libio.h" 2 3 4
# 144 "/usr/include/libio.h" 3 4
# 154 "/usr/include/libio.h" 3 4
# 177 "/usr/include/libio.h" 3 4
# 245 "/usr/include/libio.h" 3 4
# 293 "/usr/include/libio.h" 3 4
# 302 "/usr/include/libio.h" 3 4
# 338 "/usr/include/libio.h" 3 4
# 390 "/usr/include/libio.h" 3 4
# 434 "/usr/include/libio.h" 3 4
# 464 "/usr/include/libio.h" 3 4
# 75 "/usr/include/stdio.h" 2 3 4
# 90 "/usr/include/stdio.h" 3 4
# 102 "/usr/include/stdio.h" 3 4
# 164 "/usr/include/stdio.h" 3 4
# 1 "/usr/include/x86_64-linux-gnu/bits/stdio_lim.h" 1 3 4
# 165 "/usr/include/stdio.h" 2 3 4
# 209 "/usr/include/stdio.h" 3 4
# 227 "/usr/include/stdio.h" 3 4
# 252 "/usr/include/stdio.h" 3 4
# 266 "/usr/include/stdio.h" 3 4
# 295 "/usr/include/stdio.h" 3 4
# 306 "/usr/include/stdio.h" 3 4
# 319 "/usr/include/stdio.h" 3 4
# 412 "/usr/include/stdio.h" 3 4
# 443 "/usr/include/stdio.h" 3 4
# 463 "/usr/include/stdio.h" 3 4
# 494 "/usr/include/stdio.h" 3 4
# 522 "/usr/include/stdio.h" 3 4
# 550 "/usr/include/stdio.h" 3 4
# 561 "/usr/include/stdio.h" 3 4
# 594 "/usr/include/stdio.h" 3 4
# 638 "/usr/include/stdio.h" 3 4
# 665 "/usr/include/stdio.h" 3 4
# 737 "/usr/include/stdio.h" 3 4
# 773 "/usr/include/stdio.h" 3 4
# 792 "/usr/include/stdio.h" 3 4
# 815 "/usr/include/stdio.h" 3 4
# 824 "/usr/include/stdio.h" 3 4
# 1 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 1 3 4
# 26 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 3 4
# 854 "/usr/include/stdio.h" 2 3 4
# 873 "/usr/include/stdio.h" 3 4
# 913 "/usr/include/stdio.h" 3 4
# 943 "/usr/include/stdio.h" 3 4
# 14 "isl/include/isl/ctx.h" 2
# 1 "/usr/include/stdlib.h" 1 3 4
# 32 "/usr/include/stdlib.h" 3 4
# 1 "/usr/lib/gcc/x86_64-linux-gnu/4.9/include/stddef.h" 1 3 4
# 324 "/usr/lib/gcc/x86_64-linux-gnu/4.9/include/stddef.h" 3 4
# 33 "/usr/include/stdlib.h" 2 3 4
# 1 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 1 3 4
# 50 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 3 4
# 42 "/usr/include/stdlib.h" 2 3 4
# 1 "/usr/include/x86_64-linux-gnu/bits/waitstatus.h" 1 3 4
# 64 "/usr/include/x86_64-linux-gnu/bits/waitstatus.h" 3 4
# 1 "/usr/include/endian.h" 1 3 4
# 36 "/usr/include/endian.h" 3 4
# 1 "/usr/include/x86_64-linux-gnu/bits/endian.h" 1 3 4
# 37 "/usr/include/endian.h" 2 3 4
# 60 "/usr/include/endian.h" 3 4
# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 1 3 4
# 28 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4
# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4
# 29 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4
# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap-16.h" 1 3 4
# 36 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4
# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4
# 108 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4
# 61 "/usr/include/endian.h" 2 3 4
# 65 "/usr/include/x86_64-linux-gnu/bits/waitstatus.h" 2 3 4
# 43 "/usr/include/stdlib.h" 2 3 4
# 67 "/usr/include/stdlib.h" 3 4
# 95 "/usr/include/stdlib.h" 3 4
# 139 "/usr/include/stdlib.h" 3 4
# 305 "/usr/include/stdlib.h" 3 4
# 1 "/usr/include/x86_64-linux-gnu/sys/types.h" 1 3 4
# 27 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4
# 60 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4
# 98 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4
# 115 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4
# 132 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4
# 1 "/usr/include/time.h" 1 3 4
# 57 "/usr/include/time.h" 3 4
# 73 "/usr/include/time.h" 3 4
# 91 "/usr/include/time.h" 3 4
# 103 "/usr/include/time.h" 3 4
# 133 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4
# 146 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4
# 1 "/usr/lib/gcc/x86_64-linux-gnu/4.9/include/stddef.h" 1 3 4
# 147 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4
# 194 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4
# 219 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4
# 1 "/usr/include/x86_64-linux-gnu/sys/select.h" 1 3 4
# 30 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4
# 1 "/usr/include/x86_64-linux-gnu/bits/select.h" 1 3 4
# 22 "/usr/include/x86_64-linux-gnu/bits/select.h" 3 4
# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4
# 23 "/usr/include/x86_64-linux-gnu/bits/select.h" 2 3 4
# 31 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4
# 1 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 1 3 4
# 22 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 3 4
# 34 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4
# 1 "/usr/include/time.h" 1 3 4
# 120 "/usr/include/time.h" 3 4
# 44 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4
# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4
# 30 "/usr/include/x86_64-linux-gnu/bits/time.h" 3 4
# 46 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4
# 64 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4
# 96 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4
# 106 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4
# 118 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4
# 131 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4
# 220 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4
# 1 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 1 3 4
# 24 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 3 4
# 58 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 3 4
# 223 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4
# 270 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4
# 1 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 1 3 4
# 21 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4
# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4
# 22 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 2 3 4
# 60 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4
# 90 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4
# 124 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4
# 211 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4
# 271 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4
# 315 "/usr/include/stdlib.h" 2 3 4
# 1 "/usr/include/alloca.h" 1 3 4
# 24 "/usr/include/alloca.h" 3 4
# 1 "/usr/lib/gcc/x86_64-linux-gnu/4.9/include/stddef.h" 1 3 4
# 25 "/usr/include/alloca.h" 2 3 4
# 493 "/usr/include/stdlib.h" 2 3 4
# 513 "/usr/include/stdlib.h" 3 4
# 530 "/usr/include/stdlib.h" 3 4
# 578 "/usr/include/stdlib.h" 3 4
# 606 "/usr/include/stdlib.h" 3 4
# 620 "/usr/include/stdlib.h" 3 4
# 642 "/usr/include/stdlib.h" 3 4
# 663 "/usr/include/stdlib.h" 3 4
# 712 "/usr/include/stdlib.h" 3 4
# 734 "/usr/include/stdlib.h" 3 4
# 752 "/usr/include/stdlib.h" 3 4
# 775 "/usr/include/stdlib.h" 3 4
# 812 "/usr/include/stdlib.h" 3 4
# 899 "/usr/include/stdlib.h" 3 4
# 951 "/usr/include/stdlib.h" 3 4
# 1 "/usr/include/x86_64-linux-gnu/bits/stdlib-float.h" 1 3 4
# 956 "/usr/include/stdlib.h" 2 3 4
# 968 "/usr/include/stdlib.h" 3 4
# 15 "isl/include/isl/ctx.h" 2
# 1 "isl/include/isl/arg.h" 1
# 13 "isl/include/isl/arg.h"
# 1 "/usr/lib/gcc/x86_64-linux-gnu/4.9/include/stddef.h" 1 3 4
# 147 "/usr/lib/gcc/x86_64-linux-gnu/4.9/include/stddef.h" 3 4
# 14 "isl/include/isl/arg.h" 2
# 290 "isl/include/isl/arg.h"
# 17 "isl/include/isl/ctx.h" 2
# 68 "isl/include/isl/ctx.h"
# 111 "isl/include/isl/ctx.h"
# 135 "isl/include/isl/ctx.h"
# 151 "isl/include/isl/ctx.h"
# 246 "isl/include/isl/ctx.h"
# 14 "./isl/include/isl/list.h" 2
# 1 "isl/include/isl/printer.h" 1
# 11 "isl/include/isl/printer.h"
# 35 "isl/include/isl/printer.h"
# 15 "./isl/include/isl/list.h" 2
# 1 "<command-line>" 2
# 1 "./isl/include/isl/multi.h" 1
# 1 "isl/include/isl/space.h" 1
# 14 "isl/include/isl/space.h"
# 1 "isl/include/isl/id.h" 1
# 1 "isl/include/isl/list.h" 1
# 6 "isl/include/isl/id.h" 2
# 1 "isl-supplementary/isl/stdint.h" 1
# 1 "/usr/lib/gcc/x86_64-linux-gnu/4.9/include/stdint.h" 1 3 4
# 9 "/usr/lib/gcc/x86_64-linux-gnu/4.9/include/stdint.h" 3 4
# 1 "/usr/include/stdint.h" 1 3 4
# 26 "/usr/include/stdint.h" 3 4
# 1 "/usr/include/x86_64-linux-gnu/bits/wchar.h" 1 3 4
# 27 "/usr/include/stdint.h" 2 3 4
# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4
# 28 "/usr/include/stdint.h" 2 3 4
# 48 "/usr/include/stdint.h" 3 4
# 65 "/usr/include/stdint.h" 3 4
# 90 "/usr/include/stdint.h" 3 4
# 103 "/usr/include/stdint.h" 3 4
# 119 "/usr/include/stdint.h" 3 4
# 134 "/usr/include/stdint.h" 3 4
# 10 "/usr/lib/gcc/x86_64-linux-gnu/4.9/include/stdint.h" 2 3 4
# 1 "isl-supplementary/isl/stdint.h" 2
# 8 "isl/include/isl/id.h" 2
# 15 "isl/include/isl/space.h" 2
# 5 "./isl/include/isl/multi.h" 2
# 1 "isl/include/isl/set_type.h" 1
# 1 "isl/include/isl/map_type.h" 1
# 11 "isl/include/isl/map_type.h"
# 5 "isl/include/isl/set_type.h" 2
# 7 "./isl/include/isl/multi.h" 2
# 1 "<command-line>" 2
# 1 "isl_declaration_macros.h"
# 9 "isl_declaration_macros.h"
struct isl_id; struct isl_id_list; typedef struct isl_id_list isl_id_list; isl_ctx *isl_id_list_get_ctx(__isl_keep isl_id_list *list); __isl_give isl_id_list *isl_id_list_from_id( __isl_take struct isl_id *el); __isl_give isl_id_list *isl_id_list_alloc(isl_ctx *ctx, int n); __isl_give isl_id_list *isl_id_list_copy( __isl_keep isl_id_list *list); isl_id_list *isl_id_list_free( __isl_take isl_id_list *list); __isl_give isl_id_list *isl_id_list_add( __isl_take isl_id_list *list, __isl_take struct isl_id *el); __isl_give isl_id_list *isl_id_list_insert( __isl_take isl_id_list *list, unsigned pos, __isl_take struct isl_id *el); __isl_give isl_id_list *isl_id_list_drop( __isl_take isl_id_list *list, unsigned first, unsigned n); __isl_give isl_id_list *isl_id_list_concat( __isl_take isl_id_list *list1, __isl_take isl_id_list *list2); int isl_id_list_n_id(__isl_keep isl_id_list *list); __isl_give struct isl_id *isl_id_list_get_id( __isl_keep isl_id_list *list, int index); __isl_give struct isl_id_list *isl_id_list_set_id( __isl_take struct isl_id_list *list, int index, __isl_take struct isl_id *el); isl_stat isl_id_list_foreach(__isl_keep isl_id_list *list, isl_stat (*fn)(__isl_take struct isl_id *el, void *user), void *user); __isl_give isl_id_list *isl_id_list_sort( __isl_take isl_id_list *list, int (*cmp)(__isl_keep struct isl_id *a, __isl_keep struct isl_id *b, void *user), void *user); isl_stat isl_id_list_foreach_scc(__isl_keep isl_id_list *list, isl_bool (*follows)(__isl_keep struct isl_id *a, __isl_keep struct isl_id *b, void *user), void *follows_user, isl_stat (*fn)(__isl_take isl_id_list *scc, void *user), void *fn_user); __isl_give isl_printer *isl_printer_print_id_list( __isl_take isl_printer *p, __isl_keep isl_id_list *list); void isl_id_list_dump(__isl_keep isl_id_list *list);
struct isl_val; struct isl_val_list; typedef struct isl_val_list isl_val_list; isl_ctx *isl_val_list_get_ctx(__isl_keep isl_val_list *list); __isl_give isl_val_list *isl_val_list_from_val( __isl_take struct isl_val *el); __isl_give isl_val_list *isl_val_list_alloc(isl_ctx *ctx, int n); __isl_give isl_val_list *isl_val_list_copy( __isl_keep isl_val_list *list); isl_val_list *isl_val_list_free( __isl_take isl_val_list *list); __isl_give isl_val_list *isl_val_list_add( __isl_take isl_val_list *list, __isl_take struct isl_val *el); __isl_give isl_val_list *isl_val_list_insert( __isl_take isl_val_list *list, unsigned pos, __isl_take struct isl_val *el); __isl_give isl_val_list *isl_val_list_drop( __isl_take isl_val_list *list, unsigned first, unsigned n); __isl_give isl_val_list *isl_val_list_concat( __isl_take isl_val_list *list1, __isl_take isl_val_list *list2); int isl_val_list_n_val(__isl_keep isl_val_list *list); __isl_give struct isl_val *isl_val_list_get_val( __isl_keep isl_val_list *list, int index); __isl_give struct isl_val_list *isl_val_list_set_val( __isl_take struct isl_val_list *list, int index, __isl_take struct isl_val *el); isl_stat isl_val_list_foreach(__isl_keep isl_val_list *list, isl_stat (*fn)(__isl_take struct isl_val *el, void *user), void *user); __isl_give isl_val_list *isl_val_list_sort( __isl_take isl_val_list *list, int (*cmp)(__isl_keep struct isl_val *a, __isl_keep struct isl_val *b, void *user), void *user); isl_stat isl_val_list_foreach_scc(__isl_keep isl_val_list *list, isl_bool (*follows)(__isl_keep struct isl_val *a, __isl_keep struct isl_val *b, void *user), void *follows_user, isl_stat (*fn)(__isl_take isl_val_list *scc, void *user), void *fn_user); __isl_give isl_printer *isl_printer_print_val_list( __isl_take isl_printer *p, __isl_keep isl_val_list *list); void isl_val_list_dump(__isl_keep isl_val_list *list);
struct isl_aff; struct isl_aff_list; typedef struct isl_aff_list isl_aff_list; isl_ctx *isl_aff_list_get_ctx(__isl_keep isl_aff_list *list); __isl_give isl_aff_list *isl_aff_list_from_aff( __isl_take struct isl_aff *el); __isl_give isl_aff_list *isl_aff_list_alloc(isl_ctx *ctx, int n); __isl_give isl_aff_list *isl_aff_list_copy( __isl_keep isl_aff_list *list); isl_aff_list *isl_aff_list_free( __isl_take isl_aff_list *list); __isl_give isl_aff_list *isl_aff_list_add( __isl_take isl_aff_list *list, __isl_take struct isl_aff *el); __isl_give isl_aff_list *isl_aff_list_insert( __isl_take isl_aff_list *list, unsigned pos, __isl_take struct isl_aff *el); __isl_give isl_aff_list *isl_aff_list_drop( __isl_take isl_aff_list *list, unsigned first, unsigned n); __isl_give isl_aff_list *isl_aff_list_concat( __isl_take isl_aff_list *list1, __isl_take isl_aff_list *list2); int isl_aff_list_n_aff(__isl_keep isl_aff_list *list); __isl_give struct isl_aff *isl_aff_list_get_aff( __isl_keep isl_aff_list *list, int index); __isl_give struct isl_aff_list *isl_aff_list_set_aff( __isl_take struct isl_aff_list *list, int index, __isl_take struct isl_aff *el); isl_stat isl_aff_list_foreach(__isl_keep isl_aff_list *list, isl_stat (*fn)(__isl_take struct isl_aff *el, void *user), void *user); __isl_give isl_aff_list *isl_aff_list_sort( __isl_take isl_aff_list *list, int (*cmp)(__isl_keep struct isl_aff *a, __isl_keep struct isl_aff *b, void *user), void *user); isl_stat isl_aff_list_foreach_scc(__isl_keep isl_aff_list *list, isl_bool (*follows)(__isl_keep struct isl_aff *a, __isl_keep struct isl_aff *b, void *user), void *follows_user, isl_stat (*fn)(__isl_take isl_aff_list *scc, void *user), void *fn_user); __isl_give isl_printer *isl_printer_print_aff_list( __isl_take isl_printer *p, __isl_keep isl_aff_list *list); void isl_aff_list_dump(__isl_keep isl_aff_list *list);
struct isl_pw_aff; struct isl_pw_aff_list; typedef struct isl_pw_aff_list isl_pw_aff_list; isl_ctx *isl_pw_aff_list_get_ctx(__isl_keep isl_pw_aff_list *list); __isl_give isl_pw_aff_list *isl_pw_aff_list_from_pw_aff( __isl_take struct isl_pw_aff *el); __isl_give isl_pw_aff_list *isl_pw_aff_list_alloc(isl_ctx *ctx, int n); __isl_give isl_pw_aff_list *isl_pw_aff_list_copy( __isl_keep isl_pw_aff_list *list); isl_pw_aff_list *isl_pw_aff_list_free( __isl_take isl_pw_aff_list *list); __isl_give isl_pw_aff_list *isl_pw_aff_list_add( __isl_take isl_pw_aff_list *list, __isl_take struct isl_pw_aff *el); __isl_give isl_pw_aff_list *isl_pw_aff_list_insert( __isl_take isl_pw_aff_list *list, unsigned pos, __isl_take struct isl_pw_aff *el); __isl_give isl_pw_aff_list *isl_pw_aff_list_drop( __isl_take isl_pw_aff_list *list, unsigned first, unsigned n); __isl_give isl_pw_aff_list *isl_pw_aff_list_concat( __isl_take isl_pw_aff_list *list1, __isl_take isl_pw_aff_list *list2); int isl_pw_aff_list_n_pw_aff(__isl_keep isl_pw_aff_list *list); __isl_give struct isl_pw_aff *isl_pw_aff_list_get_pw_aff( __isl_keep isl_pw_aff_list *list, int index); __isl_give struct isl_pw_aff_list *isl_pw_aff_list_set_pw_aff( __isl_take struct isl_pw_aff_list *list, int index, __isl_take struct isl_pw_aff *el); isl_stat isl_pw_aff_list_foreach(__isl_keep isl_pw_aff_list *list, isl_stat (*fn)(__isl_take struct isl_pw_aff *el, void *user), void *user); __isl_give isl_pw_aff_list *isl_pw_aff_list_sort( __isl_take isl_pw_aff_list *list, int (*cmp)(__isl_keep struct isl_pw_aff *a, __isl_keep struct isl_pw_aff *b, void *user), void *user); isl_stat isl_pw_aff_list_foreach_scc(__isl_keep isl_pw_aff_list *list, isl_bool (*follows)(__isl_keep struct isl_pw_aff *a, __isl_keep struct isl_pw_aff *b, void *user), void *follows_user, isl_stat (*fn)(__isl_take isl_pw_aff_list *scc, void *user), void *fn_user); __isl_give isl_printer *isl_printer_print_pw_aff_list( __isl_take isl_printer *p, __isl_keep isl_pw_aff_list *list); void isl_pw_aff_list_dump(__isl_keep isl_pw_aff_list *list);
struct isl_constraint; struct isl_constraint_list; typedef struct isl_constraint_list isl_constraint_list; isl_ctx *isl_constraint_list_get_ctx(__isl_keep isl_constraint_list *list); __isl_give isl_constraint_list *isl_constraint_list_from_constraint( __isl_take struct isl_constraint *el); __isl_give isl_constraint_list *isl_constraint_list_alloc(isl_ctx *ctx, int n); __isl_give isl_constraint_list *isl_constraint_list_copy( __isl_keep isl_constraint_list *list); isl_constraint_list *isl_constraint_list_free( __isl_take isl_constraint_list *list); __isl_give isl_constraint_list *isl_constraint_list_add( __isl_take isl_constraint_list *list, __isl_take struct isl_constraint *el); __isl_give isl_constraint_list *isl_constraint_list_insert( __isl_take isl_constraint_list *list, unsigned pos, __isl_take struct isl_constraint *el); __isl_give isl_constraint_list *isl_constraint_list_drop( __isl_take isl_constraint_list *list, unsigned first, unsigned n); __isl_give isl_constraint_list *isl_constraint_list_concat( __isl_take isl_constraint_list *list1, __isl_take isl_constraint_list *list2); int isl_constraint_list_n_constraint(__isl_keep isl_constraint_list *list); __isl_give struct isl_constraint *isl_constraint_list_get_constraint( __isl_keep isl_constraint_list *list, int index); __isl_give struct isl_constraint_list *isl_constraint_list_set_constraint( __isl_take struct isl_constraint_list *list, int index, __isl_take struct isl_constraint *el); isl_stat isl_constraint_list_foreach(__isl_keep isl_constraint_list *list, isl_stat (*fn)(__isl_take struct isl_constraint *el, void *user), void *user); __isl_give isl_constraint_list *isl_constraint_list_sort( __isl_take isl_constraint_list *list, int (*cmp)(__isl_keep struct isl_constraint *a, __isl_keep struct isl_constraint *b, void *user), void *user); isl_stat isl_constraint_list_foreach_scc(__isl_keep isl_constraint_list *list, isl_bool (*follows)(__isl_keep struct isl_constraint *a, __isl_keep struct isl_constraint *b, void *user), void *follows_user, isl_stat (*fn)(__isl_take isl_constraint_list *scc, void *user), void *fn_user); __isl_give isl_printer *isl_printer_print_constraint_list( __isl_take isl_printer *p, __isl_keep isl_constraint_list *list); void isl_constraint_list_dump(__isl_keep isl_constraint_list *list);
struct isl_basic_set; struct isl_basic_set_list; typedef struct isl_basic_set_list isl_basic_set_list; isl_ctx *isl_basic_set_list_get_ctx(__isl_keep isl_basic_set_list *list); __isl_give isl_basic_set_list *isl_basic_set_list_from_basic_set( __isl_take struct isl_basic_set *el); __isl_give isl_basic_set_list *isl_basic_set_list_alloc(isl_ctx *ctx, int n); __isl_give isl_basic_set_list *isl_basic_set_list_copy( __isl_keep isl_basic_set_list *list); isl_basic_set_list *isl_basic_set_list_free( __isl_take isl_basic_set_list *list); __isl_give isl_basic_set_list *isl_basic_set_list_add( __isl_take isl_basic_set_list *list, __isl_take struct isl_basic_set *el); __isl_give isl_basic_set_list *isl_basic_set_list_insert( __isl_take isl_basic_set_list *list, unsigned pos, __isl_take struct isl_basic_set *el); __isl_give isl_basic_set_list *isl_basic_set_list_drop( __isl_take isl_basic_set_list *list, unsigned first, unsigned n); __isl_give isl_basic_set_list *isl_basic_set_list_concat( __isl_take isl_basic_set_list *list1, __isl_take isl_basic_set_list *list2); int isl_basic_set_list_n_basic_set(__isl_keep isl_basic_set_list *list); __isl_give struct isl_basic_set *isl_basic_set_list_get_basic_set( __isl_keep isl_basic_set_list *list, int index); __isl_give struct isl_basic_set_list *isl_basic_set_list_set_basic_set( __isl_take struct isl_basic_set_list *list, int index, __isl_take struct isl_basic_set *el); isl_stat isl_basic_set_list_foreach(__isl_keep isl_basic_set_list *list, isl_stat (*fn)(__isl_take struct isl_basic_set *el, void *user), void *user); __isl_give isl_basic_set_list *isl_basic_set_list_sort( __isl_take isl_basic_set_list *list, int (*cmp)(__isl_keep struct isl_basic_set *a, __isl_keep struct isl_basic_set *b, void *user), void *user); isl_stat isl_basic_set_list_foreach_scc(__isl_keep isl_basic_set_list *list, isl_bool (*follows)(__isl_keep struct isl_basic_set *a, __isl_keep struct isl_basic_set *b, void *user), void *follows_user, isl_stat (*fn)(__isl_take isl_basic_set_list *scc, void *user), void *fn_user); __isl_give isl_printer *isl_printer_print_basic_set_list( __isl_take isl_printer *p, __isl_keep isl_basic_set_list *list); void isl_basic_set_list_dump(__isl_keep isl_basic_set_list *list);
struct isl_basic_map; struct isl_basic_map_list; typedef struct isl_basic_map_list isl_basic_map_list; isl_ctx *isl_basic_map_list_get_ctx(__isl_keep isl_basic_map_list *list); __isl_give isl_basic_map_list *isl_basic_map_list_from_basic_map( __isl_take struct isl_basic_map *el); __isl_give isl_basic_map_list *isl_basic_map_list_alloc(isl_ctx *ctx, int n); __isl_give isl_basic_map_list *isl_basic_map_list_copy( __isl_keep isl_basic_map_list *list); isl_basic_map_list *isl_basic_map_list_free( __isl_take isl_basic_map_list *list); __isl_give isl_basic_map_list *isl_basic_map_list_add( __isl_take isl_basic_map_list *list, __isl_take struct isl_basic_map *el); __isl_give isl_basic_map_list *isl_basic_map_list_insert( __isl_take isl_basic_map_list *list, unsigned pos, __isl_take struct isl_basic_map *el); __isl_give isl_basic_map_list *isl_basic_map_list_drop( __isl_take isl_basic_map_list *list, unsigned first, unsigned n); __isl_give isl_basic_map_list *isl_basic_map_list_concat( __isl_take isl_basic_map_list *list1, __isl_take isl_basic_map_list *list2); int isl_basic_map_list_n_basic_map(__isl_keep isl_basic_map_list *list); __isl_give struct isl_basic_map *isl_basic_map_list_get_basic_map( __isl_keep isl_basic_map_list *list, int index); __isl_give struct isl_basic_map_list *isl_basic_map_list_set_basic_map( __isl_take struct isl_basic_map_list *list, int index, __isl_take struct isl_basic_map *el); isl_stat isl_basic_map_list_foreach(__isl_keep isl_basic_map_list *list, isl_stat (*fn)(__isl_take struct isl_basic_map *el, void *user), void *user); __isl_give isl_basic_map_list *isl_basic_map_list_sort( __isl_take isl_basic_map_list *list, int (*cmp)(__isl_keep struct isl_basic_map *a, __isl_keep struct isl_basic_map *b, void *user), void *user); isl_stat isl_basic_map_list_foreach_scc(__isl_keep isl_basic_map_list *list, isl_bool (*follows)(__isl_keep struct isl_basic_map *a, __isl_keep struct isl_basic_map *b, void *user), void *follows_user, isl_stat (*fn)(__isl_take isl_basic_map_list *scc, void *user), void *fn_user); __isl_give isl_printer *isl_printer_print_basic_map_list( __isl_take isl_printer *p, __isl_keep isl_basic_map_list *list); void isl_basic_map_list_dump(__isl_keep isl_basic_map_list *list);
struct isl_set; struct isl_set_list; typedef struct isl_set_list isl_set_list; isl_ctx *isl_set_list_get_ctx(__isl_keep isl_set_list *list); __isl_give isl_set_list *isl_set_list_from_set( __isl_take struct isl_set *el); __isl_give isl_set_list *isl_set_list_alloc(isl_ctx *ctx, int n); __isl_give isl_set_list *isl_set_list_copy( __isl_keep isl_set_list *list); isl_set_list *isl_set_list_free( __isl_take isl_set_list *list); __isl_give isl_set_list *isl_set_list_add( __isl_take isl_set_list *list, __isl_take struct isl_set *el); __isl_give isl_set_list *isl_set_list_insert( __isl_take isl_set_list *list, unsigned pos, __isl_take struct isl_set *el); __isl_give isl_set_list *isl_set_list_drop( __isl_take isl_set_list *list, unsigned first, unsigned n); __isl_give isl_set_list *isl_set_list_concat( __isl_take isl_set_list *list1, __isl_take isl_set_list *list2); int isl_set_list_n_set(__isl_keep isl_set_list *list); __isl_give struct isl_set *isl_set_list_get_set( __isl_keep isl_set_list *list, int index); __isl_give struct isl_set_list *isl_set_list_set_set( __isl_take struct isl_set_list *list, int index, __isl_take struct isl_set *el); isl_stat isl_set_list_foreach(__isl_keep isl_set_list *list, isl_stat (*fn)(__isl_take struct isl_set *el, void *user), void *user); __isl_give isl_set_list *isl_set_list_sort( __isl_take isl_set_list *list, int (*cmp)(__isl_keep struct isl_set *a, __isl_keep struct isl_set *b, void *user), void *user); isl_stat isl_set_list_foreach_scc(__isl_keep isl_set_list *list, isl_bool (*follows)(__isl_keep struct isl_set *a, __isl_keep struct isl_set *b, void *user), void *follows_user, isl_stat (*fn)(__isl_take isl_set_list *scc, void *user), void *fn_user); __isl_give isl_printer *isl_printer_print_set_list( __isl_take isl_printer *p, __isl_keep isl_set_list *list); void isl_set_list_dump(__isl_keep isl_set_list *list);
struct isl_map; struct isl_map_list; typedef struct isl_map_list isl_map_list; isl_ctx *isl_map_list_get_ctx(__isl_keep isl_map_list *list); __isl_give isl_map_list *isl_map_list_from_map( __isl_take struct isl_map *el); __isl_give isl_map_list *isl_map_list_alloc(isl_ctx *ctx, int n); __isl_give isl_map_list *isl_map_list_copy( __isl_keep isl_map_list *list); isl_map_list *isl_map_list_free( __isl_take isl_map_list *list); __isl_give isl_map_list *isl_map_list_add( __isl_take isl_map_list *list, __isl_take struct isl_map *el); __isl_give isl_map_list *isl_map_list_insert( __isl_take isl_map_list *list, unsigned pos, __isl_take struct isl_map *el); __isl_give isl_map_list *isl_map_list_drop( __isl_take isl_map_list *list, unsigned first, unsigned n); __isl_give isl_map_list *isl_map_list_concat( __isl_take isl_map_list *list1, __isl_take isl_map_list *list2); int isl_map_list_n_map(__isl_keep isl_map_list *list); __isl_give struct isl_map *isl_map_list_get_map( __isl_keep isl_map_list *list, int index); __isl_give struct isl_map_list *isl_map_list_set_map( __isl_take struct isl_map_list *list, int index, __isl_take struct isl_map *el); isl_stat isl_map_list_foreach(__isl_keep isl_map_list *list, isl_stat (*fn)(__isl_take struct isl_map *el, void *user), void *user); __isl_give isl_map_list *isl_map_list_sort( __isl_take isl_map_list *list, int (*cmp)(__isl_keep struct isl_map *a, __isl_keep struct isl_map *b, void *user), void *user); isl_stat isl_map_list_foreach_scc(__isl_keep isl_map_list *list, isl_bool (*follows)(__isl_keep struct isl_map *a, __isl_keep struct isl_map *b, void *user), void *follows_user, isl_stat (*fn)(__isl_take isl_map_list *scc, void *user), void *fn_user); __isl_give isl_printer *isl_printer_print_map_list( __isl_take isl_printer *p, __isl_keep isl_map_list *list); void isl_map_list_dump(__isl_keep isl_map_list *list);
struct isl_union_set; struct isl_union_set_list; typedef struct isl_union_set_list isl_union_set_list; isl_ctx *isl_union_set_list_get_ctx(__isl_keep isl_union_set_list *list); __isl_give isl_union_set_list *isl_union_set_list_from_union_set( __isl_take struct isl_union_set *el); __isl_give isl_union_set_list *isl_union_set_list_alloc(isl_ctx *ctx, int n); __isl_give isl_union_set_list *isl_union_set_list_copy( __isl_keep isl_union_set_list *list); isl_union_set_list *isl_union_set_list_free( __isl_take isl_union_set_list *list); __isl_give isl_union_set_list *isl_union_set_list_add( __isl_take isl_union_set_list *list, __isl_take struct isl_union_set *el); __isl_give isl_union_set_list *isl_union_set_list_insert( __isl_take isl_union_set_list *list, unsigned pos, __isl_take struct isl_union_set *el); __isl_give isl_union_set_list *isl_union_set_list_drop( __isl_take isl_union_set_list *list, unsigned first, unsigned n); __isl_give isl_union_set_list *isl_union_set_list_concat( __isl_take isl_union_set_list *list1, __isl_take isl_union_set_list *list2); int isl_union_set_list_n_union_set(__isl_keep isl_union_set_list *list); __isl_give struct isl_union_set *isl_union_set_list_get_union_set( __isl_keep isl_union_set_list *list, int index); __isl_give struct isl_union_set_list *isl_union_set_list_set_union_set( __isl_take struct isl_union_set_list *list, int index, __isl_take struct isl_union_set *el); isl_stat isl_union_set_list_foreach(__isl_keep isl_union_set_list *list, isl_stat (*fn)(__isl_take struct isl_union_set *el, void *user), void *user); __isl_give isl_union_set_list *isl_union_set_list_sort( __isl_take isl_union_set_list *list, int (*cmp)(__isl_keep struct isl_union_set *a, __isl_keep struct isl_union_set *b, void *user), void *user); isl_stat isl_union_set_list_foreach_scc(__isl_keep isl_union_set_list *list, isl_bool (*follows)(__isl_keep struct isl_union_set *a, __isl_keep struct isl_union_set *b, void *user), void *follows_user, isl_stat (*fn)(__isl_take isl_union_set_list *scc, void *user), void *fn_user); __isl_give isl_printer *isl_printer_print_union_set_list( __isl_take isl_printer *p, __isl_keep isl_union_set_list *list); void isl_union_set_list_dump(__isl_keep isl_union_set_list *list);
struct isl_ast_expr; struct isl_ast_expr_list; typedef struct isl_ast_expr_list isl_ast_expr_list; isl_ctx *isl_ast_expr_list_get_ctx(__isl_keep isl_ast_expr_list *list); __isl_give isl_ast_expr_list *isl_ast_expr_list_from_ast_expr( __isl_take struct isl_ast_expr *el); __isl_give isl_ast_expr_list *isl_ast_expr_list_alloc(isl_ctx *ctx, int n); __isl_give isl_ast_expr_list *isl_ast_expr_list_copy( __isl_keep isl_ast_expr_list *list); isl_ast_expr_list *isl_ast_expr_list_free( __isl_take isl_ast_expr_list *list); __isl_give isl_ast_expr_list *isl_ast_expr_list_add( __isl_take isl_ast_expr_list *list, __isl_take struct isl_ast_expr *el); __isl_give isl_ast_expr_list *isl_ast_expr_list_insert( __isl_take isl_ast_expr_list *list, unsigned pos, __isl_take struct isl_ast_expr *el); __isl_give isl_ast_expr_list *isl_ast_expr_list_drop( __isl_take isl_ast_expr_list *list, unsigned first, unsigned n); __isl_give isl_ast_expr_list *isl_ast_expr_list_concat( __isl_take isl_ast_expr_list *list1, __isl_take isl_ast_expr_list *list2); int isl_ast_expr_list_n_ast_expr(__isl_keep isl_ast_expr_list *list); __isl_give struct isl_ast_expr *isl_ast_expr_list_get_ast_expr( __isl_keep isl_ast_expr_list *list, int index); __isl_give struct isl_ast_expr_list *isl_ast_expr_list_set_ast_expr( __isl_take struct isl_ast_expr_list *list, int index, __isl_take struct isl_ast_expr *el); isl_stat isl_ast_expr_list_foreach(__isl_keep isl_ast_expr_list *list, isl_stat (*fn)(__isl_take struct isl_ast_expr *el, void *user), void *user); __isl_give isl_ast_expr_list *isl_ast_expr_list_sort( __isl_take isl_ast_expr_list *list, int (*cmp)(__isl_keep struct isl_ast_expr *a, __isl_keep struct isl_ast_expr *b, void *user), void *user); isl_stat isl_ast_expr_list_foreach_scc(__isl_keep isl_ast_expr_list *list, isl_bool (*follows)(__isl_keep struct isl_ast_expr *a, __isl_keep struct isl_ast_expr *b, void *user), void *follows_user, isl_stat (*fn)(__isl_take isl_ast_expr_list *scc, void *user), void *fn_user); __isl_give isl_printer *isl_printer_print_ast_expr_list( __isl_take isl_printer *p, __isl_keep isl_ast_expr_list *list); void isl_ast_expr_list_dump(__isl_keep isl_ast_expr_list *list);
struct isl_ast_node; struct isl_ast_node_list; typedef struct isl_ast_node_list isl_ast_node_list; isl_ctx *isl_ast_node_list_get_ctx(__isl_keep isl_ast_node_list *list); __isl_give isl_ast_node_list *isl_ast_node_list_from_ast_node( __isl_take struct isl_ast_node *el); __isl_give isl_ast_node_list *isl_ast_node_list_alloc(isl_ctx *ctx, int n); __isl_give isl_ast_node_list *isl_ast_node_list_copy( __isl_keep isl_ast_node_list *list); isl_ast_node_list *isl_ast_node_list_free( __isl_take isl_ast_node_list *list); __isl_give isl_ast_node_list *isl_ast_node_list_add( __isl_take isl_ast_node_list *list, __isl_take struct isl_ast_node *el); __isl_give isl_ast_node_list *isl_ast_node_list_insert( __isl_take isl_ast_node_list *list, unsigned pos, __isl_take struct isl_ast_node *el); __isl_give isl_ast_node_list *isl_ast_node_list_drop( __isl_take isl_ast_node_list *list, unsigned first, unsigned n); __isl_give isl_ast_node_list *isl_ast_node_list_concat( __isl_take isl_ast_node_list *list1, __isl_take isl_ast_node_list *list2); int isl_ast_node_list_n_ast_node(__isl_keep isl_ast_node_list *list); __isl_give struct isl_ast_node *isl_ast_node_list_get_ast_node( __isl_keep isl_ast_node_list *list, int index); __isl_give struct isl_ast_node_list *isl_ast_node_list_set_ast_node( __isl_take struct isl_ast_node_list *list, int index, __isl_take struct isl_ast_node *el); isl_stat isl_ast_node_list_foreach(__isl_keep isl_ast_node_list *list, isl_stat (*fn)(__isl_take struct isl_ast_node *el, void *user), void *user); __isl_give isl_ast_node_list *isl_ast_node_list_sort( __isl_take isl_ast_node_list *list, int (*cmp)(__isl_keep struct isl_ast_node *a, __isl_keep struct isl_ast_node *b, void *user), void *user); isl_stat isl_ast_node_list_foreach_scc(__isl_keep isl_ast_node_list *list, isl_bool (*follows)(__isl_keep struct isl_ast_node *a, __isl_keep struct isl_ast_node *b, void *user), void *follows_user, isl_stat (*fn)(__isl_take isl_ast_node_list *scc, void *user), void *fn_user); __isl_give isl_printer *isl_printer_print_ast_node_list( __isl_take isl_printer *p, __isl_keep isl_ast_node_list *list); void isl_ast_node_list_dump(__isl_keep isl_ast_node_list *list);
struct isl_band; struct isl_band_list; typedef struct isl_band_list isl_band_list; isl_ctx *isl_band_list_get_ctx(__isl_keep isl_band_list *list); __isl_give isl_band_list *isl_band_list_from_band( __isl_take struct isl_band *el); __isl_give isl_band_list *isl_band_list_alloc(isl_ctx *ctx, int n); __isl_give isl_band_list *isl_band_list_copy( __isl_keep isl_band_list *list); isl_band_list *isl_band_list_free( __isl_take isl_band_list *list); __isl_give isl_band_list *isl_band_list_add( __isl_take isl_band_list *list, __isl_take struct isl_band *el); __isl_give isl_band_list *isl_band_list_insert( __isl_take isl_band_list *list, unsigned pos, __isl_take struct isl_band *el); __isl_give isl_band_list *isl_band_list_drop( __isl_take isl_band_list *list, unsigned first, unsigned n); __isl_give isl_band_list *isl_band_list_concat( __isl_take isl_band_list *list1, __isl_take isl_band_list *list2); int isl_band_list_n_band(__isl_keep isl_band_list *list); __isl_give struct isl_band *isl_band_list_get_band( __isl_keep isl_band_list *list, int index); __isl_give struct isl_band_list *isl_band_list_set_band( __isl_take struct isl_band_list *list, int index, __isl_take struct isl_band *el); isl_stat isl_band_list_foreach(__isl_keep isl_band_list *list, isl_stat (*fn)(__isl_take struct isl_band *el, void *user), void *user); __isl_give isl_band_list *isl_band_list_sort( __isl_take isl_band_list *list, int (*cmp)(__isl_keep struct isl_band *a, __isl_keep struct isl_band *b, void *user), void *user); isl_stat isl_band_list_foreach_scc(__isl_keep isl_band_list *list, isl_bool (*follows)(__isl_keep struct isl_band *a, __isl_keep struct isl_band *b, void *user), void *follows_user, isl_stat (*fn)(__isl_take isl_band_list *scc, void *user), void *fn_user); __isl_give isl_printer *isl_printer_print_band_list( __isl_take isl_printer *p, __isl_keep isl_band_list *list); void isl_band_list_dump(__isl_keep isl_band_list *list);
unsigned isl_multi_aff_dim(__isl_keep isl_multi_aff *multi, enum isl_dim_type type); isl_ctx *isl_multi_aff_get_ctx( __isl_keep isl_multi_aff *multi); __isl_give isl_space *isl_multi_aff_get_space( __isl_keep isl_multi_aff *multi); __isl_give isl_space *isl_multi_aff_get_domain_space( __isl_keep isl_multi_aff *multi); int isl_multi_aff_find_dim_by_name( __isl_keep isl_multi_aff *multi, enum isl_dim_type type, const char *name); __isl_give isl_multi_aff *isl_multi_aff_from_aff_list( __isl_take isl_space *space, __isl_take isl_aff_list *list); __isl_give isl_multi_aff *isl_multi_aff_zero( __isl_take isl_space *space); __isl_give isl_multi_aff *isl_multi_aff_copy( __isl_keep isl_multi_aff *multi); isl_multi_aff *isl_multi_aff_free( __isl_take isl_multi_aff *multi); isl_bool isl_multi_aff_plain_is_equal( __isl_keep isl_multi_aff *multi1, __isl_keep isl_multi_aff *multi2); int isl_multi_aff_find_dim_by_id( __isl_keep isl_multi_aff *multi, enum isl_dim_type type, __isl_keep isl_id *id); __isl_give isl_id *isl_multi_aff_get_dim_id( __isl_take isl_multi_aff *multi, enum isl_dim_type type, unsigned pos); __isl_give isl_multi_aff *isl_multi_aff_set_dim_name( __isl_take isl_multi_aff *multi, enum isl_dim_type type, unsigned pos, const char *s); __isl_give isl_multi_aff *isl_multi_aff_set_dim_id( __isl_take isl_multi_aff *multi, enum isl_dim_type type, unsigned pos, __isl_take isl_id *id); const char *isl_multi_aff_get_tuple_name( __isl_keep isl_multi_aff *multi, enum isl_dim_type type); isl_bool isl_multi_aff_has_tuple_id( __isl_keep isl_multi_aff *multi, enum isl_dim_type type); __isl_give isl_id *isl_multi_aff_get_tuple_id( __isl_keep isl_multi_aff *multi, enum isl_dim_type type); __isl_give isl_multi_aff *isl_multi_aff_set_tuple_name( __isl_take isl_multi_aff *multi, enum isl_dim_type type, const char *s); __isl_give isl_multi_aff *isl_multi_aff_set_tuple_id( __isl_take isl_multi_aff *multi, enum isl_dim_type type, __isl_take isl_id *id); __isl_give isl_multi_aff *isl_multi_aff_reset_tuple_id( __isl_take isl_multi_aff *multi, enum isl_dim_type type); __isl_give isl_multi_aff *isl_multi_aff_reset_user( __isl_take isl_multi_aff *multi); __isl_give isl_multi_aff *isl_multi_aff_drop_dims( __isl_take isl_multi_aff *multi, enum isl_dim_type type, unsigned first, unsigned n); __isl_give isl_aff *isl_multi_aff_get_aff( __isl_keep isl_multi_aff *multi, int pos); __isl_give isl_multi_aff *isl_multi_aff_set_aff( __isl_take isl_multi_aff *multi, int pos, __isl_take isl_aff *el); __isl_give isl_multi_aff *isl_multi_aff_range_splice( __isl_take isl_multi_aff *multi1, unsigned pos, __isl_take isl_multi_aff *multi2); __isl_give isl_multi_aff *isl_multi_aff_flatten_range( __isl_take isl_multi_aff *multi); __isl_give isl_multi_aff *isl_multi_aff_flat_range_product( __isl_take isl_multi_aff *multi1, __isl_take isl_multi_aff *multi2); __isl_give isl_multi_aff *isl_multi_aff_range_product( __isl_take isl_multi_aff *multi1, __isl_take isl_multi_aff *multi2); isl_bool isl_multi_aff_range_is_wrapping( __isl_keep isl_multi_aff *multi); __isl_give isl_multi_aff *isl_multi_aff_range_factor_domain( __isl_take isl_multi_aff *multi); __isl_give isl_multi_aff *isl_multi_aff_range_factor_range( __isl_take isl_multi_aff *multi); __isl_give isl_multi_aff *isl_multi_aff_scale_val( __isl_take isl_multi_aff *multi, __isl_take isl_val *v); __isl_give isl_multi_aff *isl_multi_aff_scale_down_val( __isl_take isl_multi_aff *multi, __isl_take isl_val *v); __isl_give isl_multi_aff *isl_multi_aff_scale_multi_val( __isl_take isl_multi_aff *multi, __isl_take isl_multi_val *mv); __isl_give isl_multi_aff *isl_multi_aff_scale_down_multi_val( __isl_take isl_multi_aff *multi, __isl_take isl_multi_val *mv); __isl_give isl_multi_aff *isl_multi_aff_mod_multi_val( __isl_take isl_multi_aff *multi, __isl_take isl_multi_val *mv); __isl_give isl_multi_aff *isl_multi_aff_sub( __isl_take isl_multi_aff *multi1, __isl_take isl_multi_aff *multi2); __isl_give isl_multi_aff *isl_multi_aff_align_params( __isl_take isl_multi_aff *multi, __isl_take isl_space *model); __isl_give isl_multi_aff *isl_multi_aff_from_range( __isl_take isl_multi_aff *multi);
unsigned isl_multi_pw_aff_dim(__isl_keep isl_multi_pw_aff *multi, enum isl_dim_type type); isl_ctx *isl_multi_pw_aff_get_ctx( __isl_keep isl_multi_pw_aff *multi); __isl_give isl_space *isl_multi_pw_aff_get_space( __isl_keep isl_multi_pw_aff *multi); __isl_give isl_space *isl_multi_pw_aff_get_domain_space( __isl_keep isl_multi_pw_aff *multi); int isl_multi_pw_aff_find_dim_by_name( __isl_keep isl_multi_pw_aff *multi, enum isl_dim_type type, const char *name); __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_pw_aff_list( __isl_take isl_space *space, __isl_take isl_pw_aff_list *list); __isl_give isl_multi_pw_aff *isl_multi_pw_aff_zero( __isl_take isl_space *space); __isl_give isl_multi_pw_aff *isl_multi_pw_aff_copy( __isl_keep isl_multi_pw_aff *multi); isl_multi_pw_aff *isl_multi_pw_aff_free( __isl_take isl_multi_pw_aff *multi); isl_bool isl_multi_pw_aff_plain_is_equal( __isl_keep isl_multi_pw_aff *multi1, __isl_keep isl_multi_pw_aff *multi2); int isl_multi_pw_aff_find_dim_by_id( __isl_keep isl_multi_pw_aff *multi, enum isl_dim_type type, __isl_keep isl_id *id); __isl_give isl_id *isl_multi_pw_aff_get_dim_id( __isl_take isl_multi_pw_aff *multi, enum isl_dim_type type, unsigned pos); __isl_give isl_multi_pw_aff *isl_multi_pw_aff_set_dim_name( __isl_take isl_multi_pw_aff *multi, enum isl_dim_type type, unsigned pos, const char *s); __isl_give isl_multi_pw_aff *isl_multi_pw_aff_set_dim_id( __isl_take isl_multi_pw_aff *multi, enum isl_dim_type type, unsigned pos, __isl_take isl_id *id); const char *isl_multi_pw_aff_get_tuple_name( __isl_keep isl_multi_pw_aff *multi, enum isl_dim_type type); isl_bool isl_multi_pw_aff_has_tuple_id( __isl_keep isl_multi_pw_aff *multi, enum isl_dim_type type); __isl_give isl_id *isl_multi_pw_aff_get_tuple_id( __isl_keep isl_multi_pw_aff *multi, enum isl_dim_type type); __isl_give isl_multi_pw_aff *isl_multi_pw_aff_set_tuple_name( __isl_take isl_multi_pw_aff *multi, enum isl_dim_type type, const char *s); __isl_give isl_multi_pw_aff *isl_multi_pw_aff_set_tuple_id( __isl_take isl_multi_pw_aff *multi, enum isl_dim_type type, __isl_take isl_id *id); __isl_give isl_multi_pw_aff *isl_multi_pw_aff_reset_tuple_id( __isl_take isl_multi_pw_aff *multi, enum isl_dim_type type); __isl_give isl_multi_pw_aff *isl_multi_pw_aff_reset_user( __isl_take isl_multi_pw_aff *multi); __isl_give isl_multi_pw_aff *isl_multi_pw_aff_drop_dims( __isl_take isl_multi_pw_aff *multi, enum isl_dim_type type, unsigned first, unsigned n); __isl_give isl_pw_aff *isl_multi_pw_aff_get_pw_aff( __isl_keep isl_multi_pw_aff *multi, int pos); __isl_give isl_multi_pw_aff *isl_multi_pw_aff_set_pw_aff( __isl_take isl_multi_pw_aff *multi, int pos, __isl_take isl_pw_aff *el); __isl_give isl_multi_pw_aff *isl_multi_pw_aff_range_splice( __isl_take isl_multi_pw_aff *multi1, unsigned pos, __isl_take isl_multi_pw_aff *multi2); __isl_give isl_multi_pw_aff *isl_multi_pw_aff_flatten_range( __isl_take isl_multi_pw_aff *multi); __isl_give isl_multi_pw_aff *isl_multi_pw_aff_flat_range_product( __isl_take isl_multi_pw_aff *multi1, __isl_take isl_multi_pw_aff *multi2); __isl_give isl_multi_pw_aff *isl_multi_pw_aff_range_product( __isl_take isl_multi_pw_aff *multi1, __isl_take isl_multi_pw_aff *multi2); isl_bool isl_multi_pw_aff_range_is_wrapping( __isl_keep isl_multi_pw_aff *multi); __isl_give isl_multi_pw_aff *isl_multi_pw_aff_range_factor_domain( __isl_take isl_multi_pw_aff *multi); __isl_give isl_multi_pw_aff *isl_multi_pw_aff_range_factor_range( __isl_take isl_multi_pw_aff *multi); __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_val( __isl_take isl_multi_pw_aff *multi, __isl_take isl_val *v); __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_down_val( __isl_take isl_multi_pw_aff *multi, __isl_take isl_val *v); __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_multi_val( __isl_take isl_multi_pw_aff *multi, __isl_take isl_multi_val *mv); __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_down_multi_val( __isl_take isl_multi_pw_aff *multi, __isl_take isl_multi_val *mv); __isl_give isl_multi_pw_aff *isl_multi_pw_aff_mod_multi_val( __isl_take isl_multi_pw_aff *multi, __isl_take isl_multi_val *mv); __isl_give isl_multi_pw_aff *isl_multi_pw_aff_sub( __isl_take isl_multi_pw_aff *multi1, __isl_take isl_multi_pw_aff *multi2); __isl_give isl_multi_pw_aff *isl_multi_pw_aff_align_params( __isl_take isl_multi_pw_aff *multi, __isl_take isl_space *model); __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_range( __isl_take isl_multi_pw_aff *multi);
unsigned isl_multi_val_dim(__isl_keep isl_multi_val *multi, enum isl_dim_type type); isl_ctx *isl_multi_val_get_ctx( __isl_keep isl_multi_val *multi); __isl_give isl_space *isl_multi_val_get_space( __isl_keep isl_multi_val *multi); __isl_give isl_space *isl_multi_val_get_domain_space( __isl_keep isl_multi_val *multi); int isl_multi_val_find_dim_by_name( __isl_keep isl_multi_val *multi, enum isl_dim_type type, const char *name); __isl_give isl_multi_val *isl_multi_val_from_val_list( __isl_take isl_space *space, __isl_take isl_val_list *list); __isl_give isl_multi_val *isl_multi_val_zero( __isl_take isl_space *space); __isl_give isl_multi_val *isl_multi_val_copy( __isl_keep isl_multi_val *multi); isl_multi_val *isl_multi_val_free( __isl_take isl_multi_val *multi); isl_bool isl_multi_val_plain_is_equal( __isl_keep isl_multi_val *multi1, __isl_keep isl_multi_val *multi2); int isl_multi_val_find_dim_by_id( __isl_keep isl_multi_val *multi, enum isl_dim_type type, __isl_keep isl_id *id); __isl_give isl_id *isl_multi_val_get_dim_id( __isl_take isl_multi_val *multi, enum isl_dim_type type, unsigned pos); __isl_give isl_multi_val *isl_multi_val_set_dim_name( __isl_take isl_multi_val *multi, enum isl_dim_type type, unsigned pos, const char *s); __isl_give isl_multi_val *isl_multi_val_set_dim_id( __isl_take isl_multi_val *multi, enum isl_dim_type type, unsigned pos, __isl_take isl_id *id); const char *isl_multi_val_get_tuple_name( __isl_keep isl_multi_val *multi, enum isl_dim_type type); isl_bool isl_multi_val_has_tuple_id( __isl_keep isl_multi_val *multi, enum isl_dim_type type); __isl_give isl_id *isl_multi_val_get_tuple_id( __isl_keep isl_multi_val *multi, enum isl_dim_type type); __isl_give isl_multi_val *isl_multi_val_set_tuple_name( __isl_take isl_multi_val *multi, enum isl_dim_type type, const char *s); __isl_give isl_multi_val *isl_multi_val_set_tuple_id( __isl_take isl_multi_val *multi, enum isl_dim_type type, __isl_take isl_id *id); __isl_give isl_multi_val *isl_multi_val_reset_tuple_id( __isl_take isl_multi_val *multi, enum isl_dim_type type); __isl_give isl_multi_val *isl_multi_val_reset_user( __isl_take isl_multi_val *multi); __isl_give isl_multi_val *isl_multi_val_drop_dims( __isl_take isl_multi_val *multi, enum isl_dim_type type, unsigned first, unsigned n); __isl_give isl_val *isl_multi_val_get_val( __isl_keep isl_multi_val *multi, int pos); __isl_give isl_multi_val *isl_multi_val_set_val( __isl_take isl_multi_val *multi, int pos, __isl_take isl_val *el); __isl_give isl_multi_val *isl_multi_val_range_splice( __isl_take isl_multi_val *multi1, unsigned pos, __isl_take isl_multi_val *multi2); __isl_give isl_multi_val *isl_multi_val_flatten_range( __isl_take isl_multi_val *multi); __isl_give isl_multi_val *isl_multi_val_flat_range_product( __isl_take isl_multi_val *multi1, __isl_take isl_multi_val *multi2); __isl_give isl_multi_val *isl_multi_val_range_product( __isl_take isl_multi_val *multi1, __isl_take isl_multi_val *multi2); isl_bool isl_multi_val_range_is_wrapping( __isl_keep isl_multi_val *multi); __isl_give isl_multi_val *isl_multi_val_range_factor_domain( __isl_take isl_multi_val *multi); __isl_give isl_multi_val *isl_multi_val_range_factor_range( __isl_take isl_multi_val *multi); __isl_give isl_multi_val *isl_multi_val_scale_val( __isl_take isl_multi_val *multi, __isl_take isl_val *v); __isl_give isl_multi_val *isl_multi_val_scale_down_val( __isl_take isl_multi_val *multi, __isl_take isl_val *v); __isl_give isl_multi_val *isl_multi_val_scale_multi_val( __isl_take isl_multi_val *multi, __isl_take isl_multi_val *mv); __isl_give isl_multi_val *isl_multi_val_scale_down_multi_val( __isl_take isl_multi_val *multi, __isl_take isl_multi_val *mv); __isl_give isl_multi_val *isl_multi_val_mod_multi_val( __isl_take isl_multi_val *multi, __isl_take isl_multi_val *mv); __isl_give isl_multi_val *isl_multi_val_sub( __isl_take isl_multi_val *multi1, __isl_take isl_multi_val *multi2); __isl_give isl_multi_val *isl_multi_val_align_params( __isl_take isl_multi_val *multi, __isl_take isl_space *model); __isl_give isl_multi_val *isl_multi_val_from_range( __isl_take isl_multi_val *multi);
unsigned isl_multi_union_pw_aff_dim(__isl_keep isl_multi_union_pw_aff *multi, enum isl_dim_type type); isl_ctx *isl_multi_union_pw_aff_get_ctx( __isl_keep isl_multi_union_pw_aff *multi); __isl_give isl_space *isl_multi_union_pw_aff_get_space( __isl_keep isl_multi_union_pw_aff *multi); __isl_give isl_space *isl_multi_union_pw_aff_get_domain_space( __isl_keep isl_multi_union_pw_aff *multi); int isl_multi_union_pw_aff_find_dim_by_name( __isl_keep isl_multi_union_pw_aff *multi, enum isl_dim_type type, const char *name); __isl_give isl_multi_union_pw_aff *isl_multi_union_pw_aff_from_union_pw_aff_list( __isl_take isl_space *space, __isl_take isl_union_pw_aff_list *list); __isl_give isl_multi_union_pw_aff *isl_multi_union_pw_aff_zero( __isl_take isl_space *space); __isl_give isl_multi_union_pw_aff *isl_multi_union_pw_aff_copy( __isl_keep isl_multi_union_pw_aff *multi); isl_multi_union_pw_aff *isl_multi_union_pw_aff_free( __isl_take isl_multi_union_pw_aff *multi); isl_bool isl_multi_union_pw_aff_plain_is_equal( __isl_keep isl_multi_union_pw_aff *multi1, __isl_keep isl_multi_union_pw_aff *multi2); int isl_multi_union_pw_aff_find_dim_by_id( __isl_keep isl_multi_union_pw_aff *multi, enum isl_dim_type type, __isl_keep isl_id *id); __isl_give isl_id *isl_multi_union_pw_aff_get_dim_id( __isl_take isl_multi_union_pw_aff *multi, enum isl_dim_type type, unsigned pos); __isl_give isl_multi_union_pw_aff *isl_multi_union_pw_aff_set_dim_name( __isl_take isl_multi_union_pw_aff *multi, enum isl_dim_type type, unsigned pos, const char *s); __isl_give isl_multi_union_pw_aff *isl_multi_union_pw_aff_set_dim_id( __isl_take isl_multi_union_pw_aff *multi, enum isl_dim_type type, unsigned pos, __isl_take isl_id *id); const char *isl_multi_union_pw_aff_get_tuple_name( __isl_keep isl_multi_union_pw_aff *multi, enum isl_dim_type type); isl_bool isl_multi_union_pw_aff_has_tuple_id( __isl_keep isl_multi_union_pw_aff *multi, enum isl_dim_type type); __isl_give isl_id *isl_multi_union_pw_aff_get_tuple_id( __isl_keep isl_multi_union_pw_aff *multi, enum isl_dim_type type); __isl_give isl_multi_union_pw_aff *isl_multi_union_pw_aff_set_tuple_name( __isl_take isl_multi_union_pw_aff *multi, enum isl_dim_type type, const char *s); __isl_give isl_multi_union_pw_aff *isl_multi_union_pw_aff_set_tuple_id( __isl_take isl_multi_union_pw_aff *multi, enum isl_dim_type type, __isl_take isl_id *id); __isl_give isl_multi_union_pw_aff *isl_multi_union_pw_aff_reset_tuple_id( __isl_take isl_multi_union_pw_aff *multi, enum isl_dim_type type); __isl_give isl_multi_union_pw_aff *isl_multi_union_pw_aff_reset_user( __isl_take isl_multi_union_pw_aff *multi); __isl_give isl_multi_union_pw_aff *isl_multi_union_pw_aff_drop_dims( __isl_take isl_multi_union_pw_aff *multi, enum isl_dim_type type, unsigned first, unsigned n); __isl_give isl_union_pw_aff *isl_multi_union_pw_aff_get_union_pw_aff( __isl_keep isl_multi_union_pw_aff *multi, int pos); __isl_give isl_multi_union_pw_aff *isl_multi_union_pw_aff_set_union_pw_aff( __isl_take isl_multi_union_pw_aff *multi, int pos, __isl_take isl_union_pw_aff *el); __isl_give isl_multi_union_pw_aff *isl_multi_union_pw_aff_range_splice( __isl_take isl_multi_union_pw_aff *multi1, unsigned pos, __isl_take isl_multi_union_pw_aff *multi2); __isl_give isl_multi_union_pw_aff *isl_multi_union_pw_aff_flatten_range( __isl_take isl_multi_union_pw_aff *multi); __isl_give isl_multi_union_pw_aff *isl_multi_union_pw_aff_flat_range_product( __isl_take isl_multi_union_pw_aff *multi1, __isl_take isl_multi_union_pw_aff *multi2); __isl_give isl_multi_union_pw_aff *isl_multi_union_pw_aff_range_product( __isl_take isl_multi_union_pw_aff *multi1, __isl_take isl_multi_union_pw_aff *multi2); isl_bool isl_multi_union_pw_aff_range_is_wrapping( __isl_keep isl_multi_union_pw_aff *multi); __isl_give isl_multi_union_pw_aff *isl_multi_union_pw_aff_range_factor_domain( __isl_take isl_multi_union_pw_aff *multi); __isl_give isl_multi_union_pw_aff *isl_multi_union_pw_aff_range_factor_range( __isl_take isl_multi_union_pw_aff *multi); __isl_give isl_multi_union_pw_aff *isl_multi_union_pw_aff_scale_val( __isl_take isl_multi_union_pw_aff *multi, __isl_take isl_val *v); __isl_give isl_multi_union_pw_aff *isl_multi_union_pw_aff_scale_down_val( __isl_take isl_multi_union_pw_aff *multi, __isl_take isl_val *v); __isl_give isl_multi_union_pw_aff *isl_multi_union_pw_aff_scale_multi_val( __isl_take isl_multi_union_pw_aff *multi, __isl_take isl_multi_val *mv); __isl_give isl_multi_union_pw_aff *isl_multi_union_pw_aff_scale_down_multi_val( __isl_take isl_multi_union_pw_aff *multi, __isl_take isl_multi_val *mv); __isl_give isl_multi_union_pw_aff *isl_multi_union_pw_aff_mod_multi_val( __isl_take isl_multi_union_pw_aff *multi, __isl_take isl_multi_val *mv); __isl_give isl_multi_union_pw_aff *isl_multi_union_pw_aff_sub( __isl_take isl_multi_union_pw_aff *multi1, __isl_take isl_multi_union_pw_aff *multi2); __isl_give isl_multi_union_pw_aff *isl_multi_union_pw_aff_align_params( __isl_take isl_multi_union_pw_aff *multi, __isl_take isl_space *model); __isl_give isl_multi_union_pw_aff *isl_multi_union_pw_aff_from_range( __isl_take isl_multi_union_pw_aff *multi);