Daily bump.
[official-gcc.git] / gcc / valtrack.h
blobb7b53f351c2a122c9a8f5ac61b95f2b350820a22
1 /* Infrastructure for tracking user variable locations and values
2 throughout compilation.
3 Copyright (C) 2010-2015 Free Software Foundation, Inc.
4 Contributed by Alexandre Oliva <aoliva@redhat.com>.
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
11 version.
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
22 #ifndef GCC_VALTRACK_H
23 #define GCC_VALTRACK_H
25 #include "bitmap.h"
26 #include "df.h"
27 #include "rtl.h"
28 #include "hash-table.h"
30 /* Debug uses of dead regs. */
32 /* Entry that maps a dead pseudo (REG) used in a debug insns that dies
33 at different blocks to the debug temp (DTEMP) it was replaced
34 with. */
36 struct dead_debug_global_entry
38 rtx reg;
39 rtx dtemp;
42 /* Descriptor for hash_table to hash by dead_debug_global_entry's REG
43 and map to DTEMP. */
45 struct dead_debug_hash_descr
47 /* The hash table contains pointers to entries of this type. */
48 typedef struct dead_debug_global_entry *value_type;
49 typedef struct dead_debug_global_entry *compare_type;
50 /* Hash on the pseudo number. */
51 static inline hashval_t hash (const dead_debug_global_entry *my);
52 /* Entries are identical if they refer to the same pseudo. */
53 static inline bool equal (const dead_debug_global_entry *my,
54 const dead_debug_global_entry *other);
55 /* Release entries when they're removed. */
56 static inline void remove (dead_debug_global_entry *p);
59 /* Hash on the pseudo number. */
60 inline hashval_t
61 dead_debug_hash_descr::hash (const dead_debug_global_entry *my)
63 return REGNO (my->reg);
66 /* Entries are identical if they refer to the same pseudo. */
67 inline bool
68 dead_debug_hash_descr::equal (const dead_debug_global_entry *my,
69 const dead_debug_global_entry *other)
71 return my->reg == other->reg;
74 /* Release entries when they're removed. */
75 inline void
76 dead_debug_hash_descr::remove (dead_debug_global_entry *p)
78 XDELETE (p);
81 /* Maintain a global table of pseudos used in debug insns after their
82 deaths in other blocks, and debug temps their deathpoint values are
83 to be bound to. */
85 struct dead_debug_global
87 /* This hash table that maps pseudos to debug temps. */
88 hash_table<dead_debug_hash_descr> *htab;
89 /* For each entry in htab, the bit corresponding to its REGNO will
90 be set. */
91 bitmap used;
94 /* Node of a linked list of uses of dead REGs in debug insns. */
96 struct dead_debug_use
98 df_ref use;
99 struct dead_debug_use *next;
102 /* Linked list of the above, with a bitmap of the REGs in the
103 list. */
105 struct dead_debug_local
107 /* The first dead_debug_use entry in the list. */
108 struct dead_debug_use *head;
109 /* A pointer to the global tracking data structure. */
110 struct dead_debug_global *global;
111 /* A bitmap that has bits set for each REG used in the
112 dead_debug_use list, and for each entry in the global hash
113 table. */
114 bitmap used;
115 /* A bitmap that has bits set for each INSN that is to be
116 rescanned. */
117 bitmap to_rescan;
120 /* This type controls the behavior of dead_debug_insert_temp WRT
121 UREGNO and INSN. */
123 enum debug_temp_where
125 /* Bind a newly-created debug temporary to a REG for UREGNO, and
126 insert the debug insn before INSN. REG is expected to die at
127 INSN. */
128 DEBUG_TEMP_BEFORE_WITH_REG = -1,
129 /* Bind a newly-created debug temporary to the value INSN stores
130 in REG, and insert the debug insn before INSN. */
131 DEBUG_TEMP_BEFORE_WITH_VALUE = 0,
132 /* Bind a newly-created debug temporary to a REG for UREGNO, and
133 insert the debug insn after INSN. REG is expected to be set at
134 INSN. */
135 DEBUG_TEMP_AFTER_WITH_REG = 1,
136 /* Like DEBUG_TEMP_AFTER_WITH_REG, but force addition of a debug
137 temporary even if there is just a single debug use. This is used
138 on regs that are becoming REG_DEAD on INSN and so uses of the
139 reg later on are invalid. */
140 DEBUG_TEMP_AFTER_WITH_REG_FORCE = 2
143 extern void dead_debug_global_init (struct dead_debug_global *, bitmap);
144 extern void dead_debug_global_finish (struct dead_debug_global *, bitmap);
145 extern void dead_debug_local_init (struct dead_debug_local *, bitmap,
146 struct dead_debug_global *);
147 extern void dead_debug_local_finish (struct dead_debug_local *, bitmap);
148 extern void dead_debug_add (struct dead_debug_local *, df_ref, unsigned int);
149 extern int dead_debug_insert_temp (struct dead_debug_local *,
150 unsigned int uregno, rtx_insn *insn,
151 enum debug_temp_where);
153 extern void propagate_for_debug (rtx_insn *, rtx_insn *, rtx, rtx, basic_block);
156 #endif /* GCC_VALTRACK_H */