Make cbuilder optimizations optional
This commit is contained in:
parent
ff51552838
commit
b22c023301
1 changed files with 9 additions and 8 deletions
|
|
@ -784,7 +784,7 @@ class CDefinition(object):
|
||||||
cls._name_ = "%s_%d" % (cls._name_, counter)
|
cls._name_ = "%s_%d" % (cls._name_, counter)
|
||||||
cls.counter = counter + 1
|
cls.counter = counter + 1
|
||||||
|
|
||||||
def define(self, module):
|
def define(self, module, optimize=True):
|
||||||
'''define the function in the module.
|
'''define the function in the module.
|
||||||
|
|
||||||
Raises NameError if a function of the same name has already been
|
Raises NameError if a function of the same name has already been
|
||||||
|
|
@ -814,13 +814,14 @@ class CDefinition(object):
|
||||||
self.cbuilder.close()
|
self.cbuilder.close()
|
||||||
self.cbuilder = None
|
self.cbuilder = None
|
||||||
|
|
||||||
# optimize
|
if optimize:
|
||||||
fpm = lp.FunctionPassManager.new(module)
|
fpm = lp.FunctionPassManager.new(module)
|
||||||
pmb = lp.PassManagerBuilder.new()
|
pmb = lp.PassManagerBuilder.new()
|
||||||
pmb.opt_level = 3
|
pmb.opt_level = 3
|
||||||
pmb.vectorize = True
|
pmb.vectorize = True
|
||||||
pmb.populate(fpm)
|
pmb.populate(fpm)
|
||||||
fpm.run(func)
|
fpm.run(func)
|
||||||
|
|
||||||
return func
|
return func
|
||||||
|
|
||||||
def __call__(self, module):
|
def __call__(self, module):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue