diff options
author | Alexandre Oliva <aoliva@redhat.com> | 2012-10-02 20:06:08 +0000 |
---|---|---|
committer | Alexandre Oliva <aoliva@gcc.gnu.org> | 2012-10-02 20:06:08 +0000 |
commit | e9f950ba0d521f1a3c0599eebab1f62466b9d218 (patch) | |
tree | c5ddc0d1a51185fc60b47f6189eb5c1a1153d6a4 /gcc/valtrack.h | |
parent | 58b88be9de291c59e070fa090bc56b975c693062 (diff) | |
download | gcc-e9f950ba0d521f1a3c0599eebab1f62466b9d218.tar.gz |
re PR debug/54551 (DF resets some DEBUG_INSNs unnecessarily)
gcc/ChangeLog:
PR debug/54551
* Makefile.in (VALTRACK_H): Add hash-table.h.
* valtrack.h: Include hash-table.h.
(struct dead_debug_global_entry): New.
(struct dead_debug_hash_descr): New.
(struct dead_debug_global): New.
(struct dead_debug): Rename to...
(struct dead_debug_local): ... this. Adjust all uses.
(dead_debug_global_init, dead_debug_global_finish): New.
(dead_debug_init): Rename to...
(dead_debug_local_init): ... this. Adjust all callers.
(dead_debug_finish): Rename to...
(dead_debug_local_finish): ... this. Adjust all callers.
* valtrack.c (dead_debug_global_init): New.
(dead_debug_init): Rename to...
(dead_debug_local_init): ... this. Take global parameter.
Save it and initialize used bitmap from it.
(dead_debug_global_find, dead_debug_global_insert): New.
(dead_debug_global_replace_temp): New.
(dead_debug_promote_uses): New.
(dead_debug_finish): Rename to...
(dead_debug_local_finish): ... this. Promote remaining uses.
(dead_debug_global_finish): New.
(dead_debug_add): Try to replace global temps first.
(dead_debug_insert_temp): Support global replacements.
* dce.c (word_dce_process_block, dce_process_block): Add
global_debug parameter. Pass it on.
(fast_dce): Initialize, pass on and finalize global_debug.
* df-problems.c (df_set_unused_notes_for_mw): Adjusted.
(df_create_unused_notes, df_note_bb_compute): Likewise.
(df_note_compute): Justify local-only dead debug analysis.
gcc/testsuite/ChangeLog:
PR debug/54551
* gcc.dg/guality/pr54551.c: New.
From-SVN: r192001
Diffstat (limited to 'gcc/valtrack.h')
-rw-r--r-- | gcc/valtrack.h | 84 |
1 files changed, 79 insertions, 5 deletions
diff --git a/gcc/valtrack.h b/gcc/valtrack.h index 9f96f210b1a..303ffa43a8f 100644 --- a/gcc/valtrack.h +++ b/gcc/valtrack.h @@ -26,10 +26,71 @@ along with GCC; see the file COPYING3. If not see #include "df.h" #include "rtl.h" #include "basic-block.h" +#include "hash-table.h" /* Debug uses of dead regs. */ +/* Entry that maps a dead pseudo (REG) used in a debug insns that dies + at different blocks to the debug temp (DTEMP) it was replaced + with. */ + +struct dead_debug_global_entry +{ + rtx reg; + rtx dtemp; +}; + +/* Descriptor for hash_table to hash by dead_debug_global_entry's REG + and map to DTEMP. */ + +struct dead_debug_hash_descr +{ + /* The hash table contains pointers to entries of this type. */ + typedef struct dead_debug_global_entry T; + /* Hash on the pseudo number. */ + static inline hashval_t hash (T const *my); + /* Entries are identical if they refer to the same pseudo. */ + static inline bool equal (T const *my, T const *other); + /* Release entries when they're removed. */ + static inline void remove (T *p); +}; + +/* Hash on the pseudo number. */ +inline hashval_t +dead_debug_hash_descr::hash (T const *my) +{ + return REGNO (my->reg); +} + +/* Entries are identical if they refer to the same pseudo. */ +inline bool +dead_debug_hash_descr::equal (T const *my, T const *other) +{ + return my->reg == other->reg; +} + +/* Release entries when they're removed. */ +inline void +dead_debug_hash_descr::remove (T *p) +{ + XDELETE (p); +} + +/* Maintain a global table of pseudos used in debug insns after their + deaths in other blocks, and debug temps their deathpoint values are + to be bound to. */ + +struct dead_debug_global +{ + /* This hash table that maps pseudos to debug temps. */ + hash_table <dead_debug_hash_descr> htab; + /* For each entry in htab, the bit corresponding to its REGNO will + be set. */ + bitmap used; +}; + /* Node of a linked list of uses of dead REGs in debug insns. */ + struct dead_debug_use { df_ref use; @@ -38,15 +99,25 @@ struct dead_debug_use /* Linked list of the above, with a bitmap of the REGs in the list. */ -struct dead_debug + +struct dead_debug_local { + /* The first dead_debug_use entry in the list. */ struct dead_debug_use *head; + /* A pointer to the global tracking data structure. */ + struct dead_debug_global *global; + /* A bitmap that has bits set for each REG used in the + dead_debug_use list, and for each entry in the global hash + table. */ bitmap used; + /* A bitmap that has bits set for each INSN that is to be + rescanned. */ bitmap to_rescan; }; /* This type controls the behavior of dead_debug_insert_temp WRT UREGNO and INSN. */ + enum debug_temp_where { /* Bind a newly-created debug temporary to a REG for UREGNO, and @@ -62,10 +133,13 @@ enum debug_temp_where DEBUG_TEMP_AFTER_WITH_REG = 1 }; -extern void dead_debug_init (struct dead_debug *, bitmap); -extern void dead_debug_finish (struct dead_debug *, bitmap); -extern void dead_debug_add (struct dead_debug *, df_ref, unsigned int); -extern int dead_debug_insert_temp (struct dead_debug *, +extern void dead_debug_global_init (struct dead_debug_global *, bitmap); +extern void dead_debug_global_finish (struct dead_debug_global *, bitmap); +extern void dead_debug_local_init (struct dead_debug_local *, bitmap, + struct dead_debug_global *); +extern void dead_debug_local_finish (struct dead_debug_local *, bitmap); +extern void dead_debug_add (struct dead_debug_local *, df_ref, unsigned int); +extern int dead_debug_insert_temp (struct dead_debug_local *, unsigned int uregno, rtx insn, enum debug_temp_where); |