moved firmext code into the backend dir
[libfirm] / ir / be / grgen / simd / grgen_dumper__t.h
1 /*************************************************************************
2 * Program:  grgen_dumper_t.h
3 * Function: Dumps parts of a firm graph (those which have to be extracted
4 *                        as search and replace patterns) as a grgen rule.
5 * Author:   Andreas Schoesser
6 * Date:     2007-01-11
7 *************************************************************************/
8
9 #ifndef GRGEN_DUMPER_H_T
10 #define GRGEN_DUMPER_H_T
11
12 #include "grgen_dumper.h"
13
14 #define MAX_NODENAME_LEN 40
15
16 typedef struct
17 {
18         ir_graph *irg;
19         struct pmap *mode_edge_map;
20         struct pmap *edge_name_map;
21         struct pmap *node_name_map;  // Contains the mapping firm node -> node name
22         struct obstack node_names;   // Contains the node name data
23         struct pmap *mode_name_map;  // Contains the mapping firm mode -> mode node name
24         struct obstack mode_names;   // Contains the "mode node name" data
25         struct pmap *register_access;  // Contains all nodes that are register access and their vector component
26         struct pmap *memory_access;    // Contains all nodes that are memory access and their vector component
27         struct pmap *nodes_to_dump;         // Contains firm nodes, that have to be dumped
28         struct pmap *argument_nodes;    // Contains "pointer root nodes" (usually ProjP), which have to be transformed to a generic firm node mode P
29         struct pmap *retyped_nodes;         // Contains all nodes that were retyped in the replacement step and therefore no edges have to be dumped.
30                                                                                 // (Retyped nodes get completely new edges in our case)
31         struct pmap *dump_condition;        // Contains all nodes for which a conditions has to be dumped afterwards.
32         struct pmap *eval_statements;       // Contains strings of eval statements dropped during replacement dumping and to be dumped at the end
33         struct pmap *destroyed_regs;
34         ir_node     *complex_operation_block, *node_to_match_block;
35         char        *node_name;
36         int         has_result;
37         int                     priority;
38         int                     dump_everything;        // Used to dump whole FIRM graphs with memory egdes ....
39 } dump_info_t;
40
41 static int dump_pattern(dump_info_t *dump_info, FILE *fp);
42 static void dump_replacement(dump_info_t *dump_info, int uses_memory, FILE *fp);
43 void dump_grgen_node(ir_node *n, dump_info_t *dump_info, FILE *fp);
44 static char *dump_grgen_retyped_node(ir_node *n, ir_op *new_op, dump_info_t *dump_info, FILE *fp);
45 static void dump_grgen_block(ir_node *n, dump_info_t *dump_info, FILE *fp);
46 void dump_grgen_edge(ir_node *n, int n_edge, dump_info_t *dump_info, FILE *fp);
47 static void dump_grgen_mode(ir_node *n, dump_info_t *dump_info, FILE *fp, ir_mode *alt_mode);
48 char *dump_grgen_mode_node(ir_mode *irn_mode, dump_info_t *dump_info, FILE *fp);
49 void dump_grgen_condition(ir_node *n, dump_info_t *dump_info, FILE *fp);
50 static void dump_retyping_to_vproj(ir_node *n, ir_node *complex_operation, dump_info_t *dump_info, char *vector_op_node_name, FILE *fp);
51 static void dump_retyping_to_proj(ir_node *n, ir_node *complex_operation, dump_info_t *dump_info, char *vector_op_node_name, FILE *fp);
52 static void dump_vproj_nr(dump_info_t *dump_info, FILE *fp);
53 void dump_complex_operation_block_match(dump_info_t *dump_info, FILE *fp);
54 void dump_complex_operation(dump_info_t *dump_info, FILE *fp, int uses_memory);
55 void dump_mandatory_evals(dump_info_t *dump_info, int uses_memory, FILE *fp);
56 void add_eval(dump_info_t *dump_info, char *eval);
57 void change_mode(ir_node *n, ir_mode *m, dump_info_t *dump_info, FILE *fp);
58 void dump_grgen_delete_incoming_edges(ir_node *n, dump_info_t *dump_info, FILE *fp);
59 static void collect_nodes(ir_node *n, void * env);
60
61 void set_indent(int i);
62 int  get_indent(void);
63
64 #endif