Changeset 2792 for proto


Ignore:
Timestamp:
Dec 19, 2012, 5:00:04 PM (7 years ago)
Author:
cameron
Message:

Taking out the garbage ...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • proto/Compiler/pablo.py

    r2786 r2792  
    346346    self.current_carry = 0
    347347    self.current_adv_n = 0
    348     carry_count = CarryCounter().count(fndef)
    349     if carry_count == 0: return fndef
    350348    self.generic_visit(fndef)
    351349  def xfrm_fndef_final(self, fndef):
     
    355353    self.current_carry = 0
    356354    self.current_adv_n = 0
    357     carry_count = CarryCounter().count(fndef)
    358     if carry_count == 0: return fndef
    359355    self.generic_visit(fndef)
    360 #   
    361 #    fndef.body.insert(0, mkCallStmt('CarryDeclare', [self.carryvar, ast.Num(carry_count)]))
    362356    return fndef
    363357  def generic_xfrm(self, node):
     
    368362    self.last_stmt = None
    369363    self.last_stmt_carries = 0
    370     carry_count = CarryCounter().count(node)
    371     adv_n_count = adv_nCounter().count(node)
    372     if carry_count == 0 and adv_n_count == 0: return node
    373364    self.generic_visit(node)
    374365    return node
     
    386377  def visit_Call(self, callnode):
    387378    self.generic_visit(callnode)
    388     #CARRYSET
    389     #carry_args = [ast.Num(self.current_carry)]
    390     #adv_n_args = [ast.Subscript(ast.Name(self.carryvar.id + '.pending64', ast.Load()), ast.Num(self.current_adv_n), ast.Load())]
    391     #adv_n_pending = ast.Subscript(ast.Name(self.carryvar.id + '.pending64', ast.Load()), ast.Num(self.current_adv_n), ast.Load())
    392     if self.carryin == "_ci":
    393         carry_args = [mkCall(self.carryvar.id + "." + 'get_carry_in', [ast.Num(self.current_carry)]), ast.Num(self.current_carry)]
    394         adv_n_args = [mkCall(self.carryvar.id + "." + 'get_pending64', [ast.Num(self.current_adv_n)]), ast.Num(self.current_adv_n)]
    395     else:
    396         carry_args = [mkCall('simd<1>::constant<0>', []), ast.Num(self.current_carry)]
    397         adv_n_args = [mkCall('simd<1>::constant<0>', []), ast.Num(self.current_adv_n)]
    398 
    399     if is_BuiltIn_Call(callnode, 'Advance', 2):         
    400       #CARRYSET
    401       rtn = self.carryvar.id + "." + "BitBlock_advance_n_<%i>" % callnode.args[1].n
    402       c = mkCall(rtn, [callnode.args[0]] + adv_n_args)
    403       self.current_adv_n += 1
    404       return c
    405     if is_BuiltIn_Call(callnode, 'Advance', 1):         
    406       #CARRYSET
    407       rtn = self.carryvar.id + "." + "BitBlock_advance_ci_co"
    408       c = mkCall(rtn, callnode.args + carry_args)
    409       self.current_carry += 1
    410       return c
    411     elif is_BuiltIn_Call(callnode, 'Advance32', 1):     
    412       #CARRYSET
    413       rtn = self.carryvar.id + "." + "BitBlock_advance_n_<32>"
    414       c = mkCall(rtn, callnode.args + adv_n_args)
    415       self.current_adv_n += 1
    416       return c
    417     elif is_BuiltIn_Call(callnode, 'ScanThru', 2):
    418       #CARRYSET
    419       rtn = self.carryvar.id + "." + "BitBlock_scanthru_ci_co"
    420       c = mkCall(rtn, callnode.args + carry_args)
    421       self.current_carry += 1
    422       return c
    423     elif is_BuiltIn_Call(callnode, 'AdvanceThenScanThru', 2):
    424       #CARRYSET
    425       rtn = self.carryvar.id + "." + "BitBlock_advance_then_scanthru"
    426       c = mkCall(rtn, callnode.args + carry_args)
    427       self.current_carry += 1
    428       return c
    429     elif is_BuiltIn_Call(callnode, 'AdvanceThenScanTo', 2):
    430       #CARRYSET
    431       rtn = self.carryvar.id + "." + "BitBlock_advance_then_scanthru"
    432       if self.carryout == "":  scanclass = mkCall('simd_andc', [ast.Name('EOF_mask', ast.Load()), callnode.args[1]])
    433       else: scanclass = mkCall('simd_not', [callnode.args[1]])
    434       c = mkCall(rtn, [callnode.args[0], scanclass] + carry_args)
    435       self.current_carry += 1
    436       return c
    437     elif is_BuiltIn_Call(callnode, 'SpanUpTo', 2):
    438       #CARRYSET
    439       rtn = self.carryvar.id + "." + "BitBlock_span_upto"
    440       c = mkCall(rtn, callnode.args + carry_args)
    441       self.current_carry += 1
    442       return c
    443     elif is_BuiltIn_Call(callnode, 'InclusiveSpan', 2):
    444       #CARRYSET
    445 #      rtn = self.carryvar.id + "." + "BitBlock_span_upto"
    446 #      c = mkCall('simd_or', [mkCall(rtn, callnode.args + carry_args), callnode.args[1]])
    447       rtn = self.carryvar.id + "." + "BitBlock_inclusive_span"
    448       c = mkCall(rtn, callnode.args + carry_args)
    449       self.current_carry += 1
    450       return c
    451     elif is_BuiltIn_Call(callnode, 'ExclusiveSpan', 2):
    452       #CARRYSET
    453 #      rtn = self.carryvar.id + "." + "BitBlock_span_upto"
    454 #      c = mkCall('simd_andc', [mkCall(rtn, callnode.args + carry_args), callnode.args[0]])
    455       rtn = self.carryvar.id + "." + "BitBlock_exclusive_span"
    456       c = mkCall(rtn, callnode.args + carry_args)
    457       self.current_carry += 1
    458       return c
    459     elif is_BuiltIn_Call(callnode, 'ScanTo', 2):
    460       # Modified Oct. 9, 2011 to directly use BitBlock_scanthru, eliminating duplication
    461       # in having a separate BitBlock_scanto routine.
    462       #CARRYSET
    463       rtn = self.carryvar.id + "." + "BitBlock_scanthru_ci_co"
    464       if self.carryout == "":  scanclass = mkCall('simd_andc', [ast.Name('EOF_mask', ast.Load()), callnode.args[1]])
    465       else: scanclass = mkCall('simd_not', [callnode.args[1]])
    466       c = mkCall(rtn, [callnode.args[0], scanclass] + carry_args)
    467       self.current_carry += 1
    468       return c
    469     elif is_BuiltIn_Call(callnode, 'ScanToFirst', 1):
    470       #CARRYSET
    471       rtn = self.carryvar.id + "." + "BitBlock_scantofirst"
    472       #if self.carryout == "":  carry_args = [ast.Name('EOF_mask', ast.Load())] + carry_args
    473       c = mkCall(rtn, callnode.args + carry_args)
    474       self.current_carry += 1
    475       return c
    476     elif is_BuiltIn_Call(callnode, 'atEOF', 1):
     379    if is_BuiltIn_Call(callnode, 'atEOF', 1):
    477380      if self.carryout != "": 
    478381        # Non final block: atEOF(x) = 0.
     
    502405    if isinstance(exprnode.op, ast.Sub):
    503406      assert False, "Subtraction no longer supported - use pablo.SpanUpTo ..."
    504       #CARRYSET
    505       rtn = self.carryvar.id + "." + "BitBlock_sub_ci_co"
    506       c = mkCall(rtn, [exprnode.left, exprnode.right] + carry_args)
    507       self.current_carry += 1
    508       return c
    509407    elif isinstance(exprnode.op, ast.Add):
    510408      assert False, "Addition no longer supported - use pablo.Scan ..."
    511       #CARRYSET
    512       rtn = self.carryvar.id + "." + "BitBlock_add_ci_co"
    513       c = mkCall(rtn, [exprnode.left, exprnode.right] + carry_args)
    514       self.current_carry += 1
    515       return c
    516409    else: return exprnode
    517410  def visit_Assign(self, assigNode):
    518411    self.last_stmt_carries = CarryCounter().count(assigNode)
    519412    f = CheckForBuiltin(assigNode.value)
    520     if f == None or not experimentalMode:
     413    if f == None:
    521414            self.generic_visit(assigNode)
    522415            self.last_stmt = assigNode
     
    524417    elif isCarryGenerating(f) or (isAdvance(f) and ((len(assigNode.value.args) == 1) or (assigNode.value.args[1].n==1))):
    525418    # We have an assignment v = pablo.SomeCarryGeneratingFunction()
    526     #elif f == 'ScanThru':
    527419            if self.carryin == "_ci":
    528420                carry_in_expr = self.ccgo.GenerateCarryInAccess(self.operation_count)
Note: See TracChangeset for help on using the changeset viewer.