libFirm
irnode.h
Go to the documentation of this file.
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 
25 #ifndef FIRM_IR_IRNODE_H
26 #define FIRM_IR_IRNODE_H
27 
28 #include <stddef.h>
29 
30 #include "firm_common.h"
31 #include "typerep.h"
32 #include "irop.h"
33 #include "irmode.h"
34 #include "begin.h"
35 #include "nodeops.h"
36 
67 FIRM_API int is_ir_node(const void *thing);
68 
74 FIRM_API int get_irn_arity(const ir_node *node);
75 
80 FIRM_API ir_node *get_irn_n(const ir_node *node, int n);
81 
89 FIRM_API void set_irn_in(ir_node *node, int arity, ir_node *in[]);
90 
97 FIRM_API void add_irn_dep(ir_node *node, ir_node *dep);
98 
106 FIRM_API void add_irn_deps(ir_node *tgt, ir_node *src);
107 
113 FIRM_API int get_irn_deps(const ir_node *node);
114 
121 FIRM_API ir_node *get_irn_dep(const ir_node *node, int pos);
122 
129 FIRM_API void set_irn_dep(ir_node *node, int pos, ir_node *dep);
130 
138 FIRM_API void delete_irn_dep(ir_node *node, ir_node *dep);
139 
141 FIRM_API void set_irn_n(ir_node *node, int n, ir_node *in);
147 FIRM_API int add_irn_n(ir_node *node, ir_node *in);
149 FIRM_API void set_irn_mode(ir_node *node, ir_mode *mode);
151 FIRM_API ir_mode *get_irn_mode(const ir_node *node);
153 FIRM_API ir_op *get_irn_op(const ir_node *node);
155 FIRM_API void set_irn_op(ir_node *node, ir_op *op);
157 FIRM_API unsigned get_irn_opcode(const ir_node *node);
159 FIRM_API const char *get_irn_opname(const ir_node *node);
161 FIRM_API ident *get_irn_opident(const ir_node *node);
165 FIRM_API void set_irn_visited(ir_node *node, ir_visited_t visited);
167 FIRM_API void mark_irn_visited(ir_node *node);
169 FIRM_API int irn_visited(const ir_node *node);
173 
178 FIRM_API void set_irn_link(ir_node *node, void *link);
179 
181 FIRM_API void *get_irn_link(const ir_node *node);
182 
184 FIRM_API ir_graph *get_irn_irg(const ir_node *node);
185 
189 FIRM_API long get_irn_node_nr(const ir_node *node);
190 
199 
201 FIRM_API void set_irn_pinned(ir_node *node, op_pin_state state);
202 
210 
226  ir_op *op, ir_mode *mode,
227  int arity, ir_node *const *in);
228 
246 
248 FIRM_API void set_nodes_block(ir_node *node, ir_node *block);
249 
251 FIRM_API int get_Block_n_cfgpreds(const ir_node *block);
253 FIRM_API ir_node *get_Block_cfgpred(const ir_node *block, int pos);
255 FIRM_API void set_Block_cfgpred(ir_node *block, int pos, ir_node *pred);
256 
266 FIRM_API int get_Block_cfgpred_pos(const ir_node *block, const ir_node *pred);
267 
279 FIRM_API ir_node *get_Block_cfgpred_block(const ir_node *node, int pos);
280 
282 FIRM_API int get_Block_matured(const ir_node *block);
284 FIRM_API void set_Block_matured(ir_node *block, int matured);
285 
291 
295 FIRM_API int Block_block_visited(const ir_node *node);
296 
298 FIRM_API ir_graph *get_Block_irg(const ir_node *block);
302 FIRM_API ir_node *get_Block_phis(const ir_node *block);
304 FIRM_API void set_Block_phis(ir_node *block, ir_node *phi);
306 FIRM_API void add_Block_phi(ir_node *block, ir_node *phi);
308 FIRM_API unsigned get_Block_mark(const ir_node *block);
310 FIRM_API void set_Block_mark(ir_node *block, unsigned mark);
311 
319 
325 FIRM_API int get_End_n_keepalives(const ir_node *end);
327 FIRM_API ir_node *get_End_keepalive(const ir_node *end, int pos);
329 FIRM_API void add_End_keepalive(ir_node *end, ir_node *ka);
331 FIRM_API void set_End_keepalive(ir_node *end, int pos, ir_node *ka);
332 
338 FIRM_API void set_End_keepalives(ir_node *end, int n, ir_node *in[]);
339 
342 
345 
350 FIRM_API void free_End(ir_node *end);
351 
361 FIRM_API size_t get_Return_n_ress(const ir_node *node);
363 FIRM_API ir_node *get_Return_res(const ir_node *node, int pos);
365 FIRM_API void set_Return_res(ir_node *node, int pos, ir_node *res);
366 
374 FIRM_API int is_Const_null(const ir_node *node);
375 
377 FIRM_API int is_Const_one(const ir_node *node);
378 
380 FIRM_API int is_Const_all_one(const ir_node *node);
381 
392 FIRM_API int is_SymConst_addr_ent(const ir_node *node);
393 
395 #define SYMCONST_HAS_TYPE(kind) ((kind) <= symconst_type_align)
396 
398 #define SYMCONST_HAS_ENT(kind) ((kind) == symconst_addr_ent || (kind) == symconst_ofs_ent)
399 
401 #define SYMCONST_HAS_ENUM(kind) ((kind) == symconst_enum_const)
402 
407 
413 FIRM_API void set_SymConst_type(ir_node *node, ir_type *tp);
414 
421 
428 
432 FIRM_API void set_SymConst_symbol(ir_node *node, union symconst_symbol sym);
433 
443 FIRM_API int get_Sel_n_indexs(const ir_node *node);
445 FIRM_API ir_node *get_Sel_index(const ir_node *node, int pos);
447 FIRM_API void set_Sel_index(ir_node *node, int pos, ir_node *index);
448 
458 FIRM_API int get_Call_n_params(const ir_node *node);
460 FIRM_API ir_node *get_Call_param(const ir_node *node, int pos);
462 FIRM_API void set_Call_param(ir_node *node, int pos, ir_node *param);
463 
481 FIRM_API int Call_has_callees(const ir_node *node);
483 FIRM_API size_t get_Call_n_callees(const ir_node *node);
485 FIRM_API ir_entity *get_Call_callee(const ir_node *node, size_t pos);
486 
490 FIRM_API void set_Call_callee_arr(ir_node *node, size_t n, ir_entity **arr);
493 
503 FIRM_API int get_Builtin_n_params(const ir_node *node);
505 FIRM_API ir_node *get_Builtin_param(const ir_node *node, int pos);
507 FIRM_API void set_Builtin_param(ir_node *node, int pos, ir_node *param);
508 
513 
517 FIRM_API int is_unop(const ir_node *node);
519 FIRM_API ir_node *get_unop_op(const ir_node *node);
521 FIRM_API void set_unop_op(ir_node *node, ir_node *op);
522 
526 FIRM_API int is_binop(const ir_node *node);
528 FIRM_API ir_node *get_binop_left(const ir_node *node);
530 FIRM_API void set_binop_left(ir_node *node, ir_node *left);
534 FIRM_API void set_binop_right(ir_node *node, ir_node *right);
535 
539 FIRM_API int is_x_except_Proj(const ir_node *node);
540 
544 FIRM_API int is_x_regular_Proj(const ir_node *node);
545 
550 FIRM_API void ir_set_throws_exception(ir_node *node, int throws_exception);
551 
553 FIRM_API int ir_throws_exception(const ir_node *node);
554 
556 FIRM_API const char *get_relation_string(ir_relation relation);
557 
560 
563 
576 FIRM_API int is_Cast_upcast(ir_node *node);
577 
586 
601 FIRM_API int get_Phi_n_preds(const ir_node *node);
607 FIRM_API ir_node *get_Phi_pred(const ir_node *node, int pos);
611 FIRM_API void set_Phi_pred(ir_node *node, int pos, ir_node *pred);
615 FIRM_API ir_node *get_Phi_next(const ir_node *phi);
619 FIRM_API void set_Phi_next(ir_node *phi, ir_node *next);
620 
628 FIRM_API int is_memop(const ir_node *node);
632 FIRM_API ir_node *get_memop_mem(const ir_node *node);
636 FIRM_API void set_memop_mem(ir_node *node, ir_node *mem);
637 
645 FIRM_API int get_Sync_n_preds(const ir_node *node);
647 FIRM_API ir_node *get_Sync_pred(const ir_node *node, int pos);
649 FIRM_API void set_Sync_pred(ir_node *node, int pos, ir_node *pred);
651 FIRM_API void add_Sync_pred(ir_node *node, ir_node *pred);
653 FIRM_API void del_Sync_n(ir_node *n, int i);
654 
662 FIRM_API int is_arg_Proj(const ir_node *node);
663 
671 FIRM_API int get_Tuple_n_preds(const ir_node *node);
673 FIRM_API ir_node *get_Tuple_pred(const ir_node *node, int pos);
675 FIRM_API void set_Tuple_pred(ir_node *node, int pos, ir_node *pred);
676 
684 FIRM_API int get_ASM_n_inputs(const ir_node *node);
686 FIRM_API ir_node *get_ASM_input(const ir_node *node, int pos);
688 FIRM_API size_t get_ASM_n_output_constraints(const ir_node *node);
690 FIRM_API size_t get_ASM_n_clobbers(const ir_node *node);
691 
697 FIRM_API const ir_node *skip_Proj_const(const ir_node *node);
705 FIRM_API const ir_node *skip_Cast_const(const ir_node *node);
713 FIRM_API int is_cfop(const ir_node *node);
716 FIRM_API int is_unknown_jump(const ir_node *node);
717 
723 FIRM_API int is_fragile_op(const ir_node *node);
724 
727 FIRM_API int is_irn_forking(const ir_node *node);
728 
742 FIRM_API void copy_node_attr(ir_graph *irg, const ir_node *old_node, ir_node *new_node);
743 
747 
750 
752 FIRM_API int is_irn_constlike(const ir_node *node);
753 
758 FIRM_API int is_irn_keep(const ir_node *node);
759 
764 
768 FIRM_API int is_irn_cse_neutral(const ir_node *node);
769 
772 
782 FIRM_API const void *get_irn_generic_attr_const(const ir_node *node);
783 
789 FIRM_API unsigned get_irn_idx(const ir_node *node);
790 
798 
805 
809 FIRM_API const char *gdb_node_helper(void *firm_object);
810 
820 FIRM_API ir_switch_table *ir_new_switch_table(ir_graph *irg, size_t n_entries);
821 
826 
835 FIRM_API void ir_switch_table_set(ir_switch_table *table, size_t entry,
836  ir_tarval *min, ir_tarval *max, long pn);
837 
840  size_t entry);
841 
844  size_t entry);
845 
847 FIRM_API long ir_switch_table_get_pn(const ir_switch_table *table, size_t entry);
848 
855 #include "end.h"
856 
857 #endif