Exemplo n.º 1
0
def rename_vars (function):
	preds = logic.compute_preds (function.nodes)
	var_deps = logic.compute_var_deps (function.nodes,
		lambda x: function.outputs, preds)

	vs = set ()
	dont_rename_vs = set ()
	for n in var_deps:
		rev_renames = {}
		for (v, t) in var_deps[n]:
			v2 = recommended_rename (v)
			rev_renames.setdefault (v2, [])
			rev_renames[v2].append ((v, t))
			vs.add ((v, t))
		for (v2, vlist) in rev_renames.iteritems ():
			if len (vlist) > 1:
				dont_rename_vs.update (vlist)

	renames = dict ([(v, recommended_rename (v)) for (v, t) in vs
		if (v, t) not in dont_rename_vs])

	f = function
	f.inputs = [(renames.get (v, v), t) for (v, t) in f.inputs]
	f.outputs = [(renames.get (v, v), t) for (v, t) in f.outputs]
	for n in f.nodes:
		f.nodes[n] = syntax.copy_rename (f.nodes[n], (renames, {}))
Exemplo n.º 2
0
def rename_vars(function):
    preds = logic.compute_preds(function.nodes)
    var_deps = logic.compute_var_deps(function.nodes,
                                      lambda x: function.outputs, preds)

    vs = set()
    dont_rename_vs = set()
    for n in var_deps:
        rev_renames = {}
        for (v, t) in var_deps[n]:
            v2 = recommended_rename(v)
            rev_renames.setdefault(v2, [])
            rev_renames[v2].append((v, t))
            vs.add((v, t))
        for (v2, vlist) in rev_renames.iteritems():
            if len(vlist) > 1:
                dont_rename_vs.update(vlist)

    renames = dict([(v, recommended_rename(v)) for (v, t) in vs
                    if (v, t) not in dont_rename_vs])

    f = function
    f.inputs = [(renames.get(v, v), t) for (v, t) in f.inputs]
    f.outputs = [(renames.get(v, v), t) for (v, t) in f.outputs]
    for n in f.nodes:
        f.nodes[n] = syntax.copy_rename(f.nodes[n], (renames, {}))
Exemplo n.º 3
0
def build_call_site_set():
    for f in all_asm_functions():
        preds = logic.compute_preds(functions[f].nodes)
        for (n, node) in functions[f].nodes.iteritems():
            if node.kind == "Call":
                s = call_site_set.setdefault(node.fname, set())
                s.add(addr_of_node(preds, n))
    call_site_set[("IsLoaded", None)] = True
Exemplo n.º 4
0
def build_call_site_set():
    for f in all_asm_functions():
        preds = logic.compute_preds(functions[f].nodes)
        for (n, node) in functions[f].nodes.iteritems():
            if node.kind == 'Call':
                s = call_site_set.setdefault(node.fname, set())
                s.add(addr_of_node(preds, n))
    call_site_set[('IsLoaded', None)] = True
Exemplo n.º 5
0
	def compute_preds (self):
		self.preds = logic.compute_preds (self.nodes)
Exemplo n.º 6
0
 def compute_preds(self):
     self.preds = logic.compute_preds(self.nodes)