[AMDGPU] Test codegen'ing True16 additions.
[llvm-project.git] / polly / lib / External / isl / python / isl.py.top
blobd041315d4e11db83cca5e93634b2b3441a6df5bd
1 import os
2 from ctypes import *
3 from ctypes.util import find_library
5 isl_dyld_library_path = os.environ.get('ISL_DYLD_LIBRARY_PATH')
6 if isl_dyld_library_path != None:
7     os.environ['DYLD_LIBRARY_PATH'] =  isl_dyld_library_path
8 try:
9     isl = cdll.LoadLibrary(isl_dlname)
10 except:
11     isl = cdll.LoadLibrary(find_library("isl"))
12 libc = cdll.LoadLibrary(find_library("c"))
14 class Error(Exception):
15     pass
17 class Context:
18     defaultInstance = None
20     def __init__(self):
21         ptr = isl.isl_ctx_alloc()
22         self.ptr = ptr
24     def __del__(self):
25         isl.isl_ctx_free(self)
27     def from_param(self):
28         return c_void_p(self.ptr)
30     @staticmethod
31     def getDefaultInstance():
32         if Context.defaultInstance == None:
33             Context.defaultInstance = Context()
34         return Context.defaultInstance
36     @CFUNCTYPE(None, py_object)
37     def free_user(user):
38         pythonapi.Py_DecRef(py_object(user))
40 isl.isl_ctx_alloc.restype = c_void_p
41 isl.isl_ctx_free.argtypes = [Context]
42 isl.isl_id_alloc.restype = c_void_p
43 isl.isl_id_alloc.argtypes = [Context, c_char_p, py_object]
44 isl.isl_id_set_free_user.restype = c_void_p
45 isl.isl_id_set_free_user.argtypes = [c_void_p, c_void_p]
46 isl.isl_id_get_free_user.restype = c_void_p
47 isl.isl_id_get_free_user.argtypes = [c_void_p]
48 isl.isl_id_get_user.restype = py_object
49 isl.isl_id_get_user.argtypes = [c_void_p]