static void walk_functions(tree_set *visited, const struct cgraph_node *node)
{
	struct cgraph_edge *e;
	const_tree caller;

	if (!node)
		return;
	caller = NODE_DECL(node);

	if (pointer_set_insert(visited, caller))
		return;

	for (e = node->callees; e; e = e->next_callee) {
		const struct cgraph_node *next_node;
		tree callee = gimple_call_fndecl(e->call_stmt);

		if (DECL_BUILT_IN(callee))
			continue;

		print_function(caller, callee);

		next_node = cgraph_get_node(callee);
		walk_functions(visited, next_node);
	}
}
static unsigned int execute_latent_entropy(void)
{
	basic_block bb;
	gimple assign;
	gimple_stmt_iterator gsi;
	tree local_entropy;

	if (!latent_entropy_decl) {
#if BUILDING_GCC_VERSION >= 4009
		varpool_node *node;
#else
		struct varpool_node *node;
#endif

		FOR_EACH_VARIABLE(node) {
			tree var = NODE_DECL(node);

			if (DECL_NAME_LENGTH(var) < sizeof("latent_entropy") - 1)
				continue;
			if (strcmp(IDENTIFIER_POINTER(DECL_NAME(var)), "latent_entropy"))
				continue;
			latent_entropy_decl = var;
//			debug_tree(var);
			break;
		}
		if (!latent_entropy_decl) {
//			debug_tree(current_function_decl);
			return 0;
		}
	}
static unsigned int handle_functions(void)
{
	struct cgraph_node *node;
	tree_set *visited;

	visited = pointer_set_create();

	FOR_EACH_FUNCTION_WITH_GIMPLE_BODY(node) {
		if (DECL_BUILT_IN(NODE_DECL(node)))
			continue;
		walk_functions(visited, node);
	}

	pointer_set_destroy(visited);
	return 0;
}
示例#4
0
/* This function is ugly. */
GSGraphNode*
create_graph(void)
{
#define NODE(desc) node_##desc

#define NODE_DECL(desc) \
GSGraphNode* NODE(desc)
  NODE_DECL(A);
  NODE_DECL(B);
  NODE_DECL(C);
  NODE_DECL(D);
  NODE_DECL(E);
  NODE_DECL(F);
  NODE_DECL(G);
  NODE_DECL(H);
  NODE_DECL(I);
  NODE_DECL(J);
  NODE_DECL(K);
  NODE_DECL(L);
  NODE_DECL(M);
#undef NODE_DECL

#define NODE_DEF(desc) \
NODE(desc) = g_sgraph_node_new(g_strdup(#desc))
  NODE_DEF(A);
  NODE_DEF(B);
  NODE_DEF(C);
  NODE_DEF(D);
  NODE_DEF(E);
  NODE_DEF(F);
  NODE_DEF(G);
  NODE_DEF(H);
  NODE_DEF(I);
  NODE_DEF(J);
  NODE_DEF(K);
  NODE_DEF(L);
  NODE_DEF(M);
#undef NODE_DEF

#define NODES_CON(desc1, desc2) \
g_sgraph_node_connect(NODE(desc1), NODE(desc2))
  NODES_CON(A, B);
  NODES_CON(A, C);
  NODES_CON(B, C);
  NODES_CON(A, D);
  NODES_CON(C, D);
  NODES_CON(A, E);
  NODES_CON(A, F);
  NODES_CON(A, G);
  NODES_CON(A, H);
  NODES_CON(H, I);
  NODES_CON(F, J);
  NODES_CON(F, K);
  NODES_CON(K, J);
  NODES_CON(E, L);
  NODES_CON(G, L);
  NODES_CON(A, M);
#undef NODES_CON
  return NODE(A);
#undef NODE
}