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 Representation of opcode of intermediate operation -- private header.
23 * @author Christian Schaefer, Goetz Lindenmaier, Michael Beck
25 #ifndef FIRM_IR_IROP_T_H
26 #define FIRM_IR_IROP_T_H
35 #define get_op_code(op) get_op_code_(op)
36 #define get_op_ident(op) get_op_ident_(op)
37 #define get_op_pinned(op) get_op_pinned_(op)
38 #define get_op_ops(op) get_op_ops_(op)
39 #define set_op_tag(op, tag) set_op_tag_((op), (tag))
40 #define get_op_tag(op) get_op_tag_(op)
41 #define set_op_attr(op, attr) set_op_attr_((op), (attr))
42 #define get_op_attr(op) get_op_attr_(op)
45 * Frees a newly created ir operation.
47 void free_ir_op(ir_op *code);
49 /** Initialize the irop module. */
50 void firm_init_op(void);
52 /** frees memory allocated by irop module */
53 void firm_finish_op(void);
56 * Returns the attribute size of nodes of this opcode.
57 * @note Use not encouraged, internal feature.
59 static inline size_t get_op_attr_size (const ir_op *op)
65 * Returns non-zero if op is a control flow opcode,
66 * like Start, End, Jmp, Cond, Return, Raise or Bad.
68 static inline bool is_op_cfopcode(const ir_op *op)
70 return op->flags & irop_flag_cfopcode;
73 static inline bool is_op_unknown_jump(const ir_op *op)
75 return op->flags & irop_flag_unknown_jump;
78 /** Returns non-zero if operation is commutative */
79 static inline bool is_op_commutative(const ir_op *op)
81 return op->flags & irop_flag_commutative;
84 /** Returns non-zero if operation is fragile */
85 static inline bool is_op_fragile(const ir_op *op)
87 return op->flags & irop_flag_fragile;
90 /** Returns non-zero if operation is forking control flow */
91 static inline bool is_op_forking(const ir_op *op)
93 return op->flags & irop_flag_forking;
96 /** Returns non-zero if operation is a high-level op */
97 static inline bool is_op_highlevel(const ir_op *op)
99 return op->flags & irop_flag_highlevel;
102 /** Returns non-zero if operation is a const-like op */
103 static inline bool is_op_constlike(const ir_op *op)
105 return op->flags & irop_flag_constlike;
108 static inline bool is_op_uses_memory(const ir_op *op)
110 return op->flags & irop_flag_uses_memory;
113 /** Returns non-zero if operation is a keep-like op */
114 static inline bool is_op_keep(const ir_op *op)
116 return op->flags & irop_flag_keep;
119 /** Returns non-zero if operation must always be placed in the start block. */
120 static inline bool is_op_start_block_placed(const ir_op *op)
122 return op->flags & irop_flag_start_block;
125 /** Returns non-zero if operation is CSE neutral */
126 static inline bool is_op_cse_neutral(const ir_op *op)
128 return op->flags & irop_flag_cse_neutral;
131 static inline unsigned get_op_code_(const ir_op *op)
136 static inline ident *get_op_ident_(const ir_op *op)
141 static inline op_pin_state get_op_pinned_(const ir_op *op)
143 return op->pin_state;
146 static inline void set_generic_function_ptr_(ir_op *op, op_func func)
148 op->ops.generic = func;
151 static inline op_func get_generic_function_ptr_(const ir_op *op)
153 return op->ops.generic;
156 static inline ir_op_ops *get_op_ops_(ir_op *op)
161 static inline void set_op_tag_(ir_op *op, unsigned tag)
166 static inline unsigned get_op_tag_(const ir_op *op)
171 static inline void set_op_attr_(ir_op *op, void *attr)
176 static inline void *get_op_attr_(const ir_op *op)