bemachine.h 2.73 KB
Newer Older
Christian Würdig's avatar
Christian Würdig committed
1
/*
Michael Beck's avatar
Michael Beck committed
2
 * Copyright (C) 1995-2008 University of Karlsruhe.  All right reserved.
Christian Würdig's avatar
Christian Würdig committed
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
 *
 * This file is part of libFirm.
 *
 * This file may be distributed and/or modified under the terms of the
 * GNU General Public License version 2 as published by the Free Software
 * Foundation and appearing in the file LICENSE.GPL included in the
 * packaging of this file.
 *
 * Licensees holding valid libFirm Professional Edition licenses may use
 * this file in accordance with the libFirm Commercial License.
 * Agreement provided with the Software.
 *
 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE.
 */

20
/**
Christian Würdig's avatar
Christian Würdig committed
21
22
23
24
25
 * @file
 * @brief       Abstract machine interface.
 * @author      Christian Wuerdig
 * @date        23.10.2006
 * @version     $Id$
26
 */
Christian Würdig's avatar
Christian Würdig committed
27
28
#ifndef FIRM_BE_BEMACHINE_H
#define FIRM_BE_BEMACHINE_H
29

30
#include "be_types.h"
31
32
33
34
35
36
37
38

struct _be_execution_unit_t {
	be_execution_unit_type_t *tp;
	const char               *name;
};

struct _be_execution_unit_type_t {
	unsigned            n_units;
Christian Würdig's avatar
Christian Würdig committed
39
	unsigned            ports_per_unit;
40
41
42
43
44
	const char          *name;
	be_execution_unit_t *units;
};

struct _be_machine_t {
45
46
	unsigned                 bundle_size;
	unsigned                 bundels_per_cycle;
47
48
49
50
	unsigned                 n_unit_types;
	be_execution_unit_type_t *unit_types;
};

51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
extern be_execution_unit_t be_machine_execution_units_DUMMY[1];

/**
 * Initialize generic dummy unit.
 */
void be_machine_init_dummy_unit(void);

/**
 * Returns the generic dummy unit.
 */
be_execution_unit_t *be_machine_get_dummy_unit(void);

/**
 * Check if given unit is the generic dummy unit.
 */
Matthias Braun's avatar
Matthias Braun committed
66
int be_machine_is_dummy_unit(const be_execution_unit_t *unit);
67
68
69
70

/**
 * Check if given unit is the generic dummy unit type.
 */
Matthias Braun's avatar
Matthias Braun committed
71
int be_machine_is_dummy_unit_type(const be_execution_unit_type_t *tp);
72

73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/**
 * Get the number of available unit types in the given machine.
 */
#define be_machine_get_n_unit_types(machine) ((machine)->n_unit_types)

/**
 * Get the unit type number @p i from the given machine.
 */
#define be_machine_get_unit_type(machine, i) ((machine)->unit_types[(i)])

/**
 * Get the name of the given unit type.
 */
#define be_machine_get_unit_type_name(tp) ((tp)->name)

/**
 * Get the number of available execution units from the given unit type.
 */
#define be_machine_get_n_execunits(tp) ((tp)->n_units)

/**
 * Get the execution unit number @p i from the given unit type.
 */
#define be_machine_get_execunit(tp, i) ((tp)->units[(i)])

/**
 * Get the name of the given execution unit.
 */
#define be_machine_get_execunit_name(unit) ((unit)->name)

/**
 * Get the unit type of the given execution unit.
 */
#define be_machine_get_execunit_type(unit) ((unit)->tp)

Christian Würdig's avatar
Christian Würdig committed
108
#endif /* FIRM_BE_BEMACHINE_H */