示例#1
0
 def __init__(self, fn):
   SyntaxVisitor.__init__(self)
   
   self.fn = fn
   self.call_stack.append(fn)
   self.bound = set(fn.arg_names)
   self.seen_return = False 
示例#2
0
    def __init__(self, fn):
        SyntaxVisitor.__init__(self)

        self.fn = fn
        self.call_stack.append(fn)
        self.bound = set(fn.arg_names)
        self.seen_return = False
示例#3
0
文件: licm.py 项目: lucciano/parakeet
 def visit_While(self, stmt):
   self.volatile_vars.push(stmt.merge.keys())
   SyntaxVisitor.visit_While(self, stmt)
   if self.does_block_return(stmt.body):
     self.block_contains_return()
   volatile_in_scope = self.volatile_vars.pop()
   self.mark_safe_assignments(stmt.body, volatile_in_scope)
示例#4
0
 def visit_block(self, stmts, branch_label = None):
   self.push_scope()
   if branch_label is not None:
     self.push_scope(branch_label)
   SyntaxVisitor.visit_block(self, stmts)
   if branch_label is not None:
     self.pop_scope()
   self.pop_scope()
示例#5
0
 def visit_block(self, stmts, branch_label = None):
   self.push_scope()
   if branch_label is not None:
     self.push_scope(branch_label)
   SyntaxVisitor.visit_block(self, stmts)
   if branch_label is not None:
     self.pop_scope()
   self.pop_scope()
示例#6
0
文件: licm.py 项目: lucciano/parakeet
 def visit_If(self, stmt):
   self.volatile_vars.push(stmt.merge.keys())
   self.visit_expr(stmt.cond)
   SyntaxVisitor.visit_If(self, stmt)
   if self.does_block_return(stmt.true) or self.does_block_return(stmt.false):
     self.mark_curr_block_returns()
   volatile_in_scope = self.volatile_vars.pop()
   self.mark_safe_assignments(stmt.true, volatile_in_scope)
   self.mark_safe_assignments(stmt.false, volatile_in_scope)
示例#7
0
文件: licm.py 项目: lucciano/parakeet
 def __init__(self):
   SyntaxVisitor.__init__(self)
   self.mutable_types = None
   self.volatile_vars = ScopedSet()
   self.depends_on = {}
   self.safe_to_move = set([])
   self.curr_block_id = None
   self.block_contains_return = set([])
   self.may_alias = None
示例#8
0
 def visit_expr(self, expr):
   assert expr is not None
   assert expr.type is not None, \
     "Missing type annotation on %s" % expr 
   SyntaxVisitor.visit_expr(self, expr)
示例#9
0
 def visit_expr(self, expr):
   if isinstance(expr, Adverb):
     raise self.Yes()
   SyntaxVisitor.visit_expr(self, expr)
示例#10
0
 def __init__(self):
     SyntaxVisitor.__init__(self)
     self.mutable_types = set([])
示例#11
0
 def visit_fn(self, fn):
   escape_info = escape_analysis(fn, self.fresh_alloc_args)
   self.may_alias = escape_info.may_alias 
   SyntaxVisitor.visit_fn(self, fn)
   self.writes = set([])
示例#12
0
 def visit_stmt(self, stmt):
     if stmt.__class__ is ParFor:
         raise Yes()
     SyntaxVisitor.visit_stmt(self, stmt)
示例#13
0
 def __init__(self, fn):
   SyntaxVisitor.__init__(self)
   self.fn = fn
   self.bound = set(fn.arg_names)
示例#14
0
 def __init__(self):
     SyntaxVisitor.__init__(self)
     self.bindings = {}
示例#15
0
 def __init__(self):
   SyntaxVisitor.__init__(self)
   self.mutable_types = set([])
示例#16
0
 def __init__(self):
     SyntaxVisitor.__init__(self)
     self.live_vars = set([])
示例#17
0
 def visit_ForLoop(self, stmt):
     self.visit_Var(stmt.var)
     SyntaxVisitor.visit_ForLoop(self, stmt)
示例#18
0
    def __init__(self):

        SyntaxVisitor.__init__(self)
        self.counts = {}
示例#19
0
 def visit_expr(self, expr):
     if isinstance(expr, Adverb):
         raise Yes()
     SyntaxVisitor.visit_expr(self, expr)
示例#20
0
 def visit_expr(self, expr):
     if isinstance(expr, (UntypedFn, TypedFn, Closure)) or isinstance(
             expr.type, (FnT, ClosureT)):
         raise Yes()
     SyntaxVisitor.visit_expr(expr)
示例#21
0
 def visit_expr(self, expr):
   abstract_shape = SyntaxVisitor.visit_expr(self, expr)
   assert abstract_shape is not None, \
       "Unsupported expression in shape inference: %s" % expr.node_type()
   return abstract_shape
