Changeset 937


Ignore:
Timestamp:
Mar 11, 2011, 11:06:02 AM (8 years ago)
Author:
cameron
Message:

Add processing for @final_block_stmts.

Location:
proto/Compiler
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • proto/Compiler/compiler2.py

    r889 r937  
    1717        self.output_file = output_file
    1818
    19     def output(self, globaldecl, localdecl, stream_stmts , block_stmts, any_carry_expr, template_string):
     19    def output(self, globaldecl, localdecl, stream_stmts, block_stmts, final_block_stmts, any_carry_expr, template_string):
    2020        template_string = string.replace(template_string, '@global', globaldecl)
    2121        template_string = string.replace(template_string, '@decl', localdecl)
    2222        template_string = string.replace(template_string, '@stream_stmts', stream_stmts)
    2323        template_string = string.replace(template_string, '@block_stmts', block_stmts)
     24        template_string = string.replace(template_string, '@final_block_stmts', final_block_stmts)
    2425        template_string = string.replace(template_string, '@any_carry', any_carry_expr)
    2526        return template_string
     
    5556                            xfrmr.Cinits,
    5657                            xfrmr.Cstmts,
     58                            xfrmr.Cfinal_stmts,
    5759                            xfrmr.any_carry_expr(),
    5860                            template_contents)
  • proto/Compiler/pablo.py

    r935 r937  
    381381     
    382382class StreamFunctionCallXlator(ast.NodeTransformer):
    383   def __init__(self):
     383  def __init__(self, xlate_type="normal"):
    384384        self.stream_function_type_names = []
    385        
     385        self.xlate_type = xlate_type
     386
    386387  def xfrm(self, node, stream_function_type_names):
    387388        self.stream_function_type_names = stream_function_type_names
     
    392393
    393394        if isinstance(node, ast.Call) and isinstance(node.func, ast.Name) and node.func.id in self.stream_function_type_names:
    394                         node.func.id = node.func.id[0].lower() + node.func.id[1:] + ".do_block"
     395             struct_name = node.func.id[0].lower() + node.func.id[1:]
     396             if self.xlate_type == "final":
     397                   node.func.id = struct_name + ".do_final_block"
     398                   node.args = node.args + [ast.Name("EOF_mask", ast.Load())]
     399             else:
     400                   node.func.id = struct_name + ".do_block"
    395401        return node     
    396402               
     
    600606    AugAssignRemoval().xfrm(self.main_node)
    601607    Bitwise_to_SIMD().xfrm(self.main_node)
     608    final_block_main = copy.deepcopy(self.main_node)
    602609    CarryIntro().xfrm_fndef(self.main_node)
     610    CarryIntro('carryQ', '_ci', '').xfrm_fndef(final_block_main)
    603611    if self.add_dump_stmts:
    604612        Add_SIMD_Register_Dump().xfrm(self.main_node)
     613        Add_SIMD_Register_Dump().xfrm(final_block_stmts)
    605614               
    606615    StreamFunctionCallXlator().xfrm(self.main_node, self.stream_function_node.keys())
     616    StreamFunctionCallXlator('final').xfrm(final_block_main, self.stream_function_node.keys())
    607617   
    608618    if self.main_carry_count > 0:
     
    612622       
    613623    self.Cstmts = Cgen.py2C().gen(self.main_node.body)
     624    self.Cfinal_stmts = Cgen.py2C().gen(final_block_main.body)
    614625   
    615626if __name__ == "__main__":
Note: See TracChangeset for help on using the changeset viewer.