GCC Middle and Back End API Reference
|
Functions | |
static bool | reachable_at_most_once () |
static unsigned HOST_WIDE_INT | va_list_counter_bump (struct stdarg_info *si, tree counter, tree rhs, bool gpr_p) |
static tree | find_va_list_reference (tree *tp, int *walk_subtrees, void *data) |
static void | va_list_counter_op (struct stdarg_info *si, tree ap, tree var, bool gpr_p, bool write_p) |
static bool | va_list_counter_struct_op (struct stdarg_info *si, tree ap, tree var, bool write_p) |
static bool | va_list_ptr_read () |
static bool | va_list_ptr_write () |
static void | check_va_list_escapes () |
static bool | check_all_va_list_escapes () |
static bool | gate_optimize_stdarg () |
static unsigned int | execute_optimize_stdarg () |
gimple_opt_pass * | make_pass_stdarg () |
|
static |
Check all uses of temporaries from si->va_list_escape_vars bitmap. Return true if va_list might be escaping.
References bitmap_bit_p(), cfun, dump_file, dump_flags, get_gimple_rhs_class(), gimple_assign_cast_p(), gimple_assign_lhs(), gimple_assign_rhs1(), gimple_assign_rhs2(), gimple_assign_rhs_code(), GIMPLE_SINGLE_RHS, gsi_end_p(), gsi_next(), gsi_start_bb(), gsi_start_phis(), gsi_stmt(), host_integerp(), HOST_WIDE_INT, is_gimple_assign(), is_gimple_debug(), stdarg_info::offsets, print_gimple_stmt(), tree_low_cst(), stdarg_info::va_list_escape_vars, function::va_list_gpr_size, stdarg_info::va_list_vars, and virtual_operand_p().
Referenced by execute_optimize_stdarg().
|
static |
If RHS is X, (some type *) X or X + CST for X a temporary variable containing value of some va_list variable plus optionally some constant, either set si->va_list_escapes or add LHS to si->va_list_escape_vars, depending whether LHS is a function local temporary.
References stdarg_info::bb, bitmap_bit_p(), bitmap_set_bit(), stdarg_info::compute_sizes, dump_file, dump_flags, HOST_WIDE_INT_M1U, basic_block_def::index, reachable_at_most_once(), va_list_counter_bump(), stdarg_info::va_list_escape_vars, stdarg_info::va_list_escapes, stdarg_info::va_start_ap, stdarg_info::va_start_bb, and stdarg_info::va_start_count.
Referenced by execute_optimize_stdarg().
|
static |
Entry point to the stdarg optimization pass.
References stdarg_info::bb, bitmap_empty_p(), bitmap_set_bit(), BUILT_IN_NORMAL, calculate_dominance_info(), CDI_DOMINATORS, cfun, check_all_va_list_escapes(), check_va_list_escapes(), stdarg_info::compute_sizes, current_function_decl, function::decl, lang_hooks::decl_printable_name, dump_file, dump_flags, find_va_list_reference(), free(), get_gimple_rhs_class(), gimple_assign_lhs(), gimple_assign_rhs1(), gimple_assign_rhs2(), gimple_assign_rhs_code(), gimple_call_arg(), gimple_call_fndecl(), GIMPLE_SINGLE_RHS, gsi_end_p(), gsi_next(), gsi_start_bb(), gsi_start_phis(), gsi_stmt(), walk_stmt_info::info, integer_zerop(), is_gimple_assign(), is_gimple_call(), is_gimple_debug(), is_gimple_reg_type(), is_global_var(), memset(), stdarg_info::offsets, print_gimple_stmt(), targetm, va_list_counter_struct_op(), stdarg_info::va_list_escape_vars, stdarg_info::va_list_escapes, function::va_list_fpr_size, function::va_list_gpr_size, va_list_ptr_read(), va_list_ptr_write(), stdarg_info::va_list_vars, stdarg_info::va_start_ap, stdarg_info::va_start_bb, stdarg_info::va_start_count, virtual_operand_p(), and walk_gimple_op().
Called by walk_tree to look for references to va_list variables.
References bitmap_bit_p().
Referenced by execute_optimize_stdarg().
|
static |
Return true if this optimization pass should be done. It makes only sense for stdarg functions.
References cfun, and function::stdarg.
gimple_opt_pass* make_pass_stdarg | ( | ) |
|
static |
@verbatim Pass computing data for optimizing stdarg functions.
Copyright (C) 2004-2013 Free Software Foundation, Inc. Contributed by Jakub Jelinek jakub @red hat.c om
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see http://www.gnu.org/licenses/.
A simple pass that attempts to optimize stdarg functions on architectures that need to save register arguments to stack on entry to stdarg functions. If the function doesn't use any va_start macros, no registers need to be saved. If va_start macros are used, the va_list variables don't escape the function, it is only necessary to save registers that will be used in va_arg macros. E.g. if va_arg is only used with integral types in the function, floating point registers don't need to be saved, etc.
Return true if basic block VA_ARG_BB is dominated by VA_START_BB and is executed at most as many times as VA_START_BB.
References bitmap_bit_p(), bitmap_clear(), bitmap_set_bit(), CDI_DOMINATORS, dominated_by_p(), edge_def::flags, basic_block_def::index, basic_block_def::preds, sbitmap_alloc(), sbitmap_free(), edge_def::src, stack, visited, and vNULL.
Referenced by check_va_list_escapes(), va_list_counter_op(), and va_list_ptr_read().
|
static |
For statement COUNTER = RHS, if RHS is COUNTER + constant, return constant, otherwise return HOST_WIDE_INT_M1U. GPR_P is true if this is GPR counter.
References cfun, get_base_address(), get_gimple_rhs_class(), gimple_assign_cast_p(), gimple_assign_lhs(), gimple_assign_rhs1(), gimple_assign_rhs2(), gimple_assign_rhs_code(), GIMPLE_SINGLE_RHS, host_integerp(), HOST_WIDE_INT, HOST_WIDE_INT_M1U, is_gimple_assign(), stdarg_info::offsets, tree_low_cst(), function::va_list_fpr_size, and function::va_list_gpr_size.
Referenced by check_va_list_escapes(), va_list_counter_op(), va_list_ptr_read(), and va_list_ptr_write().
|
static |
Helper function of va_list_counter_struct_op. Compute cfun->va_list_{g,f}pr_size. AP is a va_list GPR/FPR counter, if WRITE_P is true, seen in AP = VAR, otherwise seen in VAR = AP statement. GPR_P is true if AP is a GPR counter, false if it is a FPR counter.
References stdarg_info::bb, cfun, stdarg_info::compute_sizes, dump_file, dump_flags, HOST_WIDE_INT, basic_block_def::index, reachable_at_most_once(), va_list_counter_bump(), function::va_list_fpr_size, function::va_list_gpr_size, stdarg_info::va_start_bb, and stdarg_info::va_start_count.
Referenced by va_list_counter_struct_op().
|
static |
If AP is a va_list GPR/FPR counter, compute cfun->va_list_{g,f}pr_size. If WRITE_P is true, AP has been seen in AP = VAR assignment, if WRITE_P is false, AP has been seen in VAR = AP assignment. Return true if the AP = VAR (resp. VAR = AP) statement is a recognized va_arg operation that doesn't cause the va_list variable to escape current function.
References bitmap_bit_p(), get_base_address(), va_list_counter_op(), and stdarg_info::va_list_vars.
Referenced by execute_optimize_stdarg().
|
static |
Check for TEM = AP. Return true if found and the caller shouldn't search for va_list references in the statement.
References stdarg_info::bb, bitmap_bit_p(), bitmap_set_bit(), stdarg_info::compute_sizes, dump_file, dump_flags, HOST_WIDE_INT_M1U, basic_block_def::index, reachable_at_most_once(), va_list_counter_bump(), stdarg_info::va_list_escape_vars, stdarg_info::va_list_vars, stdarg_info::va_start_bb, and stdarg_info::va_start_count.
Referenced by execute_optimize_stdarg().
|
static |
Check for: tem1 = AP; TEM2 = tem1 + CST; AP = TEM2; sequence and update cfun->va_list_gpr_size. Return true if found.
References bitmap_bit_p(), cfun, stdarg_info::compute_sizes, HOST_WIDE_INT, va_list_counter_bump(), function::va_list_gpr_size, and stdarg_info::va_list_vars.
Referenced by execute_optimize_stdarg().