GCC Middle and Back End API Reference
|
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "backend.h"
#include "tree.h"
#include "gimple.h"
#include "tree-pass.h"
#include "ssa.h"
#include "gimple-pretty-print.h"
#include "diagnostic-core.h"
#include "fold-const.h"
#include "gimple-iterator.h"
#include "tree-ssa.h"
#include "tree-cfg.h"
#include "builtins.h"
#include "calls.h"
#include "cfgloop.h"
#include "intl.h"
#include "gimple-range.h"
Data Structures | |
class | pass_walloca |
class | alloca_type_and_limit |
Enumerations | |
enum | alloca_type { ALLOCA_OK , ALLOCA_BOUND_DEFINITELY_LARGE , ALLOCA_BOUND_MAYBE_LARGE , ALLOCA_IN_LOOP , ALLOCA_ARG_IS_ZERO , ALLOCA_UNBOUNDED } |
Functions | |
static unsigned HOST_WIDE_INT | adjusted_warn_limit (bool) |
static bool | warn_limit_specified_p (bool is_vla) |
static class alloca_type_and_limit | alloca_call_type (gimple *stmt, bool is_vla) |
static bool | in_loop_p (gimple *stmt) |
gimple_opt_pass * | make_pass_walloca (gcc::context *ctxt) |
Variables | |
const pass_data | pass_data_walloca |
enum alloca_type |
|
static |
Warn on problematic uses of alloca and variable length arrays. Copyright (C) 2016-2025 Free Software Foundation, Inc. Contributed by Aldy Hernandez <aldyh@redhat.com>. 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/>.
Return the value of the argument N to -Walloca-larger-than= or -Wvla-larger-than= adjusted for the target data model so that when N == HOST_WIDE_INT_MAX, the adjusted value is set to PTRDIFF_MAX on the target. This is done to prevent warnings for unknown/unbounded allocations in the "permissive mode" while still diagnosing excessive and necessarily invalid allocations.
References HOST_WIDE_INT_MAX, limits, ptrdiff_type_node, tree_to_shwi(), and TYPE_MAX_VALUE.
Referenced by alloca_call_type(), pass_walloca::execute(), and pass_walloca::gate().
|
static |
References adjusted_warn_limit(), ALLOCA_ARG_IS_ZERO, ALLOCA_BOUND_DEFINITELY_LARGE, ALLOCA_BOUND_MAYBE_LARGE, alloca_call_type(), ALLOCA_OK, alloca_type_and_limit::alloca_type_and_limit(), ALLOCA_UNBOUNDED, cfun, compare_tree_int(), gcc_assert, get_range_query(), gimple_alloca_call_p(), gimple_call_arg(), gimple_call_builtin_p(), integer_zero_node, integer_zerop(), max_object_size(), r, wi::shwi(), size_type_node, wi::to_offset(), wi::to_wide(), TREE_CODE, tree_to_shwi(), tree_to_uhwi(), TREE_TYPE, TYPE_PRECISION, types_compatible_p(), VR_ANTI_RANGE, and warn_limit_specified_p().
Referenced by alloca_call_type(), and pass_walloca::execute().
References cfun, ENTRY_BLOCK_PTR_FOR_FN, gimple_bb(), loop::header, and basic_block_def::loop_father.
Referenced by pass_walloca::execute().
gimple_opt_pass * make_pass_walloca | ( | gcc::context * | ctxt | ) |
Return TRUE if the user specified a limit for either VLAs or ALLOCAs.
References HOST_WIDE_INT_MAX.
Referenced by alloca_call_type().
const pass_data pass_data_walloca |
Referenced by pass_walloca::pass_walloca().