2 * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved.
4 * This file is part of libFirm.
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.
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.
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
22 * @brief Internal data structures for the chordal register allocator.
23 * @author Sebastian Hack
26 #ifndef FIRM_BE_BECHORDAL_T_H
27 #define FIRM_BE_BECHORDAL_T_H
29 #include "firm_types.h"
36 #include "bechordal.h"
40 * A liveness interval border.
43 DEBUG_ONLY(unsigned magic;) /**< A magic number for checking. */
44 struct list_head list; /**< list head for queuing. */
45 border_t *other_end; /**< The other end of the border. */
46 ir_node *irn; /**< The node. */
47 unsigned step; /**< The number equal to the interval border. */
48 unsigned pressure; /**< The pressure at this interval border. (The border itself is counting). */
49 unsigned is_def : 1; /**< Does this border denote a use or a def. */
50 unsigned is_real : 1; /**< Is the def/use real? Or is it just
51 inserted at block beginnings or ends
52 to ensure that inside a block, each
53 value has one begin and one end. */
57 * Environment for each of the chordal register allocator phases
59 struct be_chordal_env_t {
60 struct obstack *obst; /**< An obstack for temporary storage. */
61 be_ra_chordal_opts_t *opts; /**< A pointer to the chordal ra options. */
62 ir_graph *irg; /**< The graph under examination. */
63 const arch_register_class_t *cls; /**< The current register class. */
64 pmap *border_heads; /**< Maps blocks to border heads. */
65 be_ifg_t *ifg; /**< The interference graph. */
66 bitset_t *allocatable_regs; /**< set of allocatable registers */
69 static inline struct list_head *get_block_border_head(be_chordal_env_t const *const inf, ir_node *const bl)
71 return pmap_get(list_head, inf->border_heads, bl);
74 #define foreach_border_head(head, pos) list_for_each_entry_reverse(border_t, pos, head, list)
78 BE_CH_DUMP_NONE = (1 << 0),
79 BE_CH_DUMP_SPILL = (1 << 1),
80 BE_CH_DUMP_LIVE = (1 << 2),
81 BE_CH_DUMP_COLOR = (1 << 3),
82 BE_CH_DUMP_COPYMIN = (1 << 4),
83 BE_CH_DUMP_SSADESTR = (1 << 5),
84 BE_CH_DUMP_TREE_INTV = (1 << 6),
85 BE_CH_DUMP_CONSTR = (1 << 7),
86 BE_CH_DUMP_SPILLSLOTS = (1 << 8),
87 BE_CH_DUMP_LOWER = (1 << 9),
88 BE_CH_DUMP_SPLIT = (1 << 10),
89 BE_CH_DUMP_APPEL = (1 << 11),
90 BE_CH_DUMP_ALL = 2 * BE_CH_DUMP_APPEL - 1,
92 /* lower perm options */
93 BE_CH_LOWER_PERM_SWAP = 1,
94 BE_CH_LOWER_PERM_COPY = 2,
99 BE_CH_VRFY_ASSERT = 3,
102 struct be_ra_chordal_opts_t {
108 void check_for_memory_operands(ir_graph *irg);
110 #endif /* FIRM_BE_BECHORDAL_T_H */