Changeset 772


Ignore:
Timestamp:
Dec 3, 2010, 2:06:00 PM (8 years ago)
Author:
cameron
Message:

Fix total carry count for @any_carry.

Location:
proto/Compiler
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • proto/Compiler/compiler2.py

    r760 r772  
    4141        self.mainfn = s.body[-1]
    4242        assert (isinstance(self.mainfn, ast.FunctionDef))
    43 
     43        carry_count = pablo.CarryCounter().count(self.mainfn)
    4444
    4545
     
    5252                            stream_stmts,
    5353                            pablo.block_stmts(self.mainfn),
    54                             pablo.any_carry_expr(self.mainfn),
     54                            pablo.any_carry_expr("carryQ", carry_count),
    5555                            templ)
    5656        self.write_final_code(templ)
  • proto/Compiler/pablo.py

    r771 r772  
    213213    self.carryvar = ast.Name(carryvar, ast.Load())
    214214    self.mode = mode
    215   def any_carry_expr(self, fndef):
    216     carry_count = CarryCounter().count(fndef)
    217     carry_arglist = [self.carryvar, ast.Num(0), ast.Num(carry_count)]
    218     return mkCall('CarryTest', carry_arglist)
    219215  def xfrm_fndef(self, fndef):
    220216    self.current_carry = 0
     
    384380  return Cgen.py2C().gen(main_fn.body)
    385381
    386 def any_carry_expr(main_fn):
    387   return Cgen.py2C().gen(CarryIntro().any_carry_expr(main_fn))
     382def any_carry_expr(carryvar, carry_count):
     383  carry_arglist = [ast.Name(carryvar, ast.Load()), ast.Num(0), ast.Num(carry_count)] 
     384  return Cgen.py2C().gen(mkCall('CarryTest', carry_arglist))
    388385
    389386if __name__ == "__main__":
Note: See TracChangeset for help on using the changeset viewer.