]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/cfghooks.h
avr.h: Remove target-independent comments about target macros.
[thirdparty/gcc.git] / gcc / cfghooks.h
CommitLineData
9ee634e3
JH
1/* Hooks for cfg representation specific functions.
2 Copyright (C) 2003 Free Software Foundation, Inc.
3 Contributed by Sebastian Pop <s.pop@laposte.net>
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2, or (at your option)
10any later version.
11
12GCC is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GCC; see the file COPYING. If not, write to
19the Free Software Foundation, 59 Temple Place - Suite 330,
20Boston, MA 02111-1307, USA. */
21
22#ifndef GCC_CFGHOOKS_H
23#define GCC_CFGHOOKS_H
24
25struct cfg_hooks
26{
27 /* Debugging. Do not use macros to hook these so they can be called from
28 debugger! */
d329e058
AJ
29 int (*cfgh_verify_flow_info) (void);
30 void (*dump_bb) (basic_block, FILE *);
9ee634e3
JH
31
32 /* Basic CFG manipulation. */
33
6614fd40 34 /* Return new basic block. */
f55ade6e 35 basic_block (*create_basic_block) (void *head, void *end, basic_block after);
bc35512f 36
9ee634e3 37 /* Redirect edge E to the given basic block B and update underlying program
e0bb17a8 38 representation. Returns false when edge is not easily redirectable for
9ee634e3 39 whatever reason. */
d329e058 40 bool (*redirect_edge_and_branch) (edge e, basic_block b);
9ee634e3
JH
41
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. */
d329e058 45 basic_block (*redirect_edge_and_branch_force) (edge, basic_block);
9ee634e3
JH
46
47 /* Remove given basic block and all edges possibly pointing into it. */
d329e058 48 void (*delete_block) (basic_block);
9ee634e3
JH
49
50 /* Split basic block B after specified instruction I. */
d329e058 51 edge (*split_block) (basic_block b, void * i);
9ee634e3 52
bc35512f 53 /* Return true when blocks A and B can be merged into single basic block. */
f55ade6e 54 bool (*can_merge_blocks_p) (basic_block a, basic_block b);
bc35512f
JH
55
56 /* Merge blocks A and B. */
f55ade6e 57 void (*merge_blocks) (basic_block a, basic_block b);
bc35512f 58
9ee634e3
JH
59 /* Higher level functions representable by primitive operations above if
60 we didn't have some oddities in RTL and Tree representations. */
d329e058 61 basic_block (*cfgh_split_edge) (edge);
9ee634e3
JH
62};
63
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)
bc35512f
JH
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)
9ee634e3
JH
72
73/* Hooks containers. */
74extern struct cfg_hooks rtl_cfg_hooks;
75
76/* A pointer to one of the hooks containers. */
77extern struct cfg_hooks *cfg_hooks;
78
79/* Declarations. */
d329e058
AJ
80extern void rtl_register_cfg_hooks (void);
81extern void cfg_layout_rtl_register_cfg_hooks (void);
9ee634e3
JH
82
83#endif /* GCC_CFGHOOKS_H */