beifg: Factorise code to count interference components.
[libfirm] / ir / be / beinsn_t.h
1 /*
2  * This file is part of libFirm.
3  * Copyright (C) 2012 University of Karlsruhe.
4  */
5
6 /**
7  * @file
8  * @brief       A data structure to treat nodes and node-proj collections uniformly.
9  * @author      Sebastian Hack
10  */
11 #ifndef FIRM_BE_BEINSN_T_H
12 #define FIRM_BE_BEINSN_T_H
13
14 #include "firm_types.h"
15 #include "bitset.h"
16
17 #include "bearch.h"
18 #include "bechordal.h"
19
20 typedef struct be_operand_t  be_operand_t;
21 typedef struct be_insn_t     be_insn_t;
22
23 struct be_operand_t {
24         ir_node        *carrier; /**< node representing the operand value (Proj or the node itself for defs, the used value for uses) */
25         be_operand_t   *partner; /**< used in bechordal later... (TODO what does it do?) */
26         unsigned const *regs;    /**< admissible register bitset */
27 };
28
29 struct be_insn_t {
30         be_operand_t *ops;       /**< the values used and defined by the insn */
31         int           n_ops;     /**< length of the ops array */
32         int           use_start; /**< entries [0-use_start) in ops are defs,
33                                       [use_start-n_ops) uses */
34         ir_node      *irn;       /**< ir_node of the instruction */
35 };
36
37 /**
38  * Create a be_insn_t for an IR node.
39  *
40  * @param env      the insn construction environment
41  * @param irn      the irn for which the be_insn should be build
42  *
43  * @return the be_insn for the IR node
44  */
45 be_insn_t *be_scan_insn(be_chordal_env_t *env, ir_node *irn);
46
47 #endif /* FIRM_BE_BEINSN_T_H */