typedef enum _arch_register_type_t {
arch_register_type_none = 0,
- arch_register_type_caller_save = 1, /**< The register must be saved by the caller
- upon a function call. It thus can be overwritten
- in the called function. */
- arch_register_type_callee_save = 2, /**< The register must be saved by the caller
- upon a function call. It thus can be overwritten
- in the called function. */
- arch_register_type_ignore = 4, /**< Do not consider this register when allocating. */
+ arch_register_type_caller_save = 1, /**< The register must be saved by the caller
+ upon a function call. It thus can be overwritten
+ in the called function. */
+ arch_register_type_callee_save = 2, /**< The register must be saved by the caller
+ upon a function call. It thus can be overwritten
+ in the called function. */
+ arch_register_type_ignore = 4, /**< Do not consider this register when allocating. */
+ arch_register_type_joker = 8, /**< The emitter can choose an arbitrary register */
+ arch_register_type_virtual = 16, /**< This is just a virtual register */
} arch_register_type_t;
/**
return reg->index;
}
+static INLINE const char *_arch_register_get_name(const arch_register_t *reg)
+{
+ return reg->name;
+}
+
#define arch_register_get_class(reg) _arch_register_get_class(reg)
#define arch_register_get_index(reg) _arch_register_get_index(reg)
-#define arch_register_get_name(reg) ((reg)->name)
+#define arch_register_get_name(reg) _arch_register_get_name(reg)
/**
* A class of registers.
/** return the largest mode of this register class */
#define arch_register_class_mode(cls) ((cls)->mode)
+/** return the name of this register class */
+#define arch_register_class_name(cls) ((cls)->name)
+
/**
* Put all registers in a class into a bitset.
* @param cls The class.
* ISA base class.
*/
struct _arch_isa_t {
- const arch_isa_if_t *impl;
+ const arch_isa_if_t *impl;
const arch_register_t *sp; /** The stack pointer register. */
const arch_register_t *bp; /** The base pointer register. */
const int stack_dir; /** -1 for decreasing, 1 for increasing. */
+ const be_main_env_t *main_env; /** the be main environment */
};
#define arch_isa_stack_dir(isa) ((isa)->stack_dir)
/**
* Initialize the isa interface.
- * @param file_handle the file handle to write the output to
- * @return a new isa instance
+ * @param file_handle the file handle to write the output to
+ * @param main_env the be main environment
+ * @return a new isa instance
*/
void *(*init)(FILE *file_handle);
* @param file_handle The file handle
* @return The environment.
*/
-extern arch_env_t *arch_env_init(arch_env_t *env, const arch_isa_if_t *isa, FILE *file_handle);
+extern arch_env_t *arch_env_init(arch_env_t *env, const arch_isa_if_t *isa, FILE *file_handle, be_main_env_t *main_env);
/**
* Add a node handler to the environment.
*/
extern const arch_irn_handler_t *arch_env_pop_irn_handler(arch_env_t *env);
-/**
- * Tells whether function represented by entity should be
- * called in the constructor section.
- * @param arch_env The architecture environment.
- * @param ent The entitiy representing a function
- * @return 1 if function is a constructor
- */
-extern int arch_ent_is_constructor(const arch_env_t *arch_env, const entitiy * ent);
-
#endif /* _FIRM_BEARCH_H */