GCC Middle and Back End API Reference
cfgexpand.cc File Reference
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "backend.h"
#include "target.h"
#include "rtl.h"
#include "tree.h"
#include "gimple.h"
#include "cfghooks.h"
#include "tree-pass.h"
#include "memmodel.h"
#include "tm_p.h"
#include "ssa.h"
#include "optabs.h"
#include "regs.h"
#include "emit-rtl.h"
#include "recog.h"
#include "cgraph.h"
#include "diagnostic.h"
#include "fold-const.h"
#include "varasm.h"
#include "stor-layout.h"
#include "stmt.h"
#include "print-tree.h"
#include "cfgrtl.h"
#include "cfganal.h"
#include "cfgbuild.h"
#include "cfgcleanup.h"
#include "dojump.h"
#include "explow.h"
#include "calls.h"
#include "expr.h"
#include "internal-fn.h"
#include "tree-eh.h"
#include "gimple-iterator.h"
#include "gimple-expr.h"
#include "gimple-walk.h"
#include "tree-cfg.h"
#include "tree-dfa.h"
#include "tree-ssa.h"
#include "except.h"
#include "gimple-pretty-print.h"
#include "toplev.h"
#include "debug.h"
#include "tree-inline.h"
#include "value-prof.h"
#include "tree-ssa-live.h"
#include "tree-outof-ssa.h"
#include "cfgloop.h"
#include "insn-attr.h"
#include "stringpool.h"
#include "attribs.h"
#include "asan.h"
#include "tree-ssa-address.h"
#include "output.h"
#include "builtins.h"
#include "opts.h"

Data Structures

class  stack_var
 
struct  part_traits
 
class  stack_vars_data
 

Macros

#define NAME__MAIN   "__main"
 
#define STACK_ALIGNMENT_NEEDED   1
 
#define SSAVAR(x)   (TREE_CODE (x) == SSA_NAME ? SSA_NAME_VAR (x) : x)
 
#define EOC   ((unsigned)-1)
 
#define SPCT_HAS_LARGE_CHAR_ARRAY   1
 
#define SPCT_HAS_SMALL_CHAR_ARRAY   2
 
#define SPCT_HAS_ARRAY   4
 
#define SPCT_HAS_AGGREGATE   8
 

Typedefs

typedef hash_map< unsigned, bitmap, part_traitspart_hashmap
 

Functions

static rtx expand_debug_expr (tree)
 
static bool defer_stack_allocation (tree, bool)
 
static void record_alignment_for_reg_var (unsigned int)
 
tree gimple_assign_rhs_to_tree (gimple *stmt)
 
static tree leader_merge (tree cur, tree next)
 
static void set_rtl (tree t, rtx x)
 
static unsigned int align_local_variable (tree decl, bool really_expand)
 
static unsigned HOST_WIDE_INT align_base (HOST_WIDE_INT base, unsigned HOST_WIDE_INT align, bool align_up)
 
static poly_int64 alloc_stack_frame_space (poly_int64 size, unsigned HOST_WIDE_INT align)
 
static poly_int64 align_frame_offset (unsigned HOST_WIDE_INT align)
 
static void add_stack_var (tree decl, bool really_expand)
 
static void add_stack_var_conflict (unsigned x, unsigned y)
 
static bool stack_var_conflict_p (unsigned x, unsigned y)
 
static bool visit_op (gimple *, tree op, tree, void *data)
 
static bool visit_conflict (gimple *, tree op, tree, void *data)
 
static void add_scope_conflicts_2 (tree use, bitmap work, walk_stmt_load_store_addr_fn visit)
 
static void add_scope_conflicts_1 (basic_block bb, bitmap work, bool for_conflict)
 
static void add_scope_conflicts (void)
 
static int stack_var_cmp (const void *a, const void *b)
 
static void add_partitioned_vars_to_ptset (struct pt_solution *pt, part_hashmap *decls_to_partitions, hash_set< bitmap > *visited, bitmap temp)
 
static void update_alias_info_with_stack_vars (void)
 
static void union_stack_vars (unsigned a, unsigned b)
 
static void partition_stack_vars (void)
 
static void dump_stack_var_partition (void)
 
static void expand_one_stack_var_at (tree decl, rtx base, unsigned base_align, poly_int64 offset)
 
static void expand_stack_vars (bool(*pred)(unsigned), class stack_vars_data *data)
 
static poly_uint64 account_stack_vars (void)
 
void set_parm_rtl (tree parm, rtx x)
 
static void expand_one_stack_var_1 (tree var)
 
static void expand_one_stack_var (tree var)
 
static void expand_one_hard_reg_var (tree var)
 
static void expand_one_ssa_partition (tree var)
 
static void adjust_one_expanded_partition_var (tree var)
 
static void expand_one_register_var (tree var)
 
static void expand_one_error_var (tree var)
 
static poly_uint64 expand_one_var (tree var, bool toplevel, bool really_expand, bitmap forced_stack_var=NULL)
 
static void expand_used_vars_for_block (tree block, bool toplevel, bitmap forced_stack_vars)
 
static void clear_tree_used (tree block)
 
static unsigned int stack_protect_classify_type (tree type)
 
static int stack_protect_decl_phase (tree decl)
 
static bool stack_protect_decl_phase_1 (unsigned i)
 
static bool stack_protect_decl_phase_2 (unsigned i)
 
static bool asan_decl_phase_3 (unsigned i)
 
static bool add_stack_protection_conflicts (void)
 
static void create_stack_guard (void)
 
static void init_vars_expansion (void)
 
static void fini_vars_expansion (void)
 
HOST_WIDE_INT estimated_stack_frame_size (struct cgraph_node *node)
 
static bool stack_protect_return_slot_p ()
 
static rtx_insnexpand_used_vars (bitmap forced_stack_vars)
 
static void maybe_dump_rtl_for_gimple_stmt (gimple *stmt, rtx_insn *since)
 
static rtx_code_labellabel_rtx_for_bb (basic_block bb)
 
static void maybe_cleanup_end_of_block (edge e, rtx_insn *last)
 
static basic_block expand_gimple_cond (basic_block bb, gcond *stmt)
 
static void mark_transaction_restart_calls (gimple *stmt)
 
static void expand_call_stmt (gcall *stmt)
 
static void expand_asm_loc (tree string, int vol, location_t locus)
 
static int n_occurrences (int c, const char *s)
 
static bool check_operand_nalternatives (const vec< const char * > &constraints)
 
static bool tree_conflicts_with_clobbers_p (tree t, HARD_REG_SET *clobbered_regs, location_t loc)
 
static bool asm_clobber_reg_is_valid (int regno, int nregs, const char *regname)
 
static void expand_asm_stmt (gasm *stmt)
 
static void expand_computed_goto (tree exp)
 
static void expand_goto (tree label)
 
static void expand_null_return_1 (void)
 
void expand_null_return (void)
 
static void expand_value_return (rtx val)
 
static void expand_return (tree retval)
 
static void expand_clobber (tree lhs)
 
static void expand_gimple_stmt_1 (gimple *stmt)
 
static rtx_insnexpand_gimple_stmt (gimple *stmt)
 
static basic_block expand_gimple_tailcall (basic_block bb, gcall *stmt, bool *can_fallthru)
 
static rtx floor_sdiv_adjust (machine_mode mode, rtx mod, rtx op1)
 
static rtx ceil_sdiv_adjust (machine_mode mode, rtx mod, rtx op1)
 
static rtx ceil_udiv_adjust (machine_mode mode, rtx mod, rtx op1)
 
static rtx round_sdiv_adjust (machine_mode mode, rtx mod, rtx op1)
 
static rtx round_udiv_adjust (machine_mode mode, rtx mod, rtx op1)
 
static rtx convert_debug_memory_address (scalar_int_mode mode, rtx x, addr_space_t as)
 
