static const char * gen_formal_list_for_func_def (tree fndecl, formals_style style) { const char *formal_list = ""; tree formal_decl; formal_decl = DECL_ARGUMENTS (fndecl); while (formal_decl) { const char *this_formal; if (*formal_list && ((style == ansi) || (style == k_and_r_names))) formal_list = concat (formal_list, ", ", NULL); this_formal = gen_decl (formal_decl, 0, style); if (style == k_and_r_decls) formal_list = concat (formal_list, this_formal, "; ", NULL); else formal_list = concat (formal_list, this_formal, NULL); formal_decl = TREE_CHAIN (formal_decl); } if (style == ansi) { if (!DECL_ARGUMENTS (fndecl)) formal_list = concat (formal_list, "void", NULL); if (stdarg_p (TREE_TYPE (fndecl))) formal_list = concat (formal_list, ", ...", NULL); } if ((style == ansi) || (style == k_and_r_names)) formal_list = concat (" (", formal_list, ")", NULL); return formal_list; }
static tree handle_type_generic_attribute (tree *node, tree ARG_UNUSED (name), tree ARG_UNUSED (args), int ARG_UNUSED (flags), bool * ARG_UNUSED (no_add_attrs)) { /* Ensure we have a function type. */ gcc_assert (TREE_CODE (*node) == FUNCTION_TYPE); /* Ensure we have a variadic function. */ gcc_assert (!prototype_p (*node) || stdarg_p (*node)); return NULL_TREE; }
static tree handle_sentinel_attribute (tree *node, tree ARG_UNUSED (name), tree args, int ARG_UNUSED (flags), bool * ARG_UNUSED (no_add_attrs)) { gcc_assert (stdarg_p (*node)); if (args) { tree position = TREE_VALUE (args); gcc_assert (TREE_CODE (position) == INTEGER_CST); if (tree_int_cst_lt (position, integer_zero_node)) gcc_unreachable (); } return NULL_TREE; }
static void lm32_setup_incoming_varargs (cumulative_args_t cum_v, machine_mode mode, tree type, int *pretend_size, int no_rtl) { CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v); int first_anon_arg; tree fntype; fntype = TREE_TYPE (current_function_decl); if (stdarg_p (fntype)) first_anon_arg = *cum + LM32_FIRST_ARG_REG; else { /* this is the common case, we have been passed details setup for the last named argument, we want to skip over the registers, if any used in passing this named paramter in order to determine which is the first registers used to pass anonymous arguments. */ int size; if (mode == BLKmode) size = int_size_in_bytes (type); else size = GET_MODE_SIZE (mode); first_anon_arg = *cum + LM32_FIRST_ARG_REG + ((size + UNITS_PER_WORD - 1) / UNITS_PER_WORD); } if ((first_anon_arg < (LM32_FIRST_ARG_REG + LM32_NUM_ARG_REGS)) && !no_rtl) { int first_reg_offset = first_anon_arg; int size = LM32_FIRST_ARG_REG + LM32_NUM_ARG_REGS - first_anon_arg; rtx regblock; regblock = gen_rtx_MEM (BLKmode, plus_constant (Pmode, arg_pointer_rtx, FIRST_PARM_OFFSET (0))); move_block_from_reg (first_reg_offset, regblock, size); *pretend_size = size * UNITS_PER_WORD; } }
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; } }