GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
-Software Foundation; either version 2, or (at your option) any later
+Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
for more details.
You should have received a copy of the GNU General Public License
-along with GCC; see the file COPYING. If not, write to the Free
-Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301, USA. */
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
#ifndef GCC_BASIC_BLOCK_H
#define GCC_BASIC_BLOCK_H
#define REGNO_REG_SET_P(TO, REG) bitmap_bit_p (TO, REG)
/* Copy the hard registers in a register set to the hard register set. */
-extern void reg_set_to_hard_reg_set (HARD_REG_SET *, bitmap);
+extern void reg_set_to_hard_reg_set (HARD_REG_SET *, const_bitmap);
#define REG_SET_TO_HARD_REG_SET(TO, FROM) \
do { \
CLEAR_HARD_REG_SET (TO); \
};
typedef struct edge_def *edge;
+typedef const struct edge_def *const_edge;
DEF_VEC_P(edge);
DEF_VEC_ALLOC_P(edge,gc);
DEF_VEC_ALLOC_P(edge,heap);
};
typedef struct basic_block_def *basic_block;
+typedef const struct basic_block_def *const_basic_block;
DEF_VEC_P(basic_block);
DEF_VEC_ALLOC_P(basic_block,gc);
#define BB_COPY_PARTITION(dstbb, srcbb) \
BB_SET_PARTITION (dstbb, BB_PARTITION (srcbb))
+/* State of dominance information. */
+
+enum dom_state
+{
+ DOM_NONE, /* Not computed at all. */
+ DOM_NO_FAST_QUERY, /* The data is OK, but the fast query data are not usable. */
+ DOM_OK /* Everything is ok. */
+};
+
/* A structure to group all the per-function control flow graph data.
The x_* prefixing is necessary because otherwise references to the
fields of this struct are interpreted as the defines for backward
PROFILE_GUESSED,
PROFILE_READ
} x_profile_status;
+
+ /* Whether the dominators and the postdominators are available. */
+ enum dom_state x_dom_computed[2];
+
+ /* Number of basic blocks in the dominance tree. */
+ unsigned x_n_bbs_in_dom_tree[2];
};
/* Defines for accessing the fields of the CFG structure for function FN. */
extern int inverted_post_order_compute (int *);
extern int pre_and_rev_post_order_compute (int *, int *, bool);
extern int dfs_enumerate_from (basic_block, int,
- bool (*)(basic_block, void *),
- basic_block *, int, void *);
+ bool (*)(const_basic_block, const void *),
+ basic_block *, int, const void *);
extern void compute_dominance_frontiers (bitmap *);
extern void dump_bb_info (basic_block, bool, bool, int, const char *, FILE *);
extern void dump_edge_info (FILE *, edge, int);
/* Returns true if BB has precisely one successor. */
static inline bool
-single_succ_p (basic_block bb)
+single_succ_p (const_basic_block bb)
{
return EDGE_COUNT (bb->succs) == 1;
}
/* Returns true if BB has precisely one predecessor. */
static inline bool
-single_pred_p (basic_block bb)
+single_pred_p (const_basic_block bb)
{
return EDGE_COUNT (bb->preds) == 1;
}
BB does not have exactly one successor. */
static inline edge
-single_succ_edge (basic_block bb)
+single_succ_edge (const_basic_block bb)
{
gcc_assert (single_succ_p (bb));
return EDGE_SUCC (bb, 0);
if BB does not have exactly one predecessor. */
static inline edge
-single_pred_edge (basic_block bb)
+single_pred_edge (const_basic_block bb)
{
gcc_assert (single_pred_p (bb));
return EDGE_PRED (bb, 0);
if BB does not have exactly one successor. */
static inline basic_block
-single_succ (basic_block bb)
+single_succ (const_basic_block bb)
{
return single_succ_edge (bb)->dest;
}
if BB does not have exactly one predecessor.*/
static inline basic_block
-single_pred (basic_block bb)
+single_pred (const_basic_block bb)
{
return single_pred_edge (bb)->src;
}
extern void compute_available (sbitmap *, sbitmap *, sbitmap *, sbitmap *);
/* In predict.c */
-extern bool maybe_hot_bb_p (basic_block);
-extern bool probably_cold_bb_p (basic_block);
-extern bool probably_never_executed_bb_p (basic_block);
-extern bool tree_predicted_by_p (basic_block, enum br_predictor);
-extern bool rtl_predicted_by_p (basic_block, enum br_predictor);
+extern bool maybe_hot_bb_p (const_basic_block);
+extern bool probably_cold_bb_p (const_basic_block);
+extern bool probably_never_executed_bb_p (const_basic_block);
+extern bool tree_predicted_by_p (const_basic_block, enum br_predictor);
+extern bool rtl_predicted_by_p (const_basic_block, enum br_predictor);
extern void tree_predict_edge (edge, enum br_predictor, int);
extern void rtl_predict_edge (edge, enum br_predictor, int);
extern void predict_edge_def (edge, enum br_predictor, enum prediction);
extern void guess_outgoing_edge_probabilities (basic_block);
extern void remove_predictions_associated_with_edge (edge);
-extern bool edge_probability_reliable_p (edge);
-extern bool br_prob_note_reliable_p (rtx);
+extern bool edge_probability_reliable_p (const_edge);
+extern bool br_prob_note_reliable_p (const_rtx);
/* In cfg.c */
extern void dump_regset (regset, FILE *);
/* In cfganal.c */
extern void find_unreachable_blocks (void);
-extern bool forwarder_block_p (basic_block);
+extern bool forwarder_block_p (const_basic_block);
extern bool can_fallthru (basic_block, basic_block);
extern bool could_fall_through (basic_block, basic_block);
-extern void flow_nodes_print (const char *, const sbitmap, FILE *);
+extern void flow_nodes_print (const char *, const_sbitmap, FILE *);
extern void flow_edge_list_print (const char *, const edge *, int, FILE *);
/* In cfgrtl.c */
extern void set_edge_can_fallthru_flag (void);
extern void update_br_prob_note (basic_block);
extern void fixup_abnormal_edges (void);
-extern bool inside_basic_block_p (rtx);
-extern bool control_flow_insn_p (rtx);
+extern bool inside_basic_block_p (const_rtx);
+extern bool control_flow_insn_p (const_rtx);
extern rtx get_last_bb_insn (basic_block);
/* In bb-reorder.c */
CDI_POST_DOMINATORS = 2
};
-enum dom_state
-{
- DOM_NONE, /* Not computed at all. */
- DOM_NO_FAST_QUERY, /* The data is OK, but the fast query data are not usable. */
- DOM_OK /* Everything is ok. */
-};
-
extern enum dom_state dom_info_state (enum cdi_direction);
extern void set_dom_info_availability (enum cdi_direction, enum dom_state);
extern bool dom_info_available_p (enum cdi_direction);
extern void set_immediate_dominator (enum cdi_direction, basic_block,
basic_block);
extern basic_block get_immediate_dominator (enum cdi_direction, basic_block);
-extern bool dominated_by_p (enum cdi_direction, basic_block, basic_block);
+extern bool dominated_by_p (enum cdi_direction, const_basic_block, const_basic_block);
extern VEC (basic_block, heap) *get_dominated_by (enum cdi_direction, basic_block);
extern VEC (basic_block, heap) *get_dominated_by_region (enum cdi_direction,
basic_block *,
return false;
}
+/* Return true when one of the predecessor edges of BB is marked with EDGE_ABNORMAL. */
+static inline bool
+bb_has_abnormal_pred (basic_block bb)
+{
+ edge e;
+ edge_iterator ei;
+
+ FOR_EACH_EDGE (e, ei, bb->preds)
+ {
+ if (e->flags & EDGE_ABNORMAL)
+ return true;
+ }
+ return false;
+}
+
/* In cfgloopmanip.c. */
extern edge mfb_kj_edge;
bool mfb_keep_just (edge);