summaryrefslogtreecommitdiff
path: root/gcc/df-scan.c
diff options
context:
space:
mode:
authorzadeck <zadeck@138bc75d-0d04-0410-961f-82ee72b054a4>2008-06-30 19:28:24 +0000
committerzadeck <zadeck@138bc75d-0d04-0410-961f-82ee72b054a4>2008-06-30 19:28:24 +0000
commitce29975928c8a054d094c42fd4b8d1e26ac4cf0f (patch)
tree25163222bdff7bf15877a51ced2d08b2d02e3dea /gcc/df-scan.c
parent3ddbdaa626bd57f5fac089e87d27e03a01ce237f (diff)
downloadgcc-ce29975928c8a054d094c42fd4b8d1e26ac4cf0f.tar.gz
2008-06-30 Kenneth Zadeck <zadeck@naturalbridge.com>
* df-scan.c (df_scan_free_ref_vec, df_scan_free_mws_vec): New macros. (df_scan_free_internal): Free data structures not allocated in storage pools. (df_mw_hardreg_chain_delete_eq_uses): Use df_scan_free_mws_vec. (df_refs_add_to_chains): Use df_scan_free_ref_vec and df_scan_free_mws_vec. * dse.c (dse_step6): Free offset_map_p and offset_map_n unconditionally. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@137284 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/df-scan.c')
-rw-r--r--gcc/df-scan.c67
1 files changed, 54 insertions, 13 deletions
diff --git a/gcc/df-scan.c b/gcc/df-scan.c
index 092273faa3b..5818717651d 100644
--- a/gcc/df-scan.c
+++ b/gcc/df-scan.c
@@ -60,6 +60,21 @@ along with GCC; see the file COPYING3. If not see
#define EPILOGUE_USES(REGNO) 0
#endif
+/* The following two macros free the vecs that hold either the refs or
+ the mw refs. They are a little tricky because the vec has 0
+ elements is special and is not to be freed. */
+#define df_scan_free_ref_vec(V) \
+ do { \
+ if (V && *V) \
+ free (V); \
+ } while (0)
+
+#define df_scan_free_mws_vec(V) \
+ do { \
+ if (V && *V) \
+ free (V); \
+ } while (0)
+
/* The bitmap_obstack is used to hold some static variables that
should not be reset after each function is compiled. */
@@ -174,11 +189,43 @@ struct df_scan_problem_data
typedef struct df_scan_bb_info *df_scan_bb_info_t;
+
+/* Internal function to shut down the scanning problem. */
static void
df_scan_free_internal (void)
{
struct df_scan_problem_data *problem_data
= (struct df_scan_problem_data *) df_scan->problem_data;
+ unsigned int i;
+ basic_block bb;
+
+ /* The vectors that hold the refs are not pool allocated because
+ they come in many sizes. This makes them impossible to delete
+ all at once. */
+ for (i = 0; i < DF_INSN_SIZE(); i++)
+ {
+ struct df_insn_info *insn_info = DF_INSN_UID_GET(i);
+ /* Skip the insns that have no insn_info or have been
+ deleted. */
+ if (insn_info)
+ {
+ df_scan_free_ref_vec (insn_info->defs);
+ df_scan_free_ref_vec (insn_info->uses);
+ df_scan_free_ref_vec (insn_info->eq_uses);
+ df_scan_free_mws_vec (insn_info->mw_hardregs);
+ }
+ }
+
+ FOR_ALL_BB (bb)
+ {
+ unsigned int bb_index = bb->index;
+ struct df_scan_bb_info *bb_info = df_scan_get_bb_info (bb_index);
+ if (bb_info)
+ {
+ df_scan_free_ref_vec (bb_info->artificial_defs);
+ df_scan_free_ref_vec (bb_info->artificial_uses);
+ }
+ }
free (df->def_info.refs);
free (df->def_info.begin);
@@ -1977,7 +2024,7 @@ df_mw_hardreg_chain_delete_eq_uses (struct df_insn_info *insn_info)
if (count == 0)
{
- free (insn_info->mw_hardregs);
+ df_scan_free_mws_vec (insn_info->mw_hardregs);
insn_info->mw_hardregs = df_null_mw_rec;
return 0;
}
@@ -2515,8 +2562,7 @@ df_refs_add_to_chains (struct df_collection_rec *collection_rec,
chain specially. */
if (collection_rec->def_vec)
{
- if (insn_rec->defs && *insn_rec->defs)
- free (insn_rec->defs);
+ df_scan_free_ref_vec (insn_rec->defs);
insn_rec->defs
= df_install_refs (bb, collection_rec->def_vec,
collection_rec->next_def,
@@ -2525,8 +2571,7 @@ df_refs_add_to_chains (struct df_collection_rec *collection_rec,
}
if (collection_rec->use_vec)
{
- if (insn_rec->uses && *insn_rec->uses)
- free (insn_rec->uses);
+ df_scan_free_ref_vec (insn_rec->uses);
insn_rec->uses
= df_install_refs (bb, collection_rec->use_vec,
collection_rec->next_use,
@@ -2535,8 +2580,7 @@ df_refs_add_to_chains (struct df_collection_rec *collection_rec,
}
if (collection_rec->eq_use_vec)
{
- if (insn_rec->eq_uses && *insn_rec->eq_uses)
- free (insn_rec->eq_uses);
+ df_scan_free_ref_vec (insn_rec->eq_uses);
insn_rec->eq_uses
= df_install_refs (bb, collection_rec->eq_use_vec,
collection_rec->next_eq_use,
@@ -2545,8 +2589,7 @@ df_refs_add_to_chains (struct df_collection_rec *collection_rec,
}
if (collection_rec->mw_vec)
{
- if (insn_rec->mw_hardregs && *insn_rec->mw_hardregs)
- free (insn_rec->mw_hardregs);
+ df_scan_free_mws_vec (insn_rec->mw_hardregs);
insn_rec->mw_hardregs
= df_install_mws (collection_rec->mw_vec,
collection_rec->next_mw);
@@ -2556,15 +2599,13 @@ df_refs_add_to_chains (struct df_collection_rec *collection_rec,
{
struct df_scan_bb_info *bb_info = df_scan_get_bb_info (bb->index);
- if (bb_info->artificial_defs && *bb_info->artificial_defs)
- free (bb_info->artificial_defs);
+ df_scan_free_ref_vec (bb_info->artificial_defs);
bb_info->artificial_defs
= df_install_refs (bb, collection_rec->def_vec,
collection_rec->next_def,
df->def_regs,
&df->def_info, false);
- if (bb_info->artificial_uses && *bb_info->artificial_uses)
- free (bb_info->artificial_uses);
+ df_scan_free_ref_vec (bb_info->artificial_uses);
bb_info->artificial_uses
= df_install_refs (bb, collection_rec->use_vec,
collection_rec->next_use,