typedef struct be_abi_call_arg_t {
unsigned is_res : 1; /**< 1: the call argument is a return value. 0: it's a call parameter. */
unsigned in_reg : 1; /**< 1: this argument is transmitted in registers. */
- unsigned on_stack : 1; /**< 1: this argument is transmitted on the stack. */
+ unsigned on_stack : 1; /**< 1: this argument is transmitted on the stack. */
unsigned callee : 1; /**< 1: someone called us. 0: We call another function */
int pos;
/** Flag: if set, try to omit the frame pointer in all routines. */
static int be_omit_fp = 1;
-/** Flag: if set, try to omit the frame pointer in leaf routines only. */
-static int be_omit_leaf_fp = 1;
-
/*
_ ____ ___ ____ _ _ _ _
/ \ | __ )_ _| / ___|__ _| | | |__ __ _ ___| | _____
* @param call the abi call
* @param is_res true for call results, false for call arguments
* @param pos position of the argument
- * @param callee context type - if we are callee or caller
+ * @param callee context type - if we are callee or caller
*/
static be_abi_call_arg_t *get_call_arg(be_abi_call_t *call, int is_res, int pos, int callee)
{
call->cb = NULL;
call->cls_addr = cls_addr;
- call->flags.bits.try_omit_fp = be_omit_fp | be_omit_leaf_fp;
+ call->flags.bits.try_omit_fp = be_omit_fp;
return call;
}
/* Insert a store for primitive arguments. */
if (is_atomic_type(param_type)) {
ir_node *store;
- ir_node *mem_input = do_seq ? curr_mem : new_NoMem();
+ ir_node *mem_input = do_seq ? curr_mem : new_r_NoMem(irg);
store = new_rd_Store(dbgi, bl, mem_input, addr, param, 0);
mem = new_r_Proj(store, mode_M, pn_Store_M);
} else {
/* Put caller save into the destroyed set and state registers in the states
* set */
- for (i = 0, n = arch_env_get_n_reg_class(arch_env); i < n; ++i) {
+ for (i = 0, n = arch_env->n_register_classes; i < n; ++i) {
unsigned j;
- const arch_register_class_t *cls = arch_env_get_reg_class(arch_env, i);
+ const arch_register_class_t *cls = &arch_env->register_classes[i];
for (j = 0; j < cls->n_regs; ++j) {
const arch_register_t *reg = arch_register_for_index(cls, j);
}
/* Collect all callee-save registers */
- for (i = 0, n = arch_env_get_n_reg_class(arch_env); i < n; ++i) {
- const arch_register_class_t *cls = arch_env_get_reg_class(arch_env, i);
+ for (i = 0, n = arch_env->n_register_classes; i < n; ++i) {
+ const arch_register_class_t *cls = &arch_env->register_classes[i];
for (j = 0; j < cls->n_regs; ++j) {
const arch_register_t *reg = &cls->regs[j];
if (arch_register_type_is(reg, callee_save) ||
ir_mode *mode = get_type_mode(param_type);
ir_mode *load_mode = arg->load_mode;
- ir_node *load = new_r_Load(start_bl, new_NoMem(), addr, load_mode, cons_floats);
+ ir_node *load = new_r_Load(start_bl, new_r_NoMem(irg), addr, load_mode, cons_floats);
repl = new_r_Proj(load, load_mode, pn_Load_res);
if (mode != load_mode) {
arch_register_t **stateregs = NEW_ARR_F(arch_register_t*, 0);
/* Collect caller save registers */
- n = arch_env_get_n_reg_class(arch_env);
+ n = arch_env->n_register_classes;
for (i = 0; i < n; ++i) {
unsigned j;
- const arch_register_class_t *cls = arch_env_get_reg_class(arch_env, i);
+ const arch_register_class_t *cls = &arch_env->register_classes[i];
for (j = 0; j < cls->n_regs; ++j) {
const arch_register_t *reg = arch_register_for_index(cls, j);
if (arch_register_type_is(reg, state)) {
&& !(get_entity_linkage(entity) & IR_LINKAGE_MERGE);
}
+static ir_node *get_pic_base(ir_graph *irg)
+{
+ const arch_env_t *arch_env = be_get_irg_arch_env(irg);
+ if (arch_env->impl->get_pic_base == NULL)
+ return NULL;
+ return arch_env->impl->get_pic_base(irg);
+}
+
/** patches SymConsts to work in position independent code */
static void fix_pic_symconsts(ir_node *node, void *data)
{
- ir_node *pic_base;
- ir_node *add;
- ir_node *block;
- ir_mode *mode;
- ir_node *load;
- ir_node *load_res;
- ir_graph *irg = get_irn_irg(node);
- int arity, i;
- be_main_env_t *be = be_get_irg_main_env(irg);
+ ir_graph *irg = get_irn_irg(node);
+ be_main_env_t *be = be_get_irg_main_env(irg);
+ ir_node *pic_base;
+ ir_node *add;
+ ir_node *block;
+ ir_mode *mode;
+ ir_node *load;
+ ir_node *load_res;
+ int arity, i;
(void) data;
arity = get_irn_arity(node);
dbgi = get_irn_dbg_info(pred);
trampoline = get_trampoline(be, entity);
trampoline_const = new_rd_SymConst_addr_ent(dbgi, irg, mode_P_code,
- trampoline, NULL);
+ trampoline);
set_irn_n(node, i, trampoline_const);
continue;
}
/* everything else is accessed relative to EIP */
mode = get_irn_mode(pred);
- pic_base = arch_code_generator_get_pic_base(be_get_irg_cg(irg));
+ pic_base = get_pic_base(irg);
/* all ok now for locally constructed stuff */
if (can_address_relative(entity)) {
dbgi = get_irn_dbg_info(pred);
pic_symbol = get_pic_symbol(be, entity);
pic_symconst = new_rd_SymConst_addr_ent(dbgi, irg, mode_P_code,
- pic_symbol, NULL);
+ pic_symbol);
add = new_r_Add(block, pic_base, pic_symconst, mode);
mark_irn_visited(add);
/* we need an extra indirection for global data outside our current
module. The loads are always safe and can therefore float
and need no memory input */
- load = new_r_Load(block, new_NoMem(), add, mode, cons_floats);
+ load = new_r_Load(block, new_r_NoMem(irg), add, mode, cons_floats);
load_res = new_r_Proj(load, mode, pn_Load_res);
set_irn_n(node, i, load_res);
return env;
be_omit_fp = options->omit_fp;
- be_omit_leaf_fp = options->omit_leaf_fp;
env->dce_survivor = new_survive_dce();
env->keep_map = pmap_create();