GCC Middle and Back End API Reference
valtrack.cc File Reference
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "backend.h"
#include "rtl.h"
#include "df.h"
#include "valtrack.h"
#include "regs.h"
#include "memmodel.h"
#include "emit-rtl.h"
#include "rtl-iter.h"
Include dependency graph for valtrack.cc:

Data Structures

struct  rtx_subst_pair


static rtx gen_lowpart_for_debug (machine_mode mode, rtx x)
static rtx cleanup_auto_inc_dec (rtx src, machine_mode mem_mode)
static rtx propagate_for_debug_subst (rtx from, const_rtx old_rtx, void *data)
void propagate_for_debug (rtx_insn *insn, rtx_insn *last, rtx dest, rtx src, basic_block this_basic_block)
void dead_debug_global_init (struct dead_debug_global *debug, bitmap used)
void dead_debug_local_init (struct dead_debug_local *debug, bitmap used, struct dead_debug_global *global)
static dead_debug_global_entrydead_debug_global_find (struct dead_debug_global *global, rtx reg)
static dead_debug_global_entrydead_debug_global_insert (struct dead_debug_global *global, rtx reg, rtx dtemp)
static bool dead_debug_global_replace_temp (struct dead_debug_global *global, df_ref use, unsigned int uregno, bitmap *pto_rescan)
static void dead_debug_reset_uses (struct dead_debug_local *debug, struct dead_debug_use *head)
static void dead_debug_promote_uses (struct dead_debug_local *debug)
void dead_debug_local_finish (struct dead_debug_local *debug, bitmap used)
void dead_debug_global_finish (struct dead_debug_global *global, bitmap used)
void dead_debug_add (struct dead_debug_local *debug, df_ref use, unsigned int uregno)
static rtx debug_lowpart_subreg (machine_mode outer_mode, rtx expr, machine_mode inner_mode)
int dead_debug_insert_temp (struct dead_debug_local *debug, unsigned int uregno, rtx_insn *insn, enum debug_temp_where where)

Function Documentation

◆ cleanup_auto_inc_dec()

static rtx cleanup_auto_inc_dec ( rtx src,
machine_mode mem_mode )
Replace auto-increment addressing modes with explicit operations to access
the same addresses without modifying the corresponding registers.   

References CASE_CONST_ANY, cleanup_auto_inc_dec(), gcc_assert, gen_int_mode(), GET_CODE, GET_MODE, GET_MODE_SIZE(), GET_RTX_FORMAT, GET_RTX_LENGTH, i, INSN_P, offset, ORIGINAL_REGNO, REG_P, REGNO, rtvec_alloc(), RTX_CODE, RTX_FLAG, shallow_copy_rtx(), shared_const_p(), XEXP, XVEC, XVECEXP, and XVECLEN.

Referenced by cleanup_auto_inc_dec(), dead_debug_insert_temp(), and propagate_for_debug_subst().

◆ dead_debug_add()

void dead_debug_add ( struct dead_debug_local * debug,
df_ref use,
unsigned int uregno )
Add USE to DEBUG, or substitute it right away if it's a pseudo in
the global substitution list.  USE must be a dead reference to
UREGNO in a debug insn.  Create a bitmap for DEBUG as needed.   

References BITMAP_ALLOC, bitmap_set_bit, dead_debug_global_replace_temp(), debug, dead_debug_use::next, NULL, and dead_debug_use::use.

Referenced by dce_process_block(), df_note_bb_compute(), move_insn_for_shrink_wrap(), and word_dce_process_block().

◆ dead_debug_global_find()

static dead_debug_global_entry * dead_debug_global_find ( struct dead_debug_global * global,
rtx reg )

◆ dead_debug_global_finish()

void dead_debug_global_finish ( struct dead_debug_global * global,
bitmap used )
Release GLOBAL->used unless it is the same as USED.  Release the
mapping hash table if it was initialized.   

References BITMAP_FREE, dead_debug_global::htab, NULL, and dead_debug_global::used.

Referenced by fast_dce().

