2 * Copyright (C) 1995-2008 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
32 struct be_execution_unit_t {
33 be_execution_unit_type_t *tp;
37 struct be_execution_unit_type_t {
39 unsigned ports_per_unit;
41 be_execution_unit_t *units;
46 unsigned bundels_per_cycle;
47 unsigned n_unit_types;
48 be_execution_unit_type_t *unit_types;
51 extern be_execution_unit_t be_machine_execution_units_DUMMY[1];
54 * Initialize generic dummy unit.
56 void be_machine_init_dummy_unit(void);
59 * Returns the generic dummy unit.
61 be_execution_unit_t *be_machine_get_dummy_unit(void);
64 * Check if given unit is the generic dummy unit.
66 int be_machine_is_dummy_unit(const be_execution_unit_t *unit);
69 * Check if given unit is the generic dummy unit type.
71 int be_machine_is_dummy_unit_type(const be_execution_unit_type_t *tp);
74 * Get the number of available unit types in the given machine.
76 #define be_machine_get_n_unit_types(machine) ((machine)->n_unit_types)
79 * Get the unit type number @p i from the given machine.
81 #define be_machine_get_unit_type(machine, i) ((machine)->unit_types[(i)])
84 * Get the name of the given unit type.
86 #define be_machine_get_unit_type_name(tp) ((tp)->name)
89 * Get the number of available execution units from the given unit type.
91 #define be_machine_get_n_execunits(tp) ((tp)->n_units)
94 * Get the execution unit number @p i from the given unit type.
96 #define be_machine_get_execunit(tp, i) ((tp)->units[(i)])
99 * Get the name of the given execution unit.
101 #define be_machine_get_execunit_name(unit) ((unit)->name)
104 * Get the unit type of the given execution unit.
106 #define be_machine_get_execunit_type(unit) ((unit)->tp)
108 #endif /* FIRM_BE_BEMACHINE_H */