4 pet
= cdll
.LoadLibrary("libpet.so")
12 def set_autodetect(val
):
13 ctx
= isl
.Context
.getDefaultInstance()
14 pet
.pet_options_set_autodetect(ctx
, val
);
16 def set_encapsulate_dynamic_control(val
):
17 ctx
= isl
.Context
.getDefaultInstance()
18 pet
.pet_options_set_encapsulate_dynamic_control(ctx
, val
);
20 def set_signed_overflow(val
):
21 ctx
= isl
.Context
.getDefaultInstance()
22 pet
.pet_options_set_signed_overflow(ctx
, val
);
25 def __init__(self
, *args
, **keywords
):
27 self
.ctx
= keywords
["ctx"]
28 self
.ptr
= keywords
["ptr"]
29 self
.filename
= keywords
["filename"]
30 self
.function
= keywords
["function"]
33 pet
.pet_scop_free(self
.ptr
)
35 return ('pet.scop.extract_from_C_source("%s", "%s")'
36 % (self
.filename
, self
.function
))
38 def extract_from_C_source(filename
, function
):
39 ctx
= isl
.Context
.getDefaultInstance()
40 res
= pet
.pet_scop_extract_from_C_source(ctx
, filename
, function
)
41 return scop(ctx
=ctx
, ptr
=res
, filename
=filename
, function
=function
)
42 def get_instance_set(self
):
43 return isl
.union_set(ctx
=self
.ctx
,
44 ptr
=pet
.pet_scop_get_instance_set(self
.ptr
))
45 def get_may_reads(self
):
46 return isl
.union_map(ctx
=self
.ctx
,
47 ptr
=pet
.pet_scop_get_may_reads(self
.ptr
))
48 def get_may_writes(self
):
49 return isl
.union_map(ctx
=self
.ctx
,
50 ptr
=pet
.pet_scop_get_may_writes(self
.ptr
))
51 def get_must_writes(self
):
52 return isl
.union_map(ctx
=self
.ctx
,
53 ptr
=pet
.pet_scop_get_must_writes(self
.ptr
))
54 def get_must_kills(self
):
55 return isl
.union_map(ctx
=self
.ctx
,
56 ptr
=pet
.pet_scop_get_must_kills(self
.ptr
))
57 def get_tagged_may_reads(self
):
58 return isl
.union_map(ctx
=self
.ctx
,
59 ptr
=pet
.pet_scop_get_tagged_may_reads(self
.ptr
))
60 def get_tagged_may_writes(self
):
61 return isl
.union_map(ctx
=self
.ctx
,
62 ptr
=pet
.pet_scop_get_tagged_may_writes(self
.ptr
))
63 def get_tagged_must_writes(self
):
64 return isl
.union_map(ctx
=self
.ctx
,
65 ptr
=pet
.pet_scop_get_tagged_must_writes(self
.ptr
))
66 def get_tagged_must_kills(self
):
67 return isl
.union_map(ctx
=self
.ctx
,
68 ptr
=pet
.pet_scop_get_tagged_must_kills(self
.ptr
))
69 def get_context(self
):
70 return isl
.set(ctx
=self
.ctx
, ptr
=pet
.pet_scop_get_context(self
.ptr
))
71 def get_schedule(self
):
72 return isl
.schedule(ctx
=self
.ctx
,
73 ptr
=pet
.pet_scop_get_schedule(self
.ptr
))
75 pet
.pet_options_set_autodetect
.argtypes
= [isl
.Context
, c_int
]
76 pet
.pet_options_set_encapsulate_dynamic_control
.argtypes
= [isl
.Context
, c_int
]
77 pet
.pet_options_set_signed_overflow
.argtypes
= [isl
.Context
, c_int
]
78 pet
.pet_scop_extract_from_C_source
.restype
= c_void_p
79 pet
.pet_scop_extract_from_C_source
.argtypes
= [isl
.Context
, c_char_p
, c_char_p
]
80 pet
.pet_scop_get_instance_set
.restype
= c_void_p
81 pet
.pet_scop_get_instance_set
.argtypes
= [c_void_p
]
82 pet
.pet_scop_get_may_reads
.restype
= c_void_p
83 pet
.pet_scop_get_may_reads
.argtypes
= [c_void_p
]
84 pet
.pet_scop_get_may_writes
.restype
= c_void_p
85 pet
.pet_scop_get_may_writes
.argtypes
= [c_void_p
]
86 pet
.pet_scop_get_must_writes
.restype
= c_void_p
87 pet
.pet_scop_get_must_writes
.argtypes
= [c_void_p
]
88 pet
.pet_scop_get_must_kills
.restype
= c_void_p
89 pet
.pet_scop_get_must_kills
.argtypes
= [c_void_p
]
90 pet
.pet_scop_get_tagged_may_reads
.restype
= c_void_p
91 pet
.pet_scop_get_tagged_may_reads
.argtypes
= [c_void_p
]
92 pet
.pet_scop_get_tagged_may_writes
.restype
= c_void_p
93 pet
.pet_scop_get_tagged_may_writes
.argtypes
= [c_void_p
]
94 pet
.pet_scop_get_tagged_must_writes
.restype
= c_void_p
95 pet
.pet_scop_get_tagged_must_writes
.argtypes
= [c_void_p
]
96 pet
.pet_scop_get_tagged_must_kills
.restype
= c_void_p
97 pet
.pet_scop_get_tagged_must_kills
.argtypes
= [c_void_p
]
98 pet
.pet_scop_get_context
.restype
= c_void_p
99 pet
.pet_scop_get_context
.argtypes
= [c_void_p
]
100 pet
.pet_scop_get_schedule
.restype
= c_void_p
101 pet
.pet_scop_get_schedule
.argtypes
= [c_void_p
]
102 pet
.pet_scop_free
.argtypes
= [c_void_p
]