예제 #1
0
    def parseProgram(self, prog_code):
        '''To parse the entire tuning specification code and to return its tuning information'''

        # parse and evaluate the entire code
        stmt_seq = pparser.TSpecParser().parseProgram(prog_code)
        stmt_seq = eval.TSpecEvaluator().evaluate(stmt_seq)

        # create a generator for performance tuning information
        #tinfo_gen = tune_info.TuningInfoGen()
        tinfo = tune_info.TuningInfoGen().generate(stmt_seq)
        return tinfo
예제 #2
0
    def parseSpec(self, spec_code, line_no):
        '''To parse the given specification body code and to return its tuning information'''

        # parse and evaluate the specification statement
        stmt_seq = pparser.TSpecParser().parseSpec(spec_code, line_no)
        stmt_seq = eval.TSpecEvaluator().evaluate(stmt_seq)

        # generate tuning information
        tinfo = tune_info.TuningInfoGen().generate(stmt_seq)

        # return the tuning information
        return tinfo
예제 #3
0
    def parseProgram(self, prog_code):
        '''To parse the entire tuning specification code and to return its tuning information'''

        # parse and evaluate the entire code
        stmt_seq = parser.TSpecParser().parseProgram(prog_code)
        stmt_seq = eval.TSpecEvaluator().evaluate(stmt_seq)

        # create a generator for performance tuning information
        tinfo_gen = tune_info.TuningInfoGen()

        # generate tuning information for each specification statement and insert it into
        # a specifications mapping
        specs_map = {}
        for s in stmt_seq:
            if s[0] == 'spec':
                _, _, (sname, _), sseq = s
                specs_map[sname] = tinfo_gen.generate(sseq)

        # return the specifications mapping
        return specs_map