9cc74735a01ba9cc4521b405bf49e2b148b41877
[libfirm] / ir / stat / pattern_dmp.h
1 #ifndef _PATTERN_DMP_H_
2 #define _PATTERN_DMP_H_
3
4 #include "counter.h"
5
6 typedef struct _pattern_dumper_t pattern_dumper_t;
7 typedef void (*DUMP_NEW_PATTERN_FUNC)(pattern_dumper_t *self, counter_t *cnt);
8 typedef void (*DUMP_FINISH_PATTERN_FUNC)(pattern_dumper_t *self);
9 typedef void (*DUMP_NODE_FUNC)(pattern_dumper_t *self, unsigned id, unsigned op_code, unsigned mode_code);
10 typedef void (*DUMP_REF_FUNC)(pattern_dumper_t *self, unsigned id);
11 typedef void (*DUMP_EDGE_FUNC)(pattern_dumper_t *self, unsigned id, unsigned parent, unsigned position);
12 typedef void (*DUMP_START_CHILDREN_FUNC)(pattern_dumper_t *self, unsigned id);
13 typedef void (*DUMP_FINISH_CHILDREN_FUNC)(pattern_dumper_t *self, unsigned id);
14
15 struct _pattern_dumper_t {
16   DUMP_NEW_PATTERN_FUNC      dump_new_pattern;
17   DUMP_FINISH_PATTERN_FUNC   dump_finish_pattern;
18   DUMP_NODE_FUNC             dump_node;
19   DUMP_REF_FUNC              dump_ref;
20   DUMP_EDGE_FUNC             dump_edge;
21   DUMP_START_CHILDREN_FUNC   dump_start_children;
22   DUMP_FINISH_CHILDREN_FUNC  dump_finish_children;
23 };
24
25 extern pattern_dumper_t vcg_dump, stdout_dump;
26
27 /**
28  * starts a new pattern
29  */
30 void pattern_dump_new_pattern(pattern_dumper_t *self, counter_t *cnt);
31
32 /**
33  * Finishes current pattern
34  */
35 void pattern_dump_finish_pattern(pattern_dumper_t *self);
36
37 /**
38  * Dumps a node
39  */
40 void pattern_dump_node(pattern_dumper_t *self, unsigned id, unsigned op_code, unsigned mode_code);
41
42 /**
43  * Dump a ref
44  */
45 void pattern_dump_ref(pattern_dumper_t *self, unsigned id);
46
47 /**
48  * Dump an edge
49  */
50 void pattern_dump_edge(pattern_dumper_t *self, unsigned id, unsigned parent, unsigned position);
51
52 /**
53  * Start children dumper
54  */
55 void pattern_start_children(pattern_dumper_t *self, unsigned id);
56
57 /**
58  * finishes childred  dumper
59  */
60 void pattern_finish_children(pattern_dumper_t *self, unsigned id);
61
62 #endif /* _PATTERN_DMP_H_ */