Exemplo n.º 1
0
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;
		}
	}
const char *get_orig_decl_name(const_tree decl)
{
	const char *name;
	unsigned int len;
	const void *end;
	const_tree orig_decl;

	if (TREE_CODE(decl) == FUNCTION_DECL)
		orig_decl = DECL_ORIGIN(decl);
	else
		orig_decl = decl;

	len = DECL_NAME_LENGTH(orig_decl);
	name = DECL_NAME_POINTER(orig_decl);

	/* Sometimes gcc loses the original cgraph node leaving only clones behind.
	 * In such cases we will extract the name from the clone and use it in the hash table
	 * without checking the parameter number on the original (unavailable) decl.
	 */

	if (made_by_compiler(orig_decl)) {
		end = memchr(name, '.', len);
		if (!end)
			return xstrndup(name, len);
		len = (long)end - (long)name;
		gcc_assert(len > 0);
	}

	return xstrndup(name, len);
}