Changeset 863 for proto/Compiler


Ignore:
Timestamp:
Jan 2, 2011, 6:44:58 PM (8 years ago)
Author:
cameron
Message:

Cleanup; add carryQ variable to function header

File:
1 edited

Legend:

Unmodified
Added
Removed
  • proto/Compiler/pablo.py

    r857 r863  
    33#  2nd generation compiler
    44#
    5 # Copyright 2010, Robert D. Cameron
     5# Copyright 2010, 2011, Robert D. Cameron
    66# All rights reserved.
    77#
     
    1111
    1212# HELPER functions for AST recognition/construction
    13 # modified from old py2bitexpr.py
     13
    1414def is_BuiltIn_Call(fncall, builtin_fnname, builtin_arg_cnt, builtin_fnmod_noprefix='bitutil'):
    1515        if isinstance(fncall.func, ast.Name): iscall = fncall.func.id == builtin_fnname
     
    1818        return iscall and len(fncall.args) == builtin_arg_cnt and fncall.kwargs == None and fncall.starargs == None
    1919
    20 def is_Advance_Call(fncall):   # extracted from old py2bitexpr.py
    21         if isinstance(fncall.func, ast.Name): iscall = fncall.func.id == 'Advance'
    22         elif isinstance(fncall.func, ast.Attribute) and isinstance(fncall.func.value, ast.Name):
    23                  iscall = fncall.func.value.id == 'bitutil' and fncall.func.attr == 'Advance'
    24         return iscall and len(fncall.args) == 1 and fncall.kwargs == None and fncall.starargs == None
    25 
    26 def is_ScanThru_Call(fncall):  # extracted from old py2bitexpr.py
    27         if isinstance(fncall.func, ast.Name): iscall = fncall.func.id == 'ScanThru'
    28         elif isinstance(fncall.func, ast.Attribute) and isinstance(fncall.func.value, ast.Name):
    29                  iscall = fncall.func.value.id == 'bitutil' and fncall.func.attr == 'ScanThru'
    30         return iscall and len(fncall.args) == 2 and fncall.kwargs == None and fncall.starargs == None
    31 
    3220def is_simd_not(e):
    3321  return isinstance(e, ast.Call) and isinstance(e.func, ast.Name) and e.func.id == 'simd_not'
     
    4533
    4634#
    47 # Reducing AugAssign
     35# Reducing AugAssign, e.g.  x |= y becomes x = x | y
    4836#
    4937class AugAssignRemoval(ast.NodeTransformer):
     
    154142      Ccode += pending + arg.id.upper()[0] + arg.id[1:] + " & " + arg.id
    155143      pending = ", "
     144  if CarryCounter().count(fndef) > 0:
     145    Ccode += pending + " CarryQtype & carryQ"
    156146  Ccode += ")"
    157147  return Ccode
Note: See TracChangeset for help on using the changeset viewer.