X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fbearch_t.h;h=b1702fd4fdc810f9335d2df62eae227dbd50b61a;hb=93da909d12b7bec51aa36ee5f05966c331f90fb9;hp=0ed5c67e8968d5a61b57be8d28e3436a23607413;hpb=be8b3b023b424af04a93c389d1a7672e1717a98e;p=libfirm diff --git a/ir/be/bearch_t.h b/ir/be/bearch_t.h index 0ed5c67e8..b1702fd4f 100644 --- a/ir/be/bearch_t.h +++ b/ir/be/bearch_t.h @@ -190,8 +190,7 @@ struct arch_irn_ops_t { * @return The register requirements for the selected operand. * The pointer returned is never NULL. */ - const arch_register_req_t *(*get_irn_reg_req)(const void *self, - const ir_node *irn, int pos); + const arch_register_req_t *(*get_irn_reg_req)(const ir_node *irn, int pos); /** * Set the register for an output operand. @@ -200,7 +199,7 @@ struct arch_irn_ops_t { * @note If the operand is not a register operand, * the call is ignored. */ - void (*set_irn_reg)(const void *self, ir_node *irn, const arch_register_t *reg); + void (*set_irn_reg)(ir_node *irn, const arch_register_t *reg); /** * Get the register allocated for an output operand. @@ -210,14 +209,14 @@ struct arch_irn_ops_t { * @c arch_register_invalid, if no register has yet been * allocated for this node. */ - const arch_register_t *(*get_irn_reg)(const void *self, const ir_node *irn); + const arch_register_t *(*get_irn_reg)(const ir_node *irn); /** * Classify the node. * @param irn The node. * @return A classification. */ - arch_irn_class_t (*classify)(const void *self, const ir_node *irn); + arch_irn_class_t (*classify)(const ir_node *irn); /** * Get the flags of a node. @@ -225,7 +224,7 @@ struct arch_irn_ops_t { * @param irn The node. * @return A set of flags. */ - arch_irn_flags_t (*get_flags)(const void *self, const ir_node *irn); + arch_irn_flags_t (*get_flags)(const ir_node *irn); /** * Get the entity on the stack frame this node depends on. @@ -234,7 +233,7 @@ struct arch_irn_ops_t { * @return The entity on the stack frame or NULL, if the node does not have a * stack frame entity. */ - ir_entity *(*get_frame_entity)(const void *self, const ir_node *irn); + ir_entity *(*get_frame_entity)(const ir_node *irn); /** * Set the entity on the stack frame this node depends on. @@ -242,7 +241,7 @@ struct arch_irn_ops_t { * @param irn The node in question. * @param ent The entity to set */ - void (*set_frame_entity)(const void *self, ir_node *irn, ir_entity *ent); + void (*set_frame_entity)(ir_node *irn, ir_entity *ent); /** * Set the offset of a node carrying an entity on the stack frame. @@ -250,7 +249,7 @@ struct arch_irn_ops_t { * @param irn The node. * @param offset The offset of the node's stack frame entity. */ - void (*set_frame_offset)(const void *self, ir_node *irn, int offset); + void (*set_frame_offset)(ir_node *irn, int offset); /** * Returns the delta of the stackpointer for nodes that increment or @@ -264,7 +263,7 @@ struct arch_irn_ops_t { * @return 0 if the stackpointer is not modified with a constant * value, otherwise the increment/decrement value */ - int (*get_sp_bias)(const void *self, const ir_node *irn); + int (*get_sp_bias)(const ir_node *irn); /** * Returns an inverse operation which yields the i-th argument @@ -277,7 +276,7 @@ struct arch_irn_ops_t { * @param obstack The obstack to use for allocation of the returned nodes array * @return The inverse operation or NULL if operation invertible */ - arch_inverse_t *(*get_inverse)(const void *self, const ir_node *irn, int i, arch_inverse_t *inverse, struct obstack *obstack); + arch_inverse_t *(*get_inverse)(const ir_node *irn, int i, arch_inverse_t *inverse, struct obstack *obstack); /** * Get the estimated cycle count for @p irn. @@ -287,7 +286,7 @@ struct arch_irn_ops_t { * * @return The estimated cycle count for this operation */ - int (*get_op_estimated_cost)(const void *self, const ir_node *irn); + int (*get_op_estimated_cost)(const ir_node *irn); /** * Asks the backend whether operand @p i of @p irn can be loaded form memory internally @@ -298,7 +297,7 @@ struct arch_irn_ops_t { * * @return nonzero if argument can be loaded or zero otherwise */ - int (*possible_memory_operand)(const void *self, const ir_node *irn, unsigned int i); + int (*possible_memory_operand)(const ir_node *irn, unsigned int i); /** * Ask the backend to assimilate @p reload of operand @p i into @p irn. @@ -308,7 +307,7 @@ struct arch_irn_ops_t { * @param spill The spill. * @param i The position of the reload. */ - void (*perform_memory_operand)(const void *self, ir_node *irn, ir_node *spill, unsigned int i); + void (*perform_memory_operand)(ir_node *irn, ir_node *spill, unsigned int i); }; /** @@ -407,24 +406,6 @@ struct arch_code_generator_t { const arch_code_generator_if_t *impl; }; -/** - * ISA base class. - */ -struct arch_isa_t { - const arch_isa_if_t *impl; - const arch_register_t *sp; /** The stack pointer register. */ - const arch_register_t *bp; /** The base pointer register. */ - int stack_dir; /** -1 for decreasing, 1 for increasing. */ - int stack_alignment; /** stack alignment */ - const be_main_env_t *main_env; /** the be main environment */ - int spill_cost; /** cost for a be_Spill node */ - int reload_cost; /** cost for a be_Reload node */ -}; - -#define arch_isa_stack_dir(isa) ((isa)->stack_dir) -#define arch_isa_sp(isa) ((isa)->sp) -#define arch_isa_bp(isa) ((isa)->bp) - /** * Architecture interface. */ @@ -435,7 +416,7 @@ struct arch_isa_if_t { * @param main_env the be main environment * @return a new isa instance */ - void *(*init)(FILE *file_handle); + arch_env_t *(*init)(FILE *file_handle); /** * Free the isa instance. @@ -541,31 +522,53 @@ struct arch_isa_if_t { * @return A flexible array ARR_F containing all desired irgs in the desired order. */ ir_graph **(*get_backend_irg_list)(const void *self, ir_graph ***irgs); + + /** + * parse an assembler constraint part and set flags according to its nature + * advances the *c pointer to point to the last parsed character (so if you + * parse a single character don't advance c) + */ + asm_constraint_flags_t (*parse_asm_constraint)(const void *self, const char **c); + + /** + * returns true if the string is a valid clobbered (register) in this + * backend + */ + int (*is_valid_clobber)(const void *self, const char *clobber); }; -#define arch_isa_get_n_reg_class(isa) ((isa)->impl->get_n_reg_class(isa)) -#define arch_isa_get_reg_class(isa,i) ((isa)->impl->get_reg_class(isa, i)) -#define arch_isa_get_call_abi(isa,tp,abi) ((isa)->impl->get_call_abi((isa), (tp), (abi))) -#define arch_isa_get_reg_class_for_mode(isa,mode) ((isa)->impl->get_reg_class_for_mode((isa), (mode))) -#define arch_isa_make_code_generator(isa,irg) ((isa)->impl->make_code_generator((isa), (irg))) -#define arch_isa_get_reg_class_alignment(isa, cls) ((isa)->impl->get_reg_class_alignment((isa), (cls))) -#define arch_isa_get_allowed_execution_units(isa, irn) ((isa)->impl->get_allowed_execution_units((isa), (irn))) -#define arch_isa_get_machine(isa) ((isa)->impl->get_machine((isa))) -#define arch_isa_get_backend_irg_list(isa, irgs) ((isa)->impl->get_backend_irg_list((isa), (irgs))) +#define arch_env_done(env) ((env)->impl->done(env)) +#define arch_env_get_n_reg_class(env) ((env)->impl->get_n_reg_class(env)) +#define arch_env_get_reg_class(env,i) ((env)->impl->get_reg_class(env, i)) +#define arch_env_get_reg_class_for_mode(env,mode) ((env)->impl->get_reg_class_for_mode((env), (mode))) +#define arch_env_get_call_abi(env,tp,abi) ((env)->impl->get_call_abi((env), (tp), (abi))) +#define arch_env_get_code_generator_if(env) ((env)->impl->get_code_generator_if((env))) +#define arch_env_get_list_sched_selector(env,selector) ((env)->impl->get_list_sched_selector((env), (selector))) +#define arch_env_get_ilp_sched_selector(env) ((env)->impl->get_ilp_sched_selector(env)) +#define arch_env_get_reg_class_alignment(env,cls) ((env)->impl->get_reg_class_alignment((env), (cls))) +#define arch_env_get_params(env) ((env)->impl->get_params()) +#define arch_env_get_allowed_execution_units(env,irn) ((env)->impl->get_allowed_execution_units((env), (irn))) +#define arch_env_get_machine(env) ((env)->impl->get_machine(env)) +#define arch_env_get_backend_irg_list(env,irgs) ((env)->impl->get_backend_irg_list((env), (irgs))) +#define arch_env_parse_asm_constraint(env,c) ((env)->impl->parse_asm_constraint((env), (c)) +#define arch_env_is_valid_clobber(env,clobber) ((env)->impl->is_valid_clobber((env), (clobber)) /** - * Environment for the architecture infrastructure. - * Keep this everywhere you're going. + * ISA base class. */ struct arch_env_t { - arch_isa_t *isa; /**< The isa about which everything is. */ + const arch_isa_if_t *impl; + const arch_register_t *sp; /** The stack pointer register. */ + const arch_register_t *bp; /** The base pointer register. */ + int stack_dir; /** -1 for decreasing, 1 for increasing. */ + int stack_alignment; /** power of 2 stack alignment */ + const be_main_env_t *main_env; /** the be main environment */ + int spill_cost; /** cost for a be_Spill node */ + int reload_cost; /** cost for a be_Reload node */ }; -/** - * Get the isa of an arch environment. - * @param env The environment. - * @return The isa with which the env was initialized with. - */ -#define arch_env_get_isa(env) ((env)->isa) +#define arch_env_stack_dir(env) ((env)->stack_dir) +#define arch_env_sp(env) ((env)->sp) +#define arch_env_bp(env) ((env)->bp) #endif /* FIRM_BE_BEARCH_T_H */