static void avoid_deep_ter_for_debug (gimple *stmt, int depth)
 
static rtx expand_debug_parm_decl (tree decl)
 
static rtx expand_debug_source_expr (tree exp)
 
static void avoid_complex_debug_insns (rtx_insn *insn, rtx *exp_p, int depth)
 
static void expand_debug_locations (void)
 
static void reorder_operands (basic_block bb)
 
static basic_block expand_gimple_basic_block (basic_block bb, bool disable_tail_calls)
 
static basic_block construct_init_block (void)
 
static void set_block_levels (tree block, int level)
 
static void construct_exit_block (void)
 
static tree discover_nonconstant_array_refs_r (tree *tp, int *walk_subtrees, void *data)
 
static void avoid_type_punning_on_regs (tree t, bitmap forced_stack_vars)
 
static void discover_nonconstant_array_refs (bitmap forced_stack_vars)
 
static void expand_stack_alignment (void)
 
static void expand_main_function (void)
 
static void stack_protect_prologue (void)
 
rtl_opt_passmake_pass_expand (gcc::context *ctxt)
 

Variables

struct ssaexpand SA
 
gimplecurrently_expanding_gimple_stmt
 
static class stack_varstack_vars
 
static unsigned stack_vars_alloc
 
static unsigned stack_vars_num
 
static hash_map< tree, unsigned > * decl_to_stack_part
 
static bitmap_obstack stack_var_bitmap_obstack
 
static unsignedstack_vars_sorted
 
static int frame_phase
 
static bool has_protected_decls
 
static bool has_short_buffer
 
static hash_map< basic_block, rtx_code_label * > * lab_rtx_for_bb
 
static hash_map< tree, tree > * deep_ter_debug_map
 

Macro Definition Documentation

◆ EOC

◆ NAME__MAIN

#define NAME__MAIN   "__main"
A pass for lowering trees to RTL.
   Copyright (C) 2004-2024 Free Software Foundation, Inc.

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/>.   
Some systems use __main in a way incompatible with its use in gcc, in these
cases use the macros NAME__MAIN to give a quoted symbol and SYMBOL__MAIN to
give the same symbol without quotes for an alternative entry point.  You
must define both, or neither.   

Referenced by expand_main_function().

◆ SPCT_HAS_AGGREGATE

#define SPCT_HAS_AGGREGATE   8

◆ SPCT_HAS_ARRAY

#define SPCT_HAS_ARRAY   4

◆ SPCT_HAS_LARGE_CHAR_ARRAY

#define SPCT_HAS_LARGE_CHAR_ARRAY   1
Examine TYPE and determine a bit mask of the following features.   

Referenced by stack_protect_classify_type(), and stack_protect_decl_phase().

◆ SPCT_HAS_SMALL_CHAR_ARRAY

#define SPCT_HAS_SMALL_CHAR_ARRAY   2

◆ SSAVAR

#define SSAVAR ( x)    (TREE_CODE (x) == SSA_NAME ? SSA_NAME_VAR (x) : x)

◆ STACK_ALIGNMENT_NEEDED

#define STACK_ALIGNMENT_NEEDED   1

Referenced by expand_used_vars().

Typedef Documentation

◆ part_hashmap

Function Documentation

◆ account_stack_vars()

static poly_uint64 account_stack_vars ( void )
static
Take into account all sizes of partitions and reset DECL_RTLs.   

References EOC, ggc_alloc(), i, stack_var::next, NULL, set_rtl(), si, stack_var::size, stack_vars, stack_vars_num, and stack_vars_sorted.

Referenced by estimated_stack_frame_size().

◆ add_partitioned_vars_to_ptset()

static void add_partitioned_vars_to_ptset ( struct pt_solution * pt,
part_hashmap * decls_to_partitions,
hash_set< bitmap > * visited,
bitmap temp )
static
If the points-to solution *PI points to variables that are in a partition
together with other variables add all partition members to the pointed-to
variables bitmap.   

References pt_solution::anything, bitmap_bit_p, bitmap_clear(), bitmap_empty_p(), bitmap_ior_into(), EXECUTE_IF_SET_IN_BITMAP, ggc_alloc(), i, NULL, pt_solution::vars, and visited.

Referenced by update_alias_info_with_stack_vars().

◆ add_scope_conflicts()

static void add_scope_conflicts ( void )
static

◆ add_scope_conflicts_1()

◆ add_scope_conflicts_2()

static void add_scope_conflicts_2 ( tree use,
bitmap work,
walk_stmt_load_store_addr_fn visit )
inlinestatic
Helper function for add_scope_conflicts_1.  For USE on
a stmt, if it is a SSA_NAME and in its SSA_NAME_DEF_STMT is known to be
based on some ADDR_EXPR, invoke VISIT on that ADDR_EXPR.   

References a, g, ggc_alloc(), gimple_assign_rhs1(), gimple_phi_arg_def(), gimple_phi_num_args(), i, INTEGRAL_TYPE_P, POINTER_TYPE_P, SSA_NAME_DEF_STMT, TREE_CODE, TREE_OPERAND, TREE_TYPE, and visit.

Referenced by add_scope_conflicts_1().

◆ add_stack_protection_conflicts()

static bool add_stack_protection_conflicts ( void )
static
Ensure that variables in different stack protection phases conflict
so that they are not merged and share the same stack slot.
Return true if there are any address taken variables.   

References add_stack_var_conflict(), ggc_alloc(), i, stack_protect_decl_phase(), stack_vars, stack_vars_num, and TREE_ADDRESSABLE.

Referenced by expand_used_vars().

◆ add_stack_var()

◆ add_stack_var_conflict()

static void add_stack_var_conflict ( unsigned x,
unsigned y )
static
Make the decls associated with luid's X and Y conflict.   

References a, b, BITMAP_ALLOC, bitmap_set_bit, stack_var::conflicts, stack_var_bitmap_obstack, stack_vars, and y.

Referenced by add_stack_protection_conflicts(), union_stack_vars(), and visit_conflict().

◆ adjust_one_expanded_partition_var()

static void adjust_one_expanded_partition_var ( tree var)
static
Record the association between the RTL generated for partition PART
and the underlying variable of the SSA_NAME VAR.   

References DECL_ARTIFICIAL, gcc_assert, get_pointer_alignment(), ggc_alloc(), ssaexpand::map, mark_reg_pointer(), mark_user_reg(), NO_PARTITION, ssaexpand::partition_to_pseudo, POINTER_TYPE_P, REG_P, SA, set_rtl(), SSA_NAME_VAR, TREE_TYPE, and var_to_partition().

◆ align_base()

static unsigned HOST_WIDE_INT align_base ( HOST_WIDE_INT base,
unsigned HOST_WIDE_INT align,
bool align_up )
inlinestatic
Align given offset BASE with ALIGN.  Truncate up if ALIGN_UP is true,
down otherwise.  Return truncated BASE value.   

References ggc_alloc().

Referenced by expand_stack_vars().

◆ align_frame_offset()

static poly_int64 align_frame_offset ( unsigned HOST_WIDE_INT align)
static
Ensure that the stack is aligned to ALIGN bytes.
Return the new frame offset.   

References alloc_stack_frame_space().

Referenced by expand_one_stack_var_1(), and expand_stack_vars().

◆ align_local_variable()

static unsigned int align_local_variable ( tree decl,
bool really_expand )
static
Compute the byte alignment to use for DECL.  Ignore alignment
we can't do with expected alignment of the stack boundary.   

References GET_MODE_ALIGNMENT, ggc_alloc(), hwasan_sanitize_stack_p(), HWASAN_TAG_GRANULE_SIZE, LOCAL_DECL_ALIGNMENT, MAX, SET_DECL_ALIGN, TREE_CODE, TREE_TYPE, TYPE_ALIGN, and TYPE_MODE.

Referenced by add_stack_var(), and expand_one_stack_var_1().

