/* Form lists of pseudo register references for autoinc optimization
for GNU compiler. This is part of flow optimization.
- Copyright (C) 1999-2016 Free Software Foundation, Inc.
+ Copyright (C) 1999-2020 Free Software Foundation, Inc.
Originally contributed by Michael P. Hayes
(m.hayes@elec.canterbury.ac.nz, mhayes@redhat.com)
Major rewrite contributed by Danny Berlin (dberlin@dberlin.org)
#include "timevar.h"
struct dataflow;
-struct df_d;
+class df_d;
struct df_problem;
struct df_link;
struct df_insn_info;
df_dump_insn_problem_function dump_insn_bottom_fun;
df_verify_solution_start verify_start_fun;
df_verify_solution_end verify_end_fun;
- struct df_problem *dependent_problem;
+ const struct df_problem *dependent_problem;
unsigned int block_info_elt_size;
/* The timevar id associated with this pass. */
/* The specific instance of the problem to solve. */
struct dataflow
{
- struct df_problem *problem; /* The problem to be solved. */
+ const struct df_problem *problem; /* The problem to be solved. */
/* Array indexed by bb->index, that contains basic block problem and
solution specific information. */
DF_UD_CHAIN = 2 /* Build UD chains. */
};
+enum df_scan_flags
+{
+ /* Flags for the SCAN problem. */
+ DF_SCAN_EMPTY_ENTRY_EXIT = 1 /* Don't define any registers in the entry
+ block; don't use any in the exit block. */
+};
+
enum df_changeable_flags
{
/* Scanning flags. */
used by owners of the problem.
----------------------------------------------------------------------------*/
-struct df_d
+class df_d
{
+public:
/* The set of problems to be solved is stored in two arrays. In
PROBLEMS_IN_ORDER, the problems are stored in the order that they
bitmap_head insns_to_notes_rescan;
int *postorder; /* The current set of basic blocks
in reverse postorder. */
- int *postorder_inverted; /* The current set of basic blocks
+ vec<int> postorder_inverted; /* The current set of basic blocks
in reverse postorder of inverted CFG. */
int n_blocks; /* The number of blocks in reverse postorder. */
- int n_blocks_inverted; /* The number of blocks
- in reverse postorder of inverted CFG. */
/* An array [FIRST_PSEUDO_REGISTER], indexed by regno, of the number
of refs that qualify as being real hard regs uses. Artificial
the ref except sparse_kill which is indexed by regno. For the
LR&RD problem, the kill set is not complete: It does not contain
DEFs killed because the set register has died in the LR set. */
-struct df_rd_bb_info
+class df_rd_bb_info
{
+public:
/* Local sets to describe the basic blocks. */
bitmap_head kill;
bitmap_head sparse_kill;
/* Multiple reaching definitions. All bitmaps are referenced by the
register number. */
-struct df_md_bb_info
+class df_md_bb_info
{
+public:
/* Local sets to describe the basic blocks. */
bitmap_head gen; /* Partial/conditional definitions live at BB out. */
bitmap_head kill; /* Other definitions that are live at BB out. */
/* Live registers, a backwards dataflow problem. All bitmaps are
referenced by the register number. */
-struct df_lr_bb_info
+class df_lr_bb_info
{
+public:
/* Local sets to describe the basic blocks. */
bitmap_head def; /* The set of registers set in this block
- except artificial defs at the top. */
register number. Anded results of the forwards and backward live
info. Note that the forwards live information is not available
separately. */
-struct df_live_bb_info
+class df_live_bb_info
{
+public:
/* Local sets to describe the basic blocks. */
bitmap_head kill; /* The set of registers unset in this block. Calls,
for instance, unset registers. */
pseudo. Only pseudos that have a size of 2 * UNITS_PER_WORD are
meaningfully tracked. */
-struct df_word_lr_bb_info
+class df_word_lr_bb_info
{
+public:
/* Local sets to describe the basic blocks. */
bitmap_head def; /* The set of registers set in this block
- except artificial defs at the top. */
/* Must-initialized registers. All bitmaps are referenced by the
register number. */
-struct df_mir_bb_info
+class df_mir_bb_info
{
+public:
/* Local sets to describe the basic blocks. */
bitmap_head kill; /* The set of registers unset in this block. Calls,
for instance, unset registers. */
/* 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
should not be used by regular code. */
-extern struct df_d *df;
+extern class df_d *df;
#define df_scan (df->problems_by_index[DF_SCAN])
#define df_rd (df->problems_by_index[DF_RD])
#define df_lr (df->problems_by_index[DF_LR])
/* Functions defined in df-core.c. */
-extern void df_add_problem (struct df_problem *);
+extern void df_add_problem (const struct df_problem *);
extern int df_set_flags (int);
extern int df_clear_flags (int);
extern void df_set_blocks (bitmap);
extern void df_finish_pass (bool);
extern void df_analyze_problem (struct dataflow *, bitmap, int *, int);
extern void df_analyze ();
-extern void df_analyze_loop (struct loop *);
+extern void df_analyze_loop (class loop *);
extern int df_get_n_blocks (enum df_flow_dir);
extern int *df_get_postorder (enum df_flow_dir);
extern void df_simple_dataflow (enum df_flow_dir, df_init_function,
extern df_ref df_find_use (rtx_insn *, rtx);
extern bool df_reg_used (rtx_insn *, rtx);
extern void df_worklist_dataflow (struct dataflow *,bitmap, int *, int);
-extern void df_print_regset (FILE *file, bitmap r);
-extern void df_print_word_regset (FILE *file, bitmap r);
+extern void df_print_regset (FILE *file, const_bitmap r);
+extern void df_print_word_regset (FILE *file, const_bitmap r);
extern void df_dump (FILE *);
extern void df_dump_region (FILE *);
extern void df_dump_start (FILE *);
extern bool df_regs_ever_live_p (unsigned int);
extern void df_set_regs_ever_live (unsigned int, bool);
extern void df_compute_regs_ever_live (bool);
-extern bool df_read_modify_subreg_p (rtx);
extern void df_scan_verify (void);
\f
return NULL;
}
-static inline struct df_rd_bb_info *
+static inline class df_rd_bb_info *
df_rd_get_bb_info (unsigned int index)
{
if (index < df_rd->block_info_size)
- return &((struct df_rd_bb_info *) df_rd->block_info)[index];
+ return &((class df_rd_bb_info *) df_rd->block_info)[index];
else
return NULL;
}
-static inline struct df_lr_bb_info *
+static inline class df_lr_bb_info *
df_lr_get_bb_info (unsigned int index)
{
if (index < df_lr->block_info_size)
- return &((struct df_lr_bb_info *) df_lr->block_info)[index];
+ return &((class df_lr_bb_info *) df_lr->block_info)[index];
else
return NULL;
}
-static inline struct df_md_bb_info *
+static inline class df_md_bb_info *
df_md_get_bb_info (unsigned int index)
{
if (index < df_md->block_info_size)
- return &((struct df_md_bb_info *) df_md->block_info)[index];
+ return &((class df_md_bb_info *) df_md->block_info)[index];
else
return NULL;
}
-static inline struct df_live_bb_info *
+static inline class df_live_bb_info *
df_live_get_bb_info (unsigned int index)
{
if (index < df_live->block_info_size)
- return &((struct df_live_bb_info *) df_live->block_info)[index];
+ return &((class df_live_bb_info *) df_live->block_info)[index];
else
return NULL;
}
-static inline struct df_word_lr_bb_info *
+static inline class df_word_lr_bb_info *
df_word_lr_get_bb_info (unsigned int index)
{
if (index < df_word_lr->block_info_size)
- return &((struct df_word_lr_bb_info *) df_word_lr->block_info)[index];
+ return &((class df_word_lr_bb_info *) df_word_lr->block_info)[index];
else
return NULL;
}
-static inline struct df_mir_bb_info *
+static inline class 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];
+ return &((class df_mir_bb_info *) df_mir->block_info)[index];
else
return NULL;
}
/* web */
-class web_entry_base
+struct web_entry_base
{
private:
/* Reference to the parent in the union/find tree. */