GCC Middle and Back End API Reference
valtrack.c File Reference
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "tm.h"
#include "rtl.h"
#include "valtrack.h"
#include "function.h"
#include "regs.h"
#include "emit-rtl.h"
Include dependency graph for valtrack.c:

Data Structures

struct  rtx_subst_pair

Functions

static rtx gen_lowpart_for_debug ()
static rtx cleanup_auto_inc_dec ()
static rtx propagate_for_debug_subst ()
void propagate_for_debug (rtx insn, rtx last, rtx dest, rtx src, basic_block this_basic_block)
void dead_debug_global_init ()
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 ()
static dead_debug_global_entrydead_debug_global_insert ()
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 ()
void dead_debug_local_finish ()
void dead_debug_global_finish ()
void dead_debug_add ()
int dead_debug_insert_temp (struct dead_debug_local *debug, unsigned int uregno, rtx insn, enum debug_temp_where where)

Function Documentation

static rtx cleanup_auto_inc_dec ( )
static

Replace auto-increment addressing modes with explicit operations to access the same addresses without modifying the corresponding registers.

void dead_debug_add ( )

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.

??? If we dealt with split multi-registers below, we should set all registers for the used mode in case of hardware registers.

References bitmap_bit_p, bitmap_clear_bit(), dead_debug_local::global, dead_debug_local::head, NULL, NULL_RTX, dead_debug_global::used, and dead_debug_local::used.

Referenced by df_create_unused_note().

void dead_debug_global_finish ( )

Release GLOBAL->used unless it is the same as USED. Release the mapping hash table if it was initialized.

void dead_debug_global_init ( )

Initialize DEBUG to an empty list, and clear USED, if given.

References BITMAP_ALLOC, dead_debug_local::global, dead_debug_local::head, NULL, dead_debug_local::to_rescan, dead_debug_global::used, and dead_debug_local::used.

static dead_debug_global_entry* dead_debug_global_insert ( )
static
static bool dead_debug_global_replace_temp ( struct dead_debug_global global,
df_ref  use,
unsigned int  uregno,
bitmap pto_rescan 
)
static

If UREGNO, referenced by USE, is a pseudo marked as used in GLOBAL, replace it with 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.

int dead_debug_insert_temp ( struct dead_debug_local debug,
unsigned int  uregno,
rtx  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.

 Move all uses of uregno from debug->head to uses, setting mode to
 the widest referenced mode.   
         If this loc has been changed e.g. to debug_expr already
         as part of a multi-register use, just drop it.   
 We may have dangling bits in debug->used for registers that were part
 of a multi-register use, one component of which has been reset.   
 Recover the expression INSN stores in REG.   
         Lose if the REG-setting insn is a CALL.   
     ??? Should we try to extract it from a PARALLEL?   
     Cool, it's the same REG, we can use SRC.   
         Hmm...  Something's fishy, we should be setting REG here.   
         If we're not overwriting all the hardware registers that
         setting REG in its mode would, we won't know what to bind
         the debug temp to.  ??? We could bind the debug_expr to a
         CONCAT or PARALLEL with the split multi-registers, and
         replace them as we found the corresponding sets.   
         Ok, it's the same (hardware) REG, but with a different
         mode, so SUBREG it.   
         We should be setting REG here.  Lose.   
         Lose if we're setting something other than the lowpart of
         REG.   
         If we're not overwriting all the hardware registers that
         setting REG in its mode would, we won't know what to bind
         the debug temp to.   
         Yay, we can use SRC, just adjust its mode.   
     Oh well, we're out of luck.   
     We couldn't figure out the value stored in REG, so reset all
     of its pending debug uses.   
 If there's a single (debug) use of an otherwise unused REG, and
 the debug use is not part of a larger expression, then it
 probably doesn't make sense to introduce a new debug temp.   
   Create DEBUG_EXPR (and DEBUG_EXPR_DECL).   
 Emit a debug bind insn before the insn in which reg dies.   
 Adjust all uses.   
     ??? Should we simplify subreg of subreg?   

References DF_REF_REAL_LOC, DF_REF_REGNO, GET_MODE, GET_MODE_BITSIZE, dead_debug_use::next, NULL, REG_P, and dead_debug_use::use.

Referenced by df_create_unused_note().

void dead_debug_local_finish ( )

Reset all debug insns with pending uses. Release the bitmap in it, unless it is USED. USED must be the same bitmap passed to 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.

Referenced by gate_ud_dce().

static void dead_debug_promote_uses ( )
static

Promote pending local uses of pseudos in DEBUG to global substitutions. Uses of non-pseudos are left alone for resetting.

Tentatively remove the USE from the list.

static void dead_debug_reset_uses ( struct dead_debug_local debug,
struct dead_debug_use head 
)
static

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.

static rtx gen_lowpart_for_debug ( )
static

Infrastructure for tracking user variable locations and values throughout compilation. Copyright (C) 2010-2013 Free Software Foundation, Inc. Contributed by Alexandre Oliva aoliv.nosp@m.a@re.nosp@m.dhat..nosp@m.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/. gen_lowpart_no_emit hook implementation for DEBUG_INSNs. In DEBUG_INSNs, all lowpart SUBREGs are valid, despite what the machine requires for instructions.

void propagate_for_debug ( rtx  insn,
rtx  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 of THIS_BASIC_BLOCK.

static rtx propagate_for_debug_subst ( )
static

DATA points to an rtx_subst_pair. Return the value that should be substituted.