12 /** Undefine this to disable debugging mode. */
16 * Convenient block getter.
17 * Works also, if the given node is a block.
18 * @param irn The node.
19 * @return The block of the node, or the node itself, if the node is a
22 static INLINE const ir_node *get_block(const ir_node *irn)
24 return is_Block(irn) ? irn : get_nodes_block(irn);
27 static INLINE int is_firm_be_mode(const ir_mode *mode)
29 return mode_is_data(mode);
33 * Check, if a node produces or consumes a data value.
34 * If it does, it is significant for scheduling and register allocation.
35 * A node produces/consumes a data value, if one of its operands is of
36 * mode datab, or his retuning mode is of mode datab.
37 * @param irn The node to check for.
38 * @return 1, if the node is a data node, 0 if not.
40 static INLINE int is_data_node(const ir_node *irn)
44 /* Unknowns do not exist, so they produce nothing */
45 if(get_irn_opcode(irn) == iro_Unknown)
48 /* If the node produces a data value, return immediately. */
49 if(is_firm_be_mode(get_irn_mode(irn)))
52 /* else check, if it takes a data value, if that is so, return */
53 for(i = 0, n = get_irn_arity(irn); i < n; ++i) {
54 ir_node *op = get_irn_n(irn, i);
55 if(is_firm_be_mode(get_irn_mode(op)))
59 /* Else the node does not produce/consume a data value */
64 * Make each constant local to its use.
65 * This duplicates all constants in order to simulate a realistic
67 * @param irg The graph.
69 void localize_consts(ir_graph *irg);
72 * Dump a vcg graph containing the controlflow graph, the schedule and
73 * allocated registers.
74 * @param irg The irg. Note that scheduling, register allocation must
75 * have been performed.
77 void dump_allocated_irg(arch_env_t *env, ir_graph *irg, char *suffix);
79 void be_clear_links(ir_graph *irg);
81 static INLINE FILE *ffopen(const char *base, const char *ext, const char *mode) {
85 snprintf(buf, sizeof(buf), "%s.%s", base, ext);
86 if (! (out = fopen(buf, mode))) {
87 fprintf(stderr, "Cannot open file %s in mode %s\n", buf, mode);
94 * Dump a graph with schedule edges.
95 * @param irg The graph.
96 * @param suffix A suffix to its file name.
98 void dump_ir_block_graph_sched(ir_graph *irg, const char *suffix);