OSDN Git Service

* config/mips/mips.h (ISA_HAS_DCLZ_DCLO): Delete.
[pf3gnuchains/gcc-fork.git] / gcc / basic-block.h
index 1902818..b5f045e 100644 (file)
@@ -1,5 +1,5 @@
 /* Define control and data flow tables, and regsets.
-   Copyright (C) 1987, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   Copyright (C) 1987, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
    Free Software Foundation, Inc.
 
 This file is part of GCC.
@@ -27,9 +27,11 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include "varray.h"
 #include "partition.h"
 #include "hard-reg-set.h"
+#include "predict.h"
 
 /* Head of register set linked list.  */
 typedef bitmap_head regset_head;
+
 /* A pointer to a regset_head.  */
 typedef bitmap regset;
 
@@ -121,24 +123,35 @@ do {                                                                      \
 typedef HOST_WIDEST_INT gcov_type;
 
 /* Control flow edge information.  */
-typedef struct edge_def {
+struct edge_def GTY((chain_next ("%h.pred_next")))
+{
   /* Links through the predecessor and successor lists.  */
-  struct edge_def *pred_next, *succ_next;
+  struct edge_def *pred_next;
+  struct edge_def *succ_next;
 
   /* The two blocks at the ends of the edge.  */
-  struct basic_block_def *src, *dest;
+  struct basic_block_def *src;
+  struct basic_block_def *dest;
 
   /* Instructions queued on the edge.  */
-  rtx insns;
+  union edge_def_insns {
+    rtx GTY ((tag ("0"))) r;
+    tree GTY ((tag ("1"))) t;
+  } GTY ((desc ("ir_type ()"))) insns;
 
   /* Auxiliary info specific to a pass.  */
-  void *aux;
+  PTR GTY ((skip (""))) aux;
+
+  /* Location of any goto implicit in the edge, during tree-ssa.  */
+  source_locus goto_locus;
 
   int flags;                   /* see EDGE_* below  */
   int probability;             /* biased by REG_BR_PROB_BASE */
   gcov_type count;             /* Expected number of executions calculated
                                   in profile.c  */
-} *edge;
+};
+
+typedef struct edge_def *edge;
 
 #define EDGE_FALLTHRU          1       /* 'Straight line' flow */
 #define EDGE_ABNORMAL          2       /* Strange flow, like computed
@@ -153,7 +166,16 @@ typedef struct edge_def {
 #define EDGE_IRREDUCIBLE_LOOP  128     /* Part of irreducible loop.  */
 #define EDGE_SIBCALL           256     /* Edge from sibcall to exit.  */
 #define EDGE_LOOP_EXIT         512     /* Exit of a loop.  */
-#define EDGE_ALL_FLAGS         1023
+#define EDGE_TRUE_VALUE                1024    /* Edge taken when controlling
+                                          predicate is non zero.  */
+#define EDGE_FALSE_VALUE       2048    /* Edge taken when controlling
+                                          predicate is zero.  */
+#define EDGE_EXECUTABLE                4096    /* Edge is executable.  Only
+                                          valid during SSA-CCP.  */
+#define EDGE_CROSSING          8192    /* Edge crosses between hot
+                                          and cold sections, when we
+                                          do partitioning.  */
+#define EDGE_ALL_FLAGS        16383
 
 #define EDGE_COMPLEX   (EDGE_ABNORMAL | EDGE_ABNORMAL_CALL | EDGE_EH)
 
@@ -165,6 +187,9 @@ extern const struct gcov_ctr_summary *profile_info;
 struct loop;
 struct loops;
 
+/* Declared in tree-flow.h.  */
+struct bb_ann_d;
+
 /* A basic block is a sequence of instructions with only entry and
    only one exit.  If any one of the instructions are executed, they
    will all be executed, and in sequence from first to last.
@@ -191,51 +216,54 @@ struct loops;
    basic blocks.  */
 
 /* Basic block information indexed by block number.  */
-typedef struct basic_block_def {
+struct basic_block_def GTY((chain_next ("%h.next_bb"), chain_prev ("%h.prev_bb")))
+{
   /* The first and last insns of the block.  */
-  rtx head_, end_;
+  rtx head_;
+  rtx end_;
 
-  /* The first and last trees of the block.  */
-  tree head_tree;
-  tree end_tree;
+  /* Pointers to the first and last trees of the block.  */
+  tree stmt_list;
 
   /* The edges into and out of the block.  */
-  edge pred, succ;
+  edge pred;
+  edge succ;
 
   /* Liveness info.  */
 
   /* The registers that are modified within this in block.  */
-  regset local_set;
+  bitmap GTY ((skip (""))) local_set;
   /* The registers that are conditionally modified within this block.
      In other words, registers that are set only as part of a
      COND_EXEC.  */
-  regset cond_local_set;
+  bitmap GTY ((skip (""))) cond_local_set;
   /* The registers that are live on entry to this block.
 
      Note that in SSA form, global_live_at_start does not reflect the
      use of regs in phi functions, since the liveness of these regs
      may depend on which edge was taken into the block.  */
-  regset global_live_at_start;
+  bitmap GTY ((skip (""))) global_live_at_start;
   /* The registers that are live on exit from this block.  */
-  regset global_live_at_end;
+  bitmap GTY ((skip (""))) global_live_at_end;
 
   /* Auxiliary info specific to a pass.  */
-  void *aux;
+  PTR GTY ((skip (""))) aux;
 
   /* The index of this block.  */
   int index;
 
   /* Previous and next blocks in the chain.  */
-  struct basic_block_def *prev_bb, *next_bb;
+  struct basic_block_def *prev_bb;
+  struct basic_block_def *next_bb;
 
   /* The loop depth of this block.  */
   int loop_depth;
 
-  /* Outermost loop containing the block.  */
-  struct loop *loop_father;
+  /* Innermost loop containing the block.  */
+  struct loop * GTY ((skip (""))) loop_father;
 
   /* The dominance and postdominance information node.  */
-  struct et_node *dom[2];
+  struct et_node * GTY ((skip (""))) dom[2];
 
   /* Expected number of executions: calculated in profile.c.  */
   gcov_type count;
@@ -246,9 +274,34 @@ typedef struct basic_block_def {
   /* Various flags.  See BB_* below.  */
   int flags;
 
-  /* Additional data maintained by cfg_layout routines.  */
-  struct reorder_block_def *rbi;
-} *basic_block;
+  /* Which section block belongs in, when partitioning basic blocks.  */
+  int partition;
+
+  /* The data used by basic block copying and reordering functions.  */
+  struct reorder_block_def * GTY ((skip (""))) rbi;
+
+  /* Annotations used at the tree level.  */
+  struct bb_ann_d *tree_annotations;
+};
+
+typedef struct basic_block_def *basic_block;
+
+/* Structure to hold information about the blocks during reordering and
+   copying.  */
+
+typedef struct reorder_block_def
+{
+  rtx header;
+  rtx footer;
+  basic_block next;
+  basic_block original;
+  /* Used by loop copying.  */
+  basic_block copy;
+  int duplicated;
+
+  /* These fields are used by bb-reorder pass.  */
+  int visited;
+} *reorder_block_def_p;
 
 #define BB_FREQ_MAX 10000
 
@@ -260,6 +313,12 @@ typedef struct basic_block_def {
 #define BB_IRREDUCIBLE_LOOP    16
 #define BB_SUPERBLOCK          32
 
+/* Partitions, to be used when partitioning hot and cold basic blocks into
+   separate sections.  */
+#define UNPARTITIONED   0
+#define HOT_PARTITION   1
+#define COLD_PARTITION  2
+
 /* Number of basic blocks in the current function.  */
 
 extern int n_basic_blocks;
@@ -272,9 +331,17 @@ extern int last_basic_block;
 
 extern int n_edges;
 
+/* Signalize the status of profile information in the CFG.  */
+extern enum profile_status
+{
+  PROFILE_ABSENT,
+  PROFILE_GUESSED,
+  PROFILE_READ
+} profile_status;
+
 /* Index by basic block number, get basic block struct info.  */
 
-extern varray_type basic_block_info;
+extern GTY(()) varray_type basic_block_info;
 
 #define BASIC_BLOCK(N)  (VARRAY_BB (basic_block_info, (N)))
 
@@ -288,6 +355,17 @@ extern varray_type basic_block_info;
 #define FOR_EACH_BB_REVERSE(BB) \
   FOR_BB_BETWEEN (BB, EXIT_BLOCK_PTR->prev_bb, ENTRY_BLOCK_PTR, prev_bb)
 
+/* For iterating over insns in basic block.  */
+#define FOR_BB_INSNS(BB, INSN)                 \
+  for ((INSN) = BB_HEAD (BB);                  \
+       (INSN) != NEXT_INSN (BB_END (BB));      \
+       (INSN) = NEXT_INSN (INSN))
+
+#define FOR_BB_INSNS_REVERSE(BB, INSN)         \
+  for ((INSN) = BB_END (BB);                   \
+       (INSN) != PREV_INSN (BB_HEAD (BB));     \
+       (INSN) = PREV_INSN (INSN))
+
 /* Cycles through _all_ basic blocks, even the fake ones (entry and
    exit block).  */
 
@@ -301,7 +379,6 @@ extern regset regs_live_at_setjmp;
 /* Special labels found during CFG build.  */
 
 extern GTY(()) rtx label_value_list;
-extern GTY(()) rtx tail_recursion_label_list;
 
 extern struct obstack flow_obstack;
 
@@ -330,9 +407,8 @@ extern struct obstack flow_obstack;
 #define INVALID_BLOCK (-3)
 
 /* Similarly, block pointers for the edge list.  */
-extern struct basic_block_def entry_exit_blocks[2];
-#define ENTRY_BLOCK_PTR        (&entry_exit_blocks[0])
-#define EXIT_BLOCK_PTR (&entry_exit_blocks[1])
+extern GTY(()) basic_block ENTRY_BLOCK_PTR;
+extern GTY(()) basic_block EXIT_BLOCK_PTR;
 
 #define BLOCK_NUM(INSN)              (BLOCK_FOR_INSN (INSN)->index + 0)
 #define set_block_for_insn(INSN, BB)  (BLOCK_FOR_INSN (INSN) = BB)
@@ -341,7 +417,7 @@ extern void compute_bb_for_insn (void);
 extern void free_bb_for_insn (void);
 extern void update_bb_for_insn (basic_block);
 
-extern void free_basic_block_vars (int);
+extern void free_basic_block_vars (void);
 
 extern void insert_insn_on_edge (rtx, edge);
 bool safe_insert_insn_on_edge (rtx, edge);
@@ -350,9 +426,9 @@ extern void commit_edge_insertions (void);
 extern void commit_edge_insertions_watch_calls (void);
 
 extern void remove_fake_edges (void);
+extern void remove_fake_exit_edges (void);
 extern void add_noreturn_fake_exit_edges (void);
 extern void connect_infinite_loops_to_exit (void);
-extern int flow_call_edges_add (sbitmap);
 extern edge unchecked_make_edge (basic_block, basic_block, int);
 extern edge cached_make_edge (sbitmap *, basic_block, basic_block, int);
 extern edge make_edge (basic_block, basic_block, int);
@@ -363,15 +439,15 @@ extern edge redirect_edge_succ_nodup (edge, basic_block);
 extern void redirect_edge_pred (edge, basic_block);
 extern basic_block create_basic_block_structure (rtx, rtx, rtx, basic_block);
 extern void clear_bb_flags (void);
-extern void tidy_fallthru_edge (edge, basic_block, basic_block);
-extern void tidy_fallthru_edges (void);
 extern void flow_reverse_top_sort_order_compute (int *);
 extern int flow_depth_first_order_compute (int *, int *);
 extern void flow_preorder_transversal_compute (int *);
 extern int dfs_enumerate_from (basic_block, int,
                               bool (*)(basic_block, void *),
                               basic_block *, int, void *);
+extern void compute_dominance_frontiers (bitmap *);
 extern void dump_edge_info (FILE *, edge, int);
+extern void brief_dump_cfg (FILE *);
 extern void clear_edges (void);
 extern void mark_critical_edges (void);
 extern rtx first_insn_after_basic_block_note (basic_block);
@@ -452,6 +528,7 @@ void free_edge_list (struct edge_list *);
 void print_edge_list (FILE *, struct edge_list *);
 void verify_edge_list (FILE *, struct edge_list *);
 int find_edge_index (struct edge_list *, basic_block, basic_block);
+edge find_edge (basic_block, basic_block);
 
 
 enum update_life_extent
@@ -480,22 +557,26 @@ enum update_life_extent
                                 | PROP_SCAN_DEAD_CODE | PROP_AUTOINC \
                                 | PROP_ALLOW_CFG_CHANGES \
                                 | PROP_SCAN_DEAD_STORES)
+#define PROP_POSTRELOAD                (PROP_DEATH_NOTES  \
+                                | PROP_KILL_DEAD_CODE  \
+                                | PROP_SCAN_DEAD_CODE | PROP_AUTOINC \
+                                | PROP_SCAN_DEAD_STORES)
 
 #define CLEANUP_EXPENSIVE      1       /* Do relatively expensive optimizations
                                           except for edge forwarding */
 #define CLEANUP_CROSSJUMP      2       /* Do crossjumping.  */
 #define CLEANUP_POST_REGSTACK  4       /* We run after reg-stack and need
                                           to care REG_DEAD notes.  */
-#define CLEANUP_PRE_SIBCALL    8       /* Do not get confused by code hidden
-                                          inside call_placeholders..  */
-#define CLEANUP_PRE_LOOP       16      /* Take care to preserve syntactic loop
+#define CLEANUP_PRE_LOOP       8       /* Take care to preserve syntactic loop
                                           notes.  */
-#define CLEANUP_UPDATE_LIFE    32      /* Keep life information up to date.  */
-#define CLEANUP_THREADING      64      /* Do jump threading.  */
-#define CLEANUP_NO_INSN_DEL    128     /* Do not try to delete trivially dead
+#define CLEANUP_UPDATE_LIFE    16      /* Keep life information up to date.  */
+#define CLEANUP_THREADING      32      /* Do jump threading.  */
+#define CLEANUP_NO_INSN_DEL    64      /* Do not try to delete trivially dead
                                           insns.  */
-#define CLEANUP_CFGLAYOUT      256     /* Do cleanup in cfglayout mode.  */
-extern void life_analysis (rtx, FILE *, int);
+#define CLEANUP_CFGLAYOUT      128     /* Do cleanup in cfglayout mode.  */
+#define CLEANUP_LOG_LINKS      256     /* Update log links.  */
+
+extern void life_analysis (FILE *, int);
 extern int update_life_info (sbitmap, enum update_life_extent, int);
 extern int update_life_info_in_dirty_blocks (enum update_life_extent, int);
 extern int count_or_remove_death_notes (sbitmap, int);
@@ -524,15 +605,18 @@ extern rtx emit_block_insn_before (rtx, rtx, basic_block);
 
 /* In predict.c */
 extern void estimate_probability (struct loops *);
-extern void note_prediction_to_br_prob (void);
 extern void expected_value_to_br_prob (void);
 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 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);
 
 /* In flow.c */
 extern void init_flow (void);
-extern void dump_bb (basic_block, FILE *);
 extern void debug_bb (basic_block);
 extern basic_block debug_bb_n (int);
 extern void dump_regset (regset, FILE *);
@@ -545,7 +629,7 @@ extern void unlink_block (basic_block);
 extern void compact_blocks (void);
 extern basic_block alloc_block (void);
 extern void find_unreachable_blocks (void);
-extern int delete_noop_moves (rtx);
+extern int delete_noop_moves (void);
 extern basic_block force_nonfallthru (edge);
 extern rtx block_label (basic_block);
 extern bool forwarder_block_p (basic_block);
@@ -553,7 +637,9 @@ extern bool purge_all_dead_edges (int);
 extern bool purge_dead_edges (basic_block);
 extern void find_sub_basic_blocks (basic_block);
 extern void find_many_sub_basic_blocks (sbitmap);
+extern void rtl_make_eh_edge (sbitmap *, basic_block, rtx);
 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_edge_list_print (const char *, const edge *, int, FILE *);
 extern void alloc_aux_for_block (basic_block, int);
@@ -564,11 +650,10 @@ extern void alloc_aux_for_edge (edge, int);
 extern void alloc_aux_for_edges (int);
 extern void clear_aux_for_edges (void);
 extern void free_aux_for_edges (void);
-
-/* This function is always defined so it can be called from the
-   debugger, and it is declared extern so we don't get warnings about
-   it being unused.  */
-extern void verify_flow_info (void);
+extern void find_basic_blocks (rtx, int, FILE *);
+extern bool cleanup_cfg (int);
+extern bool delete_unreachable_blocks (void);
+extern bool merge_seq_blocks (void);
 
 typedef struct conflict_graph_def *conflict_graph;
 
@@ -601,7 +686,13 @@ extern bool inside_basic_block_p (rtx);
 extern bool control_flow_insn_p (rtx);
 
 /* In bb-reorder.c */
-extern void reorder_basic_blocks (void);
+extern void reorder_basic_blocks (unsigned int);
+extern void partition_hot_cold_basic_blocks (void);
+
+/* In cfg.c */
+extern void alloc_rbi_pool (void);
+extern void initialize_bb_rbi (basic_block bb);
+extern void free_rbi_pool (void);
 
 /* In dominance.c */
 
@@ -640,7 +731,9 @@ extern void iterate_fix_dominators (enum cdi_direction, basic_block *, int);
 extern void verify_dominators (enum cdi_direction);
 extern basic_block first_dom_son (enum cdi_direction, basic_block);
 extern basic_block next_dom_son (enum cdi_direction, basic_block);
-extern bool try_redirect_by_replacing_jump (edge, basic_block, bool);
+extern edge try_redirect_by_replacing_jump (edge, basic_block, bool);
+extern void break_superblocks (void);
+extern void check_bb_profile (basic_block, FILE *);
 
 #include "cfghooks.h"