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