remove license stuff from files
[libfirm] / ir / be / bechordal_t.h
1 /*
2  * This file is part of libFirm.
3  * Copyright (C) 2012 University of Karlsruhe.
4  */
5
6 /**
7  * @file
8  * @brief       Internal data structures for the chordal register allocator.
9  * @author      Sebastian Hack
10  * @date        25.01.2005
11  */
12 #ifndef FIRM_BE_BECHORDAL_T_H
13 #define FIRM_BE_BECHORDAL_T_H
14
15 #include "firm_types.h"
16 #include "list.h"
17 #include "pmap.h"
18 #include "bitset.h"
19 #include "obst.h"
20 #include "debug.h"
21
22 #include "bechordal.h"
23 #include "beifg.h"
24
25 /**
26  * A liveness interval border.
27  */
28 struct border_t {
29         DEBUG_ONLY(unsigned magic;)     /**< A magic number for checking. */
30         struct list_head  list;         /**< list head for queuing. */
31         border_t         *other_end;    /**< The other end of the border. */
32         ir_node          *irn;          /**< The node. */
33         unsigned         step;          /**< The number equal to the interval border. */
34         unsigned         pressure;      /**< The pressure at this interval border. (The border itself is counting). */
35         unsigned         is_def  : 1;   /**< Does this border denote a use or a def. */
36         unsigned         is_real : 1;   /**< Is the def/use real? Or is it just
37                                              inserted at block beginnings or ends
38                                              to ensure that inside a block, each
39                                              value has one begin and one end. */
40 };
41
42 /**
43  * Environment for each of the chordal register allocator phases
44  */
45 struct be_chordal_env_t {
46         struct obstack        obst;         /**< An obstack for temporary storage. */
47         be_ra_chordal_opts_t *opts;         /**< A pointer to the chordal ra options. */
48         ir_graph             *irg;          /**< The graph under examination. */
49         const arch_register_class_t *cls;   /**< The current register class. */
50         pmap                 *border_heads; /**< Maps blocks to border heads. */
51         be_ifg_t             *ifg;          /**< The interference graph. */
52         bitset_t             *allocatable_regs; /**< set of allocatable registers */
53 };
54
55 static inline struct list_head *get_block_border_head(be_chordal_env_t const *const inf, ir_node *const bl)
56 {
57   return pmap_get(list_head, inf->border_heads, bl);
58 }
59
60 #define foreach_border_head(head, pos)      list_for_each_entry_reverse(border_t, pos, head, list)
61
62 enum {
63         /* Dump flags */
64         BE_CH_DUMP_NONE       = (1 << 0),
65         BE_CH_DUMP_SPILL      = (1 << 1),
66         BE_CH_DUMP_LIVE       = (1 << 2),
67         BE_CH_DUMP_COLOR      = (1 << 3),
68         BE_CH_DUMP_COPYMIN    = (1 << 4),
69         BE_CH_DUMP_SSADESTR   = (1 << 5),
70         BE_CH_DUMP_TREE_INTV  = (1 << 6),
71         BE_CH_DUMP_CONSTR     = (1 << 7),
72         BE_CH_DUMP_SPILLSLOTS = (1 << 8),
73         BE_CH_DUMP_LOWER      = (1 << 9),
74         BE_CH_DUMP_SPLIT      = (1 << 10),
75         BE_CH_DUMP_APPEL      = (1 << 11),
76         BE_CH_DUMP_ALL        = 2 * BE_CH_DUMP_APPEL - 1,
77
78         /* lower perm options */
79         BE_CH_LOWER_PERM_SWAP   = 1,
80         BE_CH_LOWER_PERM_COPY   = 2,
81
82         /* verify options */
83         BE_CH_VRFY_OFF    = 1,
84         BE_CH_VRFY_WARN   = 2,
85         BE_CH_VRFY_ASSERT = 3,
86 };
87
88 struct be_ra_chordal_opts_t {
89         unsigned dump_flags;
90         int      lower_perm_opt;
91         int      vrfy_option;
92 };
93
94 void check_for_memory_operands(ir_graph *irg);
95
96 #endif /* FIRM_BE_BECHORDAL_T_H */