/* Define control and data flow tables, and regsets.
- Copyright (C) 1987, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1987, 1997, 1998, 1999, 2000, 2001, 2002
+ Free Software Foundation, Inc.
-This file is part of GNU CC.
+This file is part of GCC.
-GNU CC 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 version.
+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
+version.
-GNU CC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
+along with GCC; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
#ifndef GCC_BASIC_BLOCK_H
-#define GCC_BASIC_BLOCK_H
+#define GCC_BASIC_BLOCK_H
#include "bitmap.h"
#include "sbitmap.h"
#include "varray.h"
#include "partition.h"
-#ifndef TREE_CODE
-union tree_node;
-#define tree union tree_node *
-#endif
-
/* Head of register set linked list. */
typedef bitmap_head regset_head;
/* A pointer to a regset_head. */
} while (0)
/* Loop over all registers in REGSET, starting with MIN, setting REGNUM to the
- register number and executing CODE for all registers that are set. */
+ register number and executing CODE for all registers that are set. */
#define EXECUTE_IF_SET_IN_REG_SET(REGSET, MIN, REGNUM, CODE) \
EXECUTE_IF_SET_IN_BITMAP (REGSET, MIN, REGNUM, CODE)
/* Loop over all registers in REGSET1 and REGSET2, starting with MIN, setting
REGNUM to the register number and executing CODE for all registers that are
- set in the first regset and not set in the second. */
+ set in the first regset and not set in the second. */
#define EXECUTE_IF_AND_COMPL_IN_REG_SET(REGSET1, REGSET2, MIN, REGNUM, CODE) \
EXECUTE_IF_AND_COMPL_IN_BITMAP (REGSET1, REGSET2, MIN, REGNUM, CODE)
/* Loop over all registers in REGSET1 and REGSET2, starting with MIN, setting
REGNUM to the register number and executing CODE for all registers that are
- set in both regsets. */
+ set in both regsets. */
#define EXECUTE_IF_AND_IN_REG_SET(REGSET1, REGSET2, MIN, REGNUM, CODE) \
EXECUTE_IF_AND_IN_BITMAP (REGSET1, REGSET2, MIN, REGNUM, CODE)
/* Grow any tables needed when the number of registers is calculated
or extended. For the linked list allocation, nothing needs to
be done, other than zero the statistics on the first allocation. */
-#define MAX_REGNO_REG_SET(NUM_REGS, NEW_P, RENUMBER_P)
+#define MAX_REGNO_REG_SET(NUM_REGS, NEW_P, RENUMBER_P)
/* Type we use to hold basic block counters. Should be at least 64bit. */
typedef HOST_WIDEST_INT gcov_type;
} *edge;
#define EDGE_FALLTHRU 1
-#define EDGE_CRITICAL 2
-#define EDGE_ABNORMAL 4
-#define EDGE_ABNORMAL_CALL 8
-#define EDGE_EH 16
-#define EDGE_FAKE 32
+#define EDGE_ABNORMAL 2
+#define EDGE_ABNORMAL_CALL 4
+#define EDGE_EH 8
+#define EDGE_FAKE 16
+#define EDGE_DFS_BACK 32
#define EDGE_COMPLEX (EDGE_ABNORMAL | EDGE_ABNORMAL_CALL | EDGE_EH)
/* Expected number of executions: calculated in profile.c. */
gcov_type count;
-
+
/* Expected frequency. Normalized to be in range 0 to BB_FREQ_MAX. */
int frequency;
+
+ /* Various flags. See BB_* below. */
+ int flags;
} *basic_block;
-
+
#define BB_FREQ_MAX 10000
+/* Masks for basic_block.flags. */
+#define BB_DIRTY 1
+#define BB_NEW 2
+#define BB_REACHABLE 4
+
/* Number of basic blocks in the current function. */
extern int n_basic_blocks;
extern regset regs_live_at_setjmp;
+/* Special labels found during CFG build. */
+
+extern rtx label_value_list, tail_recursion_label_list;
+
+extern struct obstack flow_obstack;
+
/* Indexed by n, gives number of basic block that (REG n) is used in.
If the value is REG_BLOCK_GLOBAL (-2),
it means (REG n) is used in more than one basic block.
#define ENTRY_BLOCK (-1)
#define EXIT_BLOCK (-2)
-/* Special block number not valid for any block. */
+/* Special block number not valid for any block. */
#define INVALID_BLOCK (-3)
/* Similarly, block pointers for the edge list. */
#define BLOCK_NUM(INSN) (BLOCK_FOR_INSN (INSN)->index + 0)
extern void compute_bb_for_insn PARAMS ((int));
+extern void free_bb_for_insn PARAMS ((void));
extern void update_bb_for_insn PARAMS ((basic_block));
extern void set_block_for_insn PARAMS ((rtx, basic_block));
-extern void set_block_for_new_insns PARAMS ((rtx, basic_block));
extern void free_basic_block_vars PARAMS ((int));
extern edge split_block PARAMS ((basic_block, rtx));
extern basic_block split_edge PARAMS ((edge));
extern void insert_insn_on_edge PARAMS ((rtx, edge));
+
extern void commit_edge_insertions PARAMS ((void));
+extern void commit_edge_insertions_watch_calls PARAMS ((void));
+
extern void remove_fake_edges PARAMS ((void));
extern void add_noreturn_fake_exit_edges PARAMS ((void));
extern void connect_infinite_loops_to_exit PARAMS ((void));
-extern int flow_call_edges_add PARAMS ((sbitmap));
-extern rtx flow_delete_insn PARAMS ((rtx));
-extern void flow_delete_insn_chain PARAMS ((rtx, rtx));
-extern void make_edge PARAMS ((sbitmap *, basic_block,
+extern int flow_call_edges_add PARAMS ((sbitmap));
+extern edge cached_make_edge PARAMS ((sbitmap *, basic_block,
+ basic_block, int));
+extern edge make_edge PARAMS ((basic_block,
+ basic_block, int));
+extern edge make_single_succ_edge PARAMS ((basic_block,
basic_block, int));
extern void remove_edge PARAMS ((edge));
extern void redirect_edge_succ PARAMS ((edge, basic_block));
-extern void redirect_edge_succ_nodup PARAMS ((edge, basic_block));
+extern edge redirect_edge_succ_nodup PARAMS ((edge, basic_block));
extern void redirect_edge_pred PARAMS ((edge, basic_block));
-extern void create_basic_block PARAMS ((int, rtx, rtx, rtx));
+extern basic_block create_basic_block_structure PARAMS ((int, rtx, rtx, rtx));
+extern basic_block create_basic_block PARAMS ((int, rtx, rtx));
extern int flow_delete_block PARAMS ((basic_block));
+extern int flow_delete_block_noexpunge PARAMS ((basic_block));
+extern void clear_bb_flags PARAMS ((void));
extern void merge_blocks_nomove PARAMS ((basic_block, basic_block));
extern void tidy_fallthru_edge PARAMS ((edge, basic_block,
basic_block));
+extern void tidy_fallthru_edges PARAMS ((void));
+extern void flow_reverse_top_sort_order_compute PARAMS ((int *));
extern int flow_depth_first_order_compute PARAMS ((int *, int *));
+extern void flow_preorder_transversal_compute PARAMS ((int *));
extern void dump_edge_info PARAMS ((FILE *, edge, int));
extern void clear_edges PARAMS ((void));
extern void mark_critical_edges PARAMS ((void));
/* Basic block of loop pre-header or NULL if it does not exist. */
basic_block pre_header;
- /* Array of edges along the pre-header extended basic block trace.
+ /* Array of edges along the pre-header extended basic block trace.
The source of the first edge is the root node of pre-header
extended basic block, if it exists. */
edge *pre_header_edges;
/* List of all LABEL_REFs which refer to code labels outside the
loop. Used by routines that need to know all loop exits, such as
final_biv_value and final_giv_value.
-
+
This does not include loop exits due to return instructions.
This is because all bivs and givs are pseudos, and hence must be
dead after a return, so the presense of a return does not affect
extern int flow_loop_scan PARAMS ((struct loops *, struct loop *, int));
/* This structure maintains an edge list vector. */
-struct edge_list
+struct edge_list
{
int num_blocks;
int num_edges;
+ REG_BR_PROB_BASE / 2) \
/ REG_BR_PROB_BASE)
+/* Return nonzero if edge is critical. */
+#define EDGE_CRITICAL_P(e) ((e)->src->succ->succ_next \
+ && (e)->dest->pred->pred_next)
+
struct edge_list * create_edge_list PARAMS ((void));
void free_edge_list PARAMS ((struct edge_list *));
void print_edge_list PARAMS ((FILE *, struct edge_list *));
void verify_edge_list PARAMS ((FILE *, struct edge_list *));
-int find_edge_index PARAMS ((struct edge_list *,
+int find_edge_index PARAMS ((struct edge_list *,
basic_block, basic_block));
#define PROP_ALLOW_CFG_CHANGES 32 /* Allow the CFG to be changed
by dead code removal. */
#define PROP_AUTOINC 64 /* Create autoinc mem references. */
+#define PROP_EQUAL_NOTES 128 /* Take into account REG_EQUAL notes. */
#define PROP_FINAL 127 /* All of the above. */
#define CLEANUP_EXPENSIVE 1 /* Do relativly expensive optimizations
inside call_placeholders.. */
#define CLEANUP_PRE_LOOP 16 /* 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. */
/* Flags for loop discovery. */
-#define LOOP_TREE 1 /* Build loop hierarchy tree. */
+#define LOOP_TREE 1 /* Build loop hierarchy tree. */
#define LOOP_PRE_HEADER 2 /* Analyse loop pre-header. */
-#define LOOP_ENTRY_EDGES 4 /* Find entry edges. */
-#define LOOP_EXIT_EDGES 8 /* Find exit edges. */
+#define LOOP_ENTRY_EDGES 4 /* Find entry edges. */
+#define LOOP_EXIT_EDGES 8 /* Find exit edges. */
#define LOOP_EDGES (LOOP_ENTRY_EDGES | LOOP_EXIT_EDGES)
-#define LOOP_EXITS_DOMS 16 /* Find nodes that dom. all exits. */
-#define LOOP_ALL 31 /* All of the above */
+#define LOOP_EXITS_DOMS 16 /* Find nodes that dom. all exits. */
+#define LOOP_ALL 31 /* All of the above */
extern void life_analysis PARAMS ((rtx, FILE *, int));
-extern void update_life_info PARAMS ((sbitmap, enum update_life_extent,
+extern int update_life_info PARAMS ((sbitmap, enum update_life_extent,
int));
+extern int update_life_info_in_dirty_blocks PARAMS ((enum update_life_extent,
+ int));
extern int count_or_remove_death_notes PARAMS ((sbitmap, int));
extern int propagate_block PARAMS ((basic_block, regset, regset, regset,
int));
extern void free_propagate_block_info PARAMS ((struct propagate_block_info *));
/* In lcm.c */
-extern struct edge_list *pre_edge_lcm PARAMS ((FILE *, int, sbitmap *,
- sbitmap *, sbitmap *,
+extern struct edge_list *pre_edge_lcm PARAMS ((FILE *, int, sbitmap *,
+ sbitmap *, sbitmap *,
sbitmap *, sbitmap **,
sbitmap **));
extern struct edge_list *pre_edge_rev_lcm PARAMS ((FILE *, int, sbitmap *,
- sbitmap *, sbitmap *,
- sbitmap *, sbitmap **,
+ sbitmap *, sbitmap *,
+ sbitmap *, sbitmap **,
sbitmap **));
extern void compute_available PARAMS ((sbitmap *, sbitmap *,
sbitmap *, sbitmap *));
extern void debug_regset PARAMS ((regset));
extern void allocate_reg_life_data PARAMS ((void));
extern void allocate_bb_life_data PARAMS ((void));
+extern void expunge_block PARAMS ((basic_block));
+extern void expunge_block_nocompact PARAMS ((basic_block));
+extern basic_block alloc_block PARAMS ((void));
extern void find_unreachable_blocks PARAMS ((void));
-extern void delete_noop_moves PARAMS ((rtx));
+extern int delete_noop_moves PARAMS ((rtx));
extern basic_block redirect_edge_and_branch_force PARAMS ((edge, basic_block));
+extern basic_block force_nonfallthru PARAMS ((edge));
extern bool redirect_edge_and_branch PARAMS ((edge, basic_block));
extern rtx block_label PARAMS ((basic_block));
extern bool forwarder_block_p PARAMS ((basic_block));
-extern void purge_all_dead_edges PARAMS ((void));
-extern void purge_dead_edges PARAMS ((basic_block));
+extern bool purge_all_dead_edges PARAMS ((int));
+extern bool purge_dead_edges PARAMS ((basic_block));
extern void find_sub_basic_blocks PARAMS ((basic_block));
-
+extern void find_many_sub_basic_blocks PARAMS ((sbitmap));
+extern bool can_fallthru PARAMS ((basic_block, basic_block));
+extern void flow_nodes_print PARAMS ((const char *, const sbitmap,
+ FILE *));
+extern void flow_edge_list_print PARAMS ((const char *, const edge *,
+ int, FILE *));
+extern void alloc_aux_for_block PARAMS ((basic_block, int));
+extern void alloc_aux_for_blocks PARAMS ((int));
+extern void clear_aux_for_blocks PARAMS ((void));
+extern void free_aux_for_blocks PARAMS ((void));
+extern void alloc_aux_for_edge PARAMS ((edge, int));
+extern void alloc_aux_for_edges PARAMS ((int));
+extern void clear_aux_for_edges PARAMS ((void));
+extern void free_aux_for_edges PARAMS ((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. */
+ it being unused. */
extern void verify_flow_info PARAMS ((void));
extern int flow_loop_outside_edge_p PARAMS ((const struct loop *, edge));
/* Prototypes of operations on conflict graphs. */
-extern conflict_graph conflict_graph_new
+extern conflict_graph conflict_graph_new
PARAMS ((int));
extern void conflict_graph_delete PARAMS ((conflict_graph));
-extern int conflict_graph_add PARAMS ((conflict_graph,
+extern int conflict_graph_add PARAMS ((conflict_graph,
int, int));
-extern int conflict_graph_conflict_p PARAMS ((conflict_graph,
+extern int conflict_graph_conflict_p PARAMS ((conflict_graph,
int, int));
-extern void conflict_graph_enum PARAMS ((conflict_graph, int,
- conflict_graph_enum_fn,
+extern void conflict_graph_enum PARAMS ((conflict_graph, int,
+ conflict_graph_enum_fn,
void *));
extern void conflict_graph_merge_regs PARAMS ((conflict_graph, int,
int));
extern void conflict_graph_print PARAMS ((conflict_graph, FILE*));
-extern conflict_graph conflict_graph_compute
+extern conflict_graph conflict_graph_compute
PARAMS ((regset,
partition));
+extern bool mark_dfs_back_edges PARAMS ((void));
+extern void update_br_prob_note PARAMS ((basic_block));
+extern void fixup_abnormal_edges PARAMS ((void));
/* In dominance.c */