2 * Copyright (C) 1995-2007 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 * File name: ir/ir/irnode_t.h
23 * Purpose: Representation of an intermediate operation -- private header.
24 * Author: Martin Trapp, Christian Schaefer
25 * Modified by: Goetz Lindenmaier, Michael Beck
28 * Copyright: (c) 1998-2003 Universität Karlsruhe
34 * Declarations of an ir node.
36 * @author Martin Trapp, Christian Schaefer
38 #ifndef _FIRM_IRNODE_T_H_
39 #define _FIRM_IRNODE_T_H_
41 #include "firm_config.h"
44 #include "irgraph_t.h"
46 #include "firm_common_t.h"
47 #include "irdom_t.h" /* For size of struct dom_info. */
50 #include "iredgekinds.h"
58 #include "irextbb_t.h"
61 /** ir node attributes **/
63 /** Block attributes */
65 /* General attributes */
66 ir_graph *irg; /**< The graph this block belongs to. */
67 unsigned long block_visited; /**< For the walker that walks over all blocks. */
68 /* Attributes private to construction: */
69 unsigned matured:1; /**< If set, all in-nodes of the block are fixed. */
70 unsigned dead:1; /**< If set, the block is dead (and could be replace by a Bad. */
71 ir_node **graph_arr; /**< An array to store all parameters. */
72 /* Attributes holding analyses information */
73 ir_dom_info dom; /**< Datastructure that holds information about dominators.
75 Eventually overlay with graph_arr as only valid
76 in different phases. Eventually inline the whole
78 ir_dom_info pdom; /**< Datastructure that holds information about post-dominators. */
79 ir_node ** in_cg; /**< array with predecessors in
80 * interprocedural_view, if they differ
81 * from intraprocedural predecessors */
82 int *backedge; /**< Field n set to true if pred n is backedge.
83 @@@ @todo Ev. replace by bit field! */
84 int *cg_backedge; /**< Field n set to true if pred n is interprocedural backedge.
85 @@@ @todo Ev. replace by bit field! */
86 ir_extblk *extblk; /**< The extended basic block this block belongs to. */
87 ir_region *region; /**< The immediate structural region this block belongs to. */
89 struct list_head succ_head; /**< A list head for all successor edges of a block. */
92 /** Cond attributes. */
94 cond_kind kind; /**< flavor of Cond */
95 long default_proj; /**< only for non-binary Conds: biggest Proj number, i.e. the one used for default. */
96 cond_jmp_predicate pred; /**< only for binary Conds: The jump predication. */
99 /** Const attributes. */
101 tarval *tv; /**< the target value */
102 ir_type *tp; /**< the source type, for analyses. default: type_unknown. */
105 /** SymConst attributes. */
107 symconst_symbol sym; // old tori
109 ir_type *tp; /**< the source type, for analyses. default: type_unknown. */
112 /** Sel attributes. */
114 ir_entity *ent; /**< entity to select */
117 /** Exception attributes. */
119 op_pin_state pin_state; /**< the pin state for operations that might generate a exception:
120 If it's know that no exception will be generated, could be set to
121 op_pin_state_floats. */
122 #if PRECISE_EXC_CONTEXT
123 struct ir_node **frag_arr; /**< For Phi node construction in case of exception */
127 /** Call attributes. */
129 except_attr exc; /**< the exception attribute. MUST be the first one. */
130 ir_type *cld_tp; /**< type of called procedure */
131 ir_entity ** callee_arr; /**< result of callee analysis */
134 /** Alloc attributes. */
136 except_attr exc; /**< the exception attribute. MUST be the first one. */
137 ir_type *type; /**< Type of the allocated object. */
138 where_alloc where; /**< stack, heap or other managed part of memory */
141 /** Free attributes. */
143 ir_type *type; /**< Type of the allocated object. */
144 where_alloc where; /**< stack, heap or other managed part of memory */
147 /** InstOf attributes. */
149 except_attr exc; /**< the exception attribute. MUST be the first one. */
150 ir_type *type; /**< the type of which the object pointer must be */
153 /** Filter attributes. */
155 long proj; /**< contains the result position to project (Proj) */
156 ir_node ** in_cg; /**< array with interprocedural predecessors (Phi) */
157 int *backedge; /**< Field n set to true if pred n is backedge.
158 @todo Ev. replace by bitfield! */
161 /** EndReg/EndExcept attributes. */
166 /** CallBegin attributes. */
168 ir_node * call; /**< Associated Call-operation. */
171 /** Cast attributes. */
173 ir_type *totype; /**< Type of the casted node. */
176 /** Load attributes. */
178 except_attr exc; /**< The exception attribute. MUST be the first one. */
179 ir_mode *load_mode; /**< The mode of this Load operation. */
180 ir_volatility volatility; /**< The volatility of a Load/Store operation. */
183 /** Store attributes. */
185 except_attr exc; /**< the exception attribute. MUST be the first one. */
186 ir_volatility volatility; /**< the volatility of a Store operation */
189 typedef pn_Cmp confirm_attr; /**< Attribute to hold compare operation */
191 /** CopyB attribute. */
193 except_attr exc; /**< The exception attribute. MUST be the first one. */
194 ir_type *data_type; /**< Type of the copied entity. */
197 /** Bound attribute. */
199 except_attr exc; /**< The exception attribute. MUST be the first one. */
202 /** Conv attribute. */
204 char strict; /**< If set, this is a strict Conv that cannot be removed. */
207 /** Some IR-nodes just have one attribute, these are stored here,
208 some have more. Their name is 'irnodename_attr' */
210 block_attr block; /**< For Block: Fields needed to construct it */
211 cond_attr cond; /**< For Cond. */
212 const_attr con; /**< For Const: contains the value of the constant and a type */
213 symconst_attr symc; /**< For SymConst. */
214 sel_attr sel; /**< For Sel. */
215 call_attr call; /**< For Call: pointer to the type of the method to call */
216 callbegin_attr callbegin; /**< For CallBegin */
217 alloc_attr alloc; /**< For Alloc. */
218 free_attr free; /**< For Free. */
219 io_attr instof; /**< For InstOf */
220 cast_attr cast; /**< For Cast. */
221 load_attr load; /**< For Load. */
222 store_attr store; /**< For Store. */
223 int phi0_pos; /**< For Phi. Used to remember the value defined by
224 this Phi node. Needed when the Phi is completed
225 to call get_r_internal_value to find the
226 predecessors. If this attribute is set, the Phi
227 node takes the role of the obsolete Phi0 node,
228 therefore the name. */
229 int *phi_backedge; /**< For Phi after construction.
230 Field n set to true if pred n is backedge.
231 @todo Ev. replace by bitfield! */
232 long proj; /**< For Proj: contains the result position to project */
233 confirm_attr confirm_cmp; /**< For Confirm: compare operation */
234 filter_attr filter; /**< For Filter */
235 end_attr end; /**< For EndReg, EndExcept */
236 except_attr except; /**< For Phi node construction in case of exceptions */
237 copyb_attr copyb; /**< For CopyB operation */
238 bound_attr bound; /**< For Bound operation */
239 conv_attr conv; /**< For Conv operation */
243 * Edge info to put into an irn.
245 typedef struct _irn_edge_kind_info_t {
246 struct list_head outs_head; /**< The list of all outs. */
247 int out_count; /**< Number of outs in the list. */
250 typedef irn_edge_info_t irn_edges_info_t[EDGE_KIND_LAST];
253 * The common structure of an irnode.
254 * If the node has some attributes, they are stored in the attr field.
257 /* ------- Basics of the representation ------- */
258 firm_kind kind; /**< Distinguishes this node from others. */
259 ir_op *op; /**< The Opcode of this node. */
260 ir_mode *mode; /**< The Mode of this node. */
261 struct ir_node **in; /**< The array of predecessors / operands. */
262 unsigned long visited; /**< The visited counter for walks of the graph. */
263 unsigned node_idx; /**< The node index of this node in its graph. */
264 void *link; /**< To attach additional information to the node, e.g.
265 used while construction to link Phi0 nodes and
266 during optimization to link to nodes that
267 shall replace a node. */
268 /* ------- Fields for optimizations / analysis information ------- */
269 struct ir_node **out; /**< @deprecated array of out edges. */
270 struct dbg_info *dbi; /**< A pointer to information for debug support. */
271 /* ------- For debugging ------- */
274 long node_nr; /**< A unique node number for each node to make output
277 /* ------- For analyses -------- */
278 ir_loop *loop; /**< the loop the node is in. Access routines in irloop.h */
279 #ifdef DO_HEAPANALYSIS
280 struct abstval *av; /**< Heapanalysis: The abstract value of this node. */
281 struct section *sec; /**< Heapanalysis: The section of this node. */
283 struct ir_node **deps; /**< Additional dependencies induced by state. */
284 irn_edges_info_t edge_info; /**< Everlasting out edges. */
285 /* ------- Opcode depending fields -------- */
286 attr attr; /**< The set of attributes of this node. Depends on opcode.
287 Must be last field of struct ir_node. */
292 * Returns the array with the ins. The content of the array may not be
294 * Note that this function returns the whole in array including the
295 * block predecessor. So, it is NOT symmetric with set_irn_in().
297 ir_node **get_irn_in (const ir_node *node);
300 /** access attributes directly */
301 const_attr get_irn_const_attr (ir_node *node);
302 long get_irn_proj_attr (ir_node *node);
303 alloc_attr get_irn_alloc_attr (ir_node *node);
304 free_attr get_irn_free_attr (ir_node *node);
305 symconst_attr get_irn_symconst_attr (ir_node *node);
306 ir_type *get_irn_call_attr (ir_node *node);
307 ir_type *get_irn_funccall_attr (ir_node *node);
308 sel_attr get_irn_sel_attr (ir_node *node);
309 int get_irn_phi_attr (ir_node *node);
310 block_attr get_irn_block_attr (ir_node *node);
311 load_attr get_irn_load_attr (ir_node *node);
312 store_attr get_irn_store_attr (ir_node *node);
313 except_attr get_irn_except_attr (ir_node *node);
317 * The amount of additional space for custom data to be allocated upon creating a new node.
319 extern unsigned firm_add_node_size;
322 * Sets the get_type operation for an ir_op_ops.
324 * @param code the opcode for the default operation
325 * @param ops the operations initialized
330 ir_op_ops *firm_set_default_get_type(ir_opcode code, ir_op_ops *ops);
333 * Sets the get_type_attr operation for an ir_op_ops.
335 * @param code the opcode for the default operation
336 * @param ops the operations initialized
341 ir_op_ops *firm_set_default_get_type_attr(ir_opcode code, ir_op_ops *ops);
344 * Sets the get_entity_attr operation for an ir_op_ops.
346 * @param code the opcode for the default operation
347 * @param ops the operations initialized
352 ir_op_ops *firm_set_default_get_entity_attr(ir_opcode code, ir_op_ops *ops);
354 /*-------------------------------------------------------------------*/
355 /* These function are most used in libfirm. Give them as static */
356 /* functions so they can be inlined. */
357 /*-------------------------------------------------------------------*/
360 * Checks whether a pointer points to a ir node.
361 * Intern version for libFirm.
364 _is_ir_node(const void *thing) {
365 return (get_kind(thing) == k_ir_node);
369 * Gets the op of a node.
370 * Intern version for libFirm.
372 static INLINE ir_op *
373 _get_irn_op(const ir_node *node) {
379 _set_irn_op(ir_node *node, ir_op *op) {
384 /** Copies all attributes stored in the old node to the new node.
385 Assumes both have the same opcode and sufficient size. */
387 copy_node_attr(const ir_node *old_node, ir_node *new_node) {
388 ir_op *op = _get_irn_op(old_node);
390 /* must always exist */
391 op->ops.copy_attr(old_node, new_node);
395 * Gets the opcode of a node.
396 * Intern version for libFirm.
398 static INLINE ir_opcode
399 _get_irn_opcode(const ir_node *node) {
400 assert(k_ir_node == get_kind(node));
402 return node->op->code;
406 * Returns the number of predecessors without the block predecessor.
407 * Intern version for libFirm.
410 _get_irn_intra_arity(const ir_node *node) {
412 return ARR_LEN(node->in) - 1;
416 * Returns the number of predecessors without the block predecessor.
417 * Intern version for libFirm.
420 _get_irn_inter_arity(const ir_node *node) {
422 if (_get_irn_op(node) == op_Filter) {
423 assert(node->attr.filter.in_cg);
424 return ARR_LEN(node->attr.filter.in_cg) - 1;
425 } else if (_get_irn_op(node) == op_Block && node->attr.block.in_cg) {
426 return ARR_LEN(node->attr.block.in_cg) - 1;
428 return _get_irn_intra_arity(node);
432 * Returns the number of predecessors without the block predecessor.
433 * Intern version for libFirm.
435 extern int (*_get_irn_arity)(const ir_node *node);
438 * Intern version for libFirm.
440 static INLINE ir_node *
441 _get_irn_intra_n(const ir_node *node, int n) {
445 assert(-1 <= n && n < _get_irn_intra_arity(node));
447 nn = node->in[n + 1];
449 /* only block inputs are allowed to be NULL */
450 assert(n == -1 && "NULL input of a node");
453 if (nn->op != op_Id) return nn;
455 return (node->in[n + 1] = skip_Id(nn));
459 * Intern version for libFirm.
461 static INLINE ir_node*
462 _get_irn_inter_n(const ir_node *node, int n) {
463 assert(node); assert(-1 <= n && n < _get_irn_inter_arity(node));
465 /* handle Filter and Block specially */
466 if (_get_irn_op(node) == op_Filter) {
467 assert(node->attr.filter.in_cg);
468 return (node->attr.filter.in_cg[n + 1] = skip_Id(node->attr.filter.in_cg[n + 1]));
469 } else if (_get_irn_op(node) == op_Block && node->attr.block.in_cg) {
470 return (node->attr.block.in_cg[n + 1] = skip_Id(node->attr.block.in_cg[n + 1]));
473 return _get_irn_intra_n(node, n);
477 * Access to the predecessors of a node.
478 * To iterate over the operands iterate from 0 to i < get_irn_arity(),
479 * to iterate including the Block predecessor iterate from i = -1 to
481 * If it is a block, the entry -1 is NULL.
482 * Intern version for libFirm.
484 extern ir_node *(*_get_irn_n)(const ir_node *node, int n);
486 static INLINE int _get_irn_deps(const ir_node *node) {
487 return node->deps ? ARR_LEN(node->deps) : 0;
490 static INLINE ir_node *_get_irn_dep(const ir_node *node, int pos) {
491 assert(node->deps && "dependency array node yet allocated. use add_irn_dep()");
492 assert(pos >= 0 && pos < ARR_LEN(node->deps) && "dependency index out of range");
493 return node->deps[pos];
497 _set_irn_dep(ir_node *node, int pos, ir_node *dep) {
500 assert(node->deps && "dependency array node yet allocated. use add_irn_dep()");
501 assert(pos >= 0 && pos < ARR_LEN(node->deps) && "dependency index out of range");
502 old = node->deps[pos];
503 node->deps[pos] = dep;
504 edges_notify_edge_kind(node, pos, dep, old, EDGE_KIND_DEP, get_irn_irg(node));
509 _get_irn_ins_or_deps(const ir_node *irn) {
510 return _get_irn_deps(irn) + _get_irn_arity(irn);
513 static INLINE ir_node *
514 _get_irn_in_or_dep(const ir_node *irn, int pos) {
515 int n_in = get_irn_arity(irn);
516 return pos < n_in ? get_irn_n(irn, pos) : get_irn_dep(irn, pos - n_in);
520 * Gets the mode of a node.
521 * Intern version for libFirm.
523 static INLINE ir_mode *
524 _get_irn_mode(const ir_node *node) {
530 * Sets the mode of a node.
531 * Intern version of libFirm.
534 _set_irn_mode(ir_node *node, ir_mode *mode) {
540 * Gets the visited counter of a node.
541 * Intern version for libFirm.
543 static INLINE unsigned long
544 _get_irn_visited(const ir_node *node) {
546 return node->visited;
550 * Sets the visited counter of a node.
551 * Intern version for libFirm.
554 _set_irn_visited(ir_node *node, unsigned long visited) {
556 node->visited = visited;
560 * Mark a node as visited in a graph.
561 * Intern version for libFirm.
564 _mark_irn_visited(ir_node *node) {
566 node->visited = current_ir_graph->visited;
570 * Returns non-zero if a node of was visited.
571 * Intern version for libFirm.
574 _irn_visited(const ir_node *node) {
576 return (node->visited >= current_ir_graph->visited);
580 * Returns non-zero if a node of was NOT visited.
581 * Intern version for libFirm.
584 _irn_not_visited(const ir_node *node) {
586 return (node->visited < current_ir_graph->visited);
590 * Sets the link of a node.
591 * Intern version of libFirm.
594 _set_irn_link(ir_node *node, void *link) {
596 /* Link field is used for Phi construction and various optimizations
598 assert(get_irg_phase_state(get_irn_irg(node)) != phase_building);
604 * Returns the link of a node.
605 * Intern version of libFirm.
608 _get_irn_link(const ir_node *node) {
609 assert(node && _is_ir_node(node));
614 * Returns whether the node _always_ must be pinned.
615 * I.e., the node is not floating after global cse.
617 * Intern version of libFirm.
619 static INLINE op_pin_state
620 _get_irn_pinned(const ir_node *node) {
622 assert(node && _is_ir_node(node));
624 state = _get_op_pinned(_get_irn_op(node));
626 if (state >= op_pin_state_exc_pinned)
627 return get_opt_fragile_ops() ? node->attr.except.pin_state : op_pin_state_pinned;
631 static INLINE op_pin_state
632 _is_irn_pinned_in_irg(const ir_node *node) {
633 if (get_irg_pinned(get_irn_irg(node)) == op_pin_state_floats)
634 return get_irn_pinned(node);
635 return op_pin_state_pinned;
639 _is_unop(const ir_node *node) {
640 assert(node && _is_ir_node(node));
641 return (node->op->opar == oparity_unary);
645 _is_binop(const ir_node *node) {
646 assert(node && _is_ir_node(node));
647 return (node->op->opar == oparity_binary);
651 _is_Bad(const ir_node *node) {
653 return (_get_irn_op(node) == op_Bad);
657 _is_NoMem(const ir_node *node) {
659 return (_get_irn_op(node) == op_NoMem);
663 _is_Mod(const ir_node *node) {
665 return (_get_irn_op(node) == op_Mod);
669 _is_Div(const ir_node *node) {
671 return (_get_irn_op(node) == op_Div);
675 _is_DivMod(const ir_node *node) {
677 return (_get_irn_op(node) == op_DivMod);
681 _is_Quot(const ir_node *node) {
683 return (_get_irn_op(node) == op_Quot);
687 _is_Start(const ir_node *node) {
689 return (_get_irn_op(node) == op_Start);
693 _is_End(const ir_node *node) {
695 return (_get_irn_op(node) == op_End);
699 _is_Const(const ir_node *node) {
701 return (_get_irn_op(node) == op_Const);
705 _is_CopyB(const ir_node *node) {
707 return (_get_irn_op(node) == op_CopyB);
711 _is_Unknown(const ir_node *node) {
713 return (_get_irn_op(node) == op_Unknown);
717 _is_Return(const ir_node *node) {
719 return (_get_irn_op(node) == op_Return);
723 _is_Call(const ir_node *node) {
725 return (_get_irn_op(node) == op_Call);
729 _is_Sel(const ir_node *node) {
731 return (_get_irn_op(node) == op_Sel);
735 _is_Mux(const ir_node *node) {
738 ir_op *op = _get_irn_op(node);
739 return (op == op_Mux || ((op == op_Psi) && _get_irn_arity(node) == 3));
745 _is_Load(const ir_node *node) {
747 return (_get_irn_op(node) == op_Load);
751 _is_Store(const ir_node *node) {
753 return (_get_irn_op(node) == op_Store);
757 _is_Sync(const ir_node *node) {
759 return (_get_irn_op(node) == op_Sync);
763 _is_Confirm(const ir_node *node) {
765 return (_get_irn_op(node) == op_Confirm);
769 _is_Pin(const ir_node *node) {
771 return (_get_irn_op(node) == op_Pin);
775 _is_SymConst(const ir_node *node) {
777 return (_get_irn_op(node) == op_SymConst);
781 _is_Cond(const ir_node *node) {
783 return (_get_irn_op(node) == op_Cond);
787 _is_Cmp(const ir_node *node) {
789 return (_get_irn_op(node) == op_Cmp);
793 _is_Alloc(const ir_node *node) {
795 return (_get_irn_op(node) == op_Alloc);
799 _is_Jmp(const ir_node *node) {
801 return (_get_irn_op(node) == op_Jmp);
805 _is_Raise(const ir_node *node) {
807 return (_get_irn_op(node) == op_Raise);
811 _is_no_Block(const ir_node *node) {
812 assert(node && _is_ir_node(node));
813 return (_get_irn_op(node) != op_Block);
817 _is_Block(const ir_node *node) {
818 assert(node && _is_ir_node(node));
819 return (_get_irn_op(node) == op_Block);
823 _get_Block_n_cfgpreds(const ir_node *node) {
824 assert(_is_Block(node));
825 return _get_irn_arity(node);
828 static INLINE ir_node *
829 _get_Block_cfgpred(ir_node *node, int pos) {
830 assert(0 <= pos && pos < get_irn_arity(node));
831 assert(_is_Block(node));
832 return _get_irn_n(node, pos);
835 /* Get the predecessor block.
837 * Returns the block corresponding to the predecessor pos.
839 * There are several ambiguities we resolve with this function:
840 * - The direct predecessor can be a Proj, which is not pinned.
841 * We walk from the predecessor to the next pinned node
842 * (skip_Proj) and return the block that node is in.
843 * - If we encounter the Bad node, this function does not return
844 * Start, but the Bad node.
846 static INLINE ir_node *
847 _get_Block_cfgpred_block(ir_node *node, int pos) {
848 ir_node *res = skip_Proj(get_Block_cfgpred(node, pos));
850 res = get_nodes_block(res);
854 static INLINE unsigned long
855 _get_Block_block_visited(const ir_node *node) {
856 assert(node->op == op_Block);
857 return node->attr.block.block_visited;
861 _set_Block_block_visited(ir_node *node, unsigned long visit) {
862 assert(node->op == op_Block);
863 node->attr.block.block_visited = visit;
866 /* For this current_ir_graph must be set. */
868 _mark_Block_block_visited(ir_node *node) {
869 assert(node->op == op_Block);
870 node->attr.block.block_visited = get_irg_block_visited(current_ir_graph);
874 _Block_not_block_visited(const ir_node *node) {
875 assert(node->op == op_Block);
876 return (node->attr.block.block_visited < get_irg_block_visited(current_ir_graph));
880 _Block_block_visited(const ir_node *node) {
881 assert(node->op == op_Block);
882 return (node->attr.block.block_visited >= get_irg_block_visited(current_ir_graph));
885 static INLINE ir_node *
886 _set_Block_dead(ir_node *block) {
887 assert(_get_irn_op(block) == op_Block);
888 block->attr.block.dead = 1;
893 _is_Block_dead(const ir_node *block) {
894 ir_op *op = _get_irn_op(block);
899 assert(op == op_Block);
900 return block->attr.block.dead;
904 static INLINE tarval *_get_Const_tarval(ir_node *node) {
905 assert(_get_irn_op(node) == op_Const);
906 return node->attr.con.tv;
909 static INLINE cnst_classify_t _classify_Const(ir_node *node) {
911 assert(_is_ir_node(node));
913 op = _get_irn_op(node);
916 return classify_tarval(_get_Const_tarval(node));
917 else if(op == op_SymConst)
918 return CNST_SYMCONST;
920 return CNST_NO_CONST;
923 static INLINE int _is_irn_forking(const ir_node *node) {
924 return is_op_forking(_get_irn_op(node));
927 static INLINE ir_type *_get_irn_type(ir_node *node) {
928 return _get_irn_op(node)->ops.get_type(node);
931 static INLINE ir_type *_get_irn_type_attr(ir_node *node) {
932 return _get_irn_op(node)->ops.get_type_attr(node);
935 static INLINE ir_entity *_get_irn_entity_attr(ir_node *node) {
936 return _get_irn_op(node)->ops.get_entity_attr(node);
939 static INLINE int _is_irn_constlike(const ir_node *node) {
940 return is_op_constlike(_get_irn_op(node));
943 static INLINE int _is_irn_always_opt(const ir_node *node) {
944 return is_op_always_opt(_get_irn_op(node));
947 static INLINE int _is_irn_keep(const ir_node *node) {
948 return is_op_keep(_get_irn_op(node));
951 static INLINE int _is_irn_start_block_placed(const ir_node *node) {
952 return is_op_start_block_placed(_get_irn_op(node));
955 static INLINE int _is_irn_machine_op(const ir_node *node) {
956 return is_op_machine(_get_irn_op(node));
959 static INLINE int _is_irn_machine_operand(const ir_node *node) {
960 return is_op_machine_operand(_get_irn_op(node));
963 static INLINE int _is_irn_machine_user(const ir_node *node, unsigned n) {
964 return is_op_machine_user(_get_irn_op(node), n);
967 static INLINE cond_jmp_predicate _get_Cond_jmp_pred(ir_node *node) {
968 assert(_get_irn_op(node) == op_Cond);
969 return node->attr.cond.pred;
972 static INLINE void _set_Cond_jmp_pred(ir_node *node, cond_jmp_predicate pred) {
973 assert(_get_irn_op(node) == op_Cond);
974 node->attr.cond.pred = pred;
977 static INLINE int _get_Psi_n_conds(ir_node *node) {
978 assert(_get_irn_op(node) == op_Psi);
979 return _get_irn_arity(node) >> 1;
982 static INLINE unsigned _get_irn_idx(const ir_node *node) {
983 return node->node_idx;
986 /* this section MUST contain all inline functions */
987 #define is_ir_node(thing) _is_ir_node(thing)
988 #define get_irn_intra_arity(node) _get_irn_intra_arity(node)
989 #define get_irn_inter_arity(node) _get_irn_inter_arity(node)
990 #define get_irn_arity(node) _get_irn_arity(node)
991 #define get_irn_intra_n(node, n) _get_irn_intra_n(node, n)
992 #define get_irn_inter_n(node, n) _get_irn_inter_n(node, n)
993 #define get_irn_n(node, n) _get_irn_n(node, n)
994 #define get_irn_mode(node) _get_irn_mode(node)
995 #define set_irn_mode(node, mode) _set_irn_mode(node, mode)
996 #define get_irn_op(node) _get_irn_op(node)
997 #define set_irn_op(node, op) _set_irn_op(node, op)
998 #define get_irn_opcode(node) _get_irn_opcode(node)
999 #define get_irn_visited(node) _get_irn_visited(node)
1000 #define set_irn_visited(node, v) _set_irn_visited(node, v)
1001 #define mark_irn_visited(node) _mark_irn_visited(node)
1002 #define irn_visited(node) _irn_visited(node)
1003 #define irn_not_visited(node) _irn_not_visited(node)
1004 #define set_irn_link(node, link) _set_irn_link(node, link)
1005 #define get_irn_link(node) _get_irn_link(node)
1006 #define get_irn_pinned(node) _get_irn_pinned(node)
1007 #define is_irn_pinned_in_irg(node) _is_irn_pinned_in_irg(node)
1008 #define is_unop(node) _is_unop(node)
1009 #define is_binop(node) _is_binop(node)
1010 #define is_Const(node) _is_Const(node)
1011 #define is_Unknown(node) _is_Unknown(node)
1012 #define is_Return(node) _is_Return(node)
1013 #define is_Call(node) _is_Call(node)
1014 #define is_Sel(node) _is_Sel(node)
1015 #define is_Mux(node) _is_Mux(node)
1016 #define is_Load(node) _is_Load(node)
1017 #define is_Sync(node) _is_Sync(node)
1018 #define is_Confirm(node) _is_Confirm(node)
1019 #define is_Pin(node) _is_Pin(node)
1020 #define is_SymConst(node) _is_SymConst(node)
1021 #define is_Cond(node) _is_Cond(node)
1022 #define is_CopyB(node) _is_CopyB(node)
1023 #define is_Cmp(node) _is_Cmp(node)
1024 #define is_Alloc(node) _is_Alloc(node)
1025 #define is_Jmp(node) _is_Jmp(node)
1026 #define is_Raise(node) _is_Raise(node)
1027 #define is_Bad(node) _is_Bad(node)
1028 #define is_NoMem(node) _is_NoMem(node)
1029 #define is_Start(node) _is_Start(node)
1030 #define is_End(node) _is_End(node)
1031 #define is_Mod(node) _is_Mod(node)
1032 #define is_Div(node) _is_Div(node)
1033 #define is_DivMod(node) _is_DivMod(node)
1034 #define is_Quot(node) _is_Quot(node)
1035 #define is_no_Block(node) _is_no_Block(node)
1036 #define is_Block(node) _is_Block(node)
1037 #define get_Block_n_cfgpreds(node) _get_Block_n_cfgpreds(node)
1038 #define get_Block_cfgpred(node, pos) _get_Block_cfgpred(node, pos)
1039 #define get_Block_cfgpred_block(node, pos) _get_Block_cfgpred_block(node, pos)
1040 #define get_Block_block_visited(node) _get_Block_block_visited(node)
1041 #define set_Block_block_visited(node, visit) _set_Block_block_visited(node, visit)
1042 #define mark_Block_block_visited(node) _mark_Block_block_visited(node)
1043 #define Block_not_block_visited(node) _Block_not_block_visited(node)
1044 #define Block_block_visited(node) _Block_block_visited(node)
1045 #define set_Block_dead(block) _set_Block_dead(block)
1046 #define is_Block_dead(block) _is_Block_dead(block)
1047 #define get_Const_tarval(node) _get_Const_tarval(node)
1048 #define classify_Const(node) _classify_Const(node)
1049 #define is_irn_forking(node) _is_irn_forking(node)
1050 #define get_irn_type(node) _get_irn_type(node)
1051 #define get_irn_type_attr(node) _get_irn_type_attr(node)
1052 #define get_irn_entity_attr(node) _get_irn_entity_attr(node)
1053 #define is_irn_constlike(node) _is_irn_constlike(node)
1054 #define is_irn_always_opt(node) _is_irn_always_opt(node)
1055 #define is_irn_keep(node) _is_irn_keep(node)
1056 #define is_irn_start_block_placed(node) _is_irn_start_block_placed(node)
1057 #define is_irn_machine_op(node) _is_irn_machine_op(node)
1058 #define is_irn_machine_operand(node) _is_irn_machine_operand(node)
1059 #define is_irn_machine_user(node, n) _is_irn_machine_user(node, n)
1060 #define get_Cond_jmp_pred(node) _get_Cond_jmp_pred(node)
1061 #define set_Cond_jmp_pred(node, pred) _set_Cond_jmp_pred(node, pred)
1062 #define get_Psi_n_conds(node) _get_Psi_n_conds(node)
1063 #define get_irn_idx(node) _get_irn_idx(node)
1065 #define get_irn_deps(node) _get_irn_deps(node)
1066 #define set_irn_dep(node, pos, dep) _set_irn_dep(node, pos, dep)
1067 #define get_irn_dep(node, pos) _get_irn_dep(node, pos)
1069 #define get_irn_ins_or_deps(node) _get_irn_ins_or_deps(node)
1070 #define get_irn_in_or_dep(node, pos) _get_irn_in_or_dep(node, pos)
1072 #endif /* _FIRM_IRNODE_T_H_ */