◆ dead_debug_global_init()

void dead_debug_global_init ( struct dead_debug_global * debug,
bitmap used )
Initialize DEBUG to an empty list, and clear USED, if given.   

References bitmap_clear(), debug, NULL, and rtx_def::used.

Referenced by fast_dce().

◆ dead_debug_global_insert()

static dead_debug_global_entry * dead_debug_global_insert ( struct dead_debug_global * global,
rtx reg,
rtx dtemp )

◆ dead_debug_global_replace_temp()

static bool dead_debug_global_replace_temp ( struct dead_debug_global * global,
df_ref use,
unsigned int uregno,
bitmap * pto_rescan )
If UREGNO, referenced by USE, is a pseudo marked as used in GLOBAL,
replace it with a USE of the debug temp recorded for it, and
return TRUE.  Otherwise, just return FALSE.

If PTO_RESCAN is given, instead of rescanning modified INSNs right
away, add their UIDs to the bitmap, allocating one of *PTO_RESCAN
is NULL.   

References BITMAP_ALLOC, bitmap_bit_p, bitmap_set_bit, dead_debug_global_find(), df_insn_rescan(), DF_REF_INSN, DF_REF_REAL_LOC, dead_debug_global_entry::dtemp, gcc_checking_assert, GET_CODE, INSN_UID(), NULL, dead_debug_global_entry::reg, REG_P, REGNO, and dead_debug_global::used.

Referenced by dead_debug_add(), and dead_debug_promote_uses().

◆ dead_debug_insert_temp()

int dead_debug_insert_temp ( struct dead_debug_local * debug,
unsigned int uregno,
rtx_insn * insn,
enum debug_temp_where where )
If UREGNO is referenced by any entry in DEBUG, emit a debug insn
before or after INSN (depending on WHERE), that binds a (possibly
global) debug temp to the widest-mode use of UREGNO, if WHERE is
*_WITH_REG, or the value stored in UREGNO by INSN otherwise, and
replace all uses of UREGNO in DEBUG with uses of the debug temp.
INSN must be where UREGNO dies, if WHERE is *_BEFORE_*, or where it
is set otherwise.  Return the number of debug insns emitted.   

References BITMAP_ALLOC, bitmap_bit_p, bitmap_clear_bit(), bitmap_set_bit, candidate(), cleanup_auto_inc_dec(), dead_debug_global_find(), dead_debug_reset_uses(), debug, DEBUG_EXPR_TREE_DECL, DEBUG_INSN_P, debug_lowpart_subreg(), DEBUG_TEMP_AFTER_WITH_REG, DEBUG_TEMP_AFTER_WITH_REG_FORCE, DEBUG_TEMP_BEFORE_WITH_VALUE, DF_REF_INSN, DF_REF_REAL_LOC, DF_REF_REGNO, dead_debug_global_entry::dtemp, emit_debug_insn_after(), emit_debug_insn_before(), gcc_checking_assert, gen_rtx_VAR_LOCATION(), GET_CODE, GET_MODE, GET_MODE_BITSIZE(), hard_regno_nregs(), INSN_UID(), INSN_VAR_LOCATION_LOC, make_debug_expr_from_rtl(), dead_debug_use::next, NULL, NULL_RTX, dead_debug_global_entry::reg, REG_NREGS, REG_P, REGNO, regno_reg_rtx, SET_DEST, SET_SRC, single_set(), subreg_lowpart_p(), SUBREG_REG, dead_debug_use::use, VAR_INIT_STATUS_INITIALIZED, and volatile_insn_p().

Referenced by dce_process_block(), dead_debug_promote_uses(), df_create_unused_note(), df_note_bb_compute(), df_set_unused_notes_for_mw(), move_insn_for_shrink_wrap(), and word_dce_process_block().

◆ dead_debug_local_finish()

void dead_debug_local_finish ( struct dead_debug_local * debug,
bitmap used )
Reset all debug insns with pending uses.  Release the bitmap in it,
unless it is USED.  USED must be the same bitmap passed to

