remove unused op_machine, op_machine_op stuff
[libfirm] / ir / ir / irop_t.h
1 /*
2  * Copyright (C) 1995-2008 University of Karlsruhe.  All right reserved.
3  *
4  * This file is part of libFirm.
5  *
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.
10  *
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.
14  *
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
17  * PURPOSE.
18  */
19
20 /**
21  * @file
22  * @brief    Representation of opcode of intermediate operation -- private header.
23  * @author   Christian Schaefer, Goetz Lindenmaier, Michael Beck
24  */
25 #ifndef FIRM_IR_IROP_T_H
26 #define FIRM_IR_IROP_T_H
27
28 #include "irop.h"
29
30 #include <stdbool.h>
31
32 #include "irtypes.h"
33 #include "tv.h"
34
35 /**
36  * Frees a newly created ir operation.
37  */
38 void free_ir_op(ir_op *code);
39
40 /** Initialize the irop module. */
41 void init_op(void);
42
43 /** Free memory used by irop module. */
44 void finish_op(void);
45
46 /**
47  * Copies simply all attributes stored in the old node to the new node.
48  * Assumes both have the same opcode and sufficient size.
49  *
50  * @param old_node  the old node from which the attributes are read
51  * @param new_node  the new node to which the attributes are written
52  */
53 void default_copy_attr(ir_graph *irg, const ir_node *old_node,
54                        ir_node *new_node);
55
56 /**
57  * Returns the attribute size of nodes of this opcode.
58  * @note Use not encouraged, internal feature.
59  */
60 static inline size_t get_op_attr_size (const ir_op *op)
61 {
62         return op->attr_size;
63 }
64
65 /**
66  * Returns non-zero if op is a control flow opcode,
67  * like Start, End, Jmp, Cond, Return, Raise or Bad.
68  */
69 static inline bool is_op_cfopcode(const ir_op *op)
70 {
71         return op->flags & irop_flag_cfopcode;
72 }
73
74 static inline bool is_op_unknown_jump(const ir_op *op)
75 {
76         return op->flags & irop_flag_unknown_jump;
77 }
78
79 /** Returns non-zero if operation is commutative */
80 static inline bool is_op_commutative(const ir_op *op)
81 {
82         return op->flags & irop_flag_commutative;
83 }
84
85 /** Returns non-zero if operation is fragile */
86 static inline bool is_op_fragile(const ir_op *op)
87 {
88         return op->flags & irop_flag_fragile;
89 }
90
91 /** Returns non-zero if operation is forking control flow */
92 static inline bool is_op_forking(const ir_op *op)
93 {
94         return op->flags & irop_flag_forking;
95 }
96
97 /** Returns non-zero if operation is a high-level op */
98 static inline bool is_op_highlevel(const ir_op *op)
99 {
100         return op->flags & irop_flag_highlevel;
101 }
102
103 /** Returns non-zero if operation is a const-like op */
104 static inline bool is_op_constlike(const ir_op *op)
105 {
106         return op->flags & irop_flag_constlike;
107 }
108
109 static inline bool is_op_uses_memory(const ir_op *op)
110 {
111         return op->flags & irop_flag_uses_memory;
112 }
113
114 /** Returns non-zero if operation must always be optimized */
115 static inline bool is_op_always_opt(const ir_op *op)
116 {
117         return op->flags & irop_flag_always_opt;
118 }
119
120 /** Returns non-zero if operation is a keep-like op */
121 static inline bool is_op_keep(const ir_op *op)
122 {
123         return op->flags & irop_flag_keep;
124 }
125
126 /** Returns non-zero if operation must always be placed in the start block. */
127 static inline bool is_op_start_block_placed(const ir_op *op)
128 {
129         return op->flags & irop_flag_start_block;
130 }
131
132 /** Returns non-zero if operation is CSE neutral */
133 static inline bool is_op_cse_neutral(const ir_op *op)
134 {
135         return op->flags & irop_flag_cse_neutral;
136 }
137
138 static inline unsigned get_op_code_(const ir_op *op)
139 {
140         return op->code;
141 }
142
143 static inline ident *get_op_ident_(const ir_op *op)
144 {
145         return op->name;
146 }
147
148 static inline op_pin_state get_op_pinned_(const ir_op *op)
149 {
150         return op->pin_state;
151 }
152
153 static inline void set_generic_function_ptr_(ir_op *op, op_func func)
154 {
155         op->ops.generic = func;
156 }
157
158 static inline op_func get_generic_function_ptr_(const ir_op *op)
159 {
160         return op->ops.generic;
161 }
162
163 static inline const ir_op_ops *get_op_ops_(const ir_op *op)
164 {
165         return &op->ops;
166 }
167
168 static inline void set_op_tag_(ir_op *op, unsigned tag)
169 {
170         op->tag = tag;
171 }
172
173 static inline unsigned get_op_tag_(const ir_op *op)
174 {
175         return op->tag;
176 }
177
178 static inline void set_op_attr_(ir_op *op, void *attr)
179 {
180         op->attr = attr;
181 }
182
183 static inline void *get_op_attr_(const ir_op *op)
184 {
185         return op->attr;
186 }
187
188 #define get_op_code(op)         get_op_code_(op)
189 #define get_op_ident(op)        get_op_ident_(op)
190 #define get_op_pinned(op)       get_op_pinned_(op)
191 #define get_op_ops(op)          get_op_ops_(op)
192 #define set_op_tag(op, tag)     set_op_tag_((op), (tag))
193 #define get_op_tag(op)          get_op_tag_(op)
194 #define set_op_attr(op, attr)   set_op_attr_((op), (attr))
195 #define get_op_attr(op)         get_op_attr_(op)
196
197 #endif