◆ alloc_stack_frame_space()

static poly_int64 alloc_stack_frame_space ( poly_int64 size,
unsigned HOST_WIDE_INT align )
static
Allocate SIZE bytes at byte alignment ALIGN from the stack frame.
Return the frame offset.   

References cfun, FRAME_GROWS_DOWNWARD, frame_offset, frame_offset_overflow(), frame_phase, ggc_alloc(), offset, and stack_var::size.

Referenced by align_frame_offset(), expand_one_stack_var_1(), expand_stack_vars(), and expand_used_vars().

◆ asan_decl_phase_3()

static bool asan_decl_phase_3 ( unsigned i)
static
And helper function that checks for asan phase (with stack protector
it is phase 3).  This is used as callback for expand_stack_vars.
Returns true if any of the vars in the partition need to be protected.   

References asan_protect_stack_decl(), EOC, i, stack_var::next, and stack_vars.

Referenced by expand_used_vars().

◆ asm_clobber_reg_is_valid()

static bool asm_clobber_reg_is_valid ( int regno,
int nregs,
const char * regname )
static
Check that the given REGNO spanning NREGS is a valid
asm clobber operand.  Some HW registers cannot be
saved/restored, hence they should not be clobbered by
asm statements.   

References accessible_reg_set, add_range_to_hard_reg_set(), CLEAR_HARD_REG_SET, crtl, error(), ggc_alloc(), in_hard_reg_set_p(), inform(), input_location, INVALID_REGNUM, overlaps_hard_reg_set_p(), PIC_OFFSET_TABLE_REGNUM, reg_raw_mode, and warning().

Referenced by expand_asm_stmt().

◆ avoid_complex_debug_insns()

static void avoid_complex_debug_insns ( rtx_insn * insn,
rtx * exp_p,
int depth )
static
Ensure INSN_VAR_LOCATION_LOC (insn) doesn't have unbound complexity.
Allow 4 levels of rtl nesting for most rtl codes, and if we see anything
deeper than that, create DEBUG_EXPRs and emit DEBUG_INSNs before INSN.   

References avoid_complex_debug_insns(), DEBUG_EXPR_TREE_DECL, emit_debug_insn_before(), exp(), gen_rtx_VAR_LOCATION(), GET_CODE, GET_MODE, GET_RTX_FORMAT, GET_RTX_LENGTH, ggc_alloc(), i, make_debug_expr_from_rtl(), MEM_P, NULL_RTX, OBJECT_P, VAR_INIT_STATUS_INITIALIZED, XEXP, XVECEXP, and XVECLEN.

Referenced by avoid_complex_debug_insns(), and expand_debug_locations().

◆ avoid_deep_ter_for_debug()

◆ avoid_type_punning_on_regs()

static void avoid_type_punning_on_regs ( tree t,
bitmap forced_stack_vars )
static
If there's a chance to get a pseudo for t then if it would be of float mode
and the actual access is via an integer mode (lowered memcpy or similar
access) then avoid the register expansion if the mode likely is not storage
suitable for raw bits processing (like XFmode on i?86).   

References bitmap_set_bit, DECL_MODE, DECL_P, DECL_UID, FLOAT_MODE_P, get_base_address(), GET_MODE_BITSIZE(), GET_MODE_INNER, GET_MODE_PRECISION(), ggc_alloc(), SCALAR_INT_MODE_P, TREE_ADDRESSABLE, TREE_TYPE, TYPE_MODE, and use_register_for_decl().

Referenced by discover_nonconstant_array_refs().

◆ ceil_sdiv_adjust()

static rtx ceil_sdiv_adjust ( machine_mode mode,
rtx mod,
rtx op1 )
static
Return the difference between the ceil and the truncated result of
a signed division by OP1 with remainder MOD.   

References const0_rtx, const1_rtx, and ggc_alloc().

Referenced by expand_debug_expr().

◆ ceil_udiv_adjust()

static rtx ceil_udiv_adjust ( machine_mode mode,
rtx mod,
rtx op1 )
static
Return the difference between the ceil and the truncated result of
an unsigned division by OP1 with remainder MOD.   

References const0_rtx, const1_rtx, and ggc_alloc().

Referenced by expand_debug_expr().

◆ check_operand_nalternatives()

static bool check_operand_nalternatives ( const vec< const char * > & constraints)
static
A subroutine of expand_asm_operands.  Check that all operands have
the same number of alternatives.  Return true if so.   

References constraints, error(), ggc_alloc(), i, MAX_RECOG_ALTERNATIVES, and n_occurrences.

Referenced by expand_asm_stmt().

◆ clear_tree_used()

static void clear_tree_used ( tree block)
static
A subroutine of expand_used_vars.  Walk down through the BLOCK tree
and clear TREE_USED on all local variables.   

References BLOCK_CHAIN, BLOCK_SUBBLOCKS, BLOCK_VARS, clear_tree_used(), DECL_CHAIN, DECL_NONSHAREABLE, ggc_alloc(), TREE_CODE, TREE_USED, and VAR_P.

Referenced by clear_tree_used(), and expand_used_vars().

◆ construct_exit_block()

◆ construct_init_block()

◆ convert_debug_memory_address()

◆ create_stack_guard()

static void create_stack_guard ( void )
static
Create a decl for the guard at the top of the stack frame.   

References build_decl(), crtl, current_function_decl, DECL_SOURCE_LOCATION, expand_one_stack_var(), ggc_alloc(), NULL, ptr_type_node, TREE_THIS_VOLATILE, and TREE_USED.

Referenced by expand_used_vars().

◆ defer_stack_allocation()

static bool defer_stack_allocation ( tree var,
bool toplevel )
static
A subroutine of expand_one_var.  VAR is a variable that will be
allocated to the local stack frame.  Return true if we wish to
add VAR to STACK_VARS so that it will be coalesced with other
variables.  Return false to allocate VAR immediately.

This function is used to reduce the number of variables considered
for coalescing, which reduces the size of the quadratic problem.   

References asan_sanitize_stack_p(), DECL_ALIGN, DECL_IGNORED_P, DECL_SIZE_UNIT, estimated_poly_value(), ggc_alloc(), MAX_SUPPORTED_STACK_ALIGNMENT, poly_int_tree_p(), SSA_NAME_VAR, SSAVAR, TREE_CODE, TREE_TYPE, TYPE_ALIGN, and TYPE_SIZE_UNIT.

Referenced by expand_one_ssa_partition(), and expand_one_var().

◆ discover_nonconstant_array_refs()

static void discover_nonconstant_array_refs ( bitmap forced_stack_vars)
static
RTL expansion is not able to compile array references with variable
offsets for arrays stored in single register.  Discover such
expressions and mark variables as addressable to avoid this
scenario.   

References avoid_type_punning_on_regs(), bitmap_set_bit, cfun, DECL_P, DECL_UID, discover_nonconstant_array_refs_r(), FOR_EACH_BB_FN, get_base_address(), ggc_alloc(), gimple_call_arg(), gimple_call_internal_fn(), gimple_call_internal_p(), gimple_call_lhs(), gimple_get_lhs(), gimple_vdef(), gsi_end_p(), gsi_next(), gsi_start_bb(), gsi_stmt(), is_gimple_debug(), NULL_TREE, REFERENCE_CLASS_P, use_register_for_decl(), and walk_gimple_op().

◆ discover_nonconstant_array_refs_r()

static tree discover_nonconstant_array_refs_r ( tree * tp,
int * walk_subtrees,
void * data )
static
Helper function for discover_nonconstant_array_refs.
Look for ARRAY_REF nodes with non-constant indexes and mark them
addressable.   

