111
|
1 /* Infrastructure for tracking user variable locations and values
|
|
2 throughout compilation.
|
145
|
3 Copyright (C) 2010-2020 Free Software Foundation, Inc.
|
111
|
4 Contributed by Alexandre Oliva <aoliva@redhat.com>.
|
|
5
|
|
6 This file is part of GCC.
|
|
7
|
|
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.
|
|
12
|
|
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.
|
|
17
|
|
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/>. */
|
|
21
|
|
22 #ifndef GCC_VALTRACK_H
|
|
23 #define GCC_VALTRACK_H
|
|
24
|
|
25 /* Debug uses of dead regs. */
|
|
26
|
|
27 /* Entry that maps a dead pseudo (REG) used in a debug insns that dies
|
|
28 at different blocks to the debug temp (DTEMP) it was replaced
|
|
29 with. */
|
|
30
|
|
31 struct dead_debug_global_entry
|
|
32 {
|
|
33 rtx reg;
|
|
34 rtx dtemp;
|
|
35 };
|
|
36
|
|
37 /* Descriptor for hash_table to hash by dead_debug_global_entry's REG
|
|
38 and map to DTEMP. */
|
|
39
|
|
40 struct dead_debug_hash_descr : free_ptr_hash <dead_debug_global_entry>
|
|
41 {
|
|
42 /* Hash on the pseudo number. */
|
|
43 static inline hashval_t hash (const dead_debug_global_entry *my);
|
|
44 /* Entries are identical if they refer to the same pseudo. */
|
|
45 static inline bool equal (const dead_debug_global_entry *my,
|
|
46 const dead_debug_global_entry *other);
|
|
47 };
|
|
48
|
|
49 /* Hash on the pseudo number. */
|
|
50 inline hashval_t
|
|
51 dead_debug_hash_descr::hash (const dead_debug_global_entry *my)
|
|
52 {
|
|
53 return REGNO (my->reg);
|
|
54 }
|
|
55
|
|
56 /* Entries are identical if they refer to the same pseudo. */
|
|
57 inline bool
|
|
58 dead_debug_hash_descr::equal (const dead_debug_global_entry *my,
|
|
59 const dead_debug_global_entry *other)
|
|
60 {
|
|
61 return my->reg == other->reg;
|
|
62 }
|
|
63
|
|
64 /* Maintain a global table of pseudos used in debug insns after their
|
|
65 deaths in other blocks, and debug temps their deathpoint values are
|
|
66 to be bound to. */
|
|
67
|
|
68 struct dead_debug_global
|
|
69 {
|
|
70 /* This hash table that maps pseudos to debug temps. */
|
|
71 hash_table<dead_debug_hash_descr> *htab;
|
|
72 /* For each entry in htab, the bit corresponding to its REGNO will
|
|
73 be set. */
|
|
74 bitmap used;
|
|
75 };
|
|
76
|
|
77 /* Node of a linked list of uses of dead REGs in debug insns. */
|
|
78
|
|
79 struct dead_debug_use
|
|
80 {
|
|
81 df_ref use;
|
|
82 struct dead_debug_use *next;
|
|
83 };
|
|
84
|
|
85 /* Linked list of the above, with a bitmap of the REGs in the
|
|
86 list. */
|
|
87
|
|
88 struct dead_debug_local
|
|
89 {
|
|
90 /* The first dead_debug_use entry in the list. */
|
|
91 struct dead_debug_use *head;
|
|
92 /* A pointer to the global tracking data structure. */
|
|
93 struct dead_debug_global *global;
|
|
94 /* A bitmap that has bits set for each REG used in the
|
|
95 dead_debug_use list, and for each entry in the global hash
|
|
96 table. */
|
|
97 bitmap used;
|
|
98 /* A bitmap that has bits set for each INSN that is to be
|
|
99 rescanned. */
|
|
100 bitmap to_rescan;
|
|
101 };
|
|
102
|
|
103 /* This type controls the behavior of dead_debug_insert_temp WRT
|
|
104 UREGNO and INSN. */
|
|
105
|
|
106 enum debug_temp_where
|
|
107 {
|
|
108 /* Bind a newly-created debug temporary to a REG for UREGNO, and
|
|
109 insert the debug insn before INSN. REG is expected to die at
|
|
110 INSN. */
|
|
111 DEBUG_TEMP_BEFORE_WITH_REG = -1,
|
|
112 /* Bind a newly-created debug temporary to the value INSN stores
|
|
113 in REG, and insert the debug insn before INSN. */
|
|
114 DEBUG_TEMP_BEFORE_WITH_VALUE = 0,
|
|
115 /* Bind a newly-created debug temporary to a REG for UREGNO, and
|
|
116 insert the debug insn after INSN. REG is expected to be set at
|
|
117 INSN. */
|
|
118 DEBUG_TEMP_AFTER_WITH_REG = 1,
|
|
119 /* Like DEBUG_TEMP_AFTER_WITH_REG, but force addition of a debug
|
|
120 temporary even if there is just a single debug use. This is used
|
|
121 on regs that are becoming REG_DEAD on INSN and so uses of the
|
|
122 reg later on are invalid. */
|
|
123 DEBUG_TEMP_AFTER_WITH_REG_FORCE = 2
|
|
124 };
|
|
125
|
|
126 extern void dead_debug_global_init (struct dead_debug_global *, bitmap);
|
|
127 extern void dead_debug_global_finish (struct dead_debug_global *, bitmap);
|
|
128 extern void dead_debug_local_init (struct dead_debug_local *, bitmap,
|
|
129 struct dead_debug_global *);
|
|
130 extern void dead_debug_local_finish (struct dead_debug_local *, bitmap);
|
|
131 extern void dead_debug_add (struct dead_debug_local *, df_ref, unsigned int);
|
|
132 extern int dead_debug_insert_temp (struct dead_debug_local *,
|
|
133 unsigned int uregno, rtx_insn *insn,
|
|
134 enum debug_temp_where);
|
|
135
|
|
136 extern void propagate_for_debug (rtx_insn *, rtx_insn *, rtx, rtx, basic_block);
|
|
137
|
|
138
|
|
139 #endif /* GCC_VALTRACK_H */
|