X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fbeirg.h;h=881a426031e89a5574fa3e7db8cd6c2ba6d59ca7;hb=ff94a727febe4d155e1e807b57179df47f8fd489;hp=d9759ed12972dbf2fe50093b1337c357ff65cc9e;hpb=39f3a8dbd0f00f90b7b12a849d1bf7b9c1329479;p=libfirm diff --git a/ir/be/beirg.h b/ir/be/beirg.h index d9759ed12..881a42603 100644 --- a/ir/be/beirg.h +++ b/ir/be/beirg.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. * @@ -27,30 +27,135 @@ #ifndef FIRM_BE_BEIRG_H #define FIRM_BE_BEIRG_H -#include "execfreq.h" -#include "belive.h" -#include "bedomfront.h" +#include "be.h" +#include "be_types.h" +#include "be_t.h" +#include "irtypes.h" -typedef struct be_irg_t be_irg_t; +be_lv_t *be_assure_liveness(ir_graph *irg); -ir_graph *be_get_birg_irg(const be_irg_t *birg); +void be_assure_dom_front(ir_graph *irg); +void be_invalidate_dom_front(ir_graph *irg); -void be_assure_liveness(be_irg_t *birg); -void be_invalidate_liveness(be_irg_t *birg); -be_lv_t *be_get_birg_liveness(const be_irg_t *birg); +/** + * frees all memory allocated by birg structures (liveness, dom_front, ...). + * The memory of the birg structure itself is not freed. + */ +void be_free_birg(ir_graph *irg); -void be_assure_dom_front(be_irg_t *birg); -void be_invalidate_dom_front(be_irg_t *birg); -be_dom_front_info_t *be_get_birg_dom_front(const be_irg_t *birg); +/** The number of parts of the stack layout. */ +#define N_FRAME_TYPES 3 -const arch_env_t *be_get_birg_arch_env(const be_irg_t *birg); +/** + * This type describes the stack layout. + * The stack is divided into 3 parts: + * - arg_type: A struct type describing the stack arguments and it's order. + * - between_type: A struct type describing the stack layout between arguments + * and frame type. In architectures that put the return address + * automatically on the stack, the return address is put here. + * - frame_type: A class type describing the frame layout. + */ +struct be_stack_layout_t { + ir_type *arg_type; /**< A type describing the stack argument layout. */ + ir_type *between_type; /**< A type describing the "between" layout. */ + ir_type *frame_type; /**< The frame type. */ -ir_exec_freq *be_get_birg_exec_freq(const be_irg_t *birg); + ir_type *order[N_FRAME_TYPES]; /**< arg, between and frame types ordered. */ + + ir_entity **param_map; /**< An array mapping type parameters to arg_type entries */ + int initial_offset; /**< the initial difference between stack pointer and frame pointer */ + int initial_bias; /**< the initial stack bias */ + int stack_dir; /**< -1 for decreasing, 1 for increasing. */ + bool sp_relative : 1; /**< entities are addressed relative to + stack pointer (omit-fp mode) */ +}; /** - * frees all memory allocated by birg structures (liveness, dom_front, ...). - * The memory of the birg structure itself is not freed. + * An ir_graph with additional analysis data about this irg. Also includes some + * backend structures */ -void be_free_birg(be_irg_t *birg); +typedef struct be_irg_t { + ir_graph *irg; + be_main_env_t *main_env; + be_abi_irg_t *abi; + arch_code_generator_t *cg; + ir_exec_freq *exec_freq; + be_dom_front_info_t *dom_front; + be_lv_t *lv; + be_stack_layout_t stack_layout; + arch_register_req_t *sp_req; /**< requirements for stackpointer producing + nodes. */ + struct obstack obst; /**< birg obstack (mainly used to keep + register constraints which we can't keep + in the irg obst, because it gets replace + during code selection) */ +} be_irg_t; + +static inline be_irg_t *be_birg_from_irg(const ir_graph *irg) +{ + return (be_irg_t*) irg->be_data; +} + +static inline be_main_env_t *be_get_irg_main_env(const ir_graph *irg) +{ + return be_birg_from_irg(irg)->main_env; +} + +static inline be_lv_t *be_get_irg_liveness(const ir_graph *irg) +{ + return be_birg_from_irg(irg)->lv; +} + +static inline ir_exec_freq *be_get_irg_exec_freq(const ir_graph *irg) +{ + return be_birg_from_irg(irg)->exec_freq; +} + +static inline be_dom_front_info_t *be_get_irg_dom_front(const ir_graph *irg) +{ + return be_birg_from_irg(irg)->dom_front; +} + +static inline be_abi_irg_t *be_get_irg_abi(const ir_graph *irg) +{ + return be_birg_from_irg(irg)->abi; +} + +static inline void be_set_irg_abi(ir_graph *irg, be_abi_irg_t *abi) +{ + be_birg_from_irg(irg)->abi = abi; +} + +static inline be_options_t *be_get_irg_options(const ir_graph *irg) +{ + return be_birg_from_irg(irg)->main_env->options; +} + +static inline arch_code_generator_t *be_get_irg_cg(const ir_graph *irg) +{ + return be_birg_from_irg(irg)->cg; +} + +/** deprecated */ +static inline ir_graph *be_get_birg_irg(const be_irg_t *birg) +{ + return birg->irg; +} + +static inline const arch_env_t *be_get_irg_arch_env(const ir_graph *irg) +{ + return be_birg_from_irg(irg)->main_env->arch_env; +} + +static inline struct obstack *be_get_be_obst(const ir_graph *irg) +{ + be_irg_t *birg = be_birg_from_irg(irg); + return &birg->obst; +} + +static inline be_stack_layout_t *be_get_irg_stack_layout(const ir_graph *irg) +{ + return &be_birg_from_irg(irg)->stack_layout; +} -#endif /* FIRM_BE_BEIRG_H */ +#endif