Fixed rare threading problem
[official-gcc.git] / gcc / cfghooks.h
blob37457deff8bec1cc456be8cbd1d23046d0d92370
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)
10 any later version.
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
25 struct cfg_hooks
27 /* Debugging. Do not use macros to hook these so they can be called from
28 debugger! */
29 int (*cfgh_verify_flow_info) (void);
30 void (*dump_bb) (basic_block, FILE *);
32 /* Basic CFG manipulation. */
34 /* Return new basic block */
35 basic_block (*create_basic_block) (void *head, void *end, basic_block after);
37 /* Redirect edge E to the given basic block B and update underlying program
38 representation. Returns false when edge is not easily redirectable for
39 whatever reason. */
40 bool (*redirect_edge_and_branch) (edge e, basic_block b);
42 /* Same as the above but allows redirecting of fallthru edges. In that case
43 newly created forwarder basic block is returned. It aborts when called
44 on abnormal edge. */
45 basic_block (*redirect_edge_and_branch_force) (edge, basic_block);
47 /* Remove given basic block and all edges possibly pointing into it. */
48 void (*delete_block) (basic_block);
50 /* Split basic block B after specified instruction I. */
51 edge (*split_block) (basic_block b, void * i);
53 /* Return true when blocks A and B can be merged into single basic block. */
54 bool (*can_merge_blocks_p) (basic_block a, basic_block b);
56 /* Merge blocks A and B. */
57 void (*merge_blocks) (basic_block a, basic_block b);
59 /* Higher level functions representable by primitive operations above if
60 we didn't have some oddities in RTL and Tree representations. */
61 basic_block (*cfgh_split_edge) (edge);
64 #define redirect_edge_and_branch(e,b) cfg_hooks->redirect_edge_and_branch (e,b)
65 #define redirect_edge_and_branch_force(e,b) cfg_hooks->redirect_edge_and_branch_force (e,b)
66 #define split_block(e,i) cfg_hooks->split_block (e,i)
67 #define delete_block(b) cfg_hooks->delete_block (b)
68 #define split_edge(e) cfg_hooks->cfgh_split_edge (e)
69 #define create_basic_block(h,e,a) cfg_hooks->create_basic_block (h,e,a)
70 #define can_merge_blocks_p(a,b) cfg_hooks->can_merge_blocks_p (a,b)
71 #define merge_blocks(a,b) cfg_hooks->merge_blocks (a,b)
73 /* Hooks containers. */
74 extern struct cfg_hooks rtl_cfg_hooks;
76 /* A pointer to one of the hooks containers. */
77 extern struct cfg_hooks *cfg_hooks;
79 /* Declarations. */
80 extern void rtl_register_cfg_hooks (void);
81 extern void cfg_layout_rtl_register_cfg_hooks (void);
83 #endif /* GCC_CFGHOOKS_H */