added function to retrieve irn ops
[libfirm] / ir / be / beinsn_t.h
1 /**
2  * Instructions
3  *
4  * A data structure to treat nodes and node-proj collections uniformly.
5  */
6
7 #ifndef _BEINSN_T_H
8 #define _BEINSN_T_H
9
10 #include "bitset.h"
11
12 #include "bearch.h"
13
14 typedef struct _be_operand_t  be_operand_t;
15 typedef struct _be_insn_t     be_insn_t;
16 typedef struct _be_insn_env_t be_insn_env_t;
17
18 struct _be_operand_t {
19         ir_node *irn;
20         ir_node *carrier;
21         be_operand_t *partner;
22         bitset_t *regs;
23         int pos;
24         arch_register_req_t req;
25         unsigned has_constraints : 1;
26 };
27
28 struct _be_insn_t {
29         be_operand_t *ops;
30         int n_ops;
31         int use_start;
32         ir_node *next_insn;
33         ir_node *irn;
34         unsigned in_constraints  : 1;
35         unsigned out_constraints : 1;
36         unsigned has_constraints : 1;
37         unsigned pre_colored     : 1;
38 };
39
40 struct _be_insn_env_t {
41         struct obstack              *obst;
42         const arch_env_t            *aenv;
43         const arch_register_class_t *cls;
44         bitset_t                    *ignore_colors;
45 };
46
47 #define be_insn_n_defs(insn) ((insn)->use_start)
48 #define be_insn_n_uses(insn) ((insn)->n_ops - (insn)->use_start)
49
50 be_insn_t *be_scan_insn(const be_insn_env_t *env, ir_node *irn);
51
52 be_insn_env_t *be_insn_env_init(be_insn_env_t *ie, const be_irg_t *birg, const arch_register_class_t *cls, struct obstack *obst);
53
54 #endif /* _BEINSN_T_H */