Beispiel #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 
Beispiel #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
Beispiel #3
0
 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)
Beispiel #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()
Beispiel #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()
Beispiel #6
0
 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)
Beispiel #7
0
 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
Beispiel #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)
Beispiel #9
0
 def visit_expr(self, expr):
   if isinstance(expr, Adverb):
     raise self.Yes()
   SyntaxVisitor.visit_expr(self, expr)
Beispiel #10
0
 def __init__(self):
     SyntaxVisitor.__init__(self)
     self.mutable_types = set([])
Beispiel #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([])
Beispiel #12
0
 def visit_stmt(self, stmt):
     if stmt.__class__ is ParFor:
         raise Yes()
     SyntaxVisitor.visit_stmt(self, stmt)
Beispiel #13
0
 def __init__(self, fn):
   SyntaxVisitor.__init__(self)
   self.fn = fn
   self.bound = set(fn.arg_names)
Beispiel #14
0
 def __init__(self):
     SyntaxVisitor.__init__(self)
     self.bindings = {}
 def __init__(self):
   SyntaxVisitor.__init__(self)
   self.mutable_types = set([])
Beispiel #16
0
 def __init__(self):
     SyntaxVisitor.__init__(self)
     self.live_vars = set([])
Beispiel #17
0
 def visit_ForLoop(self, stmt):
     self.visit_Var(stmt.var)
     SyntaxVisitor.visit_ForLoop(self, stmt)
Beispiel #18
0
    def __init__(self):

        SyntaxVisitor.__init__(self)
        self.counts = {}
Beispiel #19
0
 def visit_expr(self, expr):
     if isinstance(expr, Adverb):
         raise Yes()
     SyntaxVisitor.visit_expr(self, expr)
Beispiel #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)
Beispiel #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
Beispiel #22
0
 def __init__(self):
   SyntaxVisitor.__init__(self)
   self.bindings = {}
Beispiel #23
0
 def visit_fn(self, fn):
   for name in fn.arg_names:
     self.created_on[name] = 0
   SyntaxVisitor.visit_fn(self, fn)
 def __init__(self):
     SyntaxVisitor.__init__(self)
     self.ranges = {}
     self.old_values = ScopedDict()
     self.old_values.push()
Beispiel #25
0
 def visit_block(self, stmts):
   self.curr_block_id = id(stmts)
   SyntaxVisitor.visit_block(self, stmts)
Beispiel #26
0
 def visit_expr(self, expr):
   assert expr is not None
   SyntaxVisitor.visit_expr(self, expr)
Beispiel #27
0
 def visit_stmt(self, stmt):
     assert stmt is not None, "Statement missing, must be a compiler bug"
     SyntaxVisitor.visit_stmt(self, stmt)
Beispiel #28
0
 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
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #32
0
 def visit_stmt(self, stmt):
   assert stmt is not None, "Statement missing, must be a compiler bug"
   SyntaxVisitor.visit_stmt(self, stmt)
Beispiel #33
0
 def visit_stmt(self, stmt):
   self.inc_counter()
   self.stmt_paths[id(stmt)] = self.curr_path()
   SyntaxVisitor.visit_stmt(self, stmt)
 def __init__(self):
   SyntaxVisitor.__init__(self)
   self.ranges = {} 
   self.old_values = ScopedDict()
   self.old_values.push()
Beispiel #35
0
 def visit_fn(self, fn):
   SyntaxVisitor.visit_fn(self, fn)
   return self.known_offsets
Beispiel #36
0
 def visit_stmt(self, stmt):
   if stmt.__class__ is ParFor:
     raise Yes()
   SyntaxVisitor.visit_stmt(self, stmt)
Beispiel #37
0
 def visit_fn(self, fn):
   for name in fn.arg_names:
     self.created_on[name] = 0
   SyntaxVisitor.visit_fn(self, fn)
Beispiel #38
0
 def visit_stmt(self, stmt):
   SyntaxVisitor.visit_stmt(self, stmt)
Beispiel #39
0
 def visit_stmt(self, stmt):
   self.inc_counter()
   self.stmt_paths[id(stmt)] = self.curr_path()
   SyntaxVisitor.visit_stmt(self, stmt)
Beispiel #40
0
 def visit_stmt(self, stmt):
   assert stmt is not None
   SyntaxVisitor.visit_stmt(self, stmt)
Beispiel #41
0
 def __init__(self):
   
   SyntaxVisitor.__init__(self)
   self.counts = {}
Beispiel #42
0
 def visit_ForLoop(self, stmt):
   self.value_env[stmt.var.name] = any_scalar
   SyntaxVisitor.visit_ForLoop(self, stmt)
Beispiel #43
0
 def visit_ForLoop(self, stmt):
   self.visit_Var(stmt.var)
   SyntaxVisitor.visit_ForLoop(self, stmt)
Beispiel #44
0
 def __init__(self):
   SyntaxVisitor.__init__(self)
   self.var_names = set([])
Beispiel #45
0
 def __init__(self):
   SyntaxVisitor.__init__(self)
   self.live_vars = set([])
 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([])
Beispiel #47
0
 def __init__(self):
     SyntaxVisitor.__init__(self)
     self.var_names = set([])