Ejemplo n.º 1
0
 def __init__(self, pm, name, ctx, lambda_functions, imports):
     Transformation.__init__(self)
     self.passmanager = pm
     self.ctx = ctx
     self.prefix = name
     self.lambda_functions = lambda_functions
     self.imports = imports
     self.global_declarations = pm.gather(GlobalDeclarations, ctx.module)
Ejemplo n.º 2
0
 def generic_visit(self, node):
     if node in self.constant_expressions:
         try:
             fake_node = ast.Expression(
                 node.value if isinstance(node, ast.Index) else node)
             code = compile(fake_node, '<constant folding>', 'eval')
             value = eval(code, self.env)
             new_node = self.to_ast(value)
             if (isinstance(node, ast.Index)
                     and not isinstance(new_node, ast.Index)):
                 new_node = ast.Index(new_node)
             return new_node
         except Exception:  # as e:
             #print ast.dump(node)
             #print 'error in constant folding: ', e
             return Transformation.generic_visit(self, node)
     else:
         return Transformation.generic_visit(self, node)
Ejemplo n.º 3
0
 def __init__(self):
     Transformation.__init__(self, NormalizeTuples,
                             OptimizableComprehension)
Ejemplo n.º 4
0
 def __init__(self):
     Transformation.__init__(self, OptimizableGenexp)
Ejemplo n.º 5
0
 def __init__(self):
     Transformation.__init__(self, Locals, Globals)
Ejemplo n.º 6
0
 def __init__(self):
     Transformation.__init__(self)
     self.imports = set()
     self.symbols = dict()
Ejemplo n.º 7
0
 def __init__(self):
     Transformation.__init__(self, Identifiers)
Ejemplo n.º 8
0
 def __init__(self):
     Transformation.__init__(self)
     # Remap self.visit_XXXX() to self.attach_data() generic method
     for s in GatherOMPData.statements:
         setattr(self, "visit_" + s, lambda node_: self.attach_data(node_))
     self.current = list()
Ejemplo n.º 9
0
 def __init__(self):
     Transformation.__init__(self, ConstantExpressions)
Ejemplo n.º 10
0
 def __init__(self):
     Transformation.__init__(self, Globals)
     self.imports = set()
Ejemplo n.º 11
0
 def __init__(self, pm, name, ctx):
     Transformation.__init__(self)
     self.passmanager = pm
     self.ctx = ctx
     self.prefix = name
     self.lambda_functions = list()
Ejemplo n.º 12
0
 def __init__(self, pm, ctx):
     Transformation.__init__(self)
     self.ctx = ctx
     self.passmanager = pm
Ejemplo n.º 13
0
 def __init__(self):
     Transformation.__init__(self)
     for s in GatherOMPData.statements:
         setattr(self, "visit_" + s, lambda node_: self.attach_data(node_))
     self.current = list()
Ejemplo n.º 14
0
 def __init__(self, pm, ctx):
     Transformation.__init__(self)
     self.ctx = ctx
     self.passmanager = pm
     self.global_declarations = pm.gather(GlobalDeclarations, ctx.module)
Ejemplo n.º 15
0
 def __init__(self):
     Transformation.__init__(self, TypeDependencies,
                             OrderedGlobalDeclarations)
Ejemplo n.º 16
0
 def __init__(self):
     Transformation.__init__(self, NormalizeTuples,
                             PotentialIterator)
Ejemplo n.º 17
0
 def __init__(self):
     Transformation.__init__(self, PotentialIterator, Aliases)
Ejemplo n.º 18
0
 def __init__(self):
     self.renamings = dict()
     Transformation.__init__(self, Identifiers)
Ejemplo n.º 19
0
 def __init__(self):
     self.counter = 0
     Transformation.__init__(self)
Ejemplo n.º 20
0
 def __init__(self):
     Transformation.__init__(self)
     # Remap self.visit_XXXX() to self.attach_data() generic method
     for s in GatherOMPData.statements:
         setattr(self, "visit_" + s, lambda node_: self.attach_data(node_))
     self.current = list()