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