Changeset 1526


Ignore:
Timestamp:
Oct 12, 2011, 2:02:06 PM (8 years ago)
Author:
cameron
Message:

Simplify pablo support by eliminating non-co versions; slight speedup actually

File:
1 edited

Legend:

Unmodified
Added
Removed
  • proto/Compiler/pablo.py

    r1520 r1526  
    232232  def visit_Call(self, callnode):
    233233    self.generic_visit(callnode)
    234     if self.carryin == '' and self.carryout == '':
    235         carry_args = []
    236         adv32_args = []
    237     else:
    238         carry_args = [self.carryvar, ast.Num(self.current_carry)]
    239         adv32_args = [ast.Subscript(ast.Name('pending32', ast.Load()), ast.Num(self.current_adv32), ast.Load())]
     234    carry_args = [self.carryvar, ast.Num(self.current_carry)]
     235    adv32_args = [ast.Subscript(ast.Name('pending32', ast.Load()), ast.Num(self.current_adv32), ast.Load())]
    240236    if is_BuiltIn_Call(callnode, 'Advance', 1):         
    241       rtn = "BitBlock_advance%s%s" % (self.carryin, self.carryout)
     237      rtn = "BitBlock_advance%s_co" % (self.carryin)
    242238      c = mkCall(rtn, callnode.args + carry_args)
    243239      self.current_carry += 1
    244240      return c
    245241    elif is_BuiltIn_Call(callnode, 'Advance32', 1):     
    246       rtn = "BitBlock_advance32%s%s" % (self.carryin, self.carryout)
     242      rtn = "BitBlock_advance32%s_co" % (self.carryin)
    247243      c = mkCall(rtn, callnode.args + adv32_args)
    248244      self.current_adv32 += 1
    249245      return c
    250246    elif is_BuiltIn_Call(callnode, 'ScanThru', 2):
    251       rtn = "BitBlock_scanthru%s%s" % (self.carryin, self.carryout)
     247      rtn = "BitBlock_scanthru%s_co" % (self.carryin)
    252248      c = mkCall(rtn, callnode.args + carry_args)
    253249      self.current_carry += 1
     
    256252      # Modified Oct. 9, 2011 to directly use BitBlock_scanthru, eliminating duplication
    257253      # in having a separate BitBlock_scanto routine.
    258       rtn = "BitBlock_scanthru%s%s" % (self.carryin, self.carryout)
     254      rtn = "BitBlock_scanthru%s_co" % (self.carryin)
    259255      if self.carryout == "":  scanclass = mkCall('simd_andc', [ast.Name('EOF_mask', ast.Load()), callnode.args[1]])
    260256      else: scanclass = mkCall('simd_not', [callnode.args[1]])
     
    321317    inner_while = CarryIntro(local_carryvar, '', self.carryout).generic_xfrm(copy.deepcopy(whileNode))
    322318    self.generic_visit(whileNode)
    323     if self.carryout == '_co':
    324       local_decl = mkCallStmt('CarryDeclare', [ast.Name(local_carryvar, ast.Load()), ast.Num(carries)])
    325       local_init = mkCallStmt('CarryInit', [ast.Name(local_carryvar, ast.Load()), ast.Num(carries)])
    326       inner_while.body.insert(0, local_decl)
    327       inner_while.body.insert(1, local_init)
    328       final_combine = mkCallStmt('CarryCombine', [self.carryvar, ast.Name(local_carryvar, ast.Load()), ast.Num(carry_base), ast.Num(carries)])
    329       inner_while.body.append(final_combine)
     319    local_decl = mkCallStmt('CarryDeclare', [ast.Name(local_carryvar, ast.Load()), ast.Num(carries)])
     320    local_init = mkCallStmt('CarryInit', [ast.Name(local_carryvar, ast.Load()), ast.Num(carries)])
     321    inner_while.body.insert(0, local_decl)
     322    inner_while.body.insert(1, local_init)
     323    final_combine = mkCallStmt('CarryCombine', [self.carryvar, ast.Name(local_carryvar, ast.Load()), ast.Num(carry_base), ast.Num(carries)])
     324    inner_while.body.append(final_combine)
    330325    if self.carryin == '': new_test = whileNode.test
    331326    else: new_test = ast.BoolOp(ast.Or(), [whileNode.test, mkCall('CarryTest', carry_arglist)])
Note: See TracChangeset for help on using the changeset viewer.