References bitmap_set_bit, CONVERT_EXPR_P, DECL_MODE, DECL_P, DECL_UID, get_base_address(), GET_MODE_SIZE(), ggc_alloc(), is_gimple_min_invariant(), IS_TYPE_OR_DECL_P, NULL_TREE, POLY_INT_CST_P, REFERENCE_CLASS_P, TREE_ADDRESSABLE, TREE_CODE, TREE_OPERAND, TREE_THIS_VOLATILE, TREE_TYPE, TYPE_MODE, and TYPE_SIZE.

Referenced by discover_nonconstant_array_refs().

◆ dump_stack_var_partition()

static void dump_stack_var_partition ( void )
static

◆ estimated_stack_frame_size()

HOST_WIDE_INT estimated_stack_frame_size ( struct cgraph_node * node)
Make a fair guess for the size of the stack frame of the function
in NODE.  This doesn't have to be exact, the result is only used in
the inline heuristics.  So we don't want to run the full stack var
packing algorithm (which is quadratic in the number of stack vars).
Instead, we calculate the total size of all stack vars.  This turns
out to be a pretty fair estimate -- packing of stack vars doesn't
happen very often.   

References account_stack_vars(), auto_var_in_fn_p(), symtab_node::decl, function::decl, DECL_STRUCT_FUNCTION, estimated_poly_value(), expand_one_var(), fini_vars_expansion(), FOR_EACH_LOCAL_DECL, ggc_alloc(), i, init_vars_expansion(), pop_cfun(), push_cfun(), stack_vars_num, and stack_vars_sorted.

Referenced by compute_fn_summary().

◆ expand_asm_loc()

static void expand_asm_loc ( tree string,
int vol,
location_t locus )
static
Generate RTL for an asm statement (explicit assembler code).
STRING is a STRING_CST node containing the assembler code text,
or an ADDR_EXPR containing a STRING_CST.  VOL nonzero means the
insn is volatile; don't optimize it.   

References CLEAR_HARD_REG_SET, constraints, emit_insn(), gen_rtx_ASM_INPUT_loc, gen_rtx_MEM(), ggc_alloc(), ggc_strdup, i, MEM_VOLATILE_P, rtvec_alloc(), targetm, TREE_STRING_LENGTH, TREE_STRING_POINTER, and XVECEXP.

Referenced by expand_asm_stmt().

◆ expand_asm_stmt()

static void expand_asm_stmt ( gasm * stmt)
static
Generate RTL for an asm statement with arguments.
STRING is the instruction template.
OUTPUTS is a list of output arguments (lvalues); INPUTS a list of inputs.
Each output or input has an expression in the TREE_VALUE and
a tree list in TREE_PURPOSE which in turn contains a constraint
name in TREE_VALUE (or NULL_TREE) and a constraint string
in TREE_PURPOSE.
CLOBBERS is a list of STRING_CST nodes each naming a hard register
that is clobbered by this insn.

LABELS is a list of labels, and if LABELS is non-NULL, FALLTHRU_BB
should be the fallthru basic block of the asm goto.

Not all kinds of lvalue that may appear in OUTPUTS can be stored directly.
Some elements of OUTPUTS may be replaced with trees representing temporary
values.  The caller should copy those temporary values to the originally
specified lvalues.

VOL nonzero means the insn is volatile; don't optimize it.   

References asm_clobber_reg_is_valid(), asm_operand_ok(), ASM_OPERANDS_INPUT, ASM_OPERANDS_INPUT_CONSTRAINT_EXP, ASM_OPERANDS_LABEL, ASM_OPERANDS_OUTPUT_CONSTRAINT, ASM_OPERANDS_TEMPLATE, assign_temp(), build_string(), cfun, check_operand_nalternatives(), CLEAR_HARD_REG_SET, constraints, crtl, DECL_P, DECL_RTL, decode_reg_name_and_count(), do_pending_stack_adjust(), duplicate_insn_chain(), EDGE_COUNT, emit_insn(), emit_jump_insn(), emit_label(), emit_move_insn(), end_sequence(), error_at(), expand_asm_loc(), expand_assignment(), expand_expr(), EXPAND_INITIALIZER, EXPAND_MEMORY, EXPAND_NORMAL, EXPAND_WRITE, find_fallthru_edge(), FOR_EACH_EDGE, force_reg(), free_temp_slots(), gcc_assert, gcc_unreachable, gen_label_rtx(), gen_reg_rtx(), gen_rtx_ASM_INPUT_loc, gen_rtx_MEM(), gen_rtx_REG(), generating_concat_p, GET_CODE, get_insns(), get_last_insn(), GET_MODE, ggc_alloc(), ggc_strdup, gimple_asm_clobber_op(), gimple_asm_input_op(), gimple_asm_input_p(), gimple_asm_label_op(), gimple_asm_nclobbers(), gimple_asm_ninputs(), gimple_asm_nlabels(), gimple_asm_noutputs(), gimple_asm_output_op(), gimple_asm_string(), gimple_asm_volatile_p(), gimple_bb(), gimple_location(), HARD_REGISTER_P, i, input_location, internal_error(), label_rtx(), label_to_block(), make_tree(), mark_addressable(), max_int_size_in_bytes(), MEM_P, MEM_VOLATILE_P, NULL, NULL_RTX, parse_input_constraint(), parse_output_constraint(), prepend_insn_to_edge(), push_to_sequence2(), r, reg_overlap_mentioned_p(), REG_P, reg_raw_mode, REGNO, rtvec_alloc(), SET_HARD_REG_BIT, set_reg_attrs_for_decl_rtl(), SSA_NAME_VAR, start_sequence(), targetm, TREE_ADDRESSABLE, TREE_CODE, tree_conflicts_with_clobbers_p(), tree_fits_poly_int64_p(), TREE_OPERAND, TREE_PURPOSE, TREE_STRING_POINTER, TREE_TYPE, TREE_VALUE, TYPE_MODE, TYPE_SIZE, ULONG_MAX, validize_mem(), warning_at(), and XVECEXP.

Referenced by expand_gimple_stmt_1().

◆ expand_call_stmt()

static void expand_call_stmt ( gcall * stmt)
static
A subroutine of expand_gimple_stmt_1, expanding one GIMPLE_CALL
statement STMT.   

References add_reg_note(), ALLOCA_FUNCTION_CODE_P, build_pointer_type(), build_vl_exp(), BUILT_IN_NORMAL, CALL_ALLOCA_FOR_VAR_P, CALL_EXPR_ARG, CALL_EXPR_BY_DESCRIPTOR, CALL_EXPR_FN, CALL_EXPR_MUST_TAIL_CALL, CALL_EXPR_RETURN_SLOT_OPT, CALL_EXPR_STATIC_CHAIN, CALL_EXPR_TAILCALL, CALL_EXPR_VA_ARG_PACK, CALL_FROM_THUNK_P, CALL_P, called_as_built_in(), cfun, const0_rtx, copy_warning(), decl_debug_args_lookup(), DECL_FUNCTION_CODE(), DECL_HAS_DEBUG_ARGS_P, exp(), expand_assignment(), expand_debug_expr(), expand_expr(), expand_internal_call(), EXPAND_NORMAL, fndecl_built_in_p(), fold_convert, gcc_assert, get_gimple_for_ssa_name(), get_last_insn(), ggc_alloc(), gimple_assign_rhs1(), gimple_assign_rhs_code(), gimple_call_alloca_for_var_p(), gimple_call_arg(), gimple_call_by_descriptor_p(), gimple_call_chain(), gimple_call_fn(), gimple_call_fndecl(), gimple_call_fntype(), gimple_call_from_thunk_p(), gimple_call_internal_p(), gimple_call_lhs(), gimple_call_must_tail_p(), gimple_call_nocf_check_p(), gimple_call_nothrow_p(), gimple_call_num_args(), gimple_call_return_slot_opt_p(), gimple_call_return_type(), gimple_call_tail_p(), gimple_call_va_arg_pack_p(), gimple_has_side_effects(), gimple_location(), i, IFN_LAST, last, mark_transaction_restart_calls(), PREV_INSN(), replacement_internal_fn(), SET_EXPR_LOCATION, tm_restart_node::stmt, stmt_could_throw_p(), TREE_CODE, TREE_NOTHROW, TREE_SIDE_EFFECTS, and TREE_TYPE.

