Solution -------- In intraprocedural pass, the execute function is invoked for every function. Thus the names of global variables are printed for all the functions. However in interprocedural pass, the execute function is invoked once for a file and all the functions are processed. Thus names of global variables are printed only once. A brief explanation of the relevant code fragments has been provided below. 1. Code to print names of Global variables is explained below. /* We access the global variables from the varpool_node structure. Details of varpool_node structure can be found in cgraph.h */ for (node = varpool_nodes; node; node = node->next) { tree var = node->decl; /* Ignore artificial variables like D.xxx etc */ if (!DECL_ARTIFICIAL(var)) { /* get_name API returns the name of the variable */ fprintf(dump_file, get_name(var)); fprintf(dump_file,"\n"); } } 2. Code to print names of Local variables is explained below. /* Fetch the local variables for the current function */ tree list = cfun->local_decls; FOR_EACH_LOCAL_DECL (cfun, u, list) { if (!DECL_ARTIFICIAL (list)) fprintf(dump_file, "%s\n", get_name (list)); list = TREE_CHAIN (list); }