245aa8ff47735573bfa7861b7ff8b52647e61b3f
[libfirm] / ir / be / bemachine.c
1 /**
2  * Abstract machine interface.
3  * @author Christian Wuerdig
4  * @date   01.12.2006
5  * @cvs-id $Id$
6  */
7 #ifdef HAVE_CONFIG_H
8 #include "config.h"
9 #endif
10
11 #include "bemachine.h"
12
13 /* We define a generic dummy unit */
14 be_execution_unit_t be_machine_execution_units_DUMMY[1];
15
16 be_execution_unit_type_t be_machine_execution_unit_types[] = {
17         { 1, 1, "DUMMY", be_machine_execution_units_DUMMY },
18 };
19
20 /**
21  * Initialize generic dummy unit.
22  */
23 void be_machine_init_dummy_unit(void) {
24         be_machine_execution_units_DUMMY[0].name = "GENERIC_DUMMY_UNIT";
25         be_machine_execution_units_DUMMY[0].tp   = &be_machine_execution_unit_types[0];
26 }
27
28 /**
29  * Returns the generic dummy unit.
30  */
31 be_execution_unit_t *be_machine_get_dummy_unit(void) {
32         return &be_machine_execution_units_DUMMY[0];
33 }
34
35 /**
36  * Check if given unit is the generic dummy unit.
37  */
38 int be_machine_is_dummy_unit(const be_execution_unit_t *unit) {
39         return unit == &be_machine_execution_units_DUMMY[0];
40 }
41
42 /**
43  * Check if given unit is the generic dummy unit type.
44  */
45 int be_machine_is_dummy_unit_type(const be_execution_unit_type_t *tp) {
46         return tp == &be_machine_execution_unit_types[0];
47 }