Referenced by expand_gimple_stmt_1().

◆ expand_clobber()

static void expand_clobber ( tree lhs)
static
Expand a clobber of LHS.  If LHS is stored it in a multi-part
register, tell the rtl optimizers that its value is no longer
needed.   

References DECL_P, DECL_RTL_IF_SET, emit_clobber(), GET_MODE, GET_MODE_SIZE(), ggc_alloc(), maybe_gt, REG_P, and REGMODE_NATURAL_SIZE.

Referenced by expand_gimple_stmt_1().

◆ expand_computed_goto()

static void expand_computed_goto ( tree exp)
static
Emit code to jump to the address
specified by the pointer expression EXP.   

References do_pending_stack_adjust(), emit_indirect_jump(), exp(), and expand_normal().

Referenced by expand_gimple_stmt_1().

◆ expand_debug_expr()

static rtx expand_debug_expr ( tree exp)
static
Return an RTX equivalent to the value of the tree expression EXP.   

References adjust_address_nv, bits_to_bytes_round_down, build_pointer_type(), build_zero_cst(), CASE_CONVERT, ceil_sdiv_adjust(), ceil_udiv_adjust(), COMPLEX_MODE_P, const0_rtx, CONST_INT_P, const_true_rtx, CONSTRUCTOR_ELTS, convert_debug_memory_address(), copy_rtx(), DEBUG_EXPR_TREE_DECL, debug_tree(), DECL_EXTERNAL, DECL_HARD_REGISTER, DECL_IN_CONSTANT_POOL, DECL_NAME, DECL_RTL_IF_SET, DECL_RTL_SET_P, deep_ter_debug_map, exp(), expand_debug_expr(), expand_debug_parm_decl(), expand_expr(), EXPAND_INITIALIZER, FLOAT_MODE_P, floor_sdiv_adjust(), fold_binary, FOR_EACH_CONSTRUCTOR_VALUE, g, gcc_assert, gcc_unreachable, GEN_INT, gen_int_mode(), gen_rtx_MEM(), gen_rtx_SUBREG(), hash_map< KeyId, Value, Traits >::get(), symtab_node::get(), GET_CODE, get_gimple_for_ssa_name(), get_inner_reference(), GET_MODE, GET_MODE_BITSIZE(), GET_MODE_CLASS, GET_MODE_INNER, GET_MODE_PRECISION(), GET_MODE_SIZE(), GET_MODE_UNIT_BITSIZE, GET_MODE_UNIT_PRECISION, get_ref_base_and_extent(), ggc_alloc(), gimple_assign_rhs_to_tree(), handled_component_p(), has_zero_uses(), i, immed_wide_int_const(), int_mode_for_mode(), is_gimple_mem_ref_addr(), is_global_var(), known_eq, known_ge, known_gt, lookup_constant_def(), lowpart_subreg(), make_decl_rtl_for_debug(), ssaexpand::map, maybe_gt, MEM_P, NO_PARTITION, NOTE_P, NULL, NULL_RTX, NULL_TREE, num_trailing_bits, offset, ssaexpand::partition_to_pseudo, plus_constant(), poly_int_cst_value(), poly_int_rtx_p(), round_sdiv_adjust(), round_udiv_adjust(), rtvec_alloc(), SA, SCALAR_INT_MODE_P, SCALAR_INT_TYPE_MODE, SET_DECL_RTL, set_mem_addr_space(), set_mem_attributes(), set_mem_expr(), shallow_copy_rtx(), simplify_gen_binary(), simplify_gen_relational(), simplify_gen_subreg(), simplify_gen_ternary(), simplify_gen_unary(), smallest_int_mode_for_size(), SSA_NAME_IS_DEFAULT_DEF, SSA_NAME_VAR, SYMBOL_REF_DECL, target_for_debug_bind(), targetm, tcc_binary, tcc_comparison, tcc_constant, tcc_declaration, tcc_exceptional, tcc_expression, tcc_reference, tcc_statement, tcc_type, tcc_unary, tcc_vl_exp, TMR_BASE, TREE_ADDRESSABLE, TREE_CLOBBER_P, TREE_CODE, TREE_CODE_CLASS, TREE_IMAGPART, tree_mem_ref_addr(), TREE_OPERAND, TREE_REALPART, TREE_STATIC, TREE_STRING_LENGTH, TREE_STRING_POINTER, TREE_TYPE, TYPE_ADDR_SPACE, TYPE_MODE, TYPE_UNSIGNED, TYPE_VECTOR_SUBPARTS(), UNARY_CLASS_P, VAR_P, var_to_partition(), VECTOR_CST_ELT, VECTOR_CST_NELTS, VECTOR_TYPE_P, word_mode, XEXP, and XVECEXP.

Referenced by expand_call_stmt(), expand_debug_expr(), and expand_debug_locations().

◆ expand_debug_locations()

◆ expand_debug_parm_decl()

◆ expand_debug_source_expr()

◆ expand_gimple_basic_block()

static basic_block expand_gimple_basic_block ( basic_block bb,
bool disable_tail_calls )
static
Expand basic block BB from GIMPLE trees to RTL.   

References BARRIER_P, BB_END, BB_HEAD, bb_seq(), bitmap_bit_p, build_debug_expr_decl(), can_fallthru(), cfun, const0_rtx, curr_insn_location(), currently_expanding_gimple_stmt, DEBUG_INSN_P, DECL_MODE, DECL_P, DEF_FROM_PTR, delink_stmt_imm_use(), do_pending_stack_adjust(), dump_file, dump_flags, emit_debug_insn(), emit_insn_after_noloc(), emit_jump(), emit_label(), emit_note(), emit_note_after(), EXIT_BLOCK_PTR_FOR_FN, expand_gimple_cond(), expand_gimple_stmt(), expand_gimple_tailcall(), basic_block_def::flags, FOR_EACH_EDGE, FOR_EACH_IMM_USE_FAST, FOR_EACH_IMM_USE_ON_STMT, FOR_EACH_IMM_USE_STMT, FOR_EACH_SSA_TREE_OPERAND, gcc_assert, gcc_checking_assert, gcc_unreachable, gen_move_insn(), gen_reg_rtx(), GEN_RTX_DEBUG_MARKER_BEGIN_STMT_PAT, GEN_RTX_DEBUG_MARKER_INLINE_ENTRY_PAT, gen_rtx_VAR_LOCATION(), GET_CODE, get_gimple_for_ssa_name(), get_last_insn(), ggc_alloc(), basic_block_def::basic_block_il_dependent::gimple, gimple_assign_rhs_to_tree(), gimple_call_set_tail(), gimple_call_tail_p(), gimple_debug_begin_stmt_p(), gimple_debug_bind_get_value(), gimple_debug_bind_get_var(), gimple_debug_bind_has_value_p(), gimple_debug_bind_p(), gimple_debug_inline_entry_p(), gimple_debug_nonbind_marker_p(), gimple_debug_source_bind_get_value(), gimple_debug_source_bind_get_var(), gimple_debug_source_bind_p(), gimple_location(), gimple_return_retval(), gsi_end_p(), gsi_last(), gsi_next(), gsi_remove(), gsi_start(), gsi_stmt(), basic_block_def::il, basic_block_def::index, init_rtl_bb_info(), is_gimple_debug(), JUMP_P, JUMP_TABLE_DATA_P, lab_rtx_for_bb, LABEL_P, label_rtx_for_bb(), last, MAY_HAVE_DEBUG_BIND_INSNS, MAY_HAVE_DEBUG_MARKER_INSNS, maybe_dump_rtl_for_gimple_stmt(), basic_block_def::next_bb, NEXT_INSN(), NOTE_BASIC_BLOCK, NOTE_P, NULL, NULL_RTX, NULL_TREE, PAT_VAR_LOCATION_LOC, gimple_bb_info::phi_nodes, PREV_INSN(), prev_nondebug_insn(), reorder_operands(), rtl_profile_for_bb(), SA, gimple_bb_info::seq, set_curr_insn_location(), SET_DECL_MODE, SET_USE, SINGLE_SSA_DEF_OPERAND, single_succ(), single_succ_edge(), single_succ_p(), SSA_NAME_VERSION, SSA_OP_DEF, SSA_OP_USE, basic_block_def::succs, target_for_debug_bind(), TDF_DETAILS, TREE_CODE, TREE_TYPE, TYPE_MODE, UNKNOWN_LOCATION, update_bb_for_insn(), update_stmt(), USE_STMT, ssaexpand::values, VAR_INIT_STATUS_INITIALIZED, VAR_INIT_STATUS_UNINITIALIZED, and VECTOR_TYPE_P.

