コード例 #1
0
ファイル: check.py プロジェクト: yyshen/graph-refine
def inline_reachable_unmatched(p,
                               inline_tag,
                               compare_tag,
                               force_inline=None,
                               skip_underspec=False):
    funs = [
        pair.funs[inline_tag] for n in p.nodes if p.nodes[n].kind == 'Call'
        if p.node_tags[n][0] == compare_tag
        for pair in pairings.get(p.nodes[n].fname, [])
        if inline_tag in pair.tags
    ]

    rep = mk_graph_slice(
        p, consider_inline(funs, inline_tag, force_inline, skip_underspec))
    opts = vc_double_range(3, 3)
    while True:
        try:
            heads = problem.loop_heads_including_inner(p)
            limits = [(n, opts) for n in heads]

            for n in p.nodes.keys():
                try:
                    r = rep.get_node_pc_env((n, limits))
                except rep.TooGeneral:
                    pass

            rep.get_node_pc_env(('Ret', limits), inline_tag)
            rep.get_node_pc_env(('Err', limits), inline_tag)
            break
        except rep_graph.InlineEvent:
            continue
コード例 #2
0
ファイル: check.py プロジェクト: SEL4PROJ/graph-refine
def inline_reachable_unmatched (p, inline_tag, compare_tag,
		force_inline = None, skip_underspec = False):
	funs = [pair.funs['C']
		for n in p.nodes
		if p.nodes[n].kind == 'Call'
		if p.node_tags[n][0] == compare_tag
		for pair in pairings.get (p.nodes[n].fname, [])
		if 'C' in pair.tags]

	rep = mk_graph_slice (p,
		consider_inline_c (funs, inline_tag, force_inline,
			skip_underspec))
	opts = vc_double_range (3, 3)
	while True:
		try:
			limits = [(n, opts) for n in p.loop_heads ()]

			for n in p.nodes.keys ():
				try:
					r = rep.get_node_pc_env ((n, limits))
				except rep.TooGeneral:
					pass

			rep.get_node_pc_env (('Ret', limits), inline_tag)
			rep.get_node_pc_env (('Err', limits), inline_tag)
			break
		except rep_graph.InlineEvent:
			continue
コード例 #3
0
ファイル: rep_graph.py プロジェクト: bacam/graph-refine
	def add_func (self, name, inputs, outputs, success, n_vc):
		assert n_vc not in self.funcs
		self.funcs[n_vc] = (inputs, outputs, success)
		for pair in pairings.get (name, []):
			self.funcs.setdefault (pair.name, [])
			group = self.funcs[pair.name]
			for n_vc2 in group:
				if self.get_func_pairing (n_vc, n_vc2):
					self.add_func_assert (n_vc, n_vc2)
			group.append (n_vc)
コード例 #4
0
ファイル: check.py プロジェクト: bacam/graph-refine
def inline_completely_unmatched (p, ref_tags = None, skip_underspec = False):
	if ref_tags == None:
		ref_tags = p.pairing.tags
	while True:
		ns = [(n, skip_underspec
                                and not functions[p.nodes[n].fname].entry)
			for n in p.nodes
			if p.nodes[n].kind == 'Call'
			if not [pair for pair
				in pairings.get (p.nodes[n].fname, [])
				if pair.tags == ref_tags]]
		[trace ('Skipped inlining underspecified %s.'
			% p.nodes[n].fname) for (n, skip) in ns if skip]
		ns = [n for (n, skip) in ns if not skip]
		for n in ns:
			inline_at_point (p, n, do_analysis = False)
		if not ns:
			p.do_analysis ()
			return
コード例 #5
0
ファイル: check.py プロジェクト: yyshen/graph-refine
def inline_completely_unmatched(p, ref_tags=None, skip_underspec=False):
    if ref_tags == None:
        ref_tags = p.pairing.tags
    while True:
        ns = [(n, skip_underspec and not functions[p.nodes[n].fname].entry)
              for n in p.nodes if p.nodes[n].kind == 'Call' if not [
                  pair for pair in pairings.get(p.nodes[n].fname, [])
                  if pair.tags == ref_tags
              ]]
        [
            trace('Skipped inlining underspecified %s.' % p.nodes[n].fname)
            for (n, skip) in ns if skip
        ]
        ns = [n for (n, skip) in ns if not skip]
        for n in ns:
            trace('Function %s at %d - %s - completely unmatched.' %
                  (p.nodes[n].fname, n, p.node_tags[n][0]))
            inline_at_point(p, n, do_analysis=False)
        if not ns:
            p.do_analysis()
            return