besched.c 1.22 KB
Newer Older
1

Sebastian Hack's avatar
Sebastian Hack committed
2
#include "impl.h"
3
4
5
6
#include "irprintf.h"
#include "irgwalk.h"
#include "irnode.h"

Sebastian Hack's avatar
Sebastian Hack committed
7
#include "besched_t.h"
8
9
10
#include "besched.h"
#include "belistsched.h"

Sebastian Hack's avatar
Sebastian Hack committed
11
12
13
FIRM_IMPL1(sched_get_time_step, int, const ir_node *)
FIRM_IMPL1(sched_has_succ, int, const ir_node *)
FIRM_IMPL1(sched_has_prev, int, const ir_node *)
Sebastian Hack's avatar
Sebastian Hack committed
14
15
16
17
FIRM_IMPL1(sched_succ, ir_node *, const ir_node *)
FIRM_IMPL1(sched_prev, ir_node *, const ir_node *)
FIRM_IMPL1(sched_first, ir_node *, const ir_node *)
FIRM_IMPL1(sched_last, ir_node *, const ir_node *)
Sebastian Hack's avatar
Sebastian Hack committed
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
size_t sched_irn_data_offset = 0;

static void block_sched_dumper(ir_node *block, void *env)
{
	FILE *f = env;
	const ir_node *curr;

	ir_fprintf(f, "%n:\n", block);
	sched_foreach(block, curr) {
		ir_fprintf(f, "\t%n\n", curr);
	}
}

void be_sched_dump(FILE *f, const ir_graph *irg)
{
	irg_block_walk_graph((ir_graph *) irg, block_sched_dumper, NULL, f);
}

void be_sched_init(void)
{
	sched_irn_data_offset = register_additional_node_data(sizeof(sched_info_t));
}

void be_sched_test(void)
{
	int i, n;
	struct obstack obst;

	obstack_init(&obst);

	for(i = 0, n = get_irp_n_irgs(); i < n; ++i) {
		ir_graph *irg = get_irp_irg(i);

52
		list_sched(irg, trivial_selector);
53
54
55
56
57
		be_sched_dump(stdout, irg);
	}

	obstack_free(&obst, NULL);
}