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