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); }
static void expand_one_static_var (tree var) { /* If this is an inlined copy of a static local variable, look up the original. */ var = DECL_ORIGIN (var); /* If we've already processed this variable because of that, do nothing. */ if (TREE_ASM_WRITTEN (var)) return; /* Give the front end a chance to do whatever. In practice, this is resolving duplicate names for IMA in C. */ if (lang_hooks.expand_decl (var)) return; /* Otherwise, just emit the variable. */ rest_of_decl_compilation (var, 0, 0); }
static tree gen_stdcall_or_fastcall_suffix (tree decl, tree id, bool fastcall) { HOST_WIDE_INT total = 0; const char *old_str = IDENTIFIER_POINTER (id != NULL_TREE ? id : DECL_NAME (decl)); char *new_str, *p; tree type = TREE_TYPE (DECL_ORIGIN (decl)); tree arg; function_args_iterator args_iter; gcc_assert (TREE_CODE (decl) == FUNCTION_DECL); if (prototype_p (type)) { /* This attribute is ignored for variadic functions. */ if (stdarg_p (type)) return NULL_TREE; /* Quit if we hit an incomplete type. Error is reported by convert_arguments in c-typeck.c or cp/typeck.c. */ FOREACH_FUNCTION_ARGS(type, arg, args_iter) { HOST_WIDE_INT parm_size; HOST_WIDE_INT parm_boundary_bytes = PARM_BOUNDARY / BITS_PER_UNIT; if (! COMPLETE_TYPE_P (arg)) break; parm_size = int_size_in_bytes (arg); if (parm_size < 0) break; /* Must round up to include padding. This is done the same way as in store_one_arg. */ parm_size = ((parm_size + parm_boundary_bytes - 1) / parm_boundary_bytes * parm_boundary_bytes); total += parm_size; } }
/* Return true if DECL is artificial stub that shouldn't be instrumented by mf. We should instrument clones of non-artificial functions. */ static inline bool mf_artificial (const_tree decl) { return DECL_ARTIFICIAL (DECL_ORIGIN (decl)); }