-
Notifications
You must be signed in to change notification settings - Fork 0
/
prettyprint.h
74 lines (52 loc) · 2.85 KB
/
prettyprint.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#ifndef IR_PRETTYPRINT_H
#define IR_PRETTYPRINT_H
#include "ir.h"
#include <stdio.h>
typedef void(prettyprint_begin_visit_basicblock)(
struct ir_func *irb, struct ir_basicblock *basicblock, void *metadata);
typedef void(prettyprint_end_visit_basicblock)(struct ir_func *irb,
struct ir_basicblock *basicblock,
void *metadata);
typedef void(prettyprint_begin_visit_stmt)(struct ir_func *irb,
struct ir_stmt *stmt,
void *metadata);
typedef void(prettyprint_end_visit_stmt)(struct ir_func *irb,
struct ir_stmt *stmt, void *metadata);
typedef void(prettyprint_visit_op)(struct ir_func *irb, struct ir_op *op,
void *metadata);
struct prettyprint_callbacks {
prettyprint_begin_visit_basicblock *begin_visit_basicblock;
prettyprint_end_visit_basicblock *end_visit_basicblock;
prettyprint_begin_visit_stmt *begin_visit_stmt;
prettyprint_end_visit_stmt *end_visit_stmt;
prettyprint_visit_op *visit_op;
};
extern const struct prettyprint_callbacks FILE_WRITER_CALLBACKS;
extern const struct prettyprint_callbacks GRAPH_WRITER_CALLBACKS;
/* Generic visitor methods that can be used to walk the graph */
void debug_visit_stmt(struct ir_func *irb, struct ir_stmt *stmt,
const struct prettyprint_callbacks *callbacks,
void *metadata);
void debug_visit_basicblock(struct ir_func *irb,
struct ir_basicblock *basicblock,
const struct prettyprint_callbacks *callbacks,
void *metadata);
void debug_visit_ir(struct ir_func *irb,
const struct prettyprint_callbacks *callbacks,
void *metadata);
/* Debug methods that write textual, visual output to a file */
typedef void(debug_print_op_callback)(FILE *file, struct ir_op *op,
void *metadata);
void debug_print_var_ty_string(FILE *file, struct ir_unit *iru,
const struct ir_op_var_ty *var_ty);
void debug_print_stmt(FILE *file, struct ir_func *irb, struct ir_stmt *stmt,
debug_print_op_callback *cb, void *cb_metadata);
void debug_print_basicblock(FILE *file, struct ir_func *irb,
struct ir_basicblock *basicblock,
debug_print_op_callback *cb, void *cb_metadata);
void debug_print_ir_func(FILE *file, struct ir_func *irb,
debug_print_op_callback *cb, void *cb_metadata);
void debug_print_ir_graph(FILE *file, struct ir_func *irb);
void debug_print_ir(FILE *file, struct ir_unit *iru,
debug_print_op_callback *cb, void *cb_metadata);
#endif