Beispiel #1
0
def on_pass_execution(p, fn):
    if p.name == '*free_lang_data':
        # The '*free_lang_data' pass is called once, rather than per-function,
        # and occurs immediately after "*build_cgraph_edges", which is the
        # pass that initially builds the callgraph
        #
        # So at this point we're likely to get a good view of the callgraph
        # before further optimization passes manipulate it
        dot = callgraph_to_dot()
        invoke_dot(dot)
Beispiel #2
0
def on_pass_execution(p, fn):
    #if p.name == '*warn_function_return':
    if p.name == '*free_lang_data':
        if 0:
            dot = callgraph_to_dot()
            invoke_dot(dot)

        for cgn in gcc.get_callgraph_nodes():
            print('cgn:')
            # print(dir(cgn))
            print('  cgn.decl: %r' % cgn.decl)
            print('  cgn.callers: %r' % cgn.callers)
            print('  cgn.callees: %r' % cgn.callees)
            for e in cgn.callers:
                print(e)
                print('e.caller: %r' % e.caller)
                print('e.callee: %r' % e.callee)
                print('e.call_stmt: %r %s' % (e.call_stmt, e.call_stmt))