Ignore:
Timestamp:
Feb 12, 2010, 2:31:54 PM (10 years ago)
Author:
eamiri
Message:

Function inlining added.
Parabix2 can be compiled with some modifications

File:
1 edited

Legend:

Unmodified
Added
Removed
  • proto/Compiler/bitstream_compiler.py

    r354 r363  
    3535    def generate_code(self, s):
    3636        s = ast.parse(s)
    37         c, s = py2bitexpr.do_inlining(s)
    38        
    3937        #return s
    40         #s = s.body[0].body
    41 
    42         #FUNCTION INLINING
    43 
     38        livelist,s = py2bitexpr.get_lives(s)
     39        livelist.append('error_mask')
     40        s = py2bitexpr.do_inlining(s)
     41        #return s
    4442        s = py2bitexpr.translate_stmts(s)
    45 
    4643        st = py2bitexpr.gen_sym_table(s)
    47 
    4844        s=py2bitexpr.make_SSA(s, st)
    49 
    5045        s = py2bitexpr.partition2bb(s, )
    51 
    5246        s = py2bitexpr.apply_all_opt(s)
    5347        s = py2bitexpr.normalize(s)
    5448        py2bitexpr.simplify_tree(s)
     49        all_lives, s = py2bitexpr.eliminate_dead_code(s, set(livelist))
     50        s = py2bitexpr.factor_out(s)
     51        s, livelist = py2bitexpr.process_while_loops(s)
    5552
    56         livelist = ['error_mask', 'u16','u8_pre', 'u8_butlast', 'u8_last']
     53        declarations = py2bitexpr.gen_declarations(s)
     54        templ = self.read_template()
    5755
    58         all_lives, s = py2bitexpr.eliminate_dead_code(s, set(livelist))
    59 
    60         s=py2bitexpr.factor_out(s)
    61 
    62         s, livelist = py2bitexpr.process_while_loops(s)
    63         declarations = py2bitexpr.gen_declarations(s)
    64 
    65 
    66         #print py2bitexpr.print_prog(s)
    67         templ = self.read_template()
    6856        templ = self.output(declarations, py2bitexpr.print_prog(s), templ)
    6957        self.write_final_code(templ)
     
    7260###############################################################
    7361
    74 if __name__ == '__main__':
     62if __name__ == '__main__' or True:
    7563        mycode = ""
    7664        if len(sys.argv) < 2:
    7765            print "Usage: python bitstream_compiler.py <input file> [output file]"
    78             exit()
    79        
    80         inp_file = open(sys.argv[1])
     66            #exit()
     67
     68        inp_file = open("parabix2.py")
     69        #inp_file = open(sys.argv[1])
    8170        for line in inp_file:
    8271            mycode += line
Note: See TracChangeset for help on using the changeset viewer.