20d006a7e519d9aad5153f3d1a62003f2defebe9
[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_Bad(const ir_node *node) {
409         assert(node);
410         return (_get_irn_op(node) == op_Bad);
411 }
412
413 static INLINE int
414 _is_NoMem(const ir_node *node) {
415         assert(node);
416         return (_get_irn_op(node) == op_NoMem);
417 }
418
419 static INLINE int
420 _is_Minus(const ir_node *node) {
421         assert(node);
422         return (_get_irn_op(node) == op_Minus);
423 }
424
425 static INLINE int
426 _is_Mod(const ir_node *node) {
427         assert(node);
428         return (_get_irn_op(node) == op_Mod);
429 }
430
431 static INLINE int
432 _is_Div(const ir_node *node) {
433         assert(node);
434         return (_get_irn_op(node) == op_Div);
435 }
436
437 static INLINE int
438 _is_DivMod(const ir_node *node) {
439         assert(node);
440         return (_get_irn_op(node) == op_DivMod);
441 }
442
443 static INLINE int
444 _is_Quot(const ir_node *node) {
445         assert(node);
446         return (_get_irn_op(node) == op_Quot);
447 }
448
449 static INLINE int
450 _is_Add(const ir_node *node) {
451         assert(node);
452         return (_get_irn_op(node) == op_Add);
453 }
454
455 static INLINE int
456 _is_And(const ir_node *node) {
457         assert(node);
458         return (_get_irn_op(node) == op_And);
459 }
460
461 static INLINE int
462 _is_Or(const ir_node *node) {
463         assert(node);
464         return (_get_irn_op(node) == op_Or);
465 }
466
467 static INLINE int
468 _is_Eor(const ir_node *node) {
469         assert(node);
470         return (_get_irn_op(node) == op_Eor);
471 }
472
473 static INLINE int
474 _is_Sub(const ir_node *node) {
475         assert(node);
476         return (_get_irn_op(node) == op_Sub);
477 }
478
479 static INLINE int
480 _is_Not(const ir_node *node) {
481         assert(node);
482         return (_get_irn_op(node) == op_Not);
483 }
484
485 static INLINE int
486 _is_Shl(const ir_node *node) {
487         assert(node);
488         return (_get_irn_op(node) == op_Shl);
489 }
490
491 static INLINE int
492 _is_Shr(const ir_node *node) {
493         assert(node);
494         return (_get_irn_op(node) == op_Shr);
495 }
496
497 static INLINE int
498 _is_Shrs(const ir_node *node) {
499         assert(node);
500         return (_get_irn_op(node) == op_Shrs);
501 }
502
503 static INLINE int
504 _is_Rot(const ir_node *node) {
505         assert(node);
506         return (_get_irn_op(node) == op_Rot);
507 }
508
509 static INLINE int
510 _is_Psi(const ir_node *node) {
511         assert(node);
512         return (_get_irn_op(node) == op_Psi);
513 }
514
515 static INLINE int
516 _is_Tuple(const ir_node *node) {
517         assert(node);
518         return (_get_irn_op(node) == op_Tuple);
519 }
520
521 static INLINE int
522 _is_Start(const ir_node *node) {
523         assert(node);
524         return (_get_irn_op(node) == op_Start);
525 }
526
527 static INLINE int
528 _is_End(const ir_node *node) {
529         assert(node);
530         return (_get_irn_op(node) == op_End);
531 }
532
533 static INLINE int
534 _is_Const(const ir_node *node) {
535         assert(node);
536         return (_get_irn_op(node) == op_Const);
537 }
538
539 static INLINE int
540 _is_Conv(const ir_node *node) {
541         assert(node);
542         return (_get_irn_op(node) == op_Conv);
543 }
544
545 static INLINE int
546 _is_Cast(const ir_node *node) {
547         assert(node);
548         return (_get_irn_op(node) == op_Cast);
549 }
550
551 static INLINE int
552 _is_CopyB(const ir_node *node) {
553         assert(node);
554         return (_get_irn_op(node) == op_CopyB);
555 }
556
557 static INLINE int
558 _is_Unknown(const ir_node *node) {
559         assert(node);
560         return (_get_irn_op(node) == op_Unknown);
561 }
562
563 static INLINE int
564 _is_Return(const ir_node *node) {
565         assert(node);
566         return (_get_irn_op(node) == op_Return);
567 }
568
569 static INLINE int
570 _is_Call(const ir_node *node) {
571         assert(node);
572         return (_get_irn_op(node) == op_Call);
573 }
574
575 static INLINE int
576 _is_Sel(const ir_node *node) {
577         assert(node);
578         return (_get_irn_op(node) == op_Sel);
579 }
580
581 static INLINE int
582 _is_Mul(const ir_node *node) {
583         assert(node);
584         return (_get_irn_op(node) == op_Mul);
585 }
586
587 static INLINE int
588 _is_Mulh(const ir_node *node) {
589         assert(node);
590         return (_get_irn_op(node) == op_Mulh);
591 }
592
593 static INLINE int
594 _is_Mux(const ir_node *node) {
595         assert(node);
596         if (node) {
597                 ir_op *op = _get_irn_op(node);
598                 return (op == op_Mux || ((op == op_Psi) && _get_irn_arity(node) == 3));
599         }
600         return 0;
601 }
602
603 static INLINE int
604 _is_Load(const ir_node *node) {
605         assert(node);
606         return (_get_irn_op(node) == op_Load);
607 }
608
609 static INLINE int
610 _is_Store(const ir_node *node) {
611         assert(node);
612         return (_get_irn_op(node) == op_Store);
613 }
614
615 static INLINE int
616 _is_Sync(const ir_node *node) {
617         assert(node);
618         return (_get_irn_op(node) == op_Sync);
619 }
620
621 static INLINE int
622 _is_Confirm(const ir_node *node) {
623         assert(node);
624         return (_get_irn_op(node) == op_Confirm);
625 }
626
627 static INLINE int
628 _is_Pin(const ir_node *node) {
629         assert(node);
630         return (_get_irn_op(node) == op_Pin);
631 }
632
633 static INLINE int
634 _is_SymConst(const ir_node *node) {
635         assert(node);
636         return (_get_irn_op(node) == op_SymConst);
637 }
638
639 static INLINE int
640 _is_Cond(const ir_node *node) {
641         assert(node);
642         return (_get_irn_op(node) == op_Cond);
643 }
644
645 static INLINE int
646 _is_Cmp(const ir_node *node) {
647         assert(node);
648         return (_get_irn_op(node) == op_Cmp);
649 }
650
651 static INLINE int
652 _is_Alloc(const ir_node *node) {
653         assert(node);
654         return (_get_irn_op(node) == op_Alloc);
655 }
656
657 static INLINE int
658 _is_Jmp(const ir_node *node) {
659         assert(node);
660         return (_get_irn_op(node) == op_Jmp);
661 }
662
663 static INLINE int
664 _is_Raise(const ir_node *node) {
665         assert(node);
666         return (_get_irn_op(node) == op_Raise);
667 }
668
669 static INLINE int
670 _is_ASM(const ir_node *node) {
671         assert(node);
672         return (_get_irn_op(node) == op_ASM);
673 }
674
675 static INLINE int
676 _is_Anchor(const ir_node *node) {
677         return (_get_irn_op(node) == op_Anchor);
678 }
679
680 static INLINE int
681 _is_no_Block(const ir_node *node) {
682         assert(node && _is_ir_node(node));
683         return (_get_irn_op(node) != op_Block);
684 }
685
686 static INLINE int
687 _is_Block(const ir_node *node) {
688         assert(node && _is_ir_node(node));
689         return (_get_irn_op(node) == op_Block);
690 }
691
692 static INLINE int
693 _get_Block_n_cfgpreds(const ir_node *node) {
694         assert(_is_Block(node));
695         return _get_irn_arity(node);
696 }
697
698 static INLINE ir_node *
699 _get_Block_cfgpred(ir_node *node, int pos) {
700         assert(0 <= pos && pos < get_irn_arity(node));
701         assert(_is_Block(node));
702         return _get_irn_n(node, pos);
703 }
704
705 /* Get the predecessor block.
706  *
707  *  Returns the block corresponding to the predecessor pos.
708  *
709  *  There are several ambiguities we resolve with this function:
710  *  - The direct predecessor can be a Proj, which is not pinned.
711  *    We walk from the predecessor to the next pinned node
712  *    (skip_Proj) and return the block that node is in.
713  *  - If we encounter the Bad node, this function does not return
714  *    Start, but the Bad node.
715  */
716 static INLINE ir_node  *
717 _get_Block_cfgpred_block(ir_node *node, int pos) {
718         ir_node *res = skip_Proj(get_Block_cfgpred(node, pos));
719         if (!is_Bad(res))
720                 res = get_nodes_block(res);
721         return res;
722 }
723
724 static INLINE unsigned long
725 _get_Block_block_visited(const ir_node *node) {
726         assert(node->op == op_Block);
727         return node->attr.block.block_visited;
728 }
729
730 static INLINE void
731 _set_Block_block_visited(ir_node *node, unsigned long visit) {
732         assert(node->op == op_Block);
733         node->attr.block.block_visited = visit;
734 }
735
736 /* For this current_ir_graph must be set. */
737 static INLINE void
738 _mark_Block_block_visited(ir_node *node) {
739         assert(node->op == op_Block);
740         node->attr.block.block_visited = get_irg_block_visited(current_ir_graph);
741 }
742
743 static INLINE int
744 _Block_not_block_visited(const ir_node *node) {
745         assert(node->op == op_Block);
746         return (node->attr.block.block_visited < get_irg_block_visited(current_ir_graph));
747 }
748
749 static INLINE int
750 _Block_block_visited(const ir_node *node) {
751         assert(node->op == op_Block);
752         return (node->attr.block.block_visited >= get_irg_block_visited(current_ir_graph));
753 }
754
755 static INLINE ir_node *
756 _set_Block_dead(ir_node *block) {
757         assert(_get_irn_op(block) == op_Block);
758         block->attr.block.is_dead = 1;
759         return block;
760 }
761
762 static INLINE int
763 _is_Block_dead(const ir_node *block) {
764         ir_op *op = _get_irn_op(block);
765
766         if (op == op_Bad)
767                 return 1;
768         else {
769                 assert(op == op_Block);
770                 return block->attr.block.is_dead;
771         }
772 }
773
774 static INLINE tarval *_get_Const_tarval(const ir_node *node) {
775         assert(_get_irn_op(node) == op_Const);
776         return node->attr.con.tv;
777 }
778
779 static INLINE int _is_Const_null(const ir_node *node) {
780         return tarval_is_null(_get_Const_tarval(node));
781 }
782
783 static INLINE int _is_Const_one(const ir_node *node) {
784         return tarval_is_one(_get_Const_tarval(node));
785 }
786
787 static INLINE int _is_Const_all_one(const ir_node *node) {
788         return tarval_is_all_one(_get_Const_tarval(node));
789 }
790
791 static INLINE int _is_irn_forking(const ir_node *node) {
792         return is_op_forking(_get_irn_op(node));
793 }
794
795 static INLINE ir_type *_get_irn_type(ir_node *node) {
796         return _get_irn_op(node)->ops.get_type(node);
797 }
798
799 static INLINE ir_type *_get_irn_type_attr(ir_node *node) {
800         return _get_irn_op(node)->ops.get_type_attr(node);
801 }
802
803 static INLINE ir_entity *_get_irn_entity_attr(ir_node *node) {
804   return _get_irn_op(node)->ops.get_entity_attr(node);
805 }
806
807 static INLINE int _is_irn_constlike(const ir_node *node) {
808         return is_op_constlike(_get_irn_op(node));
809 }
810
811 static INLINE int _is_irn_always_opt(const ir_node *node) {
812         return is_op_always_opt(_get_irn_op(node));
813 }
814
815 static INLINE int _is_irn_keep(const ir_node *node) {
816         return is_op_keep(_get_irn_op(node));
817 }
818
819 static INLINE int _is_irn_start_block_placed(const ir_node *node) {
820         return is_op_start_block_placed(_get_irn_op(node));
821 }
822
823 static INLINE int _is_irn_machine_op(const ir_node *node) {
824         return is_op_machine(_get_irn_op(node));
825 }
826
827 static INLINE int _is_irn_machine_operand(const ir_node *node) {
828         return is_op_machine_operand(_get_irn_op(node));
829 }
830
831 static INLINE int _is_irn_machine_user(const ir_node *node, unsigned n) {
832         return is_op_machine_user(_get_irn_op(node), n);
833 }
834
835 static INLINE cond_jmp_predicate _get_Cond_jmp_pred(const ir_node *node) {
836         assert(_get_irn_op(node) == op_Cond);
837         return node->attr.cond.pred;
838 }
839
840 static INLINE void _set_Cond_jmp_pred(ir_node *node, cond_jmp_predicate pred) {
841         assert(_get_irn_op(node) == op_Cond);
842         node->attr.cond.pred = pred;
843 }
844
845 static INLINE int _get_Psi_n_conds(ir_node *node) {
846         assert(_get_irn_op(node) == op_Psi);
847         return _get_irn_arity(node) >> 1;
848 }
849
850 static INLINE void *_get_irn_generic_attr(ir_node *node) {
851         return &node->attr;
852 }
853
854 static INLINE const void *_get_irn_generic_attr_const(const ir_node *node) {
855         return &node->attr;
856 }
857
858 static INLINE unsigned _get_irn_idx(const ir_node *node) {
859         return node->node_idx;
860 }
861
862 static INLINE dbg_info *_get_irn_dbg_info(const ir_node *n) {
863         return n->dbi;
864 }  /* get_irn_dbg_info */
865
866 static INLINE void _set_irn_dbg_info(ir_node *n, dbg_info *db) {
867         n->dbi = db;
868 }
869
870 /* this section MUST contain all inline functions */
871 #define is_ir_node(thing)                     _is_ir_node(thing)
872 #define get_irn_intra_arity(node)             _get_irn_intra_arity(node)
873 #define get_irn_inter_arity(node)             _get_irn_inter_arity(node)
874 #define get_irn_arity(node)                   _get_irn_arity(node)
875 #define get_irn_intra_n(node, n)              _get_irn_intra_n(node, n)
876 #define get_irn_inter_n(node, n)              _get_irn_inter_n(node, n)
877 #define get_irn_n(node, n)                    _get_irn_n(node, n)
878 #define get_irn_mode(node)                    _get_irn_mode(node)
879 #define set_irn_mode(node, mode)              _set_irn_mode(node, mode)
880 #define get_irn_op(node)                      _get_irn_op(node)
881 #define set_irn_op(node, op)                  _set_irn_op(node, op)
882 #define get_irn_opcode(node)                  _get_irn_opcode(node)
883 #define get_irn_visited(node)                 _get_irn_visited(node)
884 #define set_irn_visited(node, v)              _set_irn_visited(node, v)
885 #define mark_irn_visited(node)                _mark_irn_visited(node)
886 #define irn_visited(node)                     _irn_visited(node)
887 #define irn_not_visited(node)                 _irn_not_visited(node)
888 #define set_irn_link(node, link)              _set_irn_link(node, link)
889 #define get_irn_link(node)                    _get_irn_link(node)
890 #define get_irn_pinned(node)                  _get_irn_pinned(node)
891 #define is_irn_pinned_in_irg(node)            _is_irn_pinned_in_irg(node)
892 #define is_unop(node)                         _is_unop(node)
893 #define is_binop(node)                        _is_binop(node)
894 #define is_Const(node)                        _is_Const(node)
895 #define is_Conv(node)                         _is_Conv(node)
896 #define is_Cast(node)                         _is_Cast(node)
897 #define is_Unknown(node)                      _is_Unknown(node)
898 #define is_Return(node)                       _is_Return(node)
899 #define is_Call(node)                         _is_Call(node)
900 #define is_Sel(node)                          _is_Sel(node)
901 #define is_Mul(node)                          _is_Mul(node)
902 #define is_Mulh(node)                         _is_Mulh(node)
903 #define is_Mux(node)                          _is_Mux(node)
904 #define is_Load(node)                         _is_Load(node)
905 #define is_Sync(node)                         _is_Sync(node)
906 #define is_Confirm(node)                      _is_Confirm(node)
907 #define is_Pin(node)                          _is_Pin(node)
908 #define is_SymConst(node)                     _is_SymConst(node)
909 #define is_Cond(node)                         _is_Cond(node)
910 #define is_CopyB(node)                        _is_CopyB(node)
911 #define is_Cmp(node)                          _is_Cmp(node)
912 #define is_Alloc(node)                        _is_Alloc(node)
913 #define is_Jmp(node)                          _is_Jmp(node)
914 #define is_Raise(node)                        _is_Raise(node)
915 #define is_ASM(node)                          _is_ASM(node)
916 #define is_Anchor(node)                       _is_Anchor(node)
917 #define is_Bad(node)                          _is_Bad(node)
918 #define is_NoMem(node)                        _is_NoMem(node)
919 #define is_Start(node)                        _is_Start(node)
920 #define is_End(node)                          _is_End(node)
921 #define is_Minus(node)                        _is_Minus(node)
922 #define is_Mod(node)                          _is_Mod(node)
923 #define is_Div(node)                          _is_Div(node)
924 #define is_DivMod(node)                       _is_DivMod(node)
925 #define is_Quot(node)                         _is_Quot(node)
926 #define is_Add(node)                          _is_Add(node)
927 #define is_And(node)                          _is_And(node)
928 #define is_Or(node)                           _is_Or(node)
929 #define is_Eor(node)                          _is_Eor(node)
930 #define is_Sub(node)                          _is_Sub(node)
931 #define is_Not(node)                          _is_Not(node)
932 #define is_Shl(node)                          _is_Shl(node)
933 #define is_Shr(node)                          _is_Shr(node)
934 #define is_Shrs(node)                         _is_Shrs(node)
935 #define is_Rot(node)                          _is_Rot(node)
936 #define is_Psi(node)                          _is_Psi(node)
937 #define is_Tuple(node)                        _is_Tuple(node)
938 #define is_no_Block(node)                     _is_no_Block(node)
939 #define is_Block(node)                        _is_Block(node)
940 #define get_Block_n_cfgpreds(node)            _get_Block_n_cfgpreds(node)
941 #define get_Block_cfgpred(node, pos)          _get_Block_cfgpred(node, pos)
942 #define get_Block_cfgpred_block(node, pos)    _get_Block_cfgpred_block(node, pos)
943 #define get_Block_block_visited(node)         _get_Block_block_visited(node)
944 #define set_Block_block_visited(node, visit)  _set_Block_block_visited(node, visit)
945 #define mark_Block_block_visited(node)        _mark_Block_block_visited(node)
946 #define Block_not_block_visited(node)         _Block_not_block_visited(node)
947 #define Block_block_visited(node)             _Block_block_visited(node)
948 #define set_Block_dead(block)                 _set_Block_dead(block)
949 #define is_Block_dead(block)                  _is_Block_dead(block)
950 #define get_Const_tarval(node)                _get_Const_tarval(node)
951 #define is_Const_null(node)                   _is_Const_null(node)
952 #define is_Const_one(node)                    _is_Const_one(node)
953 #define is_Const_all_one(node)                _is_Const_all_one(node)
954 #define is_irn_forking(node)                  _is_irn_forking(node)
955 #define get_irn_type(node)                    _get_irn_type(node)
956 #define get_irn_type_attr(node)               _get_irn_type_attr(node)
957 #define get_irn_entity_attr(node)             _get_irn_entity_attr(node)
958 #define is_irn_constlike(node)                _is_irn_constlike(node)
959 #define is_irn_always_opt(node)               _is_irn_always_opt(node)
960 #define is_irn_keep(node)                     _is_irn_keep(node)
961 #define is_irn_start_block_placed(node)       _is_irn_start_block_placed(node)
962 #define is_irn_machine_op(node)               _is_irn_machine_op(node)
963 #define is_irn_machine_operand(node)          _is_irn_machine_operand(node)
964 #define is_irn_machine_user(node, n)          _is_irn_machine_user(node, n)
965 #define get_Cond_jmp_pred(node)               _get_Cond_jmp_pred(node)
966 #define set_Cond_jmp_pred(node, pred)         _set_Cond_jmp_pred(node, pred)
967 #define get_Psi_n_conds(node)                 _get_Psi_n_conds(node)
968 #define get_irn_generic_attr(node)            _get_irn_generic_attr(node)
969 #define get_irn_generic_attr_const(node)      _get_irn_generic_attr_const(node)
970 #define get_irn_idx(node)                     _get_irn_idx(node)
971
972 #define get_irn_deps(node)                    _get_irn_deps(node)
973 #define set_irn_dep(node, pos, dep)           _set_irn_dep(node, pos, dep)
974 #define get_irn_dep(node, pos)                _get_irn_dep(node, pos)
975
976 #define get_irn_ins_or_deps(node)             _get_irn_ins_or_deps(node)
977 #define get_irn_in_or_dep(node, pos)          _get_irn_in_or_dep(node, pos)
978
979 #define get_irn_dbg_info(node)                _get_irn_dbg_info(node)
980 #define set_irn_dbg_info(node, db)            _set_irn_dbg_info(node, db)
981
982 #endif