libFirm
irop.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1995-2011 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 
26 #ifndef FIRM_IR_IROP_H
27 #define FIRM_IR_IROP_H
28 
29 #include <stdio.h>
30 #include "firm_types.h"
31 #include "ident.h"
32 #include "begin.h"
33 #include "opcodes.h"
34 
47 typedef enum {
48  oparity_invalid = 0,
59 } op_arity;
60 
61 
63 typedef enum {
66  irop_flag_cfopcode = 1U << 1,
67  irop_flag_fragile = 1U << 2,
70  irop_flag_forking = 1U << 3,
71  irop_flag_highlevel = 1U << 4,
73  irop_flag_constlike = 1U << 5,
75  irop_flag_keep = 1U << 6,
79  irop_flag_cse_neutral = 1U << 10,
84 } irop_flags;
86 
87 
88 FIRM_API ident *get_op_ident(const ir_op *op);
89 
91 FIRM_API const char *get_op_name(const ir_op *op);
92 
94 FIRM_API unsigned get_op_code(const ir_op *op);
95 
98 
101 
104 FIRM_API void set_op_pinned(ir_op *op, op_pin_state pinned);
105 
107 FIRM_API unsigned get_next_ir_opcode(void);
108 
110 FIRM_API unsigned get_next_ir_opcodes(unsigned num);
111 
115 typedef void (*op_func)(void);
116 
118 #define NULL_FUNC ((generic_func)(NULL))
119 
124 
129 
134 
139 typedef unsigned (*hash_func)(const ir_node *self);
140 
146 typedef ir_tarval *(*computed_value_func)(const ir_node *self);
147 
156 typedef ir_node *(*equivalent_node_func)(ir_node *self);
157 
166 typedef ir_node *(*transform_node_func)(ir_node *self);
167 
173 typedef int (*node_cmp_attr_func)(const ir_node *a, const ir_node *b);
174 
182 typedef int (*reassociate_func)(ir_node **n);
183 
188 typedef void (*copy_attr_func)(ir_graph *irg, const ir_node *old_node, ir_node *new_node);
189 
195 typedef ir_type *(*get_type_attr_func)(const ir_node *self);
196 
202 typedef ir_entity *(*get_entity_attr_func)(const ir_node *self);
203 
211 typedef int (*verify_node_func)(const ir_node *node);
212 
220 typedef int (*verify_proj_node_func)(const ir_node *proj);
221 
225 typedef enum {
230 } dump_reason_t;
231 
237 typedef void (*dump_node_func)(FILE *out, const ir_node *self, dump_reason_t reason);
238 
242 typedef struct {
258  op_func generic;
262 } ir_op_ops;
263 
281 FIRM_API ir_op *new_ir_op(unsigned code, const char *name, op_pin_state p,
282  irop_flags flags, op_arity opar, int op_index,
283  size_t attr_size);
284 
286 FIRM_API unsigned ir_get_n_opcodes(void);
287 
294 FIRM_API ir_op *ir_get_opcode(unsigned code);
295 
298 
302 FIRM_API void ir_op_set_memory_index(ir_op *op, int memory_index);
303 
308 FIRM_API void ir_op_set_fragile_indices(ir_op *op, int pn_x_regular,
309  int pn_x_except);
310 
313 
316 #include "end.h"
317 
318 #endif