2 * Copyright (C) 1995-2007 University of Karlsruhe. All right reserved.
4 * This file is part of libFirm.
6 * This file may be distributed and/or modified under the terms of the
7 * GNU General Public License version 2 as published by the Free Software
8 * Foundation and appearing in the file LICENSE.GPL included in the
9 * packaging of this file.
11 * Licensees holding valid libFirm Professional Edition licenses may use
12 * this file in accordance with the libFirm Commercial License.
13 * Agreement provided with the Software.
15 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * @brief Abstract machine interface.
23 * @author Christian Wuerdig
27 #ifndef FIRM_BE_BEMACHINE_H
28 #define FIRM_BE_BEMACHINE_H
30 typedef struct _be_execution_unit_type_t be_execution_unit_type_t;
31 typedef struct _be_execution_unit_t be_execution_unit_t;
32 typedef struct _be_machine_t be_machine_t;
34 struct _be_execution_unit_t {
35 be_execution_unit_type_t *tp;
39 struct _be_execution_unit_type_t {
41 unsigned ports_per_unit;
43 be_execution_unit_t *units;
46 struct _be_machine_t {
48 unsigned bundels_per_cycle;
49 unsigned n_unit_types;
50 be_execution_unit_type_t *unit_types;
53 extern be_execution_unit_t be_machine_execution_units_DUMMY[1];
56 * Initialize generic dummy unit.
58 void be_machine_init_dummy_unit(void);
61 * Returns the generic dummy unit.
63 be_execution_unit_t *be_machine_get_dummy_unit(void);
66 * Check if given unit is the generic dummy unit.
68 int be_machine_is_dummy_unit(const be_execution_unit_t *unit);
71 * Check if given unit is the generic dummy unit type.
73 int be_machine_is_dummy_unit_type(const be_execution_unit_type_t *tp);
76 * Get the number of available unit types in the given machine.
78 #define be_machine_get_n_unit_types(machine) ((machine)->n_unit_types)
81 * Get the unit type number @p i from the given machine.
83 #define be_machine_get_unit_type(machine, i) ((machine)->unit_types[(i)])
86 * Get the name of the given unit type.
88 #define be_machine_get_unit_type_name(tp) ((tp)->name)
91 * Get the number of available execution units from the given unit type.
93 #define be_machine_get_n_execunits(tp) ((tp)->n_units)
96 * Get the execution unit number @p i from the given unit type.
98 #define be_machine_get_execunit(tp, i) ((tp)->units[(i)])
101 * Get the name of the given execution unit.
103 #define be_machine_get_execunit_name(unit) ((unit)->name)
106 * Get the unit type of the given execution unit.
108 #define be_machine_get_execunit_type(unit) ((unit)->tp)
110 #endif /* FIRM_BE_BEMACHINE_H */