Set the outs to inconsistent at the end of transform_irg().
[libfirm] / ir / ir / irnode_t.h
1 /*
2  * Copyright (C) 1995-2007 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 an intermediate operation -- private header.
23  * @author  Martin Trapp, Christian Schaefer, Goetz Lindenmaier, Michael Beck
24  * @version $Id$
25  */
26 #ifndef FIRM_IR_IRNODE_T_H
27 #define FIRM_IR_IRNODE_T_H
28
29 #include "firm_config.h"
30 #include "irtypes.h"
31 #include "irnode.h"
32 #include "irop_t.h"
33 #include "irgraph_t.h"
34 #include "irflag_t.h"
35 #include "firm_common_t.h"
36 #include "array.h"
37
38 /**
39  * Returns the array with the ins.  The content of the array may not be
40  * changed.
41  * Note that this function returns the whole in array including the
42  * block predecessor. So, it is NOT symmetric with set_irn_in().
43  */
44 ir_node     **get_irn_in            (const ir_node *node);
45
46 /** @{ */
47 /** access attributes directly */
48 const_attr    *get_irn_const_attr    (ir_node *node);
49 long          get_irn_proj_attr     (ir_node *node);
50 alloc_attr    *get_irn_alloc_attr    (ir_node *node);
51 free_attr     *get_irn_free_attr     (ir_node *node);
52 symconst_attr *get_irn_symconst_attr (ir_node *node);
53 ir_type       *get_irn_call_attr     (ir_node *node);
54 ir_type       *get_irn_funccall_attr (ir_node *node);
55 sel_attr      *get_irn_sel_attr      (ir_node *node);
56 int           get_irn_phi0_attr     (ir_node *node);
57 block_attr    *get_irn_block_attr    (ir_node *node);
58 load_attr     *get_irn_load_attr     (ir_node *node);
59 store_attr    *get_irn_store_attr    (ir_node *node);
60 except_attr   *get_irn_except_attr   (ir_node *node);
61 /** @} */
62
63 /**
64  * The amount of additional space for custom data to be allocated upon creating a new node.
65  */
66 extern unsigned firm_add_node_size;
67
68 /**
69  * Sets the get_type operation for an ir_op_ops.
70  *
71  * @param code   the opcode for the default operation
72  * @param ops    the operations initialized
73  *
74  * @return
75  *    The operations.
76  */
77 ir_op_ops *firm_set_default_get_type(ir_opcode code, ir_op_ops *ops);
78
79 /**
80  * Sets the get_type_attr operation for an ir_op_ops.
81  *
82  * @param code   the opcode for the default operation
83  * @param ops    the operations initialized
84  *
85  * @return
86  *    The operations.
87  */
88 ir_op_ops *firm_set_default_get_type_attr(ir_opcode code, ir_op_ops *ops);
89
90 /**
91  * Sets the get_entity_attr operation for an ir_op_ops.
92  *
93  * @param code   the opcode for the default operation
94  * @param ops    the operations initialized
95  *
96  * @return
97  *    The operations.
98  */
99 ir_op_ops *firm_set_default_get_entity_attr(ir_opcode code, ir_op_ops *ops);
100
101 /*-------------------------------------------------------------------*/
102 /*  These function are most used in libfirm.  Give them as static    */
103 /*  functions so they can be inlined.                                */
104 /*-------------------------------------------------------------------*/
105
106 /**
107  * Checks whether a pointer points to a ir node.
108  * Intern version for libFirm.
109  */
110 static INLINE int
111 _is_ir_node(const void *thing) {
112         return (get_kind(thing) == k_ir_node);
113 }
114
115 /**
116  * Gets the op of a node.
117  * Intern version for libFirm.
118  */
119 static INLINE ir_op *
120 _get_irn_op(const ir_node *node) {
121         assert(node);
122         return node->op;
123 }
124
125 static INLINE void
126 _set_irn_op(ir_node *node, ir_op *op) {
127         assert(node);
128         node->op = op;
129 }
130
131 /** Copies all attributes stored in the old node  to the new node.
132     Assumes both have the same opcode and sufficient size. */
133 static INLINE void
134 copy_node_attr(const ir_node *old_node, ir_node *new_node) {
135         ir_op *op = _get_irn_op(old_node);
136
137         /* must always exist */
138         op->ops.copy_attr(old_node, new_node);
139 }
140
141 /**
142  * Gets the opcode of a node.
143  * Intern version for libFirm.
144  */
145 static INLINE unsigned
146 _get_irn_opcode(const ir_node *node) {
147         assert(k_ir_node == get_kind(node));
148         assert(node->op);
149         return node->op->code;
150 }
151
152 /**
153  * Returns the number of predecessors without the block predecessor.
154  * Intern version for libFirm.
155  */
156 static INLINE int
157 _get_irn_intra_arity(const ir_node *node) {
158         assert(node);
159         return ARR_LEN(node->in) - 1;
160 }
161
162 /**
163  * Returns the number of predecessors without the block predecessor.
164  * Intern version for libFirm.
165  */
166 static INLINE int
167 _get_irn_inter_arity(const ir_node *node) {
168         assert(node);
169         if (_get_irn_op(node) == op_Filter) {
170                 assert(node->attr.filter.in_cg);
171                 return ARR_LEN(node->attr.filter.in_cg) - 1;
172         } else if (_get_irn_op(node) == op_Block && node->attr.block.in_cg) {
173                 return ARR_LEN(node->attr.block.in_cg) - 1;
174         }
175         return _get_irn_intra_arity(node);
176 }
177
178 #ifdef INTERPROCEDURAL_VIEW
179 /**
180  * Returns the number of predecessors without the block predecessor.
181  * Intern version for libFirm.
182  */
183 extern int (*_get_irn_arity)(const ir_node *node);
184
185 #else
186
187 #define _get_irn_arity(n) _get_irn_intra_arity(n)
188 #endif
189
190 /**
191  * Intern version for libFirm.
192  */
193 static INLINE ir_node *
194 _get_irn_intra_n(const ir_node *node, int n) {
195         ir_node *nn;
196
197         assert(node);
198         assert(-1 <= n && n < _get_irn_intra_arity(node));
199
200         nn = node->in[n + 1];
201         if (nn == NULL) {
202                 /* only block and Anchor inputs are allowed to be NULL */
203                 assert((node->op == op_Anchor || n == -1) && "NULL input of a node");
204                 return NULL;
205         }
206         if (nn->op != op_Id) return nn;
207
208         return (node->in[n + 1] = skip_Id(nn));
209 }
210
211 /**
212  * Intern version for libFirm.
213  */
214 static INLINE ir_node*
215 _get_irn_inter_n(const ir_node *node, int n) {
216         assert(node); assert(-1 <= n && n < _get_irn_inter_arity(node));
217
218         /* handle Filter and Block specially */
219         if (_get_irn_op(node) == op_Filter) {
220                 assert(node->attr.filter.in_cg);
221                 return (node->attr.filter.in_cg[n + 1] = skip_Id(node->attr.filter.in_cg[n + 1]));
222         } else if (_get_irn_op(node) == op_Block && node->attr.block.in_cg) {
223                 return (node->attr.block.in_cg[n + 1] = skip_Id(node->attr.block.in_cg[n + 1]));
224         }
225
226         return _get_irn_intra_n(node, n);
227 }
228
229 /**
230  * Access to the predecessors of a node.
231  * To iterate over the operands iterate from 0 to i < get_irn_arity(),
232  * to iterate including the Block predecessor iterate from i = -1 to
233  * i < get_irn_arity.
234  * If it is a block, the entry -1 is NULL.
235  * Intern version for libFirm.
236  */
237 #ifdef INTERPROCEDURAL_VIEW
238 extern ir_node *(*_get_irn_n)(const ir_node *node, int n);
239 #else
240 #define _get_irn_n(n,i) _get_irn_intra_n(n,i)
241 #endif
242
243 static INLINE int _get_irn_deps(const ir_node *node) {
244         return node->deps ? ARR_LEN(node->deps) : 0;
245 }
246
247 static INLINE ir_node *_get_irn_dep(const ir_node *node, int pos) {
248         assert(node->deps && "dependency array node yet allocated. use add_irn_dep()");
249         assert(pos >= 0 && pos < ARR_LEN(node->deps) && "dependency index out of range");
250         return node->deps[pos];
251 }
252
253 static INLINE void
254 _set_irn_dep(ir_node *node, int pos, ir_node *dep) {
255         ir_node *old;
256
257         assert(node->deps && "dependency array node yet allocated. use add_irn_dep()");
258         assert(pos >= 0 && pos < ARR_LEN(node->deps) && "dependency index out of range");
259         old = node->deps[pos];
260         node->deps[pos] = dep;
261         edges_notify_edge_kind(node, pos, dep, old, EDGE_KIND_DEP, get_irn_irg(node));
262 }
263
264
265 static INLINE int
266 _get_irn_ins_or_deps(const ir_node *irn) {
267         return _get_irn_deps(irn) + _get_irn_arity(irn);
268 }
269
270 static INLINE ir_node *
271 _get_irn_in_or_dep(const ir_node *irn, int pos) {
272         int n_in = get_irn_arity(irn);
273         return pos < n_in ? get_irn_n(irn, pos) : get_irn_dep(irn, pos - n_in);
274 }
275
276 /**
277  * Gets the mode of a node.
278  * Intern version for libFirm.
279  */
280 static INLINE ir_mode *
281 _get_irn_mode(const ir_node *node) {
282         assert(node);
283         return node->mode;
284 }
285
286 /**
287  * Sets the mode of a node.
288  * Intern version of libFirm.
289  */
290 static INLINE void
291 _set_irn_mode(ir_node *node, ir_mode *mode) {
292         assert(node);
293         node->mode = mode;
294 }
295
296 /**
297  * Gets the visited counter of a node.
298  * Intern version for libFirm.
299  */
300 static INLINE unsigned long
301 _get_irn_visited(const ir_node *node) {
302         assert(node);
303         return node->visited;
304 }
305
306 /**
307  * Sets the visited counter of a node.
308  * Intern version for libFirm.
309  */
310 static INLINE void
311 _set_irn_visited(ir_node *node, unsigned long visited) {
312         assert(node);
313         node->visited = visited;
314 }
315
316 /**
317  * Mark a node as visited in a graph.
318  * Intern version for libFirm.
319  */
320 static INLINE void
321 _mark_irn_visited(ir_node *node) {
322         assert(node);
323         node->visited = current_ir_graph->visited;
324 }
325
326 /**
327  * Returns non-zero if a node of was visited.
328  * Intern version for libFirm.
329  */
330 static INLINE int
331 _irn_visited(const ir_node *node) {
332         assert(node);
333         return (node->visited >= current_ir_graph->visited);
334 }
335
336 /**
337  * Returns non-zero if a node of was NOT visited.
338  * Intern version for libFirm.
339  */
340 static INLINE int
341 _irn_not_visited(const ir_node *node) {
342         assert(node);
343         return (node->visited < current_ir_graph->visited);
344 }
345
346 /**
347  * Sets the link of a node.
348  * Intern version of libFirm.
349  */
350 static INLINE void
351 _set_irn_link(ir_node *node, void *link) {
352   assert(node);
353         /* Link field is used for Phi construction and various optimizations
354            in iropt. */
355         assert(get_irg_phase_state(get_irn_irg(node)) != phase_building);
356
357         node->link = link;
358 }
359
360 /**
361  * Returns the link of a node.
362  * Intern version of libFirm.
363  */
364 static INLINE void *
365 _get_irn_link(const ir_node *node) {
366         assert(node && _is_ir_node(node));
367         return node->link;
368 }
369
370 /**
371  * Returns whether the node _always_ must be pinned.
372  * I.e., the node is not floating after global cse.
373  *
374  * Intern version of libFirm.
375  */
376 static INLINE op_pin_state
377 _get_irn_pinned(const ir_node *node) {
378         op_pin_state state;
379         assert(node && _is_ir_node(node));
380         /* Check opcode */
381         state = _get_op_pinned(_get_irn_op(node));
382
383         if (state >= op_pin_state_exc_pinned)
384                 return get_opt_fragile_ops() ? node->attr.except.pin_state : op_pin_state_pinned;
385         return state;
386 }
387
388 static INLINE op_pin_state
389 _is_irn_pinned_in_irg(const ir_node *node) {
390         if (get_irg_pinned(get_irn_irg(node)) == op_pin_state_floats)
391                 return get_irn_pinned(node);
392         return op_pin_state_pinned;
393 }
394
395 static INLINE int
396 _is_unop(const ir_node *node) {
397         assert(node && _is_ir_node(node));
398         return (node->op->opar == oparity_unary);
399 }
400
401 static INLINE int
402 _is_binop(const ir_node *node) {
403         assert(node && _is_ir_node(node));
404         return (node->op->opar == oparity_binary);
405 }
406
407 static INLINE int
408 _is_Phi(const ir_node *node) {
409         ir_op *op;
410         assert(node);
411
412         op = get_irn_op(node);
413 #ifdef INTERPROCEDURAL_VIEW
414         if (op == op_Filter) return get_interprocedural_view();
415 #endif
416         return (op == op_Phi);
417 }
418
419 static INLINE int
420 _is_Proj(const ir_node *node) {
421         assert(node);
422         return (_get_irn_op(node) == op_Proj);
423 }
424
425 static INLINE int
426 _is_Bad(const ir_node *node) {
427         assert(node);
428         return (_get_irn_op(node) == op_Bad);
429 }
430
431 static INLINE int
432 _is_NoMem(const ir_node *node) {
433         assert(node);
434         return (_get_irn_op(node) == op_NoMem);
435 }
436
437 static INLINE int
438 _is_Minus(const ir_node *node) {
439         assert(node);
440         return (_get_irn_op(node) == op_Minus);
441 }
442
443 static INLINE int
444 _is_Mod(const ir_node *node) {
445         assert(node);
446         return (_get_irn_op(node) == op_Mod);
447 }
448
449 static INLINE int
450 _is_Div(const ir_node *node) {
451         assert(node);
452         return (_get_irn_op(node) == op_Div);
453 }
454
455 static INLINE int
456 _is_DivMod(const ir_node *node) {
457         assert(node);
458         return (_get_irn_op(node) == op_DivMod);
459 }
460
461 static INLINE int
462 _is_Quot(const ir_node *node) {
463         assert(node);
464         return (_get_irn_op(node) == op_Quot);
465 }
466
467 static INLINE int
468 _is_Add(const ir_node *node) {
469         assert(node);
470         return (_get_irn_op(node) == op_Add);
471 }
472
473 static INLINE int
474 _is_And(const ir_node *node) {
475         assert(node);
476         return (_get_irn_op(node) == op_And);
477 }
478
479 static INLINE int
480 _is_Or(const ir_node *node) {
481         assert(node);
482         return (_get_irn_op(node) == op_Or);
483 }
484
485 static INLINE int
486 _is_Eor(const ir_node *node) {
487         assert(node);
488         return (_get_irn_op(node) == op_Eor);
489 }
490
491 static INLINE int
492 _is_Sub(const ir_node *node) {
493         assert(node);
494         return (_get_irn_op(node) == op_Sub);
495 }
496
497 static INLINE int
498 _is_Not(const ir_node *node) {
499         assert(node);
500         return (_get_irn_op(node) == op_Not);
501 }
502
503 static INLINE int
504 _is_Shl(const ir_node *node) {
505         assert(node);
506         return (_get_irn_op(node) == op_Shl);
507 }
508
509 static INLINE int
510 _is_Shr(const ir_node *node) {
511         assert(node);
512         return (_get_irn_op(node) == op_Shr);
513 }
514
515 static INLINE int
516 _is_Shrs(const ir_node *node) {
517         assert(node);
518         return (_get_irn_op(node) == op_Shrs);
519 }
520
521 static INLINE int
522 _is_Rot(const ir_node *node) {
523         assert(node);
524         return (_get_irn_op(node) == op_Rot);
525 }
526
527 static INLINE int
528 _is_Psi(const ir_node *node) {
529         assert(node);
530         return (_get_irn_op(node) == op_Psi);
531 }
532
533 static INLINE int
534 _is_Tuple(const ir_node *node) {
535         assert(node);
536         return (_get_irn_op(node) == op_Tuple);
537 }
538
539 static INLINE int
540 _is_Start(const ir_node *node) {
541         assert(node);
542         return (_get_irn_op(node) == op_Start);
543 }
544
545 static INLINE int
546 _is_End(const ir_node *node) {
547         assert(node);
548         return (_get_irn_op(node) == op_End);
549 }
550
551 static INLINE int
552 _is_Const(const ir_node *node) {
553         assert(node);
554         return (_get_irn_op(node) == op_Const);
555 }
556
557 static INLINE int
558 _is_Conv(const ir_node *node) {
559         assert(node);
560         return (_get_irn_op(node) == op_Conv);
561 }
562
563 static INLINE int
564 _is_Cast(const ir_node *node) {
565         assert(node);
566         return (_get_irn_op(node) == op_Cast);
567 }
568
569 static INLINE int
570 _is_CopyB(const ir_node *node) {
571         assert(node);
572         return (_get_irn_op(node) == op_CopyB);
573 }
574
575 static INLINE int
576 _is_Unknown(const ir_node *node) {
577         assert(node);
578         return (_get_irn_op(node) == op_Unknown);
579 }
580
581 static INLINE int
582 _is_Return(const ir_node *node) {
583         assert(node);
584         return (_get_irn_op(node) == op_Return);
585 }
586
587 static INLINE int
588 _is_Call(const ir_node *node) {
589         assert(node);
590         return (_get_irn_op(node) == op_Call);
591 }
592
593 static INLINE int
594 _is_Sel(const ir_node *node) {
595         assert(node);
596         return (_get_irn_op(node) == op_Sel);
597 }
598
599 static INLINE int
600 _is_Mul(const ir_node *node) {
601         assert(node);
602         return (_get_irn_op(node) == op_Mul);
603 }
604
605 static INLINE int
606 _is_Mulh(const ir_node *node) {
607         assert(node);
608         return (_get_irn_op(node) == op_Mulh);
609 }
610
611 static INLINE int
612 _is_Mux(const ir_node *node) {
613         assert(node);
614         if (node) {
615                 ir_op *op = _get_irn_op(node);
616                 return (op == op_Mux || ((op == op_Psi) && _get_irn_arity(node) == 3));
617         }
618         return 0;
619 }
620
621 static INLINE int
622 _is_Load(const ir_node *node) {
623         assert(node);
624         return (_get_irn_op(node) == op_Load);
625 }
626
627 static INLINE int
628 _is_Store(const ir_node *node) {
629         assert(node);
630         return (_get_irn_op(node) == op_Store);
631 }
632
633 static INLINE int
634 _is_Sync(const ir_node *node) {
635         assert(node);
636         return (_get_irn_op(node) == op_Sync);
637 }
638
639 static INLINE int
640 _is_Confirm(const ir_node *node) {
641         assert(node);
642         return (_get_irn_op(node) == op_Confirm);
643 }
644
645 static INLINE int
646 _is_Pin(const ir_node *node) {
647         assert(node);
648         return (_get_irn_op(node) == op_Pin);
649 }
650
651 static INLINE int
652 _is_SymConst(const ir_node *node) {
653         assert(node);
654         return (_get_irn_op(node) == op_SymConst);
655 }
656
657 static INLINE int
658 _is_Cond(const ir_node *node) {
659         assert(node);
660         return (_get_irn_op(node) == op_Cond);
661 }
662
663 static INLINE int
664 _is_Cmp(const ir_node *node) {
665         assert(node);
666         return (_get_irn_op(node) == op_Cmp);
667 }
668
669 static INLINE int
670 _is_Alloc(const ir_node *node) {
671         assert(node);
672         return (_get_irn_op(node) == op_Alloc);
673 }
674
675 static INLINE int
676 _is_Jmp(const ir_node *node) {
677         assert(node);
678         return (_get_irn_op(node) == op_Jmp);
679 }
680
681 static INLINE int
682 _is_Raise(const ir_node *node) {
683         assert(node);
684         return (_get_irn_op(node) == op_Raise);
685 }
686
687 static INLINE int
688 _is_ASM(const ir_node *node) {
689         assert(node);
690         return (_get_irn_op(node) == op_ASM);
691 }
692
693 static INLINE int
694 _is_Anchor(const ir_node *node) {
695         return (_get_irn_op(node) == op_Anchor);
696 }
697
698 static INLINE int
699 _is_no_Block(const ir_node *node) {
700         assert(node && _is_ir_node(node));
701         return (_get_irn_op(node) != op_Block);
702 }
703
704 static INLINE int
705 _is_Block(const ir_node *node) {
706         assert(node && _is_ir_node(node));
707         return (_get_irn_op(node) == op_Block);
708 }
709
710 static INLINE int
711 _get_Block_n_cfgpreds(const ir_node *node) {
712         assert(_is_Block(node));
713         return _get_irn_arity(node);
714 }
715
716 static INLINE ir_node *
717 _get_Block_cfgpred(ir_node *node, int pos) {
718         assert(0 <= pos && pos < get_irn_arity(node));
719         assert(_is_Block(node));
720         return _get_irn_n(node, pos);
721 }
722
723 /* Get the predecessor block.
724  *
725  *  Returns the block corresponding to the predecessor pos.
726  *
727  *  There are several ambiguities we resolve with this function:
728  *  - The direct predecessor can be a Proj, which is not pinned.
729  *    We walk from the predecessor to the next pinned node
730  *    (skip_Proj) and return the block that node is in.
731  *  - If we encounter the Bad node, this function does not return
732  *    Start, but the Bad node.
733  */
734 static INLINE ir_node  *
735 _get_Block_cfgpred_block(ir_node *node, int pos) {
736         ir_node *res = skip_Proj(get_Block_cfgpred(node, pos));
737         if (!is_Bad(res))
738                 res = get_nodes_block(res);
739         return res;
740 }
741
742 static INLINE unsigned long
743 _get_Block_block_visited(const ir_node *node) {
744         assert(node->op == op_Block);
745         return node->attr.block.block_visited;
746 }
747
748 static INLINE void
749 _set_Block_block_visited(ir_node *node, unsigned long visit) {
750         assert(node->op == op_Block);
751         node->attr.block.block_visited = visit;
752 }
753
754 /* For this current_ir_graph must be set. */
755 static INLINE void
756 _mark_Block_block_visited(ir_node *node) {
757         assert(node->op == op_Block);
758         node->attr.block.block_visited = get_irg_block_visited(current_ir_graph);
759 }
760
761 static INLINE int
762 _Block_not_block_visited(const ir_node *node) {
763         assert(node->op == op_Block);
764         return (node->attr.block.block_visited < get_irg_block_visited(current_ir_graph));
765 }
766
767 static INLINE int
768 _Block_block_visited(const ir_node *node) {
769         assert(node->op == op_Block);
770         return (node->attr.block.block_visited >= get_irg_block_visited(current_ir_graph));
771 }
772
773 static INLINE ir_node *
774 _set_Block_dead(ir_node *block) {
775         assert(_get_irn_op(block) == op_Block);
776         block->attr.block.is_dead = 1;
777         return block;
778 }
779
780 static INLINE int
781 _is_Block_dead(const ir_node *block) {
782         ir_op *op = _get_irn_op(block);
783
784         if (op == op_Bad)
785                 return 1;
786         else {
787                 assert(op == op_Block);
788                 return block->attr.block.is_dead;
789         }
790 }
791
792 static INLINE tarval *_get_Const_tarval(const ir_node *node) {
793         assert(_get_irn_op(node) == op_Const);
794         return node->attr.con.tv;
795 }
796
797 static INLINE int _is_Const_null(const ir_node *node) {
798         return tarval_is_null(_get_Const_tarval(node));
799 }
800
801 static INLINE int _is_Const_one(const ir_node *node) {
802         return tarval_is_one(_get_Const_tarval(node));
803 }
804
805 static INLINE int _is_Const_all_one(const ir_node *node) {
806         return tarval_is_all_one(_get_Const_tarval(node));
807 }
808
809 static INLINE int _is_irn_forking(const ir_node *node) {
810         return is_op_forking(_get_irn_op(node));
811 }
812
813 static INLINE ir_type *_get_irn_type(ir_node *node) {
814         return _get_irn_op(node)->ops.get_type(node);
815 }
816
817 static INLINE ir_type *_get_irn_type_attr(ir_node *node) {
818         return _get_irn_op(node)->ops.get_type_attr(node);
819 }
820
821 static INLINE ir_entity *_get_irn_entity_attr(ir_node *node) {
822   return _get_irn_op(node)->ops.get_entity_attr(node);
823 }
824
825 static INLINE int _is_irn_constlike(const ir_node *node) {
826         return is_op_constlike(_get_irn_op(node));
827 }
828
829 static INLINE int _is_irn_always_opt(const ir_node *node) {
830         return is_op_always_opt(_get_irn_op(node));
831 }
832
833 static INLINE int _is_irn_keep(const ir_node *node) {
834         return is_op_keep(_get_irn_op(node));
835 }
836
837 static INLINE int _is_irn_start_block_placed(const ir_node *node) {
838         return is_op_start_block_placed(_get_irn_op(node));
839 }
840
841 static INLINE int _is_irn_machine_op(const ir_node *node) {
842         return is_op_machine(_get_irn_op(node));
843 }
844
845 static INLINE int _is_irn_machine_operand(const ir_node *node) {
846         return is_op_machine_operand(_get_irn_op(node));
847 }
848
849 static INLINE int _is_irn_machine_user(const ir_node *node, unsigned n) {
850         return is_op_machine_user(_get_irn_op(node), n);
851 }
852
853 static INLINE cond_jmp_predicate _get_Cond_jmp_pred(const ir_node *node) {
854         assert(_get_irn_op(node) == op_Cond);
855         return node->attr.cond.pred;
856 }
857
858 static INLINE void _set_Cond_jmp_pred(ir_node *node, cond_jmp_predicate pred) {
859         assert(_get_irn_op(node) == op_Cond);
860         node->attr.cond.pred = pred;
861 }
862
863 static INLINE int _get_Psi_n_conds(ir_node *node) {
864         assert(_get_irn_op(node) == op_Psi);
865         return _get_irn_arity(node) >> 1;
866 }
867
868 static INLINE void *_get_irn_generic_attr(ir_node *node) {
869         return &node->attr;
870 }
871
872 static INLINE const void *_get_irn_generic_attr_const(const ir_node *node) {
873         return &node->attr;
874 }
875
876 static INLINE unsigned _get_irn_idx(const ir_node *node) {
877         return node->node_idx;
878 }
879
880 static INLINE dbg_info *_get_irn_dbg_info(const ir_node *n) {
881         return n->dbi;
882 }  /* get_irn_dbg_info */
883
884 static INLINE void _set_irn_dbg_info(ir_node *n, dbg_info *db) {
885         n->dbi = db;
886 }
887
888 /* this section MUST contain all inline functions */
889 #define is_ir_node(thing)                     _is_ir_node(thing)
890 #define get_irn_intra_arity(node)             _get_irn_intra_arity(node)
891 #define get_irn_inter_arity(node)             _get_irn_inter_arity(node)
892 #define get_irn_arity(node)                   _get_irn_arity(node)
893 #define get_irn_intra_n(node, n)              _get_irn_intra_n(node, n)
894 #define get_irn_inter_n(node, n)              _get_irn_inter_n(node, n)
895 #define get_irn_n(node, n)                    _get_irn_n(node, n)
896 #define get_irn_mode(node)                    _get_irn_mode(node)
897 #define set_irn_mode(node, mode)              _set_irn_mode(node, mode)
898 #define get_irn_op(node)                      _get_irn_op(node)
899 #define set_irn_op(node, op)                  _set_irn_op(node, op)
900 #define get_irn_opcode(node)                  _get_irn_opcode(node)
901 #define get_irn_visited(node)                 _get_irn_visited(node)
902 #define set_irn_visited(node, v)              _set_irn_visited(node, v)
903 #define mark_irn_visited(node)                _mark_irn_visited(node)
904 #define irn_visited(node)                     _irn_visited(node)
905 #define irn_not_visited(node)                 _irn_not_visited(node)
906 #define set_irn_link(node, link)              _set_irn_link(node, link)
907 #define get_irn_link(node)                    _get_irn_link(node)
908 #define get_irn_pinned(node)                  _get_irn_pinned(node)
909 #define is_irn_pinned_in_irg(node)            _is_irn_pinned_in_irg(node)
910 #define is_unop(node)                         _is_unop(node)
911 #define is_binop(node)                        _is_binop(node)
912 #define is_Proj(node)                         _is_Proj(node)
913 #define is_Phi(node)                          _is_Phi(node)
914 #define is_Const(node)                        _is_Const(node)
915 #define is_Conv(node)                         _is_Conv(node)
916 #define is_Cast(node)                         _is_Cast(node)
917 #define is_Unknown(node)                      _is_Unknown(node)
918 #define is_Return(node)                       _is_Return(node)
919 #define is_Call(node)                         _is_Call(node)
920 #define is_Sel(node)                          _is_Sel(node)
921 #define is_Mul(node)                          _is_Mul(node)
922 #define is_Mulh(node)                         _is_Mulh(node)
923 #define is_Mux(node)                          _is_Mux(node)
924 #define is_Load(node)                         _is_Load(node)
925 #define is_Sync(node)                         _is_Sync(node)
926 #define is_Confirm(node)                      _is_Confirm(node)
927 #define is_Pin(node)                          _is_Pin(node)
928 #define is_SymConst(node)                     _is_SymConst(node)
929 #define is_Cond(node)                         _is_Cond(node)
930 #define is_CopyB(node)                        _is_CopyB(node)
931 #define is_Cmp(node)                          _is_Cmp(node)
932 #define is_Alloc(node)                        _is_Alloc(node)
933 #define is_Jmp(node)                          _is_Jmp(node)
934 #define is_Raise(node)                        _is_Raise(node)
935 #define is_ASM(node)                          _is_ASM(node)
936 #define is_Anchor(node)                       _is_Anchor(node)
937 #define is_Bad(node)                          _is_Bad(node)
938 #define is_NoMem(node)                        _is_NoMem(node)
939 #define is_Start(node)                        _is_Start(node)
940 #define is_End(node)                          _is_End(node)
941 #define is_Minus(node)                        _is_Minus(node)
942 #define is_Mod(node)                          _is_Mod(node)
943 #define is_Div(node)                          _is_Div(node)
944 #define is_DivMod(node)                       _is_DivMod(node)
945 #define is_Quot(node)                         _is_Quot(node)
946 #define is_Add(node)                          _is_Add(node)
947 #define is_And(node)                          _is_And(node)
948 #define is_Or(node)                           _is_Or(node)
949 #define is_Eor(node)                          _is_Eor(node)
950 #define is_Sub(node)                          _is_Sub(node)
951 #define is_Not(node)                          _is_Not(node)
952 #define is_Shl(node)                          _is_Shl(node)
953 #define is_Shr(node)                          _is_Shr(node)
954 #define is_Shrs(node)                         _is_Shrs(node)
955 #define is_Rot(node)                          _is_Rot(node)
956 #define is_Psi(node)                          _is_Psi(node)
957 #define is_Tuple(node)                        _is_Tuple(node)
958 #define is_no_Block(node)                     _is_no_Block(node)
959 #define is_Block(node)                        _is_Block(node)
960 #define get_Block_n_cfgpreds(node)            _get_Block_n_cfgpreds(node)
961 #define get_Block_cfgpred(node, pos)          _get_Block_cfgpred(node, pos)
962 #define get_Block_cfgpred_block(node, pos)    _get_Block_cfgpred_block(node, pos)
963 #define get_Block_block_visited(node)         _get_Block_block_visited(node)
964 #define set_Block_block_visited(node, visit)  _set_Block_block_visited(node, visit)
965 #define mark_Block_block_visited(node)        _mark_Block_block_visited(node)
966 #define Block_not_block_visited(node)         _Block_not_block_visited(node)
967 #define Block_block_visited(node)             _Block_block_visited(node)
968 #define set_Block_dead(block)                 _set_Block_dead(block)
969 #define is_Block_dead(block)                  _is_Block_dead(block)
970 #define get_Const_tarval(node)                _get_Const_tarval(node)
971 #define is_Const_null(node)                   _is_Const_null(node)
972 #define is_Const_one(node)                    _is_Const_one(node)
973 #define is_Const_all_one(node)                _is_Const_all_one(node)
974 #define is_irn_forking(node)                  _is_irn_forking(node)
975 #define get_irn_type(node)                    _get_irn_type(node)
976 #define get_irn_type_attr(node)               _get_irn_type_attr(node)
977 #define get_irn_entity_attr(node)             _get_irn_entity_attr(node)
978 #define is_irn_constlike(node)                _is_irn_constlike(node)
979 #define is_irn_always_opt(node)               _is_irn_always_opt(node)
980 #define is_irn_keep(node)                     _is_irn_keep(node)
981 #define is_irn_start_block_placed(node)       _is_irn_start_block_placed(node)
982 #define is_irn_machine_op(node)               _is_irn_machine_op(node)
983 #define is_irn_machine_operand(node)          _is_irn_machine_operand(node)
984 #define is_irn_machine_user(node, n)          _is_irn_machine_user(node, n)
985 #define get_Cond_jmp_pred(node)               _get_Cond_jmp_pred(node)
986 #define set_Cond_jmp_pred(node, pred)         _set_Cond_jmp_pred(node, pred)
987 #define get_Psi_n_conds(node)                 _get_Psi_n_conds(node)
988 #define get_irn_generic_attr(node)            _get_irn_generic_attr(node)
989 #define get_irn_generic_attr_const(node)      _get_irn_generic_attr_const(node)
990 #define get_irn_idx(node)                     _get_irn_idx(node)
991
992 #define get_irn_deps(node)                    _get_irn_deps(node)
993 #define set_irn_dep(node, pos, dep)           _set_irn_dep(node, pos, dep)
994 #define get_irn_dep(node, pos)                _get_irn_dep(node, pos)
995
996 #define get_irn_ins_or_deps(node)             _get_irn_ins_or_deps(node)
997 #define get_irn_in_or_dep(node, pos)          _get_irn_in_or_dep(node, pos)
998
999 #define get_irn_dbg_info(node)                _get_irn_dbg_info(node)
1000 #define set_irn_dbg_info(node, db)            _set_irn_dbg_info(node, db)
1001
1002 #endif