TEMPLATE_register_init();
TEMPLATE_create_opcodes(&TEMPLATE_irn_ops);
- return &isa->arch_env;
+ return &isa->base;
}
TEMPLATE_isa_t *isa = self;
/* emit now all global declarations */
- be_gas_emit_decls(isa->arch_env.main_env);
+ be_gas_emit_decls(isa->base.main_env);
be_emit_exit();
free(self);
typedef struct {
be_abi_call_flags_bits_t flags;
- const arch_env_t *arch_env;
- ir_graph *irg;
+ ir_graph *irg;
} TEMPLATE_abi_env_t;
-static void *TEMPLATE_abi_init(const be_abi_call_t *call, const arch_env_t *arch_env, ir_graph *irg)
+static void *TEMPLATE_abi_init(const be_abi_call_t *call, ir_graph *irg)
{
TEMPLATE_abi_env_t *env = XMALLOC(TEMPLATE_abi_env_t);
be_abi_call_flags_t fl = be_abi_call_get_flags(call);
env->flags = fl.bits;
env->irg = irg;
- env->arch_env = arch_env;
return env;
}
static const arch_register_t *TEMPLATE_abi_prologue(void *self, ir_node **mem,
pmap *reg_map, int *stack_bias)
{
- TEMPLATE_abi_env_t *env = self;
+ TEMPLATE_abi_env_t *env = self;
+ const arch_env_t *arch_env = be_get_irg_arch_env(env->irg);
(void) reg_map;
(void) mem;
(void) stack_bias;
if (env->flags.try_omit_fp)
- return env->arch_env->sp;
- return env->arch_env->bp;
+ return arch_env->sp;
+ return arch_env->bp;
}
/* Build the epilog */
};
struct TEMPLATE_isa_t {
- arch_env_t arch_env; /**< must be derived from arch_isa */
+ arch_env_t base; /**< must be derived from arch_isa */
};
/**
amd64_register_init();
amd64_create_opcodes(&amd64_irn_ops);
- return &isa->arch_env;
+ return &isa->base;
}
amd64_isa_t *isa = self;
/* emit now all global declarations */
- be_gas_emit_decls(isa->arch_env.main_env);
+ be_gas_emit_decls(isa->base.main_env);
be_emit_exit();
free(self);
typedef struct {
be_abi_call_flags_bits_t flags;
- const arch_env_t *arch_env;
ir_graph *irg;
} amd64_abi_env_t;
-static void *amd64_abi_init(const be_abi_call_t *call, const arch_env_t *arch_env, ir_graph *irg)
+static void *amd64_abi_init(const be_abi_call_t *call, ir_graph *irg)
{
amd64_abi_env_t *env = XMALLOC(amd64_abi_env_t);
be_abi_call_flags_t fl = be_abi_call_get_flags(call);
env->flags = fl.bits;
env->irg = irg;
- env->arch_env = arch_env;
return env;
}
pmap *reg_map, int *stack_bias)
{
amd64_abi_env_t *env = self;
- const arch_env_t *aenv = env->arch_env;
+ const arch_env_t *aenv = be_get_irg_arch_env(env->irg);
(void) mem;
(void) stack_bias;
(void) aenv;
if (!env->flags.try_omit_fp) {
/* FIXME: maybe later here should be some code to generate
* the usual abi prologue */
- return env->arch_env->bp;
+ return aenv->bp;
}
- return env->arch_env->sp;
+ return aenv->sp;
}
/* Build the epilog */
pmap *reg_map)
{
amd64_abi_env_t *env = self;
- const arch_env_t *aenv = env->arch_env;
+ const arch_env_t *aenv = be_get_irg_arch_env(env->irg);
ir_node *curr_sp = be_abi_reg_map_get(reg_map, aenv->sp);
ir_node *curr_bp = be_abi_reg_map_get(reg_map, aenv->bp);
(void) bl;
ir_graph *irg; /**< current irg */
amd64_isa_t *isa; /**< the isa instance */
char dump; /**< set to 1 if graphs should be dumped */
- ir_node *noreg_gp; /**< unique NoReg_GP node */
+ ir_node *noreg_gp; /**< unique NoReg_GP node */
};
struct amd64_isa_t {
- arch_env_t arch_env; /**< must be derived from arch_isa */
+ arch_env_t base; /**< must be derived from arch_isa */
};
/**
be_emit_write_line();
inited = 1;
- return &isa->arch_env;
+ return &isa->base;
}
{
arm_isa_t *isa = self;
- be_gas_emit_decls(isa->arch_env.main_env);
+ be_gas_emit_decls(isa->base.main_env);
be_emit_exit();
free(self);
struct _arm_isa_t {
- arch_env_t arch_env; /**< must be derived from arch_env_t */
+ arch_env_t base; /**< must be derived from arch_env_t */
int gen_reg_names; /**< use generic register names instead of SP, LR, PC */
int fpu_arch; /**< FPU architecture */
arm_code_gen_t *cg; /**< current code generator */
Beware: init backend abi call object after processing calls,
otherwise some information might be not yet available.
*/
- env->cb = env->call->cb->init(env->call, arch_env, irg);
+ env->cb = env->call->cb->init(env->call, irg);
/* Process the IRG */
modify_irg(irg);
/**
* Initialize the callback object.
* @param call The call object.
- * @param aenv The architecture environment.
* @param irg The graph with the method.
* @return Some pointer. This pointer is passed to all other callback functions as self object.
*/
- void *(*init)(const be_abi_call_t *call, const arch_env_t *aenv, ir_graph *irg);
+ void *(*init)(const be_abi_call_t *call, ir_graph *irg);
/**
* Destroy the callback object.
const ir_edge_t *edge;
ir_node *bb = get_nodes_block(b);
- //stat_ev_dbl("beintlive_ignore", arch_irn_is(be_get_irg_arch_env(lv->irg), a, ignore));
-
/*
* If a is live end in b's block it is
* live at b's definition (a dominates b)
goto end;
}
}
- }
+ }
end:
return res;
set_irn_in(perm, new_size, new_in);
}
-ir_node *be_new_MemPerm(const arch_env_t *arch_env, ir_node *bl, int n, ir_node *in[])
+ir_node *be_new_MemPerm(ir_node *block, int n, ir_node *in[])
{
- ir_graph *irg = get_Block_irg(bl);
+ ir_graph *irg = get_Block_irg(block);
+ const arch_env_t *arch_env = be_get_irg_arch_env(irg);
ir_node *frame = get_irg_frame(irg);
const arch_register_t *sp = arch_env->sp;
ir_node *irn;
real_in[0] = frame;
memcpy(&real_in[1], in, n * sizeof(real_in[0]));
- irn = new_ir_node(NULL, irg, bl, op_be_MemPerm, mode_T, n+1, real_in);
+ irn = new_ir_node(NULL, irg, block, op_be_MemPerm, mode_T, n+1, real_in);
init_node_attr(irn, n + 1, n);
be_node_set_reg_class_in(irn, 0, sp->reg_class);
* used as spillslots). MemPerm nodes perform this operation without modifying
* any register values.
*/
-ir_node *be_new_MemPerm(const arch_env_t *arch_env, ir_node *block, int n,
- ir_node *in[]);
+ir_node *be_new_MemPerm(ir_node *block, int n, ir_node *in[]);
ir_node *be_new_Keep(ir_node *block, int arity, ir_node *in[]);
void be_Keep_add_node(ir_node *keep, const arch_register_class_t *cls,
struct be_fec_env_t {
struct obstack obst;
- const arch_env_t *arch_env;
ir_graph *irg;
set *spills;
ir_node **reloads;
static void create_memperms(be_fec_env_t *env)
{
- const arch_env_t *arch_env = env->arch_env;
ir_graph *irg = env->irg;
memperm_t *memperm;
nodes[i] = arg;
}
- mempermnode = be_new_MemPerm(arch_env, memperm->block,
- memperm->entrycount, nodes);
+ mempermnode = be_new_MemPerm(memperm->block, memperm->entrycount,
+ nodes);
/* insert node into schedule */
blockend = get_end_of_block_insertion_point(memperm->block);
be_fec_env_t *be_new_frame_entity_coalescer(ir_graph *irg)
{
- const arch_env_t *arch_env = be_get_irg_arch_env(irg);
- be_fec_env_t *env = XMALLOC(be_fec_env_t);
+ be_fec_env_t *env = XMALLOCZ(be_fec_env_t);
be_liveness_assure_chk(be_assure_liveness(irg));
obstack_init(&env->obst);
- env->arch_env = arch_env;
env->irg = irg;
env->spills = new_set(cmp_spill, 10);
env->reloads = NEW_ARR_F(ir_node*, 0);
*/
static void collect_spills_walker(ir_node *node, void *data)
{
- be_fec_env_t *env = data;
- const ir_mode *mode;
+ be_fec_env_t *env = data;
+ const ir_mode *mode;
const arch_register_class_t *cls;
- int align;
+ int align;
+ ir_graph *irg;
+ const arch_env_t *arch_env;
if (! (arch_irn_classify(node) & arch_irn_class_reload))
return;
- mode = get_irn_mode(node);
- cls = arch_get_irn_reg_class_out(node);
- align = arch_env_get_reg_class_alignment(env->arch_env, cls);
+ mode = get_irn_mode(node);
+ cls = arch_get_irn_reg_class_out(node);
+ irg = get_irn_irg(node);
+ arch_env = be_get_irg_arch_env(irg);
+ align = arch_env_get_reg_class_alignment(arch_env, cls);
be_node_needs_frame_entity(env, node, mode, align);
}
*/
typedef struct {
be_abi_call_flags_bits_t flags; /**< The call flags. */
- const arch_env_t *aenv; /**< The architecture environment. */
ir_graph *irg; /**< The associated graph. */
} ia32_abi_env_t;
{
ia32_abi_env_t *env = self;
ia32_code_gen_t *cg = ia32_current_cg;
- const arch_env_t *arch_env = env->aenv;
+ const arch_env_t *arch_env = be_get_irg_arch_env(env->irg);
ia32_curr_fp_ommitted = env->flags.try_omit_fp;
if (! env->flags.try_omit_fp) {
static void ia32_abi_epilogue(void *self, ir_node *bl, ir_node **mem, pmap *reg_map)
{
ia32_abi_env_t *env = self;
- const arch_env_t *arch_env = env->aenv;
+ const arch_env_t *arch_env = be_get_irg_arch_env(env->irg);
ir_node *curr_sp = be_abi_reg_map_get(reg_map, arch_env->sp);
ir_node *curr_bp = be_abi_reg_map_get(reg_map, arch_env->bp);
/**
* Initialize the callback object.
* @param call The call object.
- * @param aenv The architecture environment.
* @param irg The graph with the method.
* @return Some pointer. This pointer is passed to all other callback functions as self object.
*/
-static void *ia32_abi_init(const be_abi_call_t *call, const arch_env_t *aenv, ir_graph *irg)
+static void *ia32_abi_init(const be_abi_call_t *call, ir_graph *irg)
{
ia32_abi_env_t *env = XMALLOC(ia32_abi_env_t);
be_abi_call_flags_t fl = be_abi_call_get_flags(call);
env->flags = fl.bits;
env->irg = irg;
- env->aenv = aenv;
return env;
}
be_emit_irprintf("%stext0:\n", be_gas_get_private_prefix());
be_emit_write_line();
- return &isa->arch_env;
+ return &isa->base;
}
ia32_isa_t *isa = self;
/* emit now all global declarations */
- be_gas_emit_decls(isa->arch_env.main_env);
+ be_gas_emit_decls(isa->base.main_env);
pmap_destroy(isa->regs_16bit);
pmap_destroy(isa->regs_8bit);
LC_OPT_ENT_ENUM_INT("transformer", "the transformer used for code selection", &transformer_var),
#endif
LC_OPT_ENT_INT("stackalign", "set power of two stack alignment for calls",
- &ia32_isa_template.arch_env.stack_alignment),
+ &ia32_isa_template.base.stack_alignment),
LC_OPT_LAST
};
* IA32 ISA object
*/
struct ia32_isa_t {
- arch_env_t arch_env; /**< must be derived from arch_env_t */
+ arch_env_t base; /**< must be derived from arch_env_t */
pmap *regs_16bit; /**< Contains the 16bits names of the gp registers */
pmap *regs_8bit; /**< Contains the 8bits names of the gp registers */
pmap *regs_8bit_high; /**< contains the high part of the 8 bit names of the gp registers */
sparc_create_opcodes(&sparc_irn_ops);
sparc_handle_intrinsics();
- return &isa->arch_env;
+ return &isa->base;
}
sparc_isa_t *isa = self;
/* emit now all global declarations */
- be_gas_emit_decls(isa->arch_env.main_env);
+ be_gas_emit_decls(isa->base.main_env);
be_emit_exit();
free(self);
typedef struct {
be_abi_call_flags_bits_t flags;
- const arch_env_t *arch_env;
- ir_graph *irg;
+ ir_graph *irg;
} sparc_abi_env_t;
-static void *sparc_abi_init(const be_abi_call_t *call, const arch_env_t *arch_env, ir_graph *irg)
+static void *sparc_abi_init(const be_abi_call_t *call, ir_graph *irg)
{
sparc_abi_env_t *env = XMALLOC(sparc_abi_env_t);
be_abi_call_flags_t fl = be_abi_call_get_flags(call);
env->flags = fl.bits;
env->irg = irg;
- env->arch_env = arch_env;
return env;
}
struct _sparc_isa_t {
- arch_env_t arch_env; /**< must be derived from arch_env_t */
- sparc_code_gen_t *cg; /**< current code generator */
+ arch_env_t base; /**< must be derived from arch_env_t */
+ sparc_code_gen_t *cg; /**< current code generator */
};