3c2c50e24531c3091bf97ca2cccd6bf3973c0125
[libfirm] / ir / be / beutil.h
1
2 #ifndef _BEUTIL_H
3 #define _BEUTIL_H
4
5 #include <stdio.h>
6
7 #include "irnode.h"
8 #include "config.h"
9
10 /** Undefine this to disable debugging mode. */
11 #define BE_DEBUG 1
12
13 /**
14  * Check, if a node produces or consumes a data value.
15  * If it does, it is significant for scheduling and register allocation.
16  * A node produces/consumes a data value, if one of its operands is of
17  * mode datab, or his retuning mode is of mode datab.
18  * @param irn The node to check for.
19  * @return 1, if the node is a data node, 0 if not.
20  */
21 static INLINE int is_data_node(const ir_node *irn)
22 {
23         int i, n;
24
25         /* If the node produces a data value, return immediately. */
26         if(mode_is_datab(get_irn_mode(irn)))
27                 return 1;
28
29         /* else check, if it takes a data value, if that is so, return */
30         for(i = 0, n = get_irn_arity(irn); i < n; ++i) {
31                 ir_node *op = get_irn_n(irn, i);
32                 if(mode_is_datab(get_irn_mode(op)))
33                         return 1;
34         }
35
36         /* Else the node does not produce/consume a data value */
37         return 0;
38 }
39
40
41 void dump_allocated_irg(ir_graph *irg);
42
43 #endif