Changeset 2630


Ignore:
Timestamp:
Nov 12, 2012, 7:31:37 AM (6 years ago)
Author:
cameron
Message:

Compiler bug fix: apply AugAssign? removal before TempifyBuiltins?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • proto/Compiler/pablo.py

    r2628 r2630  
    154154#
    155155#  Converting expressions involving built-ins to compiled form. 
     156#  Make sure this is applied after AugAssign removal and before
     157#  carry variable insertion.
    156158#
    157159class TempifyBuiltins(ast.NodeTransformer):
     
    174176      return self.assigNode != None and self.assigNode.value == node
    175177    def visit_If(self, ifNode):
    176       outerSetUpStmts = self.setUpStmts
    177178      self.setUpStmts = []
     179      self.generic_visit(ifNode.test)
     180      ifSetUpStmts = self.setUpStmts
    178181      self.generic_visit(ifNode)
    179       ifSetUpStmts = self.setUpStmts
    180       self.setUpStmts = outerSetUpStmts
    181182      if ifSetUpStmts == []: return ifNode
    182183      else: return ifSetUpStmts + [ifNode]
    183184    def visit_While(self, whileNode):
    184       outerSetUpStmts = self.setUpStmts
    185185      self.setUpStmts = []
     186      self.generic_visit(whileNode.test)
     187      whileSetUpStmts = self.setUpStmts
    186188      self.generic_visit(whileNode)
    187       whileSetUpStmts = self.setUpStmts
    188       self.setUpStmts = outerSetUpStmts
    189189      whileNode.body = whileNode.body + whileSetUpStmts
    190190      return whileSetUpStmts + [whileNode]
    191191    def visit_Assign(self, node):
    192192      self.assigNode = node
    193       outerSetUpStmts = self.setUpStmts
    194193      self.setUpStmts = []
    195194      self.generic_visit(node)
    196       innerSetUpStmts = self.setUpStmts
    197       self.setUpStmts = outerSetUpStmts
    198       return innerSetUpStmts + [node]
     195      return self.setUpStmts + [node]
    199196    def visit_Call(self, callnode):     
    200197        self.generic_visit(callnode)
     
    10711068                stream_function.initializations = StreamInitializations().xfrm(node)
    10721069               
     1070                StringMatchCompiler().xfrm(node)
     1071                AssertCompiler().xfrm(node)
     1072                AugAssignRemoval().xfrm(node)
     1073
    10731074                t = TempifyBuiltins()
    10741075                t.xfrm(node)
    10751076                stream_function.declarations += "\n" + BitBlock_decls_from_vars(t.tempVars())
    10761077               
    1077                 StringMatchCompiler().xfrm(node)
    1078                 AssertCompiler().xfrm(node)
    1079                 AugAssignRemoval().xfrm(node)
    10801078                Bitwise_to_SIMD().xfrm(node)
    10811079                final_block_node = copy.deepcopy(node)
Note: See TracChangeset for help on using the changeset viewer.