we don't need no stinking selfs
[libfirm] / ir / be / bemachine.c
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        01.12.2006
25  * @version     $Id$
26  */
27 #ifdef HAVE_CONFIG_H
28 #include "config.h"
29 #endif
30
31 #include "bemachine.h"
32
33 /* We define a generic dummy unit */
34 be_execution_unit_t be_machine_execution_units_DUMMY[1];
35
36 be_execution_unit_type_t be_machine_execution_unit_types[] = {
37         { 1, 1, "DUMMY", be_machine_execution_units_DUMMY },
38 };
39
40 /**
41  * Initialize generic dummy unit.
42  */
43 void be_machine_init_dummy_unit(void) {
44         be_machine_execution_units_DUMMY[0].name = "GENERIC_DUMMY_UNIT";
45         be_machine_execution_units_DUMMY[0].tp   = &be_machine_execution_unit_types[0];
46 }
47
48 /**
49  * Returns the generic dummy unit.
50  */
51 be_execution_unit_t *be_machine_get_dummy_unit(void) {
52         return &be_machine_execution_units_DUMMY[0];
53 }
54
55 /**
56  * Check if given unit is the generic dummy unit.
57  */
58 int be_machine_is_dummy_unit(const be_execution_unit_t *unit) {
59         return unit == &be_machine_execution_units_DUMMY[0];
60 }
61
62 /**
63  * Check if given unit is the generic dummy unit type.
64  */
65 int be_machine_is_dummy_unit_type(const be_execution_unit_type_t *tp) {
66         return tp == &be_machine_execution_unit_types[0];
67 }