◆ expand_gimple_cond()

◆ expand_gimple_stmt()

static rtx_insn * expand_gimple_stmt ( gimple * stmt)
static
Expand one gimple statement STMT and return the last RTL instruction
before any of the newly generated ones.

In addition to generating the necessary RTL instructions this also
sets REG_EH_REGION notes if necessary and sets the current source
location for diagnostics.   

References cfun, expand_gimple_stmt_1(), find_reg_note(), free_temp_slots(), gcc_assert, GET_CODE, get_last_insn(), ggc_alloc(), gimple_has_location(), gimple_location(), input_location, insn_could_throw_p(), last, lookup_stmt_eh_lp(), make_reg_eh_region_note(), next_real_insn(), NULL_RTX, and PATTERN().

Referenced by expand_gimple_basic_block(), and expand_gimple_tailcall().

◆ expand_gimple_stmt_1()

◆ expand_gimple_tailcall()

static basic_block expand_gimple_tailcall ( basic_block bb,
gcall * stmt,
bool * can_fallthru )
static
A subroutine of expand_gimple_basic_block.  Expand one GIMPLE_CALL
that has CALL_EXPR_TAILCALL set.  Returns non-null if we actually
generated a tail call (something that might be denied by the ABI
rules governing the call; see calls.cc).

Sets CAN_FALLTHRU if we generated a *conditional* tail call, and
can still reach the rest of BB.  The case here is __builtin_sqrt,
where the NaN result goes through the external function (with a
tailcall) and the normal result happens via a sqrt instruction.   

References BARRIER_P, BB_END, CALL_P, can_fallthru(), cfun, create_basic_block(), delete_insn(), do_pending_stack_adjust(), ei_next(), ei_safe_edge(), ei_start, EXIT_BLOCK_PTR_FOR_FN, expand_gimple_stmt(), gcc_assert, get_last_insn(), ggc_alloc(), LABEL_P, last, make_edge(), maybe_dump_rtl_for_gimple_stmt(), profile_probability::never(), NEXT_INSN(), NULL, PREV_INSN(), remove_edge(), SIBLING_CALL_P, basic_block_def::succs, and update_bb_for_insn().

Referenced by expand_gimple_basic_block().

◆ expand_goto()

static void expand_goto ( tree label)
static
Generate RTL code for a `goto' statement with target label LABEL.
LABEL should be a LABEL_DECL tree node that was or will later be
defined with `expand_label'.   

References current_function_decl, decl_function_context(), emit_jump(), gcc_assert, ggc_alloc(), and jump_target_rtx().

Referenced by expand_gimple_stmt_1().

◆ expand_main_function()

static void expand_main_function ( void )
static

◆ expand_null_return()

void expand_null_return ( void )
Generate RTL to return from the current function, with no value.
(That is, we do not do anything about returning any value.)   

References clobber_return_register(), and expand_null_return_1().

Referenced by expand_gimple_stmt_1(), and expand_return().

◆ expand_null_return_1()

static void expand_null_return_1 ( void )
static

◆ expand_one_error_var()

static void expand_one_error_var ( tree var)
static
A subroutine of expand_one_var.  Called to assign rtl to a VAR_DECL that
has some associated error, e.g. its type is error-mark.  We just need
to pick something that won't crash the rest of the compiler.   

References const0_rtx, DECL_MODE, gen_reg_rtx(), gen_rtx_MEM(), ggc_alloc(), and SET_DECL_RTL.

Referenced by expand_one_var().

◆ expand_one_hard_reg_var()

static void expand_one_hard_reg_var ( tree var)
static
A subroutine of expand_one_var.  Called to assign rtl to a VAR_DECL
that will reside in a hard register.   

References rest_of_decl_compilation().

Referenced by expand_one_var().

◆ expand_one_register_var()

static void expand_one_register_var ( tree var)
static

◆ expand_one_ssa_partition()

◆ expand_one_stack_var()

static void expand_one_stack_var ( tree var)
static
Wrapper for expand_one_stack_var_1 that checks SSA_NAMEs are
already assigned some MEM.   

References expand_one_stack_var_1(), gcc_assert, ggc_alloc(), ssaexpand::map, MEM_P, NO_PARTITION, ssaexpand::partition_to_pseudo, SA, TREE_CODE, and var_to_partition().

Referenced by create_stack_guard(), and expand_one_var().

◆ expand_one_stack_var_1()

◆ expand_one_stack_var_at()

◆ expand_one_var()

◆ expand_return()

◆ expand_stack_alignment()

static void expand_stack_alignment ( void )
static
This function sets crtl->args.internal_arg_pointer to a virtual
register if DRAP is needed.  Local register allocator will replace
virtual_incoming_args_rtx with the virtual register.   

References cfun, crtl, fixup_tail_calls(), gcc_assert, ggc_alloc(), INCOMING_STACK_BOUNDARY, NULL, PREFERRED_STACK_BOUNDARY, stack_realign_drap, SUPPORTS_STACK_ALIGNMENT, and targetm.

◆ expand_stack_vars()

◆ expand_used_vars()

static rtx_insn * expand_used_vars ( bitmap forced_stack_vars)
static
Expand all variables used in the function.   

References add_local_decl(), add_scope_conflicts(), add_stack_protection_conflicts(), alloc_stack_frame_space(), asan_decl_phase_3(), asan_emit_allocas_unpoison(), asan_emit_stack_protection(), ASAN_RED_ZONE_SIZE, asan_sanitize_allocas_p(), asan_sanitize_stack_p(), ASAN_SHADOW_SHIFT, bitmap_bit_p, cfun, clear_tree_used(), create_stack_guard(), current_function_decl, DECL_ARTIFICIAL, DECL_ATTRIBUTES, DECL_EXTERNAL, DECL_IGNORED_P, DECL_INITIAL, DECL_RTL_IF_SET, dump_file, dump_stack_var_partition(), expand_one_ssa_partition(), expand_one_var(), expand_stack_vars(), expand_used_vars_for_block(), fini_vars_expansion(), FOR_EACH_LOCAL_DECL, FOR_EACH_VEC_ELT_REVERSE, FRAME_GROWS_DOWNWARD, frame_offset, frame_phase, gcc_assert, gen_reg_rtx(), GET_CODE, GET_MODE_ALIGNMENT, ggc_alloc(), has_protected_decls, HOST_WIDE_INT_1, hwasan_emit_prologue(), hwasan_emit_untag_frame(), hwasan_get_frame_extent(), hwasan_sanitize_allocas_p(), hwasan_sanitize_stack_p(), i, init_vars_expansion(), is_gimple_reg(), lookup_attribute(), ssaexpand::map, MEM_P, NULL, NULL_RTX, _var_map::num_partitions, offset, partition_stack_vars(), partition_to_var(), ssaexpand::partitions_for_parm_default_defs, pic_offset_table_rtx, PREFERRED_STACK_BOUNDARY, SA, SPCT_FLAG_ALL, SPCT_FLAG_DEFAULT, SPCT_FLAG_EXPLICIT, SPCT_FLAG_STRONG, STACK_ALIGNMENT_NEEDED, stack_protect_decl_phase_1(), stack_protect_decl_phase_2(), stack_protect_return_slot_p(), stack_vars_num, targetm, poly_int< N, C >::to_constant(), TREE_STATIC, TREE_USED, vec_safe_is_empty(), vec_safe_length(), virtual_operand_p(), virtual_stack_dynamic_rtx, and virtual_stack_vars_rtx.

