const struct size_overflow_hash *get_size_overflow_hash_entry_tree(struct fn_raw_data *raw_data, bool hash_table)
{
	const_tree orig_decl;

	gcc_assert(raw_data->decl != NULL_TREE);

	if (made_by_compiler(raw_data->decl)) {
		orig_decl = get_orig_fndecl(raw_data->decl);
		if (raw_data->orig_num == NONE_ARGNUM)
			raw_data->orig_num = get_correct_argnum(raw_data->decl, orig_decl, raw_data->num);
	} else {
		orig_decl = raw_data->decl;
		raw_data->orig_num = raw_data->num;
	}

	if (raw_data->orig_num == CANNOT_FIND_ARG)
		return NULL;

	if (!raw_data->orig_decl_str)
		raw_data->orig_decl_str = get_orig_decl_name(orig_decl);

	raw_data->hash = get_decl_hash(orig_decl, raw_data->orig_decl_str);
	if (raw_data->hash == NO_HASH)
		return NULL;

	if (!raw_data->context)
		raw_data->context = get_decl_context(orig_decl);

	if (!raw_data->context)
		return NULL;

	if (hash_table == SIZE_OVERFLOW)
		return get_size_overflow_hash_entry(raw_data);
	return get_disable_size_overflow_hash_entry(raw_data);
}
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);
}
Ejemplo n.º 3
0
static bool is_interesting_function(const_tree decl, unsigned int num)
{
	const struct size_overflow_hash *so_hash;

	if (get_global_next_interesting_function_entry_with_hash(decl, DECL_NAME_POINTER(decl), num, YES_SO_MARK))
		return true;

	if (made_by_compiler(decl))
		return false;

	so_hash = get_size_overflow_hash_entry_tree(decl, num);
	return so_hash != NULL;
}