amd64: small changes w.r.t. stack alignment.
[libfirm] / ir / be / bemachine.h
1 /*
2  * Copyright (C) 1995-2008 University of Karlsruhe.  All right reserved.
3  *
4  * This file is part of libFirm.
5  *
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.
10  *
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.
14  *
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
17  * PURPOSE.
18  */
19
20 /**
21  * @file
22  * @brief       Abstract machine interface.
23  * @author      Christian Wuerdig
24  * @date        23.10.2006
25  * @version     $Id$
26  */
27 #ifndef FIRM_BE_BEMACHINE_H
28 #define FIRM_BE_BEMACHINE_H
29
30 #include "be_types.h"
31
32 struct _be_execution_unit_t {
33         be_execution_unit_type_t *tp;
34         const char               *name;
35 };
36
37 struct _be_execution_unit_type_t {
38         unsigned            n_units;
39         unsigned            ports_per_unit;
40         const char          *name;
41         be_execution_unit_t *units;
42 };
43
44 struct _be_machine_t {
45         unsigned                 bundle_size;
46         unsigned                 bundels_per_cycle;
47         unsigned                 n_unit_types;
48         be_execution_unit_type_t *unit_types;
49 };
50
51 extern be_execution_unit_t be_machine_execution_units_DUMMY[1];
52
53 /**
54  * Initialize generic dummy unit.
55  */
56 void be_machine_init_dummy_unit(void);
57
58 /**
59  * Returns the generic dummy unit.
60  */
61 be_execution_unit_t *be_machine_get_dummy_unit(void);
62
63 /**
64  * Check if given unit is the generic dummy unit.
65  */
66 int be_machine_is_dummy_unit(const be_execution_unit_t *unit);
67
68 /**
69  * Check if given unit is the generic dummy unit type.
70  */
71 int be_machine_is_dummy_unit_type(const be_execution_unit_type_t *tp);
72
73 /**
74  * Get the number of available unit types in the given machine.
75  */
76 #define be_machine_get_n_unit_types(machine) ((machine)->n_unit_types)
77
78 /**
79  * Get the unit type number @p i from the given machine.
80  */
81 #define be_machine_get_unit_type(machine, i) ((machine)->unit_types[(i)])
82
83 /**
84  * Get the name of the given unit type.
85  */
86 #define be_machine_get_unit_type_name(tp) ((tp)->name)
87
88 /**
89  * Get the number of available execution units from the given unit type.
90  */
91 #define be_machine_get_n_execunits(tp) ((tp)->n_units)
92
93 /**
94  * Get the execution unit number @p i from the given unit type.
95  */
96 #define be_machine_get_execunit(tp, i) ((tp)->units[(i)])
97
98 /**
99  * Get the name of the given execution unit.
100  */
101 #define be_machine_get_execunit_name(unit) ((unit)->name)
102
103 /**
104  * Get the unit type of the given execution unit.
105  */
106 #define be_machine_get_execunit_type(unit) ((unit)->tp)
107
108 #endif /* FIRM_BE_BEMACHINE_H */