is_irn_always_opt() added
[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 /** Cond attributes. */
75 typedef struct {
76   cond_kind kind;           /**< flavor of Cond */
77   long default_proj;        /**< only for non-binary Conds: biggest Proj number, i.e. the one used for default. */
78   cond_jmp_predicate pred;  /**< only for binary Conds: The jump predication. */
79 } cond_attr;
80
81 /** Const attributes. */
82 typedef struct {
83   tarval  *tv;       /**< the target value */
84   ir_type *tp;       /**< the source type, for analyses. default: type_unknown. */
85 } const_attr;
86
87 /** SymConst attributes. */
88 typedef struct {
89   symconst_symbol sym;  // old tori
90   symconst_kind num;
91   ir_type *tp;       /**< the source type, for analyses. default: type_unknown. */
92 } symconst_attr;
93
94 /** Sel attributes. */
95 typedef struct {
96   entity *ent;          /**< entity to select */
97 } sel_attr;
98
99 /** Exception attributes. */
100 typedef struct {
101   op_pin_state   pin_state;     /**< the pin state for operations that might generate a exception:
102                                      If it's know that no exception will be generated, could be set to
103                                      op_pin_state_floats. */
104 #if PRECISE_EXC_CONTEXT
105   struct ir_node **frag_arr;    /**< For Phi node construction in case of exception */
106 #endif
107 } except_attr;
108
109 /** Call attributes. */
110 typedef struct {
111   except_attr    exc;           /**< the exception attribute. MUST be the first one. */
112   ir_type *cld_tp;              /**< type of called procedure */
113   entity ** callee_arr;         /**< result of callee analysis */
114 } call_attr;
115
116 /** Alloc attributes. */
117 typedef struct {
118   except_attr    exc;           /**< the exception attribute. MUST be the first one. */
119   ir_type *type;                /**< Type of the allocated object.  */
120   where_alloc where;            /**< stack, heap or other managed part of memory */
121 } alloc_attr;
122
123 /** Free attributes. */
124 typedef struct {
125   ir_type *type;                /**< Type of the allocated object.  */
126   where_alloc where;            /**< stack, heap or other managed part of memory */
127 } free_attr;
128
129 /** InstOf attributes. */
130 typedef struct {
131   except_attr    exc;           /**< the exception attribute. MUST be the first one. */
132   ir_type *type;                /**< the type of which the object pointer must be */
133 } io_attr;
134
135 /** Filter attributes. */
136 typedef struct {
137   long proj;                 /**< contains the result position to project (Proj) */
138   ir_node ** in_cg;          /**< array with interprocedural predecessors (Phi) */
139   int *backedge;              /**< Field n set to true if pred n is backedge.
140                      @todo Ev. replace by bitfield! */
141 } filter_attr;
142
143 /** EndReg/EndExcept attributes. */
144 typedef struct {
145   char dummy;
146 } end_attr;
147
148 /** CallBegin attributes. */
149 typedef struct {
150   ir_node * call;               /**< Associated Call-operation. */
151 } callbegin_attr;
152
153 /** Cast attributes. */
154 typedef struct {
155   ir_type *totype;              /**< Type of the casted node. */
156 } cast_attr;
157
158 /** Load attributes. */
159 typedef struct {
160   except_attr    exc;           /**< The exception attribute. MUST be the first one. */
161   ir_mode        *load_mode;    /**< The mode of this Load operation. */
162   ent_volatility volatility;      /**< The volatility of a Load/Store operation. */
163 } load_attr;
164
165 /** Store attributes. */
166 typedef struct {
167   except_attr    exc;           /**< the exception attribute. MUST be the first one. */
168   ent_volatility volatility;      /**< the volatility of a Store operation */
169 } store_attr;
170
171 typedef pn_Cmp confirm_attr;    /**< Attribute to hold compare operation */
172
173 /** CopyB attribute. */
174 typedef struct {
175   except_attr    exc;           /**< The exception attribute. MUST be the first one. */
176   ir_type        *data_type;    /**< Type of the copied entity. */
177 } copyb_attr;
178
179 /** Bound attribute. */
180 typedef struct {
181   except_attr    exc;           /**< The exception attribute. MUST be the first one. */
182 } bound_attr;
183
184 /** Conv attribute. */
185 typedef struct {
186   char           strict;        /**< If set, this is a strict Conv that cannot be removed. */
187 } conv_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   block_attr     block;   /**< For Block: Fields needed to construct it */
202   cond_attr      cond;    /**< For Cond. */
203   const_attr     con;     /**< For Const: contains the value of the constant and a type */
204   symconst_attr  symc;    /**< For SymConst. */
205   sel_attr       sel;     /**< For Sel. */
206   call_attr      call;    /**< For Call: pointer to the type of the method to call */
207   callbegin_attr callbegin; /**< For CallBegin */
208   alloc_attr     alloc;  /**< For Alloc. */
209   free_attr      free;   /**< For Free. */
210   io_attr        instof; /**< For InstOf */
211   cast_attr      cast;   /**< For Cast. */
212   load_attr      load;   /**< For Load. */
213   store_attr     store;  /**< For Store. */
214   int            phi0_pos;  /**< For Phi. Used to remember the value defined by
215                    this Phi node.  Needed when the Phi is completed
216                    to call get_r_internal_value to find the
217                    predecessors. If this attribute is set, the Phi
218                    node takes the role of the obsolete Phi0 node,
219                    therefore the name. */
220   int *phi_backedge;    /**< For Phi after construction.
221                            Field n set to true if pred n is backedge.
222                            @todo Ev. replace by bitfield! */
223   long           proj;          /**< For Proj: contains the result position to project */
224   confirm_attr   confirm_cmp;   /**< For Confirm: compare operation */
225   filter_attr    filter;        /**< For Filter */
226   end_attr       end;           /**< For EndReg, EndExcept */
227   except_attr    except;        /**< For Phi node construction in case of exceptions */
228   copyb_attr     copyb;         /**< For CopyB operation */
229   bound_attr     bound;         /**< For Bound operation */
230   conv_attr      conv;          /**< For Conv 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   irn_edge_info_t edge_info;  /**< everlasting out edges */
264   /* ------- Opcode depending fields -------- */
265   attr attr;               /**< attribute of this node. Depends on opcode.
266                               Must be last field of struct ir_node. */
267 };
268
269
270 /**
271  * Returns the array with the ins.  The content of the array may not be
272  * changed.
273  * Note that this function returns the whole in array including the
274  * block predecessor. So, it is NOT symmetric with set_irn_in().
275  */
276 ir_node     **get_irn_in            (const ir_node *node);
277
278 /** @{ */
279 /** access attributes directly */
280 const_attr    get_irn_const_attr    (ir_node *node);
281 long          get_irn_proj_attr     (ir_node *node);
282 alloc_attr    get_irn_alloc_attr    (ir_node *node);
283 free_attr     get_irn_free_attr     (ir_node *node);
284 symconst_attr get_irn_symconst_attr (ir_node *node);
285 ir_type      *get_irn_call_attr     (ir_node *node);
286 ir_type      *get_irn_funccall_attr (ir_node *node);
287 sel_attr      get_irn_sel_attr      (ir_node *node);
288 int           get_irn_phi_attr      (ir_node *node);
289 block_attr    get_irn_block_attr    (ir_node *node);
290 load_attr     get_irn_load_attr     (ir_node *node);
291 store_attr    get_irn_store_attr    (ir_node *node);
292 except_attr   get_irn_except_attr   (ir_node *node);
293 /** @} */
294
295 /**
296  * The amount of additional space for custom data to be allocated upon creating a new node.
297  */
298 extern unsigned firm_add_node_size;
299
300 /**
301  * Sets the get_type operation for an ir_op_ops.
302  *
303  * @param code   the opcode for the default operation
304  * @param ops    the operations initialized
305  *
306  * @return
307  *    The operations.
308  */
309 ir_op_ops *firm_set_default_get_type(opcode code, ir_op_ops *ops);
310
311 /**
312  * Sets the get_type_attr operation for an ir_op_ops.
313  *
314  * @param code   the opcode for the default operation
315  * @param ops    the operations initialized
316  *
317  * @return
318  *    The operations.
319  */
320 ir_op_ops *firm_set_default_get_type_attr(opcode code, ir_op_ops *ops);
321
322 /**
323  * Sets the get_entity_attr operation for an ir_op_ops.
324  *
325  * @param code   the opcode for the default operation
326  * @param ops    the operations initialized
327  *
328  * @return
329  *    The operations.
330  */
331 ir_op_ops *firm_set_default_get_entity_attr(opcode code, ir_op_ops *ops);
332
333 /*-------------------------------------------------------------------*/
334 /*  These function are most used in libfirm.  Give them as static    */
335 /*  functions so they can be inlined.                                */
336 /*-------------------------------------------------------------------*/
337
338 /**
339  * Checks whether a pointer points to a ir node.
340  * Intern version for libFirm.
341  */
342 static INLINE int
343 _is_ir_node (const void *thing) {
344   return (get_kind(thing) == k_ir_node);
345 }
346
347 /**
348  * Gets the op of a node.
349  * Intern version for libFirm.
350  */
351 static INLINE ir_op *
352 _get_irn_op (const ir_node *node) {
353   assert (node);
354   return node->op;
355 }
356
357 static INLINE void
358 _set_irn_op (ir_node *node, ir_op *op) {
359   assert (node);
360   node->op = op;
361 }
362
363 /** Copies all attributes stored in the old node  to the new node.
364     Assumes both have the same opcode and sufficient size. */
365 static INLINE void
366 copy_node_attr(const ir_node *old_node, ir_node *new_node) {
367   ir_op *op = _get_irn_op(old_node);
368
369   /* must always exist */
370   op->ops.copy_attr(old_node, new_node);
371 }
372
373 /**
374  * Gets the opcode of a node.
375  * Intern version for libFirm.
376  */
377 static INLINE opcode
378 _get_irn_opcode (const ir_node *node) {
379   assert (k_ir_node == get_kind(node));
380   assert (node->op);
381   return node->op->code;
382 }
383
384 /**
385  * Returns the number of predecessors without the block predecessor.
386  * Intern version for libFirm.
387  */
388 static INLINE int
389 _get_irn_intra_arity (const ir_node *node) {
390   assert(node);
391   return ARR_LEN(node->in) - 1;
392 }
393
394 /**
395  * Returns the number of predecessors without the block predecessor.
396  * Intern version for libFirm.
397  */
398 static INLINE int
399 _get_irn_inter_arity (const ir_node *node) {
400   assert(node);
401   if (_get_irn_op(node) == op_Filter) {
402     assert(node->attr.filter.in_cg);
403     return ARR_LEN(node->attr.filter.in_cg) - 1;
404   } else if (_get_irn_op(node) == op_Block && node->attr.block.in_cg) {
405     return ARR_LEN(node->attr.block.in_cg) - 1;
406   }
407   return _get_irn_intra_arity(node);
408 }
409
410 /**
411  * Returns the number of predecessors without the block predecessor.
412  * Intern version for libFirm.
413  */
414 extern int (*_get_irn_arity)(const ir_node *node);
415
416 /**
417  * Intern version for libFirm.
418  */
419 static INLINE ir_node *
420 _get_irn_intra_n (const ir_node *node, int n) {
421   ir_node *nn;
422
423   assert(node); assert(-1 <= n && n < _get_irn_intra_arity(node));
424
425   nn = node->in[n + 1];
426   if (!nn || (nn->op != op_Id)) return nn;
427
428   return (node->in[n + 1] = skip_Id(nn));
429 }
430
431 /**
432  * Intern version for libFirm.
433  */
434 static INLINE ir_node*
435 _get_irn_inter_n (const ir_node *node, int n) {
436   assert(node); assert(-1 <= n && n < _get_irn_inter_arity(node));
437
438   /* handle Filter and Block specially */
439   if (_get_irn_op(node) == op_Filter) {
440     assert(node->attr.filter.in_cg);
441     return (node->attr.filter.in_cg[n + 1] = skip_Id(node->attr.filter.in_cg[n + 1]));
442   } else if (_get_irn_op(node) == op_Block && node->attr.block.in_cg) {
443     return (node->attr.block.in_cg[n + 1] = skip_Id(node->attr.block.in_cg[n + 1]));
444   }
445
446   return _get_irn_intra_n (node, n);
447 }
448
449 /**
450  * Access to the predecessors of a node.
451  * To iterate over the operands iterate from 0 to i < get_irn_arity(),
452  * to iterate including the Block predecessor iterate from i = -1 to
453  * i < get_irn_arity.
454  * If it is a block, the entry -1 is NULL.
455  * Intern version for libFirm.
456  */
457 extern ir_node *(*_get_irn_n)(const ir_node *node, int n);
458
459 /**
460  * Gets the mode of a node.
461  * Intern version for libFirm.
462  */
463 static INLINE ir_mode *
464 _get_irn_mode(const ir_node *node) {
465   assert (node);
466   return node->mode;
467 }
468
469 /**
470  * Sets the mode of a node.
471  * Intern version of libFirm.
472  */
473 static INLINE void
474 _set_irn_mode(ir_node *node, ir_mode *mode) {
475   assert (node);
476   node->mode = mode;
477 }
478
479 /**
480  * Gets the visited counter of a node.
481  * Intern version for libFirm.
482  */
483 static INLINE unsigned long
484 _get_irn_visited(const ir_node *node) {
485   assert (node);
486   return node->visited;
487 }
488
489 /**
490  * Sets the visited counter of a node.
491  * Intern version for libFirm.
492  */
493 static INLINE void
494 _set_irn_visited(ir_node *node, unsigned long visited) {
495   assert (node);
496   node->visited = visited;
497 }
498
499 /**
500  * Mark a node as visited in a graph.
501  * Intern version for libFirm.
502  */
503 static INLINE void
504 _mark_irn_visited(ir_node *node) {
505   assert (node);
506   node->visited = current_ir_graph->visited;
507 }
508
509 /**
510  * Returns non-zero if a node of was visited.
511  * Intern version for libFirm.
512  */
513 static INLINE int
514 _irn_visited(const ir_node *node) {
515   assert (node);
516   return (node->visited >= current_ir_graph->visited);
517 }
518
519 /**
520  * Returns non-zero if a node of was NOT visited.
521  * Intern version for libFirm.
522  */
523 static INLINE int
524 _irn_not_visited(const ir_node *node) {
525   assert (node);
526   return (node->visited < current_ir_graph->visited);
527 }
528
529 /**
530  * Sets the link of a node.
531  * Intern version of libFirm.
532  */
533 static INLINE void
534 _set_irn_link(ir_node *node, void *link) {
535   assert (node);
536   /* Link field is used for Phi construction and various optimizations
537      in iropt. */
538   assert(get_irg_phase_state(get_irn_irg(node)) != phase_building);
539
540   node->link = link;
541 }
542
543 /**
544  * Returns the link of a node.
545  * Intern version of libFirm.
546  */
547 static INLINE void *
548 _get_irn_link(const ir_node *node) {
549   assert (node && _is_ir_node(node));
550   return node->link;
551 }
552
553 /**
554  * Returns whether the node _always_ must be pinned.
555  * I.e., the node is not floating after global cse.
556  *
557  * Intern version of libFirm.
558  */
559 static INLINE op_pin_state
560 _get_irn_pinned(const ir_node *node) {
561   op_pin_state state;
562   assert(node && _is_ir_node(node));
563   /* Check opcode */
564   state = _get_op_pinned(_get_irn_op(node));
565
566   if (state >= op_pin_state_exc_pinned)
567     return get_opt_fragile_ops() ? node->attr.except.pin_state : op_pin_state_pinned;
568   return state;
569 }
570
571 static INLINE op_pin_state
572 _is_irn_pinned_in_irg(const ir_node *node) {
573   if (get_irg_pinned(get_irn_irg(node)) == op_pin_state_floats)
574     return get_irn_pinned(node);
575   return op_pin_state_pinned;
576 }
577
578 static INLINE int
579 _is_unop(const ir_node *node) {
580   assert(node && _is_ir_node(node));
581   return (node->op->opar == oparity_unary);
582 }
583
584 static INLINE int
585 _is_binop(const ir_node *node) {
586   assert(node && _is_ir_node(node));
587   return (node->op->opar == oparity_binary);
588 }
589
590 static INLINE int
591 _is_Bad(const ir_node *node) {
592   assert(node);
593   return (_get_irn_op(node) == op_Bad);
594 }
595
596 static INLINE int
597 _is_Const(const ir_node *node) {
598   assert(node);
599   return (_get_irn_op(node) == op_Const);
600 }
601
602 static INLINE int
603 _is_Unknown(const ir_node *node) {
604   assert(node);
605   return (_get_irn_op(node) == op_Unknown);
606 }
607
608 static INLINE int
609 _is_Return(const ir_node *node) {
610   assert(node);
611   return (_get_irn_op(node) == op_Return);
612 }
613
614 static INLINE int
615 _is_Call(const ir_node *node) {
616   assert(node);
617   return (_get_irn_op(node) == op_Call);
618 }
619
620 static INLINE int
621 _is_Sel(const ir_node *node) {
622   assert(node);
623   return (_get_irn_op(node) == op_Sel);
624 }
625
626 static INLINE int
627 _is_Mux(const ir_node *node) {
628   assert(node);
629   if (node) {
630     ir_op *op = _get_irn_op(node);
631     return (op == op_Mux || ((op == op_Psi) && _get_irn_arity(node) == 3));
632   }
633   return 0;
634 }
635
636 static INLINE int
637 _is_Load(const ir_node *node) {
638   assert(node);
639   return (_get_irn_op(node) == op_Load);
640 }
641
642 static INLINE int
643 _is_Sync(const ir_node *node) {
644   assert(node);
645   return (_get_irn_op(node) == op_Sync);
646 }
647
648 static INLINE int
649 _is_Confirm(const ir_node *node) {
650   assert(node);
651   return (_get_irn_op(node) == op_Confirm);
652 }
653
654 static INLINE int
655 _is_no_Block(const ir_node *node) {
656   assert(node && _is_ir_node(node));
657   return (_get_irn_op(node) != op_Block);
658 }
659
660 static INLINE int
661 _is_Block(const ir_node *node) {
662   assert(node && _is_ir_node(node));
663   return (_get_irn_op(node) == op_Block);
664 }
665
666 static INLINE int
667 _get_Block_n_cfgpreds(ir_node *node) {
668   assert(_is_Block(node));
669   return _get_irn_arity(node);
670 }
671
672 static INLINE ir_node *
673 _get_Block_cfgpred(ir_node *node, int pos) {
674   assert(0 <= pos && pos < get_irn_arity(node));
675   assert(_is_Block(node));
676   return _get_irn_n(node, pos);
677 }
678
679 /* Get the predecessor block.
680  *
681  *  Returns the block corresponding to the predecessor pos.
682  *
683  *  There are several ambiguities we resolve with this function:
684  *  - The direct predecessor can be a Proj, which is not pinned.
685  *    We walk from the predecessor to the next pinned node
686  *    (skip_Proj) and return the block that node is in.
687  *  - If we encounter the Bad node, this function does not return
688  *    Start, but the Bad node.
689  */
690 static INLINE ir_node  *
691 _get_Block_cfgpred_block(ir_node *node, int pos) {
692   ir_node *res = skip_Proj(get_Block_cfgpred(node, pos));
693   if (!is_Bad(res))
694     res = get_nodes_block(res);
695   return res;
696 }
697
698 static INLINE unsigned long
699 _get_Block_block_visited(ir_node *node) {
700   assert (node->op == op_Block);
701   return node->attr.block.block_visited;
702 }
703
704 static INLINE void
705 _set_Block_block_visited(ir_node *node, unsigned long visit) {
706   assert (node->op == op_Block);
707   node->attr.block.block_visited = visit;
708 }
709
710 /* For this current_ir_graph must be set. */
711 static INLINE void
712 _mark_Block_block_visited(ir_node *node) {
713   assert (node->op == op_Block);
714   node->attr.block.block_visited = get_irg_block_visited(current_ir_graph);
715 }
716
717 static INLINE int
718 _Block_not_block_visited(ir_node *node) {
719   assert (node->op == op_Block);
720   return (node->attr.block.block_visited < get_irg_block_visited(current_ir_graph));
721 }
722
723 static INLINE ir_node *
724 _set_Block_dead(ir_node *block) {
725   assert(_get_irn_op(block) == op_Block);
726   block->attr.block.dead = 1;
727   return block;
728 }
729
730 static INLINE int
731 _is_Block_dead(const ir_node *block) {
732   ir_op *op = _get_irn_op(block);
733
734   if (op == op_Bad)
735     return 1;
736   else {
737     assert(op == op_Block);
738     return block->attr.block.dead;
739   }
740 }
741
742 static INLINE tarval *_get_Const_tarval (ir_node *node) {
743   assert (_get_irn_op(node) == op_Const);
744   return node->attr.con.tv;
745 }
746
747 static INLINE cnst_classify_t _classify_Const(ir_node *node) {
748   ir_op *op;
749   assert(_is_ir_node(node));
750
751   op = _get_irn_op(node);
752
753   if (op == op_Const)
754     return classify_tarval(_get_Const_tarval(node));
755   else if(op == op_SymConst)
756     return CNST_SYMCONST;
757
758   return CNST_NO_CONST;
759 }
760
761 static INLINE int _is_irn_forking(const ir_node *node) {
762   return is_op_forking(_get_irn_op(node));
763 }
764
765 static INLINE ir_type *_get_irn_type(ir_node *node) {
766   return _get_irn_op(node)->ops.get_type(node);
767 }
768
769 static INLINE ir_type *_get_irn_type_attr(ir_node *node) {
770   return _get_irn_op(node)->ops.get_type_attr(node);
771 }
772
773 static INLINE entity *_get_irn_entity_attr(ir_node *node) {
774   return _get_irn_op(node)->ops.get_entity_attr(node);
775 }
776
777 static INLINE int _is_irn_constlike(const ir_node *node) {
778   return is_op_constlike(_get_irn_op(node));
779 }
780
781 static INLINE int _is_irn_always_opt(const ir_node *node) {
782   return is_op_always_opt(_get_irn_op(node));
783 }
784
785 static INLINE int _is_irn_keep(const ir_node *node) {
786   return is_op_keep(_get_irn_op(node));
787 }
788
789 static INLINE int _is_irn_machine_op(const ir_node *node) {
790   return is_op_machine(_get_irn_op(node));
791 }
792
793 static INLINE int _is_irn_machine_operand(const ir_node *node) {
794   return is_op_machine_operand(_get_irn_op(node));
795 }
796
797 static INLINE int _is_irn_machine_user(const ir_node *node, unsigned n) {
798   return is_op_machine_user(_get_irn_op(node), n);
799 }
800
801 static INLINE cond_jmp_predicate _get_Cond_jmp_pred(ir_node *node) {
802   assert (_get_irn_op(node) == op_Cond);
803   return node->attr.cond.pred;
804 }
805
806 static INLINE void _set_Cond_jmp_pred(ir_node *node, cond_jmp_predicate pred) {
807   assert (_get_irn_op(node) == op_Cond);
808   node->attr.cond.pred = pred;
809 }
810
811 static INLINE int _get_Psi_n_conds(ir_node *node) {
812   assert(_get_irn_op(node) == op_Psi);
813   return _get_irn_arity(node) >> 1;
814 }
815
816 static INLINE unsigned _get_irn_idx(const ir_node *node) {
817   return node->node_idx;
818 }
819
820 /* this section MUST contain all inline functions */
821 #define is_ir_node(thing)                     _is_ir_node(thing)
822 #define get_irn_intra_arity(node)             _get_irn_intra_arity(node)
823 #define get_irn_inter_arity(node)             _get_irn_inter_arity(node)
824 #define get_irn_arity(node)                   _get_irn_arity(node)
825 #define get_irn_intra_n(node, n)              _get_irn_intra_n(node, n)
826 #define get_irn_inter_n(node, n)              _get_irn_inter_n(node, n)
827 #define get_irn_n(node, n)                    _get_irn_n(node, n)
828 #define get_irn_mode(node)                    _get_irn_mode(node)
829 #define set_irn_mode(node, mode)              _set_irn_mode(node, mode)
830 #define get_irn_op(node)                      _get_irn_op(node)
831 #define set_irn_op(node, op)                  _set_irn_op(node, op)
832 #define get_irn_opcode(node)                  _get_irn_opcode(node)
833 #define get_irn_visited(node)                 _get_irn_visited(node)
834 #define set_irn_visited(node, v)              _set_irn_visited(node, v)
835 #define mark_irn_visited(node)                _mark_irn_visited(node)
836 #define irn_visited(node)                     _irn_visited(node)
837 #define irn_not_visited(node)                 _irn_not_visited(node)
838 #define set_irn_link(node, link)              _set_irn_link(node, link)
839 #define get_irn_link(node)                    _get_irn_link(node)
840 #define get_irn_pinned(node)                  _get_irn_pinned(node)
841 #define is_irn_pinned_in_irg(node)            _is_irn_pinned_in_irg(node)
842 #define is_unop(node)                         _is_unop(node)
843 #define is_binop(node)                        _is_binop(node)
844 #define is_Const(node)                        _is_Const(node)
845 #define is_Unknown(node)                      _is_Unknown(node)
846 #define is_Return(node)                       _is_Return(node)
847 #define is_Call(node)                         _is_Call(node)
848 #define is_Sel(node)                          _is_Sel(node)
849 #define is_Mux(node)                          _is_Mux(node)
850 #define is_Load(node)                         _is_Load(node)
851 #define is_Sync(node)                         _is_Sync(node)
852 #define is_Confirm(node)                      _is_Confirm(node)
853 #define is_Bad(node)                          _is_Bad(node)
854 #define is_no_Block(node)                     _is_no_Block(node)
855 #define is_Block(node)                        _is_Block(node)
856 #define get_Block_n_cfgpreds(node)            _get_Block_n_cfgpreds(node)
857 #define get_Block_cfgpred(node, pos)          _get_Block_cfgpred(node, pos)
858 #define get_Block_cfgpred_block(node, pos)    _get_Block_cfgpred_block(node, pos)
859 #define get_Block_block_visited(node)         _get_Block_block_visited(node)
860 #define set_Block_block_visited(node, visit)  _set_Block_block_visited(node, visit)
861 #define mark_Block_block_visited(node)        _mark_Block_block_visited(node)
862 #define Block_not_block_visited(node)         _Block_not_block_visited(node)
863 #define set_Block_dead(block)                 _set_Block_dead(block)
864 #define is_Block_dead(block)                  _is_Block_dead(block)
865 #define get_Const_tarval(node)                _get_Const_tarval(node)
866 #define classify_Const(node)                  _classify_Const(node)
867 #define is_irn_forking(node)                  _is_irn_forking(node)
868 #define get_irn_type(node)                    _get_irn_type(node)
869 #define get_irn_type_attr(node)               _get_irn_type_attr(node)
870 #define get_irn_entity_attr(node)             _get_irn_entity_attr(node)
871 #define is_irn_constlike(node)                _is_irn_constlike(node)
872 #define is_irn_always_opt(node)               _is_irn_always_opt(node)
873 #define is_irn_keep(node)                     _is_irn_keep(node)
874 #define is_irn_machine_op(node)               _is_irn_machine_op(node)
875 #define is_irn_machine_operand(node)          _is_irn_machine_operand(node)
876 #define is_irn_machine_user(node, n)          _is_irn_machine_user(node, n)
877 #define get_Cond_jmp_pred(node)               _get_Cond_jmp_pred(node)
878 #define set_Cond_jmp_pred(node, pred)         _set_Cond_jmp_pred(node, pred)
879 #define get_Psi_n_conds(node)                 _get_Psi_n_conds(node)
880 #define get_irn_idx(node)                     _get_irn_idx(node)
881
882 # endif /* _IRNODE_T_H_ */