Prototypely implemented constrained coloring
[libfirm] / ir / be / benode_t.h
1 /**
2  * @file   benode_t.h
3  * @date   17.05.2005
4  * @author Sebastian Hack
5  *
6  * Backend node support.
7  *
8  * Copyright (C) 2005 Universitaet Karlsruhe
9  * Released under the GPL
10  */
11
12 #ifndef _BENODE_T_H
13 #define _BENODE_T_H
14
15 #include "pmap.h"
16
17 #include "irmode.h"
18 #include "irnode.h"
19
20 #include "be_t.h"
21 #include "bearch.h"
22
23 struct _be_node_factory_t {
24   const arch_isa_if_t *isa;
25
26   struct obstack      obst;
27   set                 *ops;
28   pmap                *irn_op_map;
29   pmap                *reg_req_map;
30
31   arch_irn_handler_t  handler;
32   arch_irn_ops_t      irn_ops;
33 };
34
35 typedef struct _be_node_factory_t                       be_node_factory_t;
36
37 be_node_factory_t *be_node_factory_init(be_node_factory_t *factory, const arch_isa_t *isa);
38
39 const arch_irn_handler_t *be_node_get_irn_handler(const be_node_factory_t *f);
40
41 ir_node *new_Spill(const be_node_factory_t *factory,
42     const arch_register_class_t *cls,
43     ir_graph *irg, ir_node *bl, ir_node *node_to_spill, ir_node *ctx);
44
45 ir_node *new_Reload(const be_node_factory_t *factory,
46     const arch_register_class_t *cls, ir_graph *irg,
47     ir_node *bl, ir_mode *mode, ir_node *spill_node);
48
49 ir_node *new_Perm(const be_node_factory_t *factory,
50     const arch_register_class_t *cls,
51     ir_graph *irg, ir_node *bl, int arity, ir_node **in);
52
53 ir_node *new_Copy(const be_node_factory_t *factory,
54     const arch_register_class_t *cls,
55     ir_graph *irg, ir_node *block, ir_node *in);
56
57 ir_node *be_spill(
58                 const be_node_factory_t *factory,
59                 const arch_env_t *arch_env,
60                 ir_node *irn,
61                 ir_node *spill_ctx);
62
63 ir_node *be_reload(
64                 const be_node_factory_t *factory,
65                 const arch_env_t *arch_env,
66                 const arch_register_class_t *cls,
67                 ir_node *irn, int pos, ir_mode *mode, ir_node *spill);
68
69 int is_Spill(const ir_node *irn);
70
71 int is_Perm(const ir_node *irn);
72
73 /**
74  * Modify the output register requirements of a Perm.
75  * This function incur register constraints to an output value of a Perm.
76  * This is used when handling register constraints in general,
77  * see beconstrperm.c
78  */
79 void be_set_Perm_out_req(ir_node *irn, int pos, const arch_register_req_t *req);
80
81 /**
82  * Insert a Perm node after a specific node in the schedule.
83  * The Perm permutes over all values live at the given node.
84  * This means that all liveness intervals are cut apart at this
85  * location in the program.
86  */
87 ir_node *insert_Perm_after(const be_main_env_t *env,
88                                                    const arch_register_class_t *cls,
89                                                    dom_front_info_t *dom_front,
90                                                    ir_node *pos);
91
92 #endif /* _BENODE_T_H */