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 * @brief Representation of an intermediate operation -- private header.
23 * @author Martin Trapp, Christian Schaefer, Goetz Lindenmaier, Michael Beck
26 #ifndef FIRM_IR_IRNODE_T_H
27 #define FIRM_IR_IRNODE_T_H
29 #include "firm_config.h"
32 #include "irgraph_t.h"
34 #include "firm_common_t.h"
35 #include "irdom_t.h" /* For size of struct dom_info. */
38 #include "iredgekinds.h"
46 #include "irextbb_t.h"
49 /** ir node attributes **/
51 /** Block attributes */
53 /* General attributes */
54 ir_graph *irg; /**< The graph this block belongs to. */
55 unsigned long block_visited; /**< For the walker that walks over all blocks. */
56 /* Attributes private to construction: */
57 unsigned is_matured:1; /**< If set, all in-nodes of the block are fixed. */
58 unsigned is_dead:1; /**< If set, the block is dead (and could be replace by a Bad. */
59 unsigned is_mb_head:1; /**< Set if this block is a macroblock head. */
60 ir_node **graph_arr; /**< An array to store all parameters. */
61 /* Attributes holding analyses information */
62 ir_dom_info dom; /**< Datastructure that holds information about dominators.
64 Eventually overlay with graph_arr as only valid
65 in different phases. Eventually inline the whole
67 ir_dom_info pdom; /**< Datastructure that holds information about post-dominators. */
68 ir_node ** in_cg; /**< array with predecessors in
69 * interprocedural_view, if they differ
70 * from intraprocedural predecessors */
71 int *backedge; /**< Field n set to true if pred n is backedge.
72 @@@ @todo Ev. replace by bit field! */
73 int *cg_backedge; /**< Field n set to true if pred n is interprocedural backedge.
74 @@@ @todo Ev. replace by bit field! */
75 ir_extblk *extblk; /**< The extended basic block this block belongs to. */
76 ir_region *region; /**< The immediate structural region this block belongs to. */
77 unsigned mb_depth; /**< The macroblock depth: A distance from the macroblock header */
79 struct list_head succ_head; /**< A list head for all successor edges of a block. */
82 /** Cond attributes. */
84 cond_kind kind; /**< flavor of Cond */
85 long default_proj; /**< only for non-binary Conds: biggest Proj number, i.e. the one used for default. */
86 cond_jmp_predicate pred; /**< only for binary Conds: The jump predication. */
89 /** Const attributes. */
91 tarval *tv; /**< the target value */
92 ir_type *tp; /**< the source type, for analyses. default: type_unknown. */
95 /** SymConst attributes. */
97 symconst_symbol sym; // old tori
99 ir_type *tp; /**< the source type, for analyses. default: type_unknown. */
102 /** Sel attributes. */
104 ir_entity *ent; /**< entity to select */
107 /** Exception attributes. */
109 op_pin_state pin_state; /**< the pin state for operations that might generate a exception:
110 If it's know that no exception will be generated, could be set to
111 op_pin_state_floats. */
112 #if PRECISE_EXC_CONTEXT
113 struct ir_node **frag_arr; /**< For Phi node construction in case of exception */
117 /** Call attributes. */
119 except_attr exc; /**< the exception attribute. MUST be the first one. */
120 ir_type *cld_tp; /**< type of called procedure */
121 ir_entity ** callee_arr; /**< result of callee analysis */
124 /** Alloc attributes. */
126 except_attr exc; /**< the exception attribute. MUST be the first one. */
127 ir_type *type; /**< Type of the allocated object. */
128 where_alloc where; /**< stack, heap or other managed part of memory */
131 /** Free attributes. */
133 ir_type *type; /**< Type of the allocated object. */
134 where_alloc where; /**< stack, heap or other managed part of memory */
137 /** InstOf attributes. */
139 except_attr exc; /**< the exception attribute. MUST be the first one. */
140 ir_type *type; /**< the type of which the object pointer must be */
143 /** Filter attributes. */
145 long proj; /**< contains the result position to project (Proj) */
146 ir_node ** in_cg; /**< array with interprocedural predecessors (Phi) */
147 int *backedge; /**< Field n set to true if pred n is backedge.
148 @todo Ev. replace by bitfield! */
151 /** CallBegin attributes. */
153 ir_node * call; /**< Associated Call-operation. */
156 /** Cast attributes. */
158 ir_type *totype; /**< Type of the casted node. */
161 /** Load attributes. */
163 except_attr exc; /**< The exception attribute. MUST be the first one. */
164 ir_mode *load_mode; /**< The mode of this Load operation. */
165 ir_volatility volatility; /**< The volatility of a Load/Store operation. */
168 /** Store attributes. */
170 except_attr exc; /**< the exception attribute. MUST be the first one. */
171 ir_volatility volatility; /**< the volatility of a Store operation */
175 int pos; /**< For Phi. Used to remember the value defined by
176 this Phi node. Needed when the Phi is completed
177 to call get_r_internal_value to find the
178 predecessors. If this attribute is set, the Phi
179 node takes the role of the obsolete Phi0 node,
180 therefore the name. */
184 typedef pn_Cmp confirm_attr; /**< Attribute to hold compare operation */
186 /** CopyB attribute. */
188 except_attr exc; /**< The exception attribute. MUST be the first one. */
189 ir_type *data_type; /**< Type of the copied entity. */
192 /** Bound attribute. */
194 except_attr exc; /**< The exception attribute. MUST be the first one. */
197 /** Conv attribute. */
199 char strict; /**< If set, this is a strict Conv that cannot be removed. */
202 /** Div/Mod/DivMod/Quot attribute. */
204 except_attr exc; /**< The exception attribute. MUST be the first one. */
205 ir_mode *res_mode; /**< Result mode for the division. */
208 /** Inline Assembler support attribute. */
210 op_pin_state pin_state; /**< the pin state for operations that might generate a exception */
211 ident *asm_text; /**< The inline assembler text. */
212 void *be_data; /**< backend can add data here. */
215 /** Some IR-nodes just have one attribute, these are stored here,
216 some have more. Their name is 'irnodename_attr' */
218 block_attr block; /**< For Block: Fields needed to construct it */
219 cond_attr cond; /**< For Cond. */
220 const_attr con; /**< For Const: contains the value of the constant and a type */
221 symconst_attr symc; /**< For SymConst. */
222 sel_attr sel; /**< For Sel. */
223 call_attr call; /**< For Call: pointer to the type of the method to call */
224 callbegin_attr callbegin; /**< For CallBegin */
225 alloc_attr alloc; /**< For Alloc. */
226 free_attr free; /**< For Free. */
227 io_attr instof; /**< For InstOf */
228 cast_attr cast; /**< For Cast. */
229 load_attr load; /**< For Load. */
230 store_attr store; /**< For Store. */
231 phi0_attr phi0; /**< for Phi0 nodes. */
232 int *phi_backedge; /**< For Phi after construction.
233 Field n set to true if pred n is backedge.
234 @todo Ev. replace by bitfield! */
235 long proj; /**< For Proj: contains the result position to project */
236 confirm_attr confirm_cmp; /**< For Confirm: compare operation */
237 filter_attr filter; /**< For Filter */
238 except_attr except; /**< For Phi node construction in case of exceptions */
239 copyb_attr copyb; /**< For CopyB operation */
240 bound_attr bound; /**< For Bound operation */
241 conv_attr conv; /**< For Conv operation */
242 divmod_attr divmod; /**< For Div/Mod/DivMod operation */
243 asm_attr assem; /**< For ASM operation. */
247 * Edge info to put into an irn.
249 typedef struct _irn_edge_kind_info_t {
250 struct list_head outs_head; /**< The list of all outs. */
251 int out_count; /**< Number of outs in the list. */
254 typedef irn_edge_info_t irn_edges_info_t[EDGE_KIND_LAST];
257 * The common structure of an irnode.
258 * If the node has some attributes, they are stored in the attr field.
261 /* ------- Basics of the representation ------- */
262 firm_kind kind; /**< Distinguishes this node from others. */
263 ir_op *op; /**< The Opcode of this node. */
264 ir_mode *mode; /**< The Mode of this node. */
265 struct ir_node **in; /**< The array of predecessors / operands. */
266 unsigned long visited; /**< The visited counter for walks of the graph. */
267 unsigned node_idx; /**< The node index of this node in its graph. */
268 void *link; /**< To attach additional information to the node, e.g.
269 used while construction to link Phi0 nodes and
270 during optimization to link to nodes that
271 shall replace a node. */
272 /* ------- Fields for optimizations / analysis information ------- */
273 struct ir_node **out; /**< @deprecated array of out edges. */
274 struct dbg_info *dbi; /**< A pointer to information for debug support. */
275 /* ------- For debugging ------- */
278 long node_nr; /**< A unique node number for each node to make output
281 /* ------- For analyses -------- */
282 ir_loop *loop; /**< the loop the node is in. Access routines in irloop.h */
283 #ifdef DO_HEAPANALYSIS
284 struct abstval *av; /**< Heapanalysis: The abstract value of this node. */
285 struct section *sec; /**< Heapanalysis: The section of this node. */
287 struct ir_node **deps; /**< Additional dependencies induced by state. */
288 irn_edges_info_t edge_info; /**< Everlasting out edges. */
289 /* ------- Opcode depending fields -------- */
290 attr attr; /**< The set of attributes of this node. Depends on opcode.
291 Must be last field of struct ir_node. */
296 * Returns the array with the ins. The content of the array may not be
298 * Note that this function returns the whole in array including the
299 * block predecessor. So, it is NOT symmetric with set_irn_in().
301 ir_node **get_irn_in (const ir_node *node);
304 /** access attributes directly */
305 const_attr get_irn_const_attr (ir_node *node);
306 long get_irn_proj_attr (ir_node *node);
307 alloc_attr get_irn_alloc_attr (ir_node *node);
308 free_attr get_irn_free_attr (ir_node *node);
309 symconst_attr get_irn_symconst_attr (ir_node *node);
310 ir_type *get_irn_call_attr (ir_node *node);
311 ir_type *get_irn_funccall_attr (ir_node *node);
312 sel_attr get_irn_sel_attr (ir_node *node);
313 int get_irn_phi0_attr (ir_node *node);
314 block_attr get_irn_block_attr (ir_node *node);
315 load_attr get_irn_load_attr (ir_node *node);
316 store_attr get_irn_store_attr (ir_node *node);
317 except_attr get_irn_except_attr (ir_node *node);
321 * The amount of additional space for custom data to be allocated upon creating a new node.
323 extern unsigned firm_add_node_size;
326 * Sets the get_type operation for an ir_op_ops.
328 * @param code the opcode for the default operation
329 * @param ops the operations initialized
334 ir_op_ops *firm_set_default_get_type(ir_opcode code, ir_op_ops *ops);
337 * Sets the get_type_attr operation for an ir_op_ops.
339 * @param code the opcode for the default operation
340 * @param ops the operations initialized
345 ir_op_ops *firm_set_default_get_type_attr(ir_opcode code, ir_op_ops *ops);
348 * Sets the get_entity_attr operation for an ir_op_ops.
350 * @param code the opcode for the default operation
351 * @param ops the operations initialized
356 ir_op_ops *firm_set_default_get_entity_attr(ir_opcode code, ir_op_ops *ops);
358 /*-------------------------------------------------------------------*/
359 /* These function are most used in libfirm. Give them as static */
360 /* functions so they can be inlined. */
361 /*-------------------------------------------------------------------*/
364 * Checks whether a pointer points to a ir node.
365 * Intern version for libFirm.
368 _is_ir_node(const void *thing) {
369 return (get_kind(thing) == k_ir_node);
373 * Gets the op of a node.
374 * Intern version for libFirm.
376 static INLINE ir_op *
377 _get_irn_op(const ir_node *node) {
383 _set_irn_op(ir_node *node, ir_op *op) {
388 /** Copies all attributes stored in the old node to the new node.
389 Assumes both have the same opcode and sufficient size. */
391 copy_node_attr(const ir_node *old_node, ir_node *new_node) {
392 ir_op *op = _get_irn_op(old_node);
394 /* must always exist */
395 op->ops.copy_attr(old_node, new_node);
399 * Gets the opcode of a node.
400 * Intern version for libFirm.
402 static INLINE ir_opcode
403 _get_irn_opcode(const ir_node *node) {
404 assert(k_ir_node == get_kind(node));
406 return node->op->code;
410 * Returns the number of predecessors without the block predecessor.
411 * Intern version for libFirm.
414 _get_irn_intra_arity(const ir_node *node) {
416 return ARR_LEN(node->in) - 1;
420 * Returns the number of predecessors without the block predecessor.
421 * Intern version for libFirm.
424 _get_irn_inter_arity(const ir_node *node) {
426 if (_get_irn_op(node) == op_Filter) {
427 assert(node->attr.filter.in_cg);
428 return ARR_LEN(node->attr.filter.in_cg) - 1;
429 } else if (_get_irn_op(node) == op_Block && node->attr.block.in_cg) {
430 return ARR_LEN(node->attr.block.in_cg) - 1;
432 return _get_irn_intra_arity(node);
436 * Returns the number of predecessors without the block predecessor.
437 * Intern version for libFirm.
439 extern int (*_get_irn_arity)(const ir_node *node);
442 * Intern version for libFirm.
444 static INLINE ir_node *
445 _get_irn_intra_n(const ir_node *node, int n) {
449 assert(-1 <= n && n < _get_irn_intra_arity(node));
451 nn = node->in[n + 1];
453 /* only block inputs are allowed to be NULL */
454 assert(n == -1 && "NULL input of a node");
457 if (nn->op != op_Id) return nn;
459 return (node->in[n + 1] = skip_Id(nn));
463 * Intern version for libFirm.
465 static INLINE ir_node*
466 _get_irn_inter_n(const ir_node *node, int n) {
467 assert(node); assert(-1 <= n && n < _get_irn_inter_arity(node));
469 /* handle Filter and Block specially */
470 if (_get_irn_op(node) == op_Filter) {
471 assert(node->attr.filter.in_cg);
472 return (node->attr.filter.in_cg[n + 1] = skip_Id(node->attr.filter.in_cg[n + 1]));
473 } else if (_get_irn_op(node) == op_Block && node->attr.block.in_cg) {
474 return (node->attr.block.in_cg[n + 1] = skip_Id(node->attr.block.in_cg[n + 1]));
477 return _get_irn_intra_n(node, n);
481 * Access to the predecessors of a node.
482 * To iterate over the operands iterate from 0 to i < get_irn_arity(),
483 * to iterate including the Block predecessor iterate from i = -1 to
485 * If it is a block, the entry -1 is NULL.
486 * Intern version for libFirm.
488 extern ir_node *(*_get_irn_n)(const ir_node *node, int n);
490 static INLINE int _get_irn_deps(const ir_node *node) {
491 return node->deps ? ARR_LEN(node->deps) : 0;
494 static INLINE ir_node *_get_irn_dep(const ir_node *node, int pos) {
495 assert(node->deps && "dependency array node yet allocated. use add_irn_dep()");
496 assert(pos >= 0 && pos < ARR_LEN(node->deps) && "dependency index out of range");
497 return node->deps[pos];
501 _set_irn_dep(ir_node *node, int pos, ir_node *dep) {
504 assert(node->deps && "dependency array node yet allocated. use add_irn_dep()");
505 assert(pos >= 0 && pos < ARR_LEN(node->deps) && "dependency index out of range");
506 old = node->deps[pos];
507 node->deps[pos] = dep;
508 edges_notify_edge_kind(node, pos, dep, old, EDGE_KIND_DEP, get_irn_irg(node));
513 _get_irn_ins_or_deps(const ir_node *irn) {
514 return _get_irn_deps(irn) + _get_irn_arity(irn);
517 static INLINE ir_node *
518 _get_irn_in_or_dep(const ir_node *irn, int pos) {
519 int n_in = get_irn_arity(irn);
520 return pos < n_in ? get_irn_n(irn, pos) : get_irn_dep(irn, pos - n_in);
524 * Gets the mode of a node.
525 * Intern version for libFirm.
527 static INLINE ir_mode *
528 _get_irn_mode(const ir_node *node) {
534 * Sets the mode of a node.
535 * Intern version of libFirm.
538 _set_irn_mode(ir_node *node, ir_mode *mode) {
544 * Gets the visited counter of a node.
545 * Intern version for libFirm.
547 static INLINE unsigned long
548 _get_irn_visited(const ir_node *node) {
550 return node->visited;
554 * Sets the visited counter of a node.
555 * Intern version for libFirm.
558 _set_irn_visited(ir_node *node, unsigned long visited) {
560 node->visited = visited;
564 * Mark a node as visited in a graph.
565 * Intern version for libFirm.
568 _mark_irn_visited(ir_node *node) {
570 node->visited = current_ir_graph->visited;
574 * Returns non-zero if a node of was visited.
575 * Intern version for libFirm.
578 _irn_visited(const ir_node *node) {
580 return (node->visited >= current_ir_graph->visited);
584 * Returns non-zero if a node of was NOT visited.
585 * Intern version for libFirm.
588 _irn_not_visited(const ir_node *node) {
590 return (node->visited < current_ir_graph->visited);
594 * Sets the link of a node.
595 * Intern version of libFirm.
598 _set_irn_link(ir_node *node, void *link) {
600 /* Link field is used for Phi construction and various optimizations
602 assert(get_irg_phase_state(get_irn_irg(node)) != phase_building);
608 * Returns the link of a node.
609 * Intern version of libFirm.
612 _get_irn_link(const ir_node *node) {
613 assert(node && _is_ir_node(node));
618 * Returns whether the node _always_ must be pinned.
619 * I.e., the node is not floating after global cse.
621 * Intern version of libFirm.
623 static INLINE op_pin_state
624 _get_irn_pinned(const ir_node *node) {
626 assert(node && _is_ir_node(node));
628 state = _get_op_pinned(_get_irn_op(node));
630 if (state >= op_pin_state_exc_pinned)
631 return get_opt_fragile_ops() ? node->attr.except.pin_state : op_pin_state_pinned;
635 static INLINE op_pin_state
636 _is_irn_pinned_in_irg(const ir_node *node) {
637 if (get_irg_pinned(get_irn_irg(node)) == op_pin_state_floats)
638 return get_irn_pinned(node);
639 return op_pin_state_pinned;
643 _is_unop(const ir_node *node) {
644 assert(node && _is_ir_node(node));
645 return (node->op->opar == oparity_unary);
649 _is_binop(const ir_node *node) {
650 assert(node && _is_ir_node(node));
651 return (node->op->opar == oparity_binary);
655 _is_Bad(const ir_node *node) {
657 return (_get_irn_op(node) == op_Bad);
661 _is_NoMem(const ir_node *node) {
663 return (_get_irn_op(node) == op_NoMem);
667 _is_Mod(const ir_node *node) {
669 return (_get_irn_op(node) == op_Mod);
673 _is_Div(const ir_node *node) {
675 return (_get_irn_op(node) == op_Div);
679 _is_DivMod(const ir_node *node) {
681 return (_get_irn_op(node) == op_DivMod);
685 _is_Quot(const ir_node *node) {
687 return (_get_irn_op(node) == op_Quot);
691 _is_Add(const ir_node *node) {
693 return (_get_irn_op(node) == op_Add);
697 _is_Sub(const ir_node *node) {
699 return (_get_irn_op(node) == op_Sub);
703 _is_Start(const ir_node *node) {
705 return (_get_irn_op(node) == op_Start);
709 _is_End(const ir_node *node) {
711 return (_get_irn_op(node) == op_End);
715 _is_Const(const ir_node *node) {
717 return (_get_irn_op(node) == op_Const);
721 _is_Conv(const ir_node *node) {
723 return (_get_irn_op(node) == op_Conv);
727 _is_CopyB(const ir_node *node) {
729 return (_get_irn_op(node) == op_CopyB);
733 _is_Unknown(const ir_node *node) {
735 return (_get_irn_op(node) == op_Unknown);
739 _is_Return(const ir_node *node) {
741 return (_get_irn_op(node) == op_Return);
745 _is_Call(const ir_node *node) {
747 return (_get_irn_op(node) == op_Call);
751 _is_Sel(const ir_node *node) {
753 return (_get_irn_op(node) == op_Sel);
757 _is_Mul(const ir_node *node) {
759 return (_get_irn_op(node) == op_Mul);
763 _is_Mux(const ir_node *node) {
766 ir_op *op = _get_irn_op(node);
767 return (op == op_Mux || ((op == op_Psi) && _get_irn_arity(node) == 3));
773 _is_Load(const ir_node *node) {
775 return (_get_irn_op(node) == op_Load);
779 _is_Store(const ir_node *node) {
781 return (_get_irn_op(node) == op_Store);
785 _is_Sync(const ir_node *node) {
787 return (_get_irn_op(node) == op_Sync);
791 _is_Confirm(const ir_node *node) {
793 return (_get_irn_op(node) == op_Confirm);
797 _is_Pin(const ir_node *node) {
799 return (_get_irn_op(node) == op_Pin);
803 _is_SymConst(const ir_node *node) {
805 return (_get_irn_op(node) == op_SymConst);
809 _is_Cond(const ir_node *node) {
811 return (_get_irn_op(node) == op_Cond);
815 _is_Cmp(const ir_node *node) {
817 return (_get_irn_op(node) == op_Cmp);
821 _is_Alloc(const ir_node *node) {
823 return (_get_irn_op(node) == op_Alloc);
827 _is_Jmp(const ir_node *node) {
829 return (_get_irn_op(node) == op_Jmp);
833 _is_Raise(const ir_node *node) {
835 return (_get_irn_op(node) == op_Raise);
839 _is_ASM(const ir_node *node) {
841 return (_get_irn_op(node) == op_ASM);
845 _is_no_Block(const ir_node *node) {
846 assert(node && _is_ir_node(node));
847 return (_get_irn_op(node) != op_Block);
851 _is_Block(const ir_node *node) {
852 assert(node && _is_ir_node(node));
853 return (_get_irn_op(node) == op_Block);
857 _get_Block_n_cfgpreds(const ir_node *node) {
858 assert(_is_Block(node));
859 return _get_irn_arity(node);
862 static INLINE ir_node *
863 _get_Block_cfgpred(ir_node *node, int pos) {
864 assert(0 <= pos && pos < get_irn_arity(node));
865 assert(_is_Block(node));
866 return _get_irn_n(node, pos);
869 /* Get the predecessor block.
871 * Returns the block corresponding to the predecessor pos.
873 * There are several ambiguities we resolve with this function:
874 * - The direct predecessor can be a Proj, which is not pinned.
875 * We walk from the predecessor to the next pinned node
876 * (skip_Proj) and return the block that node is in.
877 * - If we encounter the Bad node, this function does not return
878 * Start, but the Bad node.
880 static INLINE ir_node *
881 _get_Block_cfgpred_block(ir_node *node, int pos) {
882 ir_node *res = skip_Proj(get_Block_cfgpred(node, pos));
884 res = get_nodes_block(res);
888 static INLINE unsigned long
889 _get_Block_block_visited(const ir_node *node) {
890 assert(node->op == op_Block);
891 return node->attr.block.block_visited;
895 _set_Block_block_visited(ir_node *node, unsigned long visit) {
896 assert(node->op == op_Block);
897 node->attr.block.block_visited = visit;
900 /* For this current_ir_graph must be set. */
902 _mark_Block_block_visited(ir_node *node) {
903 assert(node->op == op_Block);
904 node->attr.block.block_visited = get_irg_block_visited(current_ir_graph);
908 _Block_not_block_visited(const ir_node *node) {
909 assert(node->op == op_Block);
910 return (node->attr.block.block_visited < get_irg_block_visited(current_ir_graph));
914 _Block_block_visited(const ir_node *node) {
915 assert(node->op == op_Block);
916 return (node->attr.block.block_visited >= get_irg_block_visited(current_ir_graph));
919 static INLINE ir_node *
920 _set_Block_dead(ir_node *block) {
921 assert(_get_irn_op(block) == op_Block);
922 block->attr.block.is_dead = 1;
927 _is_Block_dead(const ir_node *block) {
928 ir_op *op = _get_irn_op(block);
933 assert(op == op_Block);
934 return block->attr.block.is_dead;
938 static INLINE tarval *_get_Const_tarval(const ir_node *node) {
939 assert(_get_irn_op(node) == op_Const);
940 return node->attr.con.tv;
943 static INLINE cnst_classify_t _classify_Const(ir_node *node) {
945 assert(_is_ir_node(node));
947 op = _get_irn_op(node);
950 return classify_tarval(_get_Const_tarval(node));
951 else if(op == op_SymConst)
952 return CNST_SYMCONST;
954 return CNST_NO_CONST;
957 static INLINE int _is_irn_forking(const ir_node *node) {
958 return is_op_forking(_get_irn_op(node));
961 static INLINE ir_type *_get_irn_type(ir_node *node) {
962 return _get_irn_op(node)->ops.get_type(node);
965 static INLINE ir_type *_get_irn_type_attr(ir_node *node) {
966 return _get_irn_op(node)->ops.get_type_attr(node);
969 static INLINE ir_entity *_get_irn_entity_attr(ir_node *node) {
970 return _get_irn_op(node)->ops.get_entity_attr(node);
973 static INLINE int _is_irn_constlike(const ir_node *node) {
974 return is_op_constlike(_get_irn_op(node));
977 static INLINE int _is_irn_always_opt(const ir_node *node) {
978 return is_op_always_opt(_get_irn_op(node));
981 static INLINE int _is_irn_keep(const ir_node *node) {
982 return is_op_keep(_get_irn_op(node));
985 static INLINE int _is_irn_start_block_placed(const ir_node *node) {
986 return is_op_start_block_placed(_get_irn_op(node));
989 static INLINE int _is_irn_machine_op(const ir_node *node) {
990 return is_op_machine(_get_irn_op(node));
993 static INLINE int _is_irn_machine_operand(const ir_node *node) {
994 return is_op_machine_operand(_get_irn_op(node));
997 static INLINE int _is_irn_machine_user(const ir_node *node, unsigned n) {
998 return is_op_machine_user(_get_irn_op(node), n);
1001 static INLINE cond_jmp_predicate _get_Cond_jmp_pred(const ir_node *node) {
1002 assert(_get_irn_op(node) == op_Cond);
1003 return node->attr.cond.pred;
1006 static INLINE void _set_Cond_jmp_pred(ir_node *node, cond_jmp_predicate pred) {
1007 assert(_get_irn_op(node) == op_Cond);
1008 node->attr.cond.pred = pred;
1011 static INLINE int _get_Psi_n_conds(ir_node *node) {
1012 assert(_get_irn_op(node) == op_Psi);
1013 return _get_irn_arity(node) >> 1;
1016 static INLINE void *_get_irn_generic_attr(ir_node *node) {
1020 static INLINE const void *_get_irn_generic_attr_const(const ir_node *node) {
1024 static INLINE unsigned _get_irn_idx(const ir_node *node) {
1025 return node->node_idx;
1028 /* this section MUST contain all inline functions */
1029 #define is_ir_node(thing) _is_ir_node(thing)
1030 #define get_irn_intra_arity(node) _get_irn_intra_arity(node)
1031 #define get_irn_inter_arity(node) _get_irn_inter_arity(node)
1032 #define get_irn_arity(node) _get_irn_arity(node)
1033 #define get_irn_intra_n(node, n) _get_irn_intra_n(node, n)
1034 #define get_irn_inter_n(node, n) _get_irn_inter_n(node, n)
1035 #define get_irn_n(node, n) _get_irn_n(node, n)
1036 #define get_irn_mode(node) _get_irn_mode(node)
1037 #define set_irn_mode(node, mode) _set_irn_mode(node, mode)
1038 #define get_irn_op(node) _get_irn_op(node)
1039 #define set_irn_op(node, op) _set_irn_op(node, op)
1040 #define get_irn_opcode(node) _get_irn_opcode(node)
1041 #define get_irn_visited(node) _get_irn_visited(node)
1042 #define set_irn_visited(node, v) _set_irn_visited(node, v)
1043 #define mark_irn_visited(node) _mark_irn_visited(node)
1044 #define irn_visited(node) _irn_visited(node)
1045 #define irn_not_visited(node) _irn_not_visited(node)
1046 #define set_irn_link(node, link) _set_irn_link(node, link)
1047 #define get_irn_link(node) _get_irn_link(node)
1048 #define get_irn_pinned(node) _get_irn_pinned(node)
1049 #define is_irn_pinned_in_irg(node) _is_irn_pinned_in_irg(node)
1050 #define is_unop(node) _is_unop(node)
1051 #define is_binop(node) _is_binop(node)
1052 #define is_Const(node) _is_Const(node)
1053 #define is_Conv(node) _is_Conv(node)
1054 #define is_Unknown(node) _is_Unknown(node)
1055 #define is_Return(node) _is_Return(node)
1056 #define is_Call(node) _is_Call(node)
1057 #define is_Sel(node) _is_Sel(node)
1058 #define is_Mul(node) _is_Mul(node)
1059 #define is_Mux(node) _is_Mux(node)
1060 #define is_Load(node) _is_Load(node)
1061 #define is_Sync(node) _is_Sync(node)
1062 #define is_Confirm(node) _is_Confirm(node)
1063 #define is_Pin(node) _is_Pin(node)
1064 #define is_SymConst(node) _is_SymConst(node)
1065 #define is_Cond(node) _is_Cond(node)
1066 #define is_CopyB(node) _is_CopyB(node)
1067 #define is_Cmp(node) _is_Cmp(node)
1068 #define is_Alloc(node) _is_Alloc(node)
1069 #define is_Jmp(node) _is_Jmp(node)
1070 #define is_Raise(node) _is_Raise(node)
1071 #define is_ASM(node) _is_ASM(node)
1072 #define is_Bad(node) _is_Bad(node)
1073 #define is_NoMem(node) _is_NoMem(node)
1074 #define is_Start(node) _is_Start(node)
1075 #define is_End(node) _is_End(node)
1076 #define is_Mod(node) _is_Mod(node)
1077 #define is_Div(node) _is_Div(node)
1078 #define is_DivMod(node) _is_DivMod(node)
1079 #define is_Quot(node) _is_Quot(node)
1080 #define is_Add(node) _is_Add(node)
1081 #define is_Sub(node) _is_Sub(node)
1082 #define is_no_Block(node) _is_no_Block(node)
1083 #define is_Block(node) _is_Block(node)
1084 #define get_Block_n_cfgpreds(node) _get_Block_n_cfgpreds(node)
1085 #define get_Block_cfgpred(node, pos) _get_Block_cfgpred(node, pos)
1086 #define get_Block_cfgpred_block(node, pos) _get_Block_cfgpred_block(node, pos)
1087 #define get_Block_block_visited(node) _get_Block_block_visited(node)
1088 #define set_Block_block_visited(node, visit) _set_Block_block_visited(node, visit)
1089 #define mark_Block_block_visited(node) _mark_Block_block_visited(node)
1090 #define Block_not_block_visited(node) _Block_not_block_visited(node)
1091 #define Block_block_visited(node) _Block_block_visited(node)
1092 #define set_Block_dead(block) _set_Block_dead(block)
1093 #define is_Block_dead(block) _is_Block_dead(block)
1094 #define get_Const_tarval(node) _get_Const_tarval(node)
1095 #define classify_Const(node) _classify_Const(node)
1096 #define is_irn_forking(node) _is_irn_forking(node)
1097 #define get_irn_type(node) _get_irn_type(node)
1098 #define get_irn_type_attr(node) _get_irn_type_attr(node)
1099 #define get_irn_entity_attr(node) _get_irn_entity_attr(node)
1100 #define is_irn_constlike(node) _is_irn_constlike(node)
1101 #define is_irn_always_opt(node) _is_irn_always_opt(node)
1102 #define is_irn_keep(node) _is_irn_keep(node)
1103 #define is_irn_start_block_placed(node) _is_irn_start_block_placed(node)
1104 #define is_irn_machine_op(node) _is_irn_machine_op(node)
1105 #define is_irn_machine_operand(node) _is_irn_machine_operand(node)
1106 #define is_irn_machine_user(node, n) _is_irn_machine_user(node, n)
1107 #define get_Cond_jmp_pred(node) _get_Cond_jmp_pred(node)
1108 #define set_Cond_jmp_pred(node, pred) _set_Cond_jmp_pred(node, pred)
1109 #define get_Psi_n_conds(node) _get_Psi_n_conds(node)
1110 #define get_irn_generic_attr(node) _get_irn_generic_attr(node)
1111 #define get_irn_generic_attr_const(node) _get_irn_generic_attr_const(node)
1112 #define get_irn_idx(node) _get_irn_idx(node)
1114 #define get_irn_deps(node) _get_irn_deps(node)
1115 #define set_irn_dep(node, pos, dep) _set_irn_dep(node, pos, dep)
1116 #define get_irn_dep(node, pos) _get_irn_dep(node, pos)
1118 #define get_irn_ins_or_deps(node) _get_irn_ins_or_deps(node)
1119 #define get_irn_in_or_dep(node, pos) _get_irn_in_or_dep(node, pos)