◆ expand_used_vars_for_block()

static void expand_used_vars_for_block ( tree block,
bool toplevel,
bitmap forced_stack_vars )
static
A subroutine of expand_used_vars.  Walk down through the BLOCK tree
expanding variables.  Those variables that can be put into registers
are allocated pseudos; those that can't are put on the stack.

TOPLEVEL is true if this is the outermost BLOCK.   

References BLOCK_CHAIN, BLOCK_SUBBLOCKS, BLOCK_VARS, DECL_CHAIN, DECL_NONSHAREABLE, expand_one_var(), expand_used_vars_for_block(), ggc_alloc(), TREE_CODE, TREE_USED, and VAR_P.

Referenced by expand_used_vars(), and expand_used_vars_for_block().

◆ expand_value_return()

◆ fini_vars_expansion()

◆ floor_sdiv_adjust()

static rtx floor_sdiv_adjust ( machine_mode mode,
rtx mod,
rtx op1 )
static
Return the difference between the floor and the truncated result of
a signed division by OP1 with remainder MOD.   

References const0_rtx, constm1_rtx, and ggc_alloc().

Referenced by expand_debug_expr().

◆ gimple_assign_rhs_to_tree()

◆ init_vars_expansion()

◆ label_rtx_for_bb()

static rtx_code_label * label_rtx_for_bb ( basic_block bb)
static
Returns the label_rtx expression for a label starting basic block BB.   

References block_label(), DECL_NONLOCAL, gen_label_rtx(), ggc_alloc(), gimple_label_label(), gsi_end_p(), gsi_start_bb(), gsi_stmt(), jump_target_rtx(), and lab_rtx_for_bb.

Referenced by expand_gimple_basic_block(), and expand_gimple_cond().

◆ leader_merge()

static tree leader_merge ( tree cur,
tree next )
static
Choose either CUR or NEXT as the leader DECL for a partition.
Prefer ignored decls, to simplify debug dumps and reduce ambiguity
out of the same user variable being in multiple partitions (this is
less likely for compiler-introduced temps).   

References DECL_IGNORED_P, DECL_P, and NULL.

Referenced by set_rtl().

◆ make_pass_expand()

rtl_opt_pass * make_pass_expand ( gcc::context * ctxt)

References ggc_alloc().

◆ mark_transaction_restart_calls()

static void mark_transaction_restart_calls ( gimple * stmt)
static

◆ maybe_cleanup_end_of_block()

static void maybe_cleanup_end_of_block ( edge e,
rtx_insn * last )
static
A subroutine of expand_gimple_cond.  Given E, a fallthrough edge
of a basic block where we just expanded the conditional at the end,
possibly clean up the CFG and instruction sequence.  LAST is the
last instruction before the just emitted jump sequence.   

References any_condjump_p(), BARRIER_P, delete_insn(), gcc_assert, get_last_insn(), JUMP_P, last, NEXT_INSN(), PREV_INSN(), and remove_edge().

Referenced by expand_gimple_cond().

◆ maybe_dump_rtl_for_gimple_stmt()

static void maybe_dump_rtl_for_gimple_stmt ( gimple * stmt,
rtx_insn * since )
static
If we need to produce a detailed dump, print the tree representation
for STMT to the dump file.  SINCE is the last RTX after which the RTL
generated for STMT should have been appended.   

References dump_file, dump_flags, ggc_alloc(), NEXT_INSN(), print_gimple_stmt(), print_rtl(), TDF_DETAILS, TDF_LINENO, and TDF_SLIM.

Referenced by expand_gimple_basic_block(), expand_gimple_cond(), and expand_gimple_tailcall().

◆ n_occurrences()

static int n_occurrences ( int c,
const char * s )
static
Return the number of times character C occurs in string S.   

◆ partition_stack_vars()

static void partition_stack_vars ( void )
static
A subroutine of expand_used_vars.  Binpack the variables into
  partitions constrained by the interference graph.  The overall
  algorithm used is as follows:

       Sort the objects by size in descending order.
       For each object A {
         S = size(A)
         O = 0
         loop {
           Look for the largest non-conflicting object B with size <= S.
           UNION (A, B)
         }
       }

References stack_var::alignb, asan_sanitize_stack_p(), ggc_alloc(), i, MAX_SUPPORTED_STACK_ALIGNMENT, qsort, stack_var::representative, si, stack_var::size, stack_var_cmp(), stack_var_conflict_p(), stack_vars, stack_vars_num, stack_vars_sorted, union_stack_vars(), and update_alias_info_with_stack_vars().

Referenced by expand_used_vars().

◆ record_alignment_for_reg_var()

static void record_alignment_for_reg_var ( unsigned int align)
static
Record the alignment requirements of some variable assigned to a
pseudo.   

References crtl, gcc_assert, and SUPPORTS_STACK_ALIGNMENT.

Referenced by expand_one_ssa_partition(), expand_one_var(), and set_parm_rtl().

◆ reorder_operands()

◆ round_sdiv_adjust()

static rtx round_sdiv_adjust ( machine_mode mode,
rtx mod,
rtx op1 )
static
Return the difference between the rounded and the truncated result
of a signed division by OP1 with remainder MOD.  Halfway cases are
rounded away from zero, rather than to the nearest even number.   

References const0_rtx, const1_rtx, constm1_rtx, and ggc_alloc().

Referenced by expand_debug_expr().

◆ round_udiv_adjust()

static rtx round_udiv_adjust ( machine_mode mode,
rtx mod,
rtx op1 )
static
Return the difference between the rounded and the truncated result
of a unsigned division by OP1 with remainder MOD.  Halfway cases
are rounded away from zero, rather than to the nearest even
number.   

References const0_rtx, const1_rtx, and ggc_alloc().

Referenced by expand_debug_expr().

◆ set_block_levels()

static void set_block_levels ( tree block,
int level )
static
For each lexical block, set BLOCK_NUMBER to the depth at which it is
found in the block tree.   

References BLOCK_CHAIN, BLOCK_NUMBER, BLOCK_SUBBLOCKS, and set_block_levels().

Referenced by set_block_levels().

◆ set_parm_rtl()

◆ set_rtl()

◆ stack_protect_classify_type()

◆ stack_protect_decl_phase()

static int stack_protect_decl_phase ( tree decl)
static
Return nonzero if DECL should be segregated into the "vulnerable" upper
part of the local stack frame.  Remember if we ever return nonzero for
any variable in this function.  The return value is the phase number in
which the variable should be allocated.   

References current_function_decl, DECL_ATTRIBUTES, ggc_alloc(), has_protected_decls, has_short_buffer, lookup_attribute(), SPCT_FLAG_ALL, SPCT_FLAG_EXPLICIT, SPCT_FLAG_STRONG, SPCT_HAS_AGGREGATE, SPCT_HAS_ARRAY, SPCT_HAS_LARGE_CHAR_ARRAY, SPCT_HAS_SMALL_CHAR_ARRAY, stack_protect_classify_type(), and TREE_TYPE.

Referenced by add_stack_protection_conflicts(), stack_protect_decl_phase_1(), and stack_protect_decl_phase_2().

◆ stack_protect_decl_phase_1()

