2 * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved.
4 * This file is part of libFirm.
6 * This file may be distributed and/or modified under the terms of the
7 * GNU General Public License version 2 as published by the Free Software
8 * Foundation and appearing in the file LICENSE.GPL included in the
9 * packaging of this file.
11 * Licensees holding valid libFirm Professional Edition licenses may use
12 * this file in accordance with the libFirm Commercial License.
13 * Agreement provided with the Software.
15 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * @brief A data structure to treat nodes and node-proj collections uniformly.
23 * @author Sebastian Hack
26 #ifndef FIRM_BE_BEINSN_T_H
27 #define FIRM_BE_BEINSN_T_H
29 #include "firm_types.h"
36 typedef struct be_operand_t be_operand_t;
37 typedef struct be_insn_t be_insn_t;
38 typedef struct be_insn_env_t be_insn_env_t;
41 ir_node *irn; /**< Firm node of the insn this operand belongs to */
42 ir_node *carrier; /**< node representing the operand value (Proj or the node itself for defs, the used value for uses) */
43 be_operand_t *partner; /**< used in bechordal later... (TODO what does it do?) */
44 bitset_t *regs; /**< admissible register bitset */
45 int pos; /**< pos of the operand (0 to n are inputs, -1 to -n are outputs) */
46 const arch_register_req_t *req; /**< register constraints for the carrier node */
47 unsigned has_constraints : 1; /**< the carrier node has register constraints (the constraint type is limited) */
51 be_operand_t *ops; /**< the values used and defined by the insn */
52 int n_ops; /**< length of the ops array */
53 int use_start; /**< entries [0-use_start) in ops are defs,
54 [use_start-n_ops) uses */
55 ir_node *next_insn; /**< next instruction in schedule */
56 ir_node *irn; /**< ir_node of the instruction */
57 unsigned in_constraints : 1; /**< instruction has input constraints */
58 unsigned out_constraints : 1; /**< instruction has output constraints */
59 unsigned has_constraints : 1; /**< in_constraints or out_constraints true */
60 unsigned pre_colored : 1; /**< all defined values already have a register assigned */
63 struct be_insn_env_t {
65 const arch_register_class_t *cls;
66 bitset_t *ignore_colors;
69 #define be_insn_n_defs(insn) ((insn)->use_start)
70 #define be_insn_n_uses(insn) ((insn)->n_ops - (insn)->use_start)
72 be_insn_t *be_scan_insn(const be_insn_env_t *env, ir_node *irn);
74 be_insn_env_t *be_insn_env_init(be_insn_env_t *ie, ir_graph *irg, const arch_register_class_t *cls, struct obstack *obst);
76 #endif /* FIRM_BE_BEINSN_T_H */