1 /* Hooks for cfg representation specific functions.
2 Copyright (C) 2003 Free Software Foundation, Inc.
3 Contributed by Sebastian Pop <s.pop@laposte.net>
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
12 GCC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING. If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
22 #ifndef GCC_CFGHOOKS_H
23 #define GCC_CFGHOOKS_H
27 /* Name of the corresponding ir. */
31 int (*verify_flow_info
) (void);
32 void (*dump_bb
) (basic_block
, FILE *, int);
34 /* Basic CFG manipulation. */
36 /* Return new basic block. */
37 basic_block (*create_basic_block
) (void *head
, void *end
, basic_block after
);
39 /* Redirect edge E to the given basic block B and update underlying program
40 representation. Returns false when edge is not easily redirectable for
42 bool (*redirect_edge_and_branch
) (edge e
, basic_block b
);
44 /* Same as the above but allows redirecting of fallthru edges. In that case
45 newly created forwarder basic block is returned. It aborts when called
47 basic_block (*redirect_edge_and_branch_force
) (edge
, basic_block
);
49 /* Remove statements corresponding to a given basic block. */
50 void (*delete_basic_block
) (basic_block
);
52 /* Creates a new basic block just after basic block B by splitting
53 everything after specified instruction I. */
54 basic_block (*split_block
) (basic_block b
, void * i
);
56 /* Move block B immediately after block A. */
57 bool (*move_block_after
) (basic_block b
, basic_block a
);
59 /* Return true when blocks A and B can be merged into single basic block. */
60 bool (*can_merge_blocks_p
) (basic_block a
, basic_block b
);
62 /* Merge blocks A and B. */
63 void (*merge_blocks
) (basic_block a
, basic_block b
);
65 /* Higher level functions representable by primitive operations above if
66 we didn't have some oddities in RTL and Tree representations. */
67 basic_block (*split_edge
) (edge
);
68 void (*make_forwarder_block
) (edge
);
70 /* Tries to make the edge fallthru. */
71 void (*tidy_fallthru_edge
) (edge
);
74 extern void verify_flow_info (void);
75 extern void dump_bb (basic_block
, FILE *, int);
76 extern bool redirect_edge_and_branch (edge
, basic_block
);
77 extern basic_block
redirect_edge_and_branch_force (edge
, basic_block
);
78 extern edge
split_block (basic_block
, void *);
79 extern edge
split_block_after_labels (basic_block
);
80 extern bool move_block_after (basic_block
, basic_block
);
81 extern void delete_basic_block (basic_block
);
82 extern basic_block
split_edge (edge
);
83 extern basic_block
create_basic_block (void *, void *, basic_block
);
84 extern basic_block
create_empty_bb (basic_block
);
85 extern bool can_merge_blocks_p (basic_block
, basic_block
);
86 extern void merge_blocks (basic_block
, basic_block
);
87 extern edge
make_forwarder_block (basic_block
, bool (*)(edge
),
88 void (*) (basic_block
));
89 extern void tidy_fallthru_edge (edge
);
90 extern void tidy_fallthru_edges (void);
92 /* Hooks containers. */
93 extern struct cfg_hooks rtl_cfg_hooks
;
94 extern struct cfg_hooks cfg_layout_rtl_cfg_hooks
;
97 extern void rtl_register_cfg_hooks (void);
98 extern void cfg_layout_rtl_register_cfg_hooks (void);
100 #endif /* GCC_CFGHOOKS_H */