示例#22
0
 def __init__(self):
   SyntaxVisitor.__init__(self)
   self.bindings = {}
示例#23
0
 def visit_fn(self, fn):
   for name in fn.arg_names:
     self.created_on[name] = 0
   SyntaxVisitor.visit_fn(self, fn)
示例#24
0
 def __init__(self):
     SyntaxVisitor.__init__(self)
     self.ranges = {}
     self.old_values = ScopedDict()
     self.old_values.push()
示例#25
0
文件: licm.py 项目: lucciano/parakeet
 def visit_block(self, stmts):
   self.curr_block_id = id(stmts)
   SyntaxVisitor.visit_block(self, stmts)
示例#26
0
 def visit_expr(self, expr):
   assert expr is not None
   SyntaxVisitor.visit_expr(self, expr)
示例#27
0
 def visit_stmt(self, stmt):
     assert stmt is not None, "Statement missing, must be a compiler bug"
     SyntaxVisitor.visit_stmt(self, stmt)
示例#28
0
文件: licm.py 项目: lucciano/parakeet
 def visit_fn(self, fn):
   self.volatile_vars.push(fn.arg_names)
   self.may_alias = may_alias(fn)
   SyntaxVisitor.visit_fn(self, fn)
   return self.safe_to_move
示例#29
0
 def visit_expr(self, expr):
   assert expr is not None, "Expression missing, must be a compiler bug"
   assert expr.type is not None, \
     "Missing type annotation on %s" % expr 
   SyntaxVisitor.visit_expr(self, expr)
示例#30
0
 def visit_expr(self, expr):
   if isinstance(expr, (UntypedFn, TypedFn, Closure)) or isinstance(expr.type, (FnT, ClosureT)):
     raise Yes()
   SyntaxVisitor.visit_expr(expr)
示例#31
0
 def visit_expr(self, expr):
     assert expr is not None, "Expression missing, must be a compiler bug"
     assert expr.type is not None, \
       "Missing type annotation on %s" % expr
     SyntaxVisitor.visit_expr(self, expr)
示例#32
0
 def visit_stmt(self, stmt):
   assert stmt is not None, "Statement missing, must be a compiler bug"
   SyntaxVisitor.visit_stmt(self, stmt)
示例#33
0
 def visit_stmt(self, stmt):
   self.inc_counter()
   self.stmt_paths[id(stmt)] = self.curr_path()
   SyntaxVisitor.visit_stmt(self, stmt)
示例#34
0
 def __init__(self):
   SyntaxVisitor.__init__(self)
   self.ranges = {} 
   self.old_values = ScopedDict()
   self.old_values.push()
示例#35
0
 def visit_fn(self, fn):
   SyntaxVisitor.visit_fn(self, fn)
   return self.known_offsets
示例#36
0
 def visit_stmt(self, stmt):
   if stmt.__class__ is ParFor:
     raise Yes()
   SyntaxVisitor.visit_stmt(self, stmt)
示例#37
0
 def visit_fn(self, fn):
   for name in fn.arg_names:
     self.created_on[name] = 0
   SyntaxVisitor.visit_fn(self, fn)
示例#38
0
 def visit_stmt(self, stmt):
   SyntaxVisitor.visit_stmt(self, stmt)
示例#39
0
 def visit_stmt(self, stmt):
   self.inc_counter()
   self.stmt_paths[id(stmt)] = self.curr_path()
   SyntaxVisitor.visit_stmt(self, stmt)
示例#40
0
 def visit_stmt(self, stmt):
   assert stmt is not None
   SyntaxVisitor.visit_stmt(self, stmt)
示例#41
0
 def __init__(self):
   
   SyntaxVisitor.__init__(self)
   self.counts = {}
示例#42
0
 def visit_ForLoop(self, stmt):
   self.value_env[stmt.var.name] = any_scalar
   SyntaxVisitor.visit_ForLoop(self, stmt)
示例#43
0
 def visit_ForLoop(self, stmt):
   self.visit_Var(stmt.var)
   SyntaxVisitor.visit_ForLoop(self, stmt)
示例#44
0
 def __init__(self):
   SyntaxVisitor.__init__(self)
   self.var_names = set([])
示例#45
0
 def __init__(self):
   SyntaxVisitor.__init__(self)
   self.live_vars = set([])
示例#46
0
 def visit_fn(self, fn):
   escape_info = escape_analysis(fn, self.fresh_alloc_args)
   self.may_alias = escape_info.may_alias 
   SyntaxVisitor.visit_fn(self, fn)
   self.writes = set([])
示例#47
0
 def __init__(self):
     SyntaxVisitor.__init__(self)
     self.var_names = set([])