X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fbearch.h;h=ddb9c32761ff196f9e46a4eb46d4155afa155c9d;hb=38efd2ac16aa827ae9f07acc9ebfc7d74422290e;hp=48b247b9e14d0436e65365ccbf40872edb9d24d2;hpb=c29950589fd872e87fc148e2cd1d85173ecaef78;p=libfirm diff --git a/ir/be/bearch.h b/ir/be/bearch.h index 48b247b9e..ddb9c3276 100644 --- a/ir/be/bearch.h +++ b/ir/be/bearch.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1995-2007 University of Karlsruhe. All right reserved. + * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved. * * This file is part of libFirm. * @@ -29,6 +29,7 @@ #include "firm_types.h" #include "bitset.h" #include "be.h" +#include "obst.h" typedef struct arch_register_class_t arch_register_class_t; typedef struct arch_register_req_t arch_register_req_t; @@ -40,10 +41,15 @@ typedef struct arch_isa_t arch_isa_t; typedef struct arch_env_t arch_env_t; typedef struct arch_irn_ops_if_t arch_irn_ops_if_t; typedef struct arch_irn_ops_t arch_irn_ops_t; -typedef struct arch_irn_handler_t arch_irn_handler_t; typedef struct arch_code_generator_t arch_code_generator_t; typedef struct arch_code_generator_if_t arch_code_generator_if_t; +typedef enum arch_register_class_flags_t { + arch_register_class_flag_none = 0, + arch_register_class_flag_manual_ra = 1, /**< don't do automatic register allocation for this class */ + arch_register_class_flag_state = 2 +} arch_register_class_flags_t; + 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 @@ -54,8 +60,11 @@ typedef enum arch_register_type_t { 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_state = 32, + arch_register_type_virtual = 16, /**< This is just a virtual register.Virtual registers have + nearly no constraints, it is a allowed to have multiple + definition for the same register at a point) */ + arch_register_type_state = 32, /**< The register represents a state that should be handled by + bestate code */ } arch_register_type_t; /** @@ -79,12 +88,11 @@ typedef enum arch_operand_type_t { * Different types of register allocation requirements. */ typedef enum arch_register_req_type_t { - arch_register_req_type_none = 0, /**< No register requirement. */ - arch_register_req_type_normal = 1, /**< All registers in the class are allowed. */ - arch_register_req_type_limited = 2, /**< Only a real subset of the class is allowed. */ - arch_register_req_type_should_be_same = 4, /**< The register should be equal another one at the node. */ - arch_register_req_type_should_be_different = 8, /**< The register must be unequal to some other at the node. */ - arch_register_req_type_should_be_different_from_all = 16, /**< The register must be different from all in's at the node */ + arch_register_req_type_none = 0, /**< No register requirement. */ + arch_register_req_type_normal = 1, /**< All registers in the class are allowed. */ + arch_register_req_type_limited = 2, /**< Only a real subset of the class is allowed. */ + arch_register_req_type_should_be_same = 4, /**< The register should be equal to another one at the node. */ + arch_register_req_type_should_be_different = 8, /**< The register must be unequal from some other at the node. */ } arch_register_req_type_t; extern const arch_register_req_t *arch_no_register_req; @@ -123,7 +131,8 @@ typedef enum arch_irn_flags_t { arch_irn_flags_rematerializable = 2, /**< This can be replicated instead of spilled/reloaded. */ arch_irn_flags_ignore = 4, /**< Ignore node during register allocation. */ arch_irn_flags_modify_sp = 8, /**< I modify the stack pointer. */ - arch_irn_flags_last = arch_irn_flags_modify_sp + arch_irn_flags_modify_flags = 16, /**< I modify flags. */ + arch_irn_flags_last = arch_irn_flags_modify_flags } arch_irn_flags_t; /** @@ -263,6 +272,14 @@ extern arch_irn_flags_t arch_irn_get_flags(const arch_env_t *env, const ir_node #define arch_irn_consider_in_reg_alloc(env, cls, irn) \ (arch_irn_has_reg_class(env, irn, -1, cls) && !arch_irn_is(env, irn, ignore)) +/** + * Get the operations of an irn. + * @param self The handler from which the method is invoked. + * @param irn Some node. + * @return Operations for that irn. + */ +typedef const void *(arch_get_irn_ops_t)(const ir_node *irn); + /** * Initialize the architecture environment struct. * @param isa The isa which shall be put into the environment. @@ -273,19 +290,12 @@ 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. + * Set the architectural node handler to the environment. * @param env The environment. - * @param handler A node handler. + * @param handler The node handler for the selected architecture. * @return The environment itself. */ -extern arch_env_t *arch_env_push_irn_handler(arch_env_t *env, const arch_irn_handler_t *handler); - -/** - * Remove a node handler from the handler stack. - * @param env The architecture environment. - * @return The popped handler. - */ -extern const arch_irn_handler_t *arch_env_pop_irn_handler(arch_env_t *env); +extern void arch_env_set_irn_handler(arch_env_t *env, arch_get_irn_ops_t *handler); /** * Register an instruction set architecture