References BITMAP_FREE, dead_debug_promote_uses(), dead_debug_reset_uses(), debug, df_insn_rescan(), DF_INSN_UID_SAFE_GET, EXECUTE_IF_SET_IN_BITMAP, and df_insn_info::insn.

Referenced by dce_process_block(), df_note_bb_compute(), prepare_shrink_wrap(), and word_dce_process_block().

◆ dead_debug_local_init()

void dead_debug_local_init ( struct dead_debug_local * debug,
bitmap used,
struct dead_debug_global * global )
Initialize DEBUG to an empty list, and clear USED, if given.  Link
back to GLOBAL, if given, and bring in used bits from it.   

References BITMAP_ALLOC, bitmap_clear(), bitmap_copy(), debug, NULL, and dead_debug_global::used.

Referenced by dce_process_block(), df_note_bb_compute(), prepare_shrink_wrap(), and word_dce_process_block().

◆ dead_debug_promote_uses()

◆ dead_debug_reset_uses()

static void dead_debug_reset_uses ( struct dead_debug_local * debug,
struct dead_debug_use * head )
Reset all debug uses in HEAD, and clear DEBUG->to_rescan bits of
each reset insn.  DEBUG is not otherwise modified.  If HEAD is
DEBUG->head, DEBUG->head will be set to NULL at the end.
Otherwise, entries from DEBUG->head that pertain to reset insns
will be removed, and only then rescanned.   

References BITMAP_ALLOC, bitmap_bit_p, bitmap_clear_bit(), BITMAP_FREE, bitmap_set_bit, debug, df_insn_rescan_debug_internal(), DF_INSN_UID_SAFE_GET, DF_REF_INSN, EXECUTE_IF_SET_IN_BITMAP, gen_rtx_UNKNOWN_VAR_LOC, df_insn_info::insn, INSN_UID(), INSN_VAR_LOCATION_LOC, dead_debug_use::next, NULL, and dead_debug_use::use.

Referenced by dead_debug_insert_temp(), and dead_debug_local_finish().

◆ debug_lowpart_subreg()

static rtx debug_lowpart_subreg ( machine_mode outer_mode,
rtx expr,
machine_mode inner_mode )
Like lowpart_subreg, but if a subreg is not valid for machine, force
it anyway - for use in debug insns.   

References GET_MODE, NULL_RTX, offset, simplify_gen_subreg(), and subreg_lowpart_offset().

Referenced by dead_debug_insert_temp().

◆ gen_lowpart_for_debug()

static rtx gen_lowpart_for_debug ( machine_mode mode,
rtx x )
Infrastructure for tracking user variable locations and values
   throughout compilation.
   Copyright (C) 2010-2024 Free Software Foundation, Inc.
   Contributed by Alexandre Oliva <aoliva@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

GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
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
gen_lowpart_no_emit hook implementation for DEBUG_INSNs.  In DEBUG_INSNs,
all lowpart SUBREGs are valid, despite what the machine requires for

References gen_lowpart_if_possible(), GET_MODE, NULL_RTX, and subreg_lowpart_offset().

Referenced by propagate_for_debug().

◆ propagate_for_debug()

void propagate_for_debug ( rtx_insn * insn,
rtx_insn * last,
rtx dest,
rtx src,
basic_block this_basic_block )
Replace all the occurrences of DEST with SRC in DEBUG_INSNs between INSN
and LAST, not including INSN, but including LAST.  Also stop at the end

References rtx_subst_pair::adjusted, BB_END, DEBUG_BIND_INSN_P, df_insn_rescan(), end(), gen_lowpart_for_debug(), rtl_hooks::gen_lowpart_no_emit, gen_rtx_UNKNOWN_VAR_LOC, rtx_subst_pair::insn, INSN_VAR_LOCATION_LOC, last, NEXT_INSN(), propagate_for_debug_subst(), simplify_replace_fn_rtx(), this_basic_block, rtx_subst_pair::to, and volatile_insn_p().

Referenced by attempt_change(), and try_combine().

◆ propagate_for_debug_subst()