added new licence header
[libfirm] / ir / be / bemachine.c
1 /*
2  * Copyright (C) 1995-2007 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  * Abstract machine interface.
22  * @author Christian Wuerdig
23  * @date   01.12.2006
24  * @cvs-id $Id$
25  */
26 #ifdef HAVE_CONFIG_H
27 #include "config.h"
28 #endif
29
30 #include "bemachine.h"
31
32 /* We define a generic dummy unit */
33 be_execution_unit_t be_machine_execution_units_DUMMY[1];
34
35 be_execution_unit_type_t be_machine_execution_unit_types[] = {
36         { 1, 1, "DUMMY", be_machine_execution_units_DUMMY },
37 };
38
39 /**
40  * Initialize generic dummy unit.
41  */
42 void be_machine_init_dummy_unit(void) {
43         be_machine_execution_units_DUMMY[0].name = "GENERIC_DUMMY_UNIT";
44         be_machine_execution_units_DUMMY[0].tp   = &be_machine_execution_unit_types[0];
45 }
46
47 /**
48  * Returns the generic dummy unit.
49  */
50 be_execution_unit_t *be_machine_get_dummy_unit(void) {
51         return &be_machine_execution_units_DUMMY[0];
52 }
53
54 /**
55  * Check if given unit is the generic dummy unit.
56  */
57 int be_machine_is_dummy_unit(const be_execution_unit_t *unit) {
58         return unit == &be_machine_execution_units_DUMMY[0];
59 }
60
61 /**
62  * Check if given unit is the generic dummy unit type.
63  */
64 int be_machine_is_dummy_unit_type(const be_execution_unit_type_t *tp) {
65         return tp == &be_machine_execution_unit_types[0];
66 }