bestack: Fetch the start block only once.
[libfirm] / ir / be / beinfo.h
1 /*
2  * Copyright (C) 1995-2011 University of Karlsruhe.  All right reserved.
3  *
4  * This file is part of libFirm.
5  *
6  * This file may be distributed and/or modified under the terms of the
7  * GNU General Public License version 2 as published by the Free Software
8  * Foundation and appearing in the file LICENSE.GPL included in the
9  * packaging of this file.
10  *
11  * Licensees holding valid libFirm Professional Edition licenses may use
12  * this file in accordance with the libFirm Commercial License.
13  * Agreement provided with the Software.
14  *
15  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17  * PURPOSE.
18  */
19
20 /**
21  * @file
22  * @brief       additional backend node infos
23  * @author      Matthias Braun
24  */
25 #ifndef FIRM_BE_BEINFO_H
26 #define FIRM_BE_BEINFO_H
27
28 #include "be_types.h"
29 #include "irnode_t.h"
30
31 /**
32  * The schedule structure which is present at each ir node.
33  *
34  * Currently, only basic blocks are scheduled. The list head of
35  * every block schedule list is the Block list.
36  */
37 struct sched_info_t {
38         ir_node          *next;
39         ir_node          *prev;
40         sched_timestep_t  time_step;    /**< If a is after b in a schedule, its time step is larger than b's. */
41 };
42
43 struct reg_out_info_t {
44         const arch_register_t     *reg;
45         const arch_register_req_t *req;
46 };
47
48 struct backend_info_t {
49         sched_info_t                sched_info;
50         const arch_register_req_t **in_reqs;
51         reg_out_info_t             *out_infos;
52         arch_irn_flags_t            flags;
53 };
54
55 static inline backend_info_t *be_get_info(const ir_node *node)
56 {
57         assert(!is_Proj(node));
58         return (backend_info_t*) node->backend_info;
59 }
60
61 void be_info_init(void);
62 void be_info_free(void);
63 void be_info_init_irg(ir_graph *irg);
64 void be_info_new_node(ir_graph *irg, ir_node *node);
65
66 int be_nodes_equal(const ir_node *node1, const ir_node *node2);
67
68 #endif