summaryrefslogtreecommitdiff
path: root/gcc/df.h
diff options
context:
space:
mode:
authorpmderodat <pmderodat@138bc75d-0d04-0410-961f-82ee72b054a4>2015-10-19 23:47:35 +0000
committerpmderodat <pmderodat@138bc75d-0d04-0410-961f-82ee72b054a4>2015-10-19 23:47:35 +0000
commitfbe9d8a6c95eec91d4bc9c00690537294a70b1c0 (patch)
treed4b672674b050b5804bf9a28e4d83b5c24ea0d85 /gcc/df.h
parent3bd5b2f05bba61c944cec6ec0d6dee0e79532328 (diff)
downloadgcc-fbe9d8a6c95eec91d4bc9c00690537294a70b1c0.tar.gz
REE: fix uninitialized registers handling
gcc/ChangeLog: PR rtl-optimization/66790 * df.h (DF_MIR): New macro. (DF_LAST_PROBLEM_PLUS1): Update to be past DF_MIR (DF_MIR_INFO_BB): New macro. (DF_MIR_IN, DF_MIR_OUT): New macros. (struct df_mir_bb_info): New. (df_mir): New macro. (df_mir_add_problem, df_mir_simulate_one_insn): New forward declarations. (df_mir_get_bb_info): New. * df-problems.c (struct df_mir_problem_data): New. (df_mir_free_bb_info, df_mir_alloc, df_mir_reset, df_mir_bb_local_compute, df_mir_local_compute, df_mir_init, df_mir_confluence_0, df_mir_confluence_n, df_mir_transfer_function, df_mir_free, df_mir_top_dump, df_mir_bottom_dump, df_mir_verify_solution_start, df_mir_verify_solution_end): New. (problem_MIR): New. (df_mir_add_problem, df_mir_simulate_one_insn): New. * timevar.def (TV_DF_MIR): New. * ree.c: Include bitmap.h (add_removable_extension): Add an INIT_REGS parameter. Use it to skip zero-extensions that may get an uninitialized register. (find_removable_extensions): Compute must-initialized registers using the MIR dataflow problem. Update the call to add_removable_extension. (find_and_remove_re): Call df_mir_add_problem. gcc/testsuite/ChangeLog: * gnat.dg/opt50.adb: New test. * gnat.dg/opt50_pkg.adb: New helper. * gnat.dg/opt50_pkg.ads: New helper. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@229008 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/df.h')
-rw-r--r--gcc/df.h34
1 files changed, 33 insertions, 1 deletions
diff --git a/gcc/df.h b/gcc/df.h
index 44e5fdb37a9..54b9abbed56 100644
--- a/gcc/df.h
+++ b/gcc/df.h
@@ -51,8 +51,9 @@ union df_ref_d;
#define DF_WORD_LR 5 /* Subreg tracking lr. */
#define DF_NOTE 6 /* REG_DEAD and REG_UNUSED notes. */
#define DF_MD 7 /* Multiple Definitions. */
+#define DF_MIR 8 /* Must-initialized Registers. */
-#define DF_LAST_PROBLEM_PLUS1 (DF_MD + 1)
+#define DF_LAST_PROBLEM_PLUS1 (DF_MIR + 1)
/* Dataflow direction. */
enum df_flow_dir
@@ -612,12 +613,16 @@ struct df_d
#define DF_LIVE_BB_INFO(BB) (df_live_get_bb_info ((BB)->index))
#define DF_WORD_LR_BB_INFO(BB) (df_word_lr_get_bb_info ((BB)->index))
#define DF_MD_BB_INFO(BB) (df_md_get_bb_info ((BB)->index))
+#define DF_MIR_BB_INFO(BB) (df_mir_get_bb_info ((BB)->index))
/* Most transformations that wish to use live register analysis will
use these macros. This info is the and of the lr and live sets. */
#define DF_LIVE_IN(BB) (&DF_LIVE_BB_INFO (BB)->in)
#define DF_LIVE_OUT(BB) (&DF_LIVE_BB_INFO (BB)->out)
+#define DF_MIR_IN(BB) (&DF_MIR_BB_INFO (BB)->in)
+#define DF_MIR_OUT(BB) (&DF_MIR_BB_INFO (BB)->out)
+
/* These macros are used by passes that are not tolerant of
uninitialized variables. This intolerance should eventually
be fixed. */
@@ -896,6 +901,21 @@ struct df_word_lr_bb_info
bitmap_head out; /* At the bottom of the block. */
};
+/* Must-initialized registers. All bitmaps are referenced by the
+ register number. */
+struct df_mir_bb_info
+{
+ /* Local sets to describe the basic blocks. */
+ bitmap_head kill; /* The set of registers unset in this block. Calls,
+ for instance, unset registers. */
+ bitmap_head gen; /* The set of registers set in this block, excluding the
+ ones killed later on in this block. */
+
+ /* The results of the dataflow problem. */
+ bitmap_head in; /* At the top of the block. */
+ bitmap_head out; /* At the bottom of the block. */
+};
+
/* This is used for debugging and for the dumpers to find the latest
instance so that the df info can be added to the dumps. This
@@ -909,6 +929,7 @@ extern struct df_d *df;
#define df_word_lr (df->problems_by_index[DF_WORD_LR])
#define df_note (df->problems_by_index[DF_NOTE])
#define df_md (df->problems_by_index[DF_MD])
+#define df_mir (df->problems_by_index[DF_MIR])
/* This symbol turns on checking that each modification of the cfg has
been identified to the appropriate df routines. It is not part of
@@ -1005,6 +1026,8 @@ extern void df_note_add_problem (void);
extern void df_md_add_problem (void);
extern void df_md_simulate_artificial_defs_at_top (basic_block, bitmap);
extern void df_md_simulate_one_insn (basic_block, rtx_insn *, bitmap);
+extern void df_mir_add_problem (void);
+extern void df_mir_simulate_one_insn (basic_block, rtx_insn *, bitmap, bitmap);
extern void df_simulate_find_noclobber_defs (rtx_insn *, bitmap);
extern void df_simulate_find_defs (rtx_insn *, bitmap);
extern void df_simulate_defs (rtx_insn *, bitmap);
@@ -1111,6 +1134,15 @@ df_word_lr_get_bb_info (unsigned int index)
return NULL;
}
+static inline struct df_mir_bb_info *
+df_mir_get_bb_info (unsigned int index)
+{
+ if (index < df_mir->block_info_size)
+ return &((struct df_mir_bb_info *) df_mir->block_info)[index];
+ else
+ return NULL;
+}
+
/* Get the live at out set for BB no matter what problem happens to be
defined. This function is used by the register allocators who
choose different dataflow problems depending on the optimization