From: Christian Würdig Date: Tue, 24 Oct 2006 12:22:19 +0000 (+0000) Subject: initial checkin of abstract machine interface X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=41c42d0890e829ac41792a23a163dbf73d288f8e;p=libfirm initial checkin of abstract machine interface --- diff --git a/ir/be/bemachine.h b/ir/be/bemachine.h new file mode 100644 index 000000000..2f6d1cf04 --- /dev/null +++ b/ir/be/bemachine.h @@ -0,0 +1,66 @@ +#ifndef _BE_MACHINE_H_ +#define _BE_MACHINE_H_ + +/** + * Abstract machine interface. + * @author Christian Wuerdig + * @date 23.10.2006 + * @cvs-id $Id$ + */ + +typedef struct _be_execution_unit_type_t be_execution_unit_type_t; +typedef struct _be_execution_unit_t be_execution_unit_t; +typedef struct _be_machine_t be_machine_t; + +struct _be_execution_unit_t { + be_execution_unit_type_t *tp; + const char *name; +}; + +struct _be_execution_unit_type_t { + unsigned n_units; + const char *name; + be_execution_unit_t *units; +}; + +struct _be_machine_t { + unsigned n_unit_types; + be_execution_unit_type_t *unit_types; +}; + +/** + * Get the number of available unit types in the given machine. + */ +#define be_machine_get_n_unit_types(machine) ((machine)->n_unit_types) + +/** + * Get the unit type number @p i from the given machine. + */ +#define be_machine_get_unit_type(machine, i) ((machine)->unit_types[(i)]) + +/** + * Get the name of the given unit type. + */ +#define be_machine_get_unit_type_name(tp) ((tp)->name) + +/** + * Get the number of available execution units from the given unit type. + */ +#define be_machine_get_n_execunits(tp) ((tp)->n_units) + +/** + * Get the execution unit number @p i from the given unit type. + */ +#define be_machine_get_execunit(tp, i) ((tp)->units[(i)]) + +/** + * Get the name of the given execution unit. + */ +#define be_machine_get_execunit_name(unit) ((unit)->name) + +/** + * Get the unit type of the given execution unit. + */ +#define be_machine_get_execunit_type(unit) ((unit)->tp) + +#endif /* _BE_MACHINE_H_ */