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