added get_next_ir_opcodes() to allow allocation of cosecutive opcodes
[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 "firm_config.h"
16 #include "pmap.h"
17
18 #include "irmode.h"
19 #include "irnode.h"
20 #include "entity_t.h"
21
22 #include "be_t.h"
23 #include "bearch.h"
24
25 typedef enum {
26         beo_NoBeOp = 0,
27         beo_Spill,
28         beo_Reload,
29         beo_Perm,
30         beo_Copy,
31         beo_Keep,
32         beo_Last
33 } be_opcode_t;
34
35 void be_node_init(void);
36
37 const arch_irn_handler_t be_node_irn_handler;
38
39 ir_node *be_new_Spill(const arch_register_class_t *cls, ir_graph *irg, ir_node *bl, ir_node *node_to_spill, ir_node *ctx);
40 ir_node *be_new_Reload(const arch_register_class_t *cls, ir_graph *irg, ir_node *bl, ir_mode *mode, ir_node *spill_node);
41 ir_node *be_new_Copy(const arch_register_class_t *cls, ir_graph *irg, ir_node *block, ir_node *in);
42 ir_node *be_new_Perm(const arch_register_class_t *cls, ir_graph *irg, ir_node *bl, int arity, ir_node *in[]);
43 ir_node *be_new_Keep(const arch_register_class_t *cls, ir_graph *irg, ir_node *bl, int arity, ir_node *in[]);
44
45 ir_node *be_spill(const arch_env_t *arch_env, ir_node *irn,ir_node *spill_ctx);
46 ir_node *be_reload(const arch_env_t *arch_env, const arch_register_class_t *cls, ir_node *irn, int pos, ir_mode *mode, ir_node *spill);
47
48 int be_is_Spill(const ir_node *irn);
49 int be_is_Reload(const ir_node *irn);
50 int be_is_Copy(const ir_node *irn);
51 int be_is_Perm(const ir_node *irn);
52 int be_is_Keep(const ir_node *irn);
53
54 void   be_set_Spill_entity(ir_node *irn, entity *ent);
55 entity *be_get_spill_entity(ir_node *irn);
56
57 ir_node *be_get_Spill_context(const ir_node *irn);
58
59
60 /**
61  * Modify the output register requirements of a Perm.
62  * This function incur register constraints to an output value of a Perm.
63  * This is used when handling register constraints in general,
64  * see beconstrperm.c
65  * @param irn The perm node.
66  * @param pos The position.
67  * @param req The requirements to set to.
68  * @param negate_limited When the requirements are limited, inverse the set of admissible registers.
69  */
70 void be_set_Perm_out_req(ir_node *irn, int pos, const arch_register_req_t *req, unsigned negate_limited);
71
72 /**
73  * Insert a Perm node after a specific node in the schedule.
74  * The Perm permutes over all values live at the given node.
75  * This means that all liveness intervals are cut apart at this
76  * location in the program.
77  */
78 ir_node *insert_Perm_after(const arch_env_t *env,
79                                                    const arch_register_class_t *cls,
80                                                    dom_front_info_t *dom_front,
81                                                    ir_node *pos);
82
83 #endif /* _BENODE_T_H */