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 /* Debugging. Do not use macros to hook these so they can be called from
29 int (*cfgh_verify_flow_info
) (void);
30 void (*dump_bb
) (basic_block
, FILE *);
32 /* Basic CFG manipulation. */
34 /* Redirect edge E to the given basic block B and update underlying program
35 representation. Returns false when edge is not easily redirectable for
37 bool (*redirect_edge_and_branch
) (edge e
, basic_block b
);
39 /* Same as the above but allows redirecting of fallthru edges. In that case
40 newly created forwarder basic block is returned. It aborts when called
42 basic_block (*redirect_edge_and_branch_force
) (edge
, basic_block
);
44 /* Remove given basic block and all edges possibly pointing into it. */
45 void (*delete_block
) (basic_block
);
47 /* Split basic block B after specified instruction I. */
48 edge (*split_block
) (basic_block b
, void * i
);
50 /* Higher level functions representable by primitive operations above if
51 we didn't have some oddities in RTL and Tree representations. */
52 basic_block (*cfgh_split_edge
) (edge
);
55 #define redirect_edge_and_branch(e,b) cfg_hooks->redirect_edge_and_branch (e,b)
56 #define redirect_edge_and_branch_force(e,b) cfg_hooks->redirect_edge_and_branch_force (e,b)
57 #define split_block(e,i) cfg_hooks->split_block (e,i)
58 #define delete_block(b) cfg_hooks->delete_block (b)
59 #define split_edge(e) cfg_hooks->cfgh_split_edge (e)
61 /* Hooks containers. */
62 extern struct cfg_hooks rtl_cfg_hooks
;
64 /* A pointer to one of the hooks containers. */
65 extern struct cfg_hooks
*cfg_hooks
;
68 extern void rtl_register_cfg_hooks (void);
69 extern void cfg_layout_rtl_register_cfg_hooks (void);
71 #endif /* GCC_CFGHOOKS_H */