Changeset 299 for proto


Ignore:
Timestamp:
Sep 11, 2009, 6:42:33 AM (10 years ago)
Author:
cameron
Message:

Avoid generating trivial new variables.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • proto/parabix2/Compiler/bitstream_compiler.py

    r298 r299  
    4949    def add_stmt(self, varname, expr):
    5050        self.common_expression_map[expr.show()] = varname
    51         self.generated_code.append(bitexpr.BitAssign(varname, expr))
     51        self.generated_code.append(bitexpr.BitAssign(varname, expr))
    5252    def expr_string_to_variable(self, expr_string):
    5353        if self.common_expression_map.has_key(expr_string.show()):
     
    7676    if isinstance(expr, bitexpr.TrueLiteral): return simple_op(Nop, AllOne)
    7777    elif isinstance(expr, bitexpr.FalseLiteral): return simple_op(Nop, AllZero)
    78     elif isinstance(expr, bitexpr.Var): return simple_op(Nop, expr.varname)
     78    elif isinstance(expr, bitexpr.Var):
     79        v = simple_op(Nop, expr.varname)
     80        genobj.common_expression_map[v.show()] = expr.varname
     81        return v
    7982    elif isinstance(expr, bitexpr.Not):
    8083       e = genobj.expr_string_to_variable(expr2simd(genobj, expr.operand))
Note: See TracChangeset for help on using the changeset viewer.