introduced node index: a small unique per graph node number
[libfirm] / ir / ir / irnode_t.h
1 /*
2  * Project:     libFIRM
3  * File name:   ir/ir/irnode_t.h
4  * Purpose:     Representation of an intermediate operation -- private header.
5  * Author:      Martin Trapp, Christian Schaefer
6  * Modified by: Goetz Lindenmaier
7  * Created:
8  * CVS-ID:      $Id$
9  * Copyright:   (c) 1998-2003 Universität Karlsruhe
10  * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
11  */
12
13 /**
14  * @file irnode_t.h
15  *
16  * Declarations of an ir node.
17  *
18  * @author Martin Trapp, Christian Schaefer
19  */
20
21 # ifndef _IRNODE_T_H_
22 # define _IRNODE_T_H_
23
24 #include "firm_config.h"
25 #include "irnode.h"
26 #include "irop_t.h"
27 #include "irgraph_t.h"
28 #include "irflag_t.h"
29 #include "firm_common_t.h"
30 #include "irdom_t.h" /* For size of struct dom_info. */
31 #include "dbginfo.h"
32 #include "irloop.h"
33 #include "array.h"
34
35 #include "set.h"
36 #include "list.h"
37 #include "entity_t.h"
38 #include "type_t.h"
39 #include "tv_t.h"
40 #include "irextbb_t.h"
41
42
43 /** ir node attributes **/
44
45 /** Block attributes */
46 typedef struct {
47   /* General attributes */
48   ir_graph *irg;
49   unsigned long block_visited;  /**< for the walker that walks over all blocks. */
50   /* Attributes private to construction: */
51   unsigned matured:1;         /**< if set, all in-nodes of the block are fixed */
52   unsigned dead:1;            /**< if set, the block is dead (and could be replace by a Bad */
53   ir_node **graph_arr;        /**< array to store all parameters */
54   /* Attributes holding analyses information */
55   dom_info dom;               /**< Datastructure that holds information about dominators.
56                                    @@@ @todo
57                                    Eventually overlay with graph_arr as only valid
58                                    in different phases.  Eventually inline the whole
59                                    datastructure. */
60   dom_info pdom;              /**< Datastructure that holds information about post-dominators. */
61   ir_node ** in_cg;           /**< array with predecessors in
62                                * interprocedural_view, if they differ
63                                * from intraprocedural predecessors */
64   int *backedge;              /**< Field n set to true if pred n is backedge.
65                                    @@@ @todo Ev. replace by bit field! */
66   int *cg_backedge;           /**< Field n set to true if pred n is interprocedural backedge.
67                                    @@@ @todo Ev. replace by bit field! */
68   ir_extblk *extblk;          /**< the extended basic block this block belongs to */
69
70   struct list_head succ_head; /**< A list head for all successor edges of a block. */
71
72 } block_attr;
73
74 /** Start attributes */
75 typedef struct {
76   char dummy;
77   /*   ir_graph *irg;   @@@ now in block */
78 } start_attr;
79
80 /** Cond attributes */
81 typedef struct {
82   cond_kind kind;           /**< flavor of Cond */
83   long default_proj;        /**< only for non-binary Conds: biggest Proj number, i.e. the one used for default. */
84   cond_jmp_predicate pred;  /**< only for binary Conds: The jump predication. */
85 } cond_attr;
86
87 /** Const attributes */
88 typedef struct {
89   tarval  *tv;       /**< the target value */
90   ir_type *tp;       /**< the source type, for analyses. default: type_unknown. */
91 } const_attr;
92
93 typedef struct {
94   symconst_symbol sym;  // old tori
95   symconst_kind num;
96   ir_type *tp;       /**< the source type, for analyses. default: type_unknown. */
97 } symconst_attr;
98
99 /** Sel attributes */
100 typedef struct {
101   entity *ent;          /**< entity to select */
102 } sel_attr;
103
104 /** Exception attributes */
105 typedef struct {
106   op_pin_state   pin_state;     /**< the pin state for operations that might generate a exception:
107                                      If it's know that no exception will be generated, could be set to
108                                      op_pin_state_floats. */
109 #if PRECISE_EXC_CONTEXT
110   struct ir_node **frag_arr;    /**< For Phi node construction in case of exception */
111 #endif
112 } except_attr;
113
114 /** Call attributes */
115 typedef struct {
116   except_attr    exc;           /**< the exception attribute. MUST be the first one. */
117   ir_type *cld_tp;              /**< type of called procedure */
118   entity ** callee_arr;         /**< result of callee analysis */
119 } call_attr;
120
121 /** Alloc attributes */
122 typedef struct {
123   except_attr    exc;           /**< the exception attribute. MUST be the first one. */
124   ir_type *type;                /**< Type of the allocated object.  */
125   where_alloc where;            /**< stack, heap or other managed part of memory */
126 } alloc_attr;
127
128 /** Free attributes */
129 typedef struct {
130   ir_type *type;                /**< Type of the allocated object.  */
131   where_alloc where;            /**< stack, heap or other managed part of memory */
132 } free_attr;
133
134 /** InstOf attributes */
135 typedef struct {
136   except_attr    exc;           /**< the exception attribute. MUST be the first one. */
137   ir_type *type;                /**< the type of which the object pointer must be */
138 } io_attr;
139
140 /** Filter attributes */
141 typedef struct {
142   long proj;                 /**< contains the result position to project (Proj) */
143   ir_node ** in_cg;          /**< array with interprocedural predecessors (Phi) */
144   int *backedge;              /**< Field n set to true if pred n is backedge.
145                      @todo Ev. replace by bitfield! */
146 } filter_attr;
147
148 /** EndReg/EndExcept attributes */
149 typedef struct {
150   char dummy;
151 } end_attr;
152
153 /** CallBegin attributes */
154 typedef struct {
155   ir_node * call;               /**< Associated Call-operation. */
156 } callbegin_attr;
157
158 /** Cast attributes */
159 typedef struct {
160   ir_type *totype;              /**< Type of the casted node. */
161 } cast_attr;
162
163 /** Load attributes */
164 typedef struct {
165   except_attr    exc;           /**< The exception attribute. MUST be the first one. */
166   ir_mode        *load_mode;    /**< The mode of this Load operation. */
167   ent_volatility volatility;      /**< The volatility of a Load/Store operation. */
168 } load_attr;
169
170 /** Store attributes */
171 typedef struct {
172   except_attr    exc;           /**< the exception attribute. MUST be the first one. */
173   ent_volatility volatility;      /**< the volatility of a Store operation */
174 } store_attr;
175
176 typedef pn_Cmp confirm_attr;    /**< Attribute to hold compare operation */
177
178 /** CopyB attribute */
179 typedef struct {
180   except_attr    exc;           /**< The exception attribute. MUST be the first one. */
181   ir_type        *data_type;    /**< Type of the copied entity. */
182 } copyb_attr;
183
184 /** Bound attribute */
185 typedef struct {
186   except_attr    exc;           /**< The exception attribute. MUST be the first one. */
187 } bound_attr;
188
189 /**
190  * Edge info to put into an irn.
191  */
192 typedef struct _irn_edge_info_t {
193   struct list_head outs_head;  /**< The list of all outs. */
194   int out_count;               /**< Number of outs in the list. */
195 } irn_edge_info_t;
196
197
198 /** Some IR-nodes just have one attribute, these are stored here,
199    some have more. Their name is 'irnodename_attr' */
200 typedef union {
201   start_attr     start; /**< For Start */
202   block_attr     block; /**< For Block: Fields needed to construct it */
203   cond_attr      c;     /**< For Cond. */
204   const_attr     con;   /**< For Const: contains the value of the constant and a type */
205   symconst_attr  i;     /**< For SymConst. */
206   sel_attr       s;     /**< For Sel. */
207   call_attr      call;  /**< For Call: pointer to the type of the method to call */
208   callbegin_attr callbegin; /**< For CallBegin */
209   alloc_attr     a;    /**< For Alloc. */
210   free_attr      f;    /**< For Free. */
211   io_attr        io;    /**< For InstOf */
212   cast_attr      cast;  /**< For Cast. */
213   load_attr      load;  /**< For Load. */
214   store_attr     store;  /**< For Store. */
215   int            phi0_pos;  /**< For Phi. Used to remember the value defined by
216                    this Phi node.  Needed when the Phi is completed
217                    to call get_r_internal_value to find the
218                    predecessors. If this attribute is set, the Phi
219                    node takes the role of the obsolete Phi0 node,
220                    therefore the name. */
221   int *phi_backedge;    /**< For Phi after construction.
222                            Field n set to true if pred n is backedge.
223                            @todo Ev. replace by bitfield! */
224   long           proj;          /**< For Proj: contains the result position to project */
225   confirm_attr   confirm_cmp;   /**< For Confirm: compare operation */
226   filter_attr    filter;        /**< For Filter */
227   end_attr       end;           /**< For EndReg, EndExcept */
228   except_attr    except;        /**< For Phi node construction in case of exceptions */
229   copyb_attr     copyb;         /**< For CopyB operation */
230   bound_attr     bound;         /**< For Bound operation */
231 } attr;
232
233
234 /** common structure of an irnode
235     if the node has some attributes, they are stored in attr */
236 struct ir_node {
237   /* ------- Basics of the representation  ------- */
238   firm_kind kind;          /**< distinguishes this node from others */
239   ir_op *op;               /**< Opcode of this node. */
240   ir_mode *mode;           /**< Mode of this node. */
241   struct ir_node **in;     /**< array with predecessors / operands */
242   unsigned long visited;   /**< visited counter for walks of the graph */
243   unsigned node_idx;       /**< the node index of this node in its graph */
244   void *link;              /**< to attach additional information to the node, e.g.
245                               used while construction to link Phi0 nodes and
246                               during optimization to link to nodes that
247                               shall replace a node. */
248   /* ------- Fields for optimizations / analysis information ------- */
249   struct ir_node **out;    /**< @deprecated array of out edges. */
250   struct dbg_info* dbi;    /**< A pointer to information for debug support. */
251   /* ------- For debugging ------- */
252 #ifdef DEBUG_libfirm
253   int out_valid;
254   long node_nr;            /**< a unique node number for each node to make output
255                                    readable. */
256 #endif
257   /* ------- For analyses -------- */
258   ir_loop *loop;           /**< the loop the node is in. Access routines in irloop.h */
259 #ifdef  DO_HEAPANALYSIS
260   struct abstval *av;      /**< the abstract value of this node */
261   struct section *sec;
262 #endif
263 #if FIRM_EDGES_INPLACE
264   irn_edge_info_t edge_info;  /**< everlasting out edges */
265 #endif
266   /* ------- Opcode depending fields -------- */
267   attr attr;               /**< attribute of this node. Depends on opcode.
268                               Must be last field of struct ir_node. */
269 };
270
271
272 /**
273  * Returns the array with the ins.  The content of the array may not be
274  * changed.
275  * Note that this function returns the whole in array including the
276  * block predecessor. So, it is NOT symmetric with set_irn_in().
277  */
278 ir_node     **get_irn_in            (const ir_node *node);
279
280 /** @{ */
281 /** access attributes directly */
282 const_attr    get_irn_const_attr    (ir_node *node);
283 long          get_irn_proj_attr     (ir_node *node);
284 alloc_attr    get_irn_alloc_attr    (ir_node *node);
285 free_attr     get_irn_free_attr     (ir_node *node);
286 symconst_attr get_irn_symconst_attr (ir_node *node);
287 ir_type      *get_irn_call_attr     (ir_node *node);
288 ir_type      *get_irn_funccall_attr (ir_node *node);
289 sel_attr      get_irn_sel_attr      (ir_node *node);
290 int           get_irn_phi_attr      (ir_node *node);
291 block_attr    get_irn_block_attr    (ir_node *node);
292 load_attr     get_irn_load_attr     (ir_node *node);
293 store_attr    get_irn_store_attr    (ir_node *node);
294 except_attr   get_irn_except_attr   (ir_node *node);
295 /** @} */
296
297 /**
298  * The amount of additional space for custom data to be allocated upon creating a new node.
299  */
300 extern unsigned firm_add_node_size;
301
302 /**
303  * Sets the get_type operation for an ir_op_ops.
304  *
305  * @param code   the opcode for the default operation
306  * @param ops    the operations initialized
307  *
308  * @return
309  *    The operations.
310  */
311 ir_op_ops *firm_set_default_get_type(opcode code, ir_op_ops *ops);
312
313 /**
314  * Sets the get_type_attr operation for an ir_op_ops.
315  *
316  * @param code   the opcode for the default operation
317  * @param ops    the operations initialized
318  *
319  * @return
320  *    The operations.
321  */
322 ir_op_ops *firm_set_default_get_type_attr(opcode code, ir_op_ops *ops);
323
324 /**
325  * Sets the get_entity_attr operation for an ir_op_ops.
326  *
327  * @param code   the opcode for the default operation
328  * @param ops    the operations initialized
329  *
330  * @return
331  *    The operations.
332  */
333 ir_op_ops *firm_set_default_get_entity_attr(opcode code, ir_op_ops *ops);
334
335 /*-------------------------------------------------------------------*/
336 /*  These function are most used in libfirm.  Give them as static    */
337 /*  functions so they can be inlined.                                */
338 /*-------------------------------------------------------------------*/
339
340 /**
341  * Checks whether a pointer points to a ir node.
342  * Intern version for libFirm.
343  */
344 static INLINE int
345 _is_ir_node (const void *thing) {
346   return (get_kind(thing) == k_ir_node);
347 }
348
349 /**
350  * Gets the op of a node.
351  * Intern version for libFirm.
352  */
353 static INLINE ir_op *
354 _get_irn_op (const ir_node *node) {
355   assert (node);
356   return node->op;
357 }
358
359 static INLINE void
360 _set_irn_op (ir_node *node, ir_op *op) {
361   assert (node);
362   node->op = op;
363 }
364
365 /** Copies all attributes stored in the old node  to the new node.
366     Assumes both have the same opcode and sufficient size. */
367 static INLINE void
368 copy_node_attr(const ir_node *old_node, ir_node *new_node) {
369   ir_op *op = _get_irn_op(old_node);
370
371   /* must always exist */
372   op->ops.copy_attr(old_node, new_node);
373 }
374
375 /**
376  * Gets the opcode of a node.
377  * Intern version for libFirm.
378  */
379 static INLINE opcode
380 _get_irn_opcode (const ir_node *node) {
381   assert (k_ir_node == get_kind(node));
382   assert (node->op);
383   return node->op->code;
384 }
385
386 /**
387  * Returns the number of predecessors without the block predecessor.
388  * Intern version for libFirm.
389  */
390 static INLINE int
391 _get_irn_intra_arity (const ir_node *node) {
392   assert(node);
393   return ARR_LEN(node->in) - 1;
394 }
395
396 /**
397  * Returns the number of predecessors without the block predecessor.
398  * Intern version for libFirm.
399  */
400 static INLINE int
401 _get_irn_inter_arity (const ir_node *node) {
402   assert(node);
403   if (_get_irn_op(node) == op_Filter) {
404     assert(node->attr.filter.in_cg);
405     return ARR_LEN(node->attr.filter.in_cg) - 1;
406   } else if (_get_irn_op(node) == op_Block && node->attr.block.in_cg) {
407     return ARR_LEN(node->attr.block.in_cg) - 1;
408   }
409   return _get_irn_intra_arity(node);
410 }
411
412 /**
413  * Returns the number of predecessors without the block predecessor.
414  * Intern version for libFirm.
415  */
416 extern int (*_get_irn_arity)(const ir_node *node);
417
418 /**
419  * Intern version for libFirm.
420  */
421 static INLINE ir_node *
422 _get_irn_intra_n (const ir_node *node, int n) {
423   ir_node *nn;
424
425   assert(node); assert(-1 <= n && n < _get_irn_intra_arity(node));
426
427   nn = node->in[n + 1];
428   if (!nn || (nn->op != op_Id)) return nn;
429
430   return (node->in[n + 1] = skip_Id(nn));
431 }
432
433 /**
434  * Intern version for libFirm.
435  */
436 static INLINE ir_node*
437 _get_irn_inter_n (const ir_node *node, int n) {
438   assert(node); assert(-1 <= n && n < _get_irn_inter_arity(node));
439
440   /* handle Filter and Block specially */
441   if (_get_irn_op(node) == op_Filter) {
442     assert(node->attr.filter.in_cg);
443     return (node->attr.filter.in_cg[n + 1] = skip_Id(node->attr.filter.in_cg[n + 1]));
444   } else if (_get_irn_op(node) == op_Block && node->attr.block.in_cg) {
445     return (node->attr.block.in_cg[n + 1] = skip_Id(node->attr.block.in_cg[n + 1]));
446   }
447
448   return _get_irn_intra_n (node, n);
449 }
450
451 /**
452  * Access to the predecessors of a node.
453  * To iterate over the operands iterate from 0 to i < get_irn_arity(),
454  * to iterate including the Block predecessor iterate from i = -1 to
455  * i < get_irn_arity.
456  * If it is a block, the entry -1 is NULL.
457  * Intern version for libFirm.
458  */
459 extern ir_node *(*_get_irn_n)(const ir_node *node, int n);
460
461 /**
462  * Gets the mode of a node.
463  * Intern version for libFirm.
464  */
465 static INLINE ir_mode *
466 _get_irn_mode (const ir_node *node)
467 {
468   assert (node);
469   return node->mode;
470 }
471
472 /**
473  * Sets the mode of a node.
474  * Intern version of libFirm.
475  */
476 static INLINE void
477 _set_irn_mode (ir_node *node, ir_mode *mode)
478 {
479   assert (node);
480   node->mode = mode;
481 }
482
483 /**
484  * Gets the visited counter of a node.
485  * Intern version for libFirm.
486  */
487 static INLINE unsigned long
488 _get_irn_visited (const ir_node *node)
489 {
490   assert (node);
491   return node->visited;
492 }
493
494 /**
495  * Sets the visited counter of a node.
496  * Intern version for libFirm.
497  */
498 static INLINE void
499 _set_irn_visited (ir_node *node, unsigned long visited)
500 {
501   assert (node);
502   node->visited = visited;
503 }
504
505 /**
506  * Mark a node as visited in a graph.
507  * Intern version for libFirm.
508  */
509 static INLINE void
510 _mark_irn_visited (ir_node *node) {
511   assert (node);
512   node->visited = current_ir_graph->visited;
513 }
514
515 /**
516  * Returns non-zero if a node of was visited.
517  * Intern version for libFirm.
518  */
519 static INLINE int
520 _irn_visited(const ir_node *node) {
521   assert (node);
522   return (node->visited >= current_ir_graph->visited);
523 }
524
525 /**
526  * Returns non-zero if a node of was NOT visited.
527  * Intern version for libFirm.
528  */
529 static INLINE int
530 _irn_not_visited(const ir_node *node) {
531   assert (node);
532   return (node->visited < current_ir_graph->visited);
533 }
534
535 /**
536  * Sets the link of a node.
537  * Intern version of libFirm.
538  */
539 static INLINE void
540 _set_irn_link(ir_node *node, void *link) {
541   assert (node);
542   /* Link field is used for Phi construction and various optimizations
543      in iropt. */
544   assert(get_irg_phase_state(get_irn_irg(node)) != phase_building);
545
546   node->link = link;
547 }
548
549 /**
550  * Returns the link of a node.
551  * Intern version of libFirm.
552  */
553 static INLINE void *
554 _get_irn_link(const ir_node *node) {
555   assert (node && _is_ir_node(node));
556   return node->link;
557 }
558
559 /**
560  * Returns whether the node _always_ must be pinned.
561  * I.e., the node is not floating after global cse.
562  *
563  * Intern version of libFirm.
564  */
565 static INLINE op_pin_state
566 _get_irn_pinned(const ir_node *node) {
567   op_pin_state state;
568   assert(node && _is_ir_node(node));
569   /* Check opcode */
570   state = _get_op_pinned(_get_irn_op(node));
571
572   if (state >= op_pin_state_exc_pinned)
573     return get_opt_fragile_ops() ? node->attr.except.pin_state : op_pin_state_pinned;
574   return state;
575 }
576
577 static INLINE op_pin_state
578 _is_irn_pinned_in_irg(const ir_node *node) {
579   if (get_irg_pinned(get_irn_irg(node)) == op_pin_state_floats)
580     return get_irn_pinned(node);
581   return op_pin_state_pinned;
582 }
583
584 static INLINE int
585 _is_unop(const ir_node *node) {
586   assert(node && _is_ir_node(node));
587   return (node->op->opar == oparity_unary);
588 }
589
590 static INLINE int
591 _is_binop(const ir_node *node) {
592   assert(node && _is_ir_node(node));
593   return (node->op->opar == oparity_binary);
594 }
595
596 static INLINE int
597 _is_Bad(const ir_node *node) {
598   assert(node);
599   return (node && _get_irn_op(node) == op_Bad);
600 }
601
602 static INLINE int
603 _is_Const(const ir_node *node) {
604   assert(node);
605   return (node && _get_irn_op(node) == op_Const);
606 }
607
608 static INLINE int
609 _is_Unknown (const ir_node *node) {
610   assert(node);
611   return (node && _get_irn_op(node) == op_Unknown);
612 }
613
614 static INLINE int
615 _is_Return (const ir_node *node) {
616   assert(node);
617   return (node && _get_irn_op(node) == op_Return);
618 }
619
620 static INLINE int
621 _is_Call (const ir_node *node) {
622   assert(node);
623   return (node && _get_irn_op(node) == op_Call);
624 }
625
626 static INLINE int
627 _is_Sel (const ir_node *node) {
628   assert(node);
629   return (node && _get_irn_op(node) == op_Sel);
630 }
631
632 static INLINE int
633 _is_Mux (const ir_node *node) {
634   assert(node);
635   if (node) {
636     ir_op *op = _get_irn_op(node);
637     return (op == op_Mux || ((op == op_Psi) && _get_irn_arity(node) == 3));
638   }
639   return 0;
640 }
641
642 static INLINE int
643 _is_no_Block(const ir_node *node) {
644   assert(node && _is_ir_node(node));
645   return (_get_irn_op(node) != op_Block);
646 }
647
648 static INLINE int
649 _is_Block(const ir_node *node) {
650   assert(node && _is_ir_node(node));
651   return (_get_irn_op(node) == op_Block);
652 }
653
654 static INLINE int
655 _get_Block_n_cfgpreds (ir_node *node) {
656   assert(_is_Block(node));
657   return _get_irn_arity(node);
658 }
659
660 static INLINE ir_node *
661 _get_Block_cfgpred (ir_node *node, int pos) {
662   assert(0 <= pos && pos < get_irn_arity(node));
663   assert(_is_Block(node));
664   return _get_irn_n(node, pos);
665 }
666
667 /* Get the predecessor block.
668  *
669  *  Returns the block corresponding to the predecessor pos.
670  *
671  *  There are several ambiguities we resolve with this function:
672  *  - The direct predecessor can be a Proj, which is not pinned.
673  *    We walk from the predecessor to the next pinned node
674  *    (skip_Proj) and return the block that node is in.
675  *  - If we encounter the Bad node, this function does not return
676  *    Start, but the Bad node.
677  */
678 static INLINE ir_node  *
679 _get_Block_cfgpred_block(ir_node *node, int pos) {
680   ir_node *res = skip_Proj(get_Block_cfgpred(node, pos));
681   if (!is_Bad(res))
682     res = get_nodes_block(res);
683   return res;
684 }
685
686 static INLINE unsigned long
687 _get_Block_block_visited (ir_node *node) {
688   assert (node->op == op_Block);
689   return node->attr.block.block_visited;
690 }
691
692 static INLINE void
693 _set_Block_block_visited (ir_node *node, unsigned long visit) {
694   assert (node->op == op_Block);
695   node->attr.block.block_visited = visit;
696 }
697
698 /* For this current_ir_graph must be set. */
699 static INLINE void
700 _mark_Block_block_visited (ir_node *node) {
701   assert (node->op == op_Block);
702   node->attr.block.block_visited = get_irg_block_visited(current_ir_graph);
703 }
704
705 static INLINE int
706 _Block_not_block_visited(ir_node *node) {
707   assert (node->op == op_Block);
708   return (node->attr.block.block_visited < get_irg_block_visited(current_ir_graph));
709 }
710
711 static INLINE ir_node *
712 _set_Block_dead(ir_node *block) {
713   assert(_get_irn_op(block) == op_Block);
714   block->attr.block.dead = 1;
715   return block;
716 }
717
718 static INLINE int
719 _is_Block_dead(const ir_node *block) {
720   ir_op * op = _get_irn_op(block);
721
722   if (op == op_Bad)
723     return 1;
724   else {
725     assert(op == op_Block);
726     return block->attr.block.dead;
727   }
728 }
729
730 static INLINE tarval *_get_Const_tarval (ir_node *node) {
731   assert (_get_irn_op(node) == op_Const);
732   return node->attr.con.tv;
733 }
734
735 static INLINE cnst_classify_t _classify_Const(ir_node *node) {
736   ir_op *op;
737   assert(_is_ir_node(node));
738
739   op = _get_irn_op(node);
740
741   if(op == op_Const)
742     return classify_tarval(_get_Const_tarval(node));
743   else if(op == op_SymConst)
744     return CNST_SYMCONST;
745
746   return CNST_NO_CONST;
747 }
748
749 static INLINE int _is_irn_forking(const ir_node *node) {
750   return is_op_forking(_get_irn_op(node));
751 }
752
753 static INLINE ir_type *_get_irn_type(ir_node *node) {
754   return _get_irn_op(node)->ops.get_type(node);
755 }
756
757 static INLINE ir_type *_get_irn_type_attr(ir_node *node) {
758   return _get_irn_op(node)->ops.get_type_attr(node);
759 }
760
761 static INLINE entity *_get_irn_entity_attr(ir_node *node) {
762   return _get_irn_op(node)->ops.get_entity_attr(node);
763 }
764
765 static INLINE int _is_irn_constlike(const ir_node *node) {
766   return is_op_constlike(_get_irn_op(node));
767 }
768
769 static INLINE int _is_irn_keep(const ir_node *node) {
770   return is_op_keep(_get_irn_op(node));
771 }
772
773 static INLINE int _is_irn_machine_op(const ir_node *node) {
774   return is_op_machine(_get_irn_op(node));
775 }
776
777 static INLINE int _is_irn_machine_operand(const ir_node *node) {
778   return is_op_machine_operand(_get_irn_op(node));
779 }
780
781 static INLINE int _is_irn_machine_user(const ir_node *node, unsigned n) {
782   return is_op_machine_user(_get_irn_op(node), n);
783 }
784
785 static INLINE cond_jmp_predicate _get_Cond_jmp_pred(ir_node *node) {
786   assert (_get_irn_op(node) == op_Cond);
787   return node->attr.c.pred;
788 }
789
790 static INLINE void _set_Cond_jmp_pred(ir_node *node, cond_jmp_predicate pred) {
791   assert (_get_irn_op(node) == op_Cond);
792   node->attr.c.pred = pred;
793 }
794
795 static INLINE int _get_Psi_n_conds(ir_node *node) {
796   assert(_get_irn_op(node) == op_Psi);
797   return _get_irn_arity(node) >> 1;
798 }
799
800 static INLINE unsigned _get_irn_idx(const ir_node *node) {
801   return node->node_idx;
802 }
803
804 /* this section MUST contain all inline functions */
805 #define is_ir_node(thing)                     _is_ir_node(thing)
806 #define get_irn_intra_arity(node)             _get_irn_intra_arity(node)
807 #define get_irn_inter_arity(node)             _get_irn_inter_arity(node)
808 #define get_irn_arity(node)                   _get_irn_arity(node)
809 #define get_irn_intra_n(node, n)              _get_irn_intra_n(node, n)
810 #define get_irn_inter_n(node, n)              _get_irn_inter_n(node, n)
811 #define get_irn_n(node, n)                    _get_irn_n(node, n)
812 #define get_irn_mode(node)                    _get_irn_mode(node)
813 #define set_irn_mode(node, mode)              _set_irn_mode(node, mode)
814 #define get_irn_op(node)                      _get_irn_op(node)
815 #define set_irn_op(node, op)                  _set_irn_op(node, op)
816 #define get_irn_opcode(node)                  _get_irn_opcode(node)
817 #define get_irn_visited(node)                 _get_irn_visited(node)
818 #define set_irn_visited(node, v)              _set_irn_visited(node, v)
819 #define mark_irn_visited(node)                _mark_irn_visited(node)
820 #define irn_visited(node)                     _irn_visited(node)
821 #define irn_not_visited(node)                 _irn_not_visited(node)
822 #define set_irn_link(node, link)              _set_irn_link(node, link)
823 #define get_irn_link(node)                    _get_irn_link(node)
824 #define get_irn_pinned(node)                  _get_irn_pinned(node)
825 #define is_irn_pinned_in_irg(node)            _is_irn_pinned_in_irg(node)
826 #define is_unop(node)                         _is_unop(node)
827 #define is_binop(node)                        _is_binop(node)
828 #define is_Const(node)                        _is_Const(node)
829 #define is_Unknown(node)                      _is_Unknown(node)
830 #define is_Return(node)                       _is_Return(node)
831 #define is_Call(node)                         _is_Call(node)
832 #define is_Sel(node)                          _is_Sel(node)
833 #define is_Mux(node)                          _is_Mux(node)
834 #define is_Bad(node)                          _is_Bad(node)
835 #define is_no_Block(node)                     _is_no_Block(node)
836 #define is_Block(node)                        _is_Block(node)
837 #define get_Block_n_cfgpreds(node)            _get_Block_n_cfgpreds(node)
838 #define get_Block_cfgpred(node, pos)          _get_Block_cfgpred(node, pos)
839 #define get_Block_cfgpred_block(node, pos)    _get_Block_cfgpred_block(node, pos)
840 #define get_Block_block_visited(node)         _get_Block_block_visited(node)
841 #define set_Block_block_visited(node, visit)  _set_Block_block_visited(node, visit)
842 #define mark_Block_block_visited(node)        _mark_Block_block_visited(node)
843 #define Block_not_block_visited(node)         _Block_not_block_visited(node)
844 #define set_Block_dead(block)                 _set_Block_dead(block)
845 #define is_Block_dead(block)                  _is_Block_dead(block)
846 #define get_Const_tarval(node)                _get_Const_tarval(node)
847 #define classify_Const(node)                  _classify_Const(node)
848 #define is_irn_forking(node)                  _is_irn_forking(node)
849 #define get_irn_type(node)                    _get_irn_type(node)
850 #define get_irn_type_attr(node)               _get_irn_type_attr(node)
851 #define get_irn_entity_attr(node)             _get_irn_entity_attr(node)
852 #define is_irn_constlike(node)                _is_irn_constlike(node)
853 #define is_irn_keep(node)                     _is_irn_keep(node)
854 #define is_irn_machine_op(node)               _is_irn_machine_op(node)
855 #define is_irn_machine_operand(node)          _is_irn_machine_operand(node)
856 #define is_irn_machine_user(node, n)          _is_irn_machine_user(node, n)
857 #define get_Cond_jmp_pred(node)               _get_Cond_jmp_pred(node)
858 #define set_Cond_jmp_pred(node, pred)         _set_Cond_jmp_pred(node, pred)
859 #define get_Psi_n_conds(node)                 _get_Psi_n_conds(node)
860 #define get_irn_idx(node)                     _get_irn_idx(node)
861
862 # endif /* _IRNODE_T_H_ */