static bool stack_protect_decl_phase_1 ( unsigned i)
static
Two helper routines that check for phase 1 and phase 2.  These are used
as callbacks for expand_stack_vars.   

References i, stack_protect_decl_phase(), and stack_vars.

Referenced by expand_used_vars().

◆ stack_protect_decl_phase_2()

static bool stack_protect_decl_phase_2 ( unsigned i)
static

References i, stack_protect_decl_phase(), and stack_vars.

Referenced by expand_used_vars().

◆ stack_protect_prologue()

static void stack_protect_prologue ( void )
static
Expand code to initialize the stack_protect_guard.  This is invoked at
the beginning of a function to be protected.   

References const0_rtx, crtl, DECL_P, DECL_RTL, emit_insn(), emit_move_insn(), expand_normal(), gcc_assert, ggc_alloc(), targetm, and y.

◆ stack_protect_return_slot_p()

static bool stack_protect_return_slot_p ( )
static

◆ stack_var_cmp()

static int stack_var_cmp ( const void * a,
const void * b )
static
A subroutine of partition_stack_vars.  A comparison function for qsort,
sorting an array of indices by the properties of the object.   

References a, stack_var::alignb, b, stack_var::decl, DECL_UID, ggc_alloc(), MAX_SUPPORTED_STACK_ALIGNMENT, stack_var::size, SSA_NAME_VERSION, stack_vars, and TREE_CODE.

Referenced by partition_stack_vars().

◆ stack_var_conflict_p()

static bool stack_var_conflict_p ( unsigned x,
unsigned y )
static
Check whether the decls associated with luid's X and Y conflict.   

References a, b, bitmap_bit_p, stack_vars, TREE_CODE, and y.

Referenced by partition_stack_vars().

◆ tree_conflicts_with_clobbers_p()

static bool tree_conflicts_with_clobbers_p ( tree t,
HARD_REG_SET * clobbered_regs,
location_t loc )
static
Check for overlap between registers marked in CLOBBERED_REGS and
anything inappropriate in T.  Emit error and return the register
variable definition for error, NULL_TREE for ok.   

References DECL_NAME, DECL_REGISTER, error_at(), ggc_alloc(), and tree_overlaps_hard_reg_set().

Referenced by expand_asm_stmt().

◆ union_stack_vars()

static void union_stack_vars ( unsigned a,
unsigned b )
static
A subroutine of partition_stack_vars.  The UNION portion of a UNION/FIND
partitioning algorithm.  Partitions A and B are known to be non-conflicting.
Merge them into a single partition A.   

References a, add_stack_var_conflict(), stack_var::alignb, b, BITMAP_FREE, EOC, EXECUTE_IF_SET_IN_BITMAP, gcc_assert, ggc_alloc(), stack_var::next, stack_var::representative, stack_var::size, and stack_vars.

Referenced by partition_stack_vars().

◆ update_alias_info_with_stack_vars()

static void update_alias_info_with_stack_vars ( void )
static
Update points-to sets based on partition info, so we can use them on RTL.
The bitmaps representing stack partitions will be saved until expand,
where partitioned decls used as bases in memory expressions will be
rewritten.

It is not necessary to update TBAA info on accesses to the coalesced
storage since our memory model doesn't allow TBAA to be used for
WAW or WAR dependences.  For RAW when the write is to an old object
the new object would not have been initialized at the point of the
read, invoking undefined behavior.   

References add_partitioned_vars_to_ptset(), BITMAP_ALLOC, BITMAP_FREE, BITMAP_GGC_ALLOC, bitmap_set_bit, cfun, create_tmp_var, stack_var::decl, DECL_PT_UID, EOC, FOR_EACH_SSA_NAME, get_ptr_info(), ggc_alloc(), i, make_ssa_name(), stack_var::next, NULL, NULL_TREE, POINTER_TYPE_P, pt_solution_set(), ptr_type_node, SSA_NAME_PTR_INFO, stack_var_bitmap_obstack, stack_vars, stack_vars_num, TREE_ADDRESSABLE, TREE_TYPE, and visited.

Referenced by partition_stack_vars().

◆ visit_conflict()

static bool visit_conflict ( gimple * ,
tree op,
tree ,
void * data )
static
Callback for walk_stmt_ops.  If OP is a decl touched by add_stack_var
record conflicts between it and all currently active other partitions
from bitmap DATA.   

References add_stack_var_conflict(), bitmap_set_bit, DECL_P, DECL_RTL_IF_SET, decl_to_stack_part, EXECUTE_IF_SET_IN_BITMAP, gcc_assert, hash_map< KeyId, Value, Traits >::get(), get_base_address(), i, pc_rtx, and stack_vars_num.

Referenced by add_scope_conflicts_1().

◆ visit_op()

static bool visit_op ( gimple * ,
tree op,
tree ,
void * data )
static
Callback for walk_stmt_ops.  If OP is a decl touched by add_stack_var
enter its partition number into bitmap DATA.   

References bitmap_set_bit, DECL_P, DECL_RTL_IF_SET, decl_to_stack_part, hash_map< KeyId, Value, Traits >::get(), get_base_address(), and pc_rtx.

Referenced by add_scope_conflicts_1().

Variable Documentation

◆ currently_expanding_gimple_stmt

gimple* currently_expanding_gimple_stmt
This variable holds the currently expanded gimple statement for purposes
of comminucating the profile info to the builtin expanders.   

Referenced by expand_builtin_memory_copy_args(), expand_builtin_memset_args(), and expand_gimple_basic_block().

◆ decl_to_stack_part

◆ deep_ter_debug_map

hash_map<tree, tree>* deep_ter_debug_map
static
Map from SSA_NAMEs to corresponding DEBUG_EXPR_DECLs created
by avoid_deep_ter_for_debug.   

Referenced by avoid_deep_ter_for_debug(), expand_debug_expr(), and expand_debug_locations().

◆ frame_phase

int frame_phase
static
The phase of the stack frame.  This is the known misalignment of
virtual_stack_vars_rtx from PREFERRED_STACK_BOUNDARY.  That is,
(frame_offset+frame_phase) % PREFERRED_STACK_BOUNDARY == 0.   

Referenced by alloc_stack_frame_space(), expand_one_stack_var_at(), expand_used_vars(), and try_fit_stack_local().

◆ has_protected_decls

bool has_protected_decls
static
Used during expand_used_vars to remember if we saw any decls for
which we'd like to enable stack smashing protection.   

Referenced by expand_used_vars(), init_vars_expansion(), and stack_protect_decl_phase().

◆ has_short_buffer

bool has_short_buffer
static
Used during expand_used_vars.  Remember if we say a character buffer
smaller than our cutoff threshold.  Used for -Wstack-protector.   

Referenced by init_vars_expansion(), and stack_protect_decl_phase().

◆ lab_rtx_for_bb

hash_map<basic_block, rtx_code_label *>* lab_rtx_for_bb
static
Maps the blocks that do not contain tree labels to rtx labels.   

Referenced by expand_gimple_basic_block(), and label_rtx_for_bb().

◆ SA

◆ stack_var_bitmap_obstack

bitmap_obstack stack_var_bitmap_obstack
static
Conflict bitmaps go on this obstack.  This allows us to destroy
all of them in one big sweep.   

Referenced by add_scope_conflicts(), add_scope_conflicts_1(), add_stack_var_conflict(), fini_vars_expansion(), init_vars_expansion(), and update_alias_info_with_stack_vars().

◆ stack_vars

◆ stack_vars_alloc

unsigned stack_vars_alloc
static

◆ stack_vars_num

◆ stack_vars_sorted

unsigned* stack_vars_sorted
static
An array of indices such that stack_vars[stack_vars_sorted[i]].size
is non-decreasing.   

Referenced by account_stack_vars(), dump_stack_var_partition(), estimated_stack_frame_size(), expand_stack_vars(), fini_vars_expansion(), and partition_stack_vars().