Commit e8e667ac authored by Matthias Braun's avatar Matthias Braun
Browse files

Let backends remember omit_fp setting on their own

They previously used be_stack_layout but that structure will be remove
soon.
parent 3a696605
......@@ -89,6 +89,7 @@ x86_cconv_t *amd64_decide_calling_convention(ir_type *function_type,
omit_fp = be_options.omit_fp;
if (omit_fp)
irg_walk_graph(irg, check_omit_fp, NULL, &omit_fp);
amd64_get_irg_data(irg)->omit_fp = omit_fp;
}
unsigned *caller_saves = rbitset_malloc(N_AMD64_REGISTERS);
......
......@@ -80,9 +80,8 @@ static void amd64_set_frame_offset(ir_node *node, int offset)
amd64_addr_attr_t *attr = get_amd64_addr_attr(node);
attr->addr.immediate.offset += offset;
if (is_amd64_pop_am(node)) {
ir_graph *irg = get_irn_irg(node);
be_stack_layout_t *layout = be_get_irg_stack_layout(irg);
if (layout->sp_relative)
ir_graph *irg = get_irn_irg(node);
if (amd64_get_irg_data(irg)->omit_fp)
attr->addr.immediate.offset -= get_insn_size_bytes(attr->size);
}
assert(attr->addr.immediate.kind == X86_IMM_FRAMEENT);
......@@ -519,17 +518,16 @@ static void amd64_select_instructions(ir_graph *irg)
be_dump(DUMP_BE, irg, "opt");
}
static void introduce_epilogue(ir_node *ret)
static void introduce_epilogue(ir_node *ret, bool omit_fp)
{
ir_graph *irg = get_irn_irg(ret);
ir_node *block = get_nodes_block(ret);
ir_type *frame_type = get_irg_frame_type(irg);
unsigned frame_size = get_type_size(frame_type);
be_stack_layout_t *layout = be_get_irg_stack_layout(irg);
ir_node *first_sp = get_irn_n(ret, n_amd64_ret_stack);
ir_node *curr_sp = first_sp;
if (!layout->sp_relative) {
if (!omit_fp) {
int const n_rbp = determine_rbp_input(ret);
ir_node *curr_bp = get_irn_n(ret, n_rbp);
ir_node *curr_mem = get_irn_n(ret, n_amd64_ret_mem);
......@@ -557,7 +555,7 @@ static void introduce_epilogue(ir_node *ret)
}
}
static void introduce_prologue(ir_graph *const irg)
static void introduce_prologue(ir_graph *const irg, bool omit_fp)
{
const arch_register_t *sp = &amd64_registers[REG_RSP];
const arch_register_t *bp = &amd64_registers[REG_RBP];
......@@ -565,10 +563,9 @@ static void introduce_prologue(ir_graph *const irg)
ir_node *block = get_nodes_block(start);
ir_type *frame_type = get_irg_frame_type(irg);
unsigned frame_size = get_type_size(frame_type);
be_stack_layout_t *layout = be_get_irg_stack_layout(irg);
ir_node *initial_sp = be_get_Start_proj(irg, sp);
if (!layout->sp_relative) {
if (!omit_fp) {
/* push rbp */
ir_node *const mem = get_irg_initial_mem(irg);
ir_node *const initial_bp = be_get_Start_proj(irg, bp);
......@@ -591,6 +588,7 @@ static void introduce_prologue(ir_graph *const irg)
/* make sure the initial IncSP is really used by someone */
be_keep_if_unused(incsp);
be_stack_layout_t *const layout = be_get_irg_stack_layout(irg);
layout->initial_bias = -8;
} else {
if (frame_size > 0) {
......@@ -602,15 +600,15 @@ static void introduce_prologue(ir_graph *const irg)
}
}
static void introduce_prologue_epilogue(ir_graph *irg)
static void introduce_prologue_epilogue(ir_graph *irg, bool omit_fp)
{
/* introduce epilogue for every return node */
foreach_irn_in(get_irg_end_block(irg), i, ret) {
assert(is_amd64_ret(ret));
introduce_epilogue(ret);
introduce_epilogue(ret, omit_fp);
}
introduce_prologue(irg);
introduce_prologue(irg, omit_fp);
}
/**
......@@ -618,18 +616,17 @@ static void introduce_prologue_epilogue(ir_graph *irg)
*/
static void amd64_finish_and_emit(ir_graph *irg)
{
be_stack_layout_t *stack_layout = be_get_irg_stack_layout(irg);
bool at_begin = stack_layout->sp_relative;
be_fec_env_t *fec_env = be_new_frame_entity_coalescer(irg);
bool omit_fp = amd64_get_irg_data(irg)->omit_fp;
be_fec_env_t *fec_env = be_new_frame_entity_coalescer(irg);
/* create and coalesce frame entities */
irg_walk_graph(irg, NULL, amd64_collect_frame_entity_nodes, fec_env);
be_assign_entities(fec_env, amd64_set_frame_entity, at_begin);
be_assign_entities(fec_env, amd64_set_frame_entity, omit_fp);
be_free_frame_entity_coalescer(fec_env);
irg_block_walk_graph(irg, NULL, amd64_after_ra_walker, NULL);
introduce_prologue_epilogue(irg);
introduce_prologue_epilogue(irg, omit_fp);
/* fix stack entity offsets */
be_fix_stack_nodes(irg, &amd64_registers[REG_RSP]);
......@@ -671,6 +668,9 @@ static void amd64_generate_code(FILE *output, const char *cup_name)
if (!be_step_first(irg))
continue;
struct obstack *obst = be_get_be_obst(irg);
be_birg_from_irg(irg)->isa_link = OALLOCZ(obst, amd64_irg_data_t);
be_birg_from_irg(irg)->non_ssa_regs = sp_is_non_ssa;
amd64_select_instructions(irg);
......
......@@ -10,9 +10,14 @@
#ifndef FIRM_BE_AMD64_BEARCH_AMD64_T_H
#define FIRM_BE_AMD64_BEARCH_AMD64_T_H
#include "beirg.h"
#include "../ia32/x86_cconv.h"
#include "../ia32/x86_x87.h"
typedef struct amd64_irg_data_t {
bool omit_fp;
} amd64_irg_data_t;
extern pmap *amd64_constants; /**< A map of entities that store const tarvals */
extern ir_mode *amd64_mode_xmm;
......@@ -24,6 +29,11 @@ extern bool amd64_use_x64_abi;
/** power of two stack alignment on calls */
#define AMD64_PO2_STACK_ALIGNMENT 4
static inline amd64_irg_data_t *amd64_get_irg_data(ir_graph const *const irg)
{
return (amd64_irg_data_t*)be_birg_from_irg(irg)->isa_link;
}
/**
* Determine how function parameters and return values are passed.
* Decides what goes to register or to stack and what stack offsets/
......
......@@ -9,6 +9,8 @@
* @author Matthias Braun
*/
#include "arm_cconv.h"
#include "bearch_arm_t.h"
#include "becconv.h"
#include "beirg.h"
#include "irmode_t.h"
......@@ -147,6 +149,7 @@ calling_convention_t *arm_decide_calling_convention(const ir_graph *irg,
assert(birg->allocatable_regs == NULL);
birg->allocatable_regs = be_cconv_alloc_all_regs(&birg->obst, N_ARM_REGISTERS);
be_cconv_rem_regs(birg->allocatable_regs, ignore_regs, ARRAY_SIZE(ignore_regs));
arm_get_irg_data(irg)->omit_fp = true;
}
return cconv;
......
......@@ -173,12 +173,11 @@ static ir_entity *arm_get_frame_entity(const ir_node *irn)
void arm_finish_graph(ir_graph *irg)
{
be_stack_layout_t *stack_layout = be_get_irg_stack_layout(irg);
bool at_begin = stack_layout->sp_relative;
be_fec_env_t *fec_env = be_new_frame_entity_coalescer(irg);
bool omit_fp = arm_get_irg_data(irg)->omit_fp;
be_fec_env_t *fec_env = be_new_frame_entity_coalescer(irg);
irg_walk_graph(irg, NULL, arm_collect_frame_entity_nodes, fec_env);
be_assign_entities(fec_env, arm_set_frame_entity, at_begin);
be_assign_entities(fec_env, arm_set_frame_entity, omit_fp);
be_free_frame_entity_coalescer(fec_env);
introduce_prolog_epilog(irg);
......
......@@ -179,6 +179,9 @@ static void arm_generate_code(FILE *output, const char *cup_name)
if (!be_step_first(irg))
continue;
struct obstack *obst = be_get_be_obst(irg);
be_birg_from_irg(irg)->isa_link = OALLOCZ(obst, arm_irg_data_t);
be_birg_from_irg(irg)->non_ssa_regs = sp_is_non_ssa;
arm_select_instructions(irg);
......
......@@ -13,8 +13,13 @@
#include <stdbool.h>
#include "beirg.h"
#include "firm_types.h"
typedef struct arm_irg_data_t {
bool omit_fp;
} arm_irg_data_t;
typedef struct arm_isa_t arm_isa_t;
/**
......@@ -45,6 +50,11 @@ extern arm_codegen_config_t arm_cg_config;
extern ir_mode *arm_mode_gp;
extern ir_mode *arm_mode_flags;
static inline arm_irg_data_t *arm_get_irg_data(ir_graph const *const irg)
{
return (arm_irg_data_t*)be_birg_from_irg(irg)->isa_link;
}
void arm_finish_graph(ir_graph *irg);
void arm_lower_64bit(void);
......
......@@ -247,9 +247,9 @@ static void ia32_build_between_type(void)
*/
ir_entity *ia32_get_return_address_entity(ir_graph *irg)
{
const be_stack_layout_t *layout = be_get_irg_stack_layout(irg);
ia32_build_between_type();
return layout->sp_relative ? omit_fp_ret_addr_ent : ret_addr_ent;
return ia32_get_irg_data(irg)->omit_fp ? omit_fp_ret_addr_ent
: ret_addr_ent;
}
/**
......@@ -257,9 +257,8 @@ ir_entity *ia32_get_return_address_entity(ir_graph *irg)
*/
ir_entity *ia32_get_frame_address_entity(ir_graph *irg)
{
const be_stack_layout_t *layout = be_get_irg_stack_layout(irg);
ia32_build_between_type();
return layout->sp_relative ? NULL : old_bp_ent;
return ia32_get_irg_data(irg)->omit_fp ? NULL : old_bp_ent;
}
/**
......@@ -981,14 +980,13 @@ static int determine_ebp_input(ir_node *ret)
panic("no ebp input found at %+F", ret);
}
static void introduce_epilogue(ir_node *const ret)
static void introduce_epilogue(ir_node *const ret, bool const omit_fp)
{
ir_node *curr_sp;
ir_node *const first_sp = get_irn_n(ret, n_ia32_Return_stack);
ir_node *const block = get_nodes_block(ret);
ir_graph *const irg = get_irn_irg(ret);
be_stack_layout_t *const layout = be_get_irg_stack_layout(irg);
if (!layout->sp_relative) {
ir_node *curr_sp;
ir_node *const first_sp = get_irn_n(ret, n_ia32_Return_stack);
ir_node *const block = get_nodes_block(ret);
ir_graph *const irg = get_irn_irg(ret);
if (!omit_fp) {
arch_register_t const *const sp = &ia32_registers[REG_ESP];
arch_register_t const *const bp = &ia32_registers[REG_EBP];
......@@ -1029,7 +1027,7 @@ static void introduce_epilogue(ir_node *const ret)
kill_node(first_sp);
}
static void introduce_prologue(ir_graph *const irg)
static void introduce_prologue(ir_graph *const irg, bool omit_fp)
{
const arch_register_t *sp = &ia32_registers[REG_ESP];
const arch_register_t *bp = &ia32_registers[REG_EBP];
......@@ -1037,10 +1035,9 @@ static void introduce_prologue(ir_graph *const irg)
ir_node *block = get_nodes_block(start);
ir_type *frame_type = get_irg_frame_type(irg);
unsigned frame_size = get_type_size(frame_type);
be_stack_layout_t *layout = be_get_irg_stack_layout(irg);
ir_node *initial_sp = be_get_Start_proj(irg, sp);
if (!layout->sp_relative) {
if (!omit_fp) {
/* push ebp */
ir_node *const mem = get_irg_initial_mem(irg);
ir_node *const noreg = ia32_new_NoReg_gp(irg);
......@@ -1064,6 +1061,7 @@ static void introduce_prologue(ir_graph *const irg)
/* make sure the initial IncSP is really used by someone */
be_keep_if_unused(incsp);
be_stack_layout_t *const layout = be_get_irg_stack_layout(irg);
layout->initial_bias = -4;
} else {
ir_node *const incsp = ia32_new_IncSP(block, initial_sp, frame_size, 0);
......@@ -1075,15 +1073,15 @@ static void introduce_prologue(ir_graph *const irg)
/**
* Put the prologue code at the beginning, epilogue code before each return
*/
static void introduce_prologue_epilogue(ir_graph *const irg)
static void introduce_prologue_epilogue(ir_graph *const irg, bool omit_fp)
{
/* introduce epilogue for every return node */
foreach_irn_in(get_irg_end_block(irg), i, ret) {
assert(is_ia32_Return(ret));
introduce_epilogue(ret);
introduce_epilogue(ret, omit_fp);
}
introduce_prologue(irg);
introduce_prologue(irg, omit_fp);
}
static x87_attr_t *ia32_get_x87_attr(ir_node *const node)
......@@ -1099,18 +1097,17 @@ static void ia32_before_emit(ir_graph *irg)
* virtual with real x87 instructions, creating a block schedule and
* peephole optimizations.
*/
be_stack_layout_t *stack_layout = be_get_irg_stack_layout(irg);
bool at_begin = stack_layout->sp_relative;
be_fec_env_t *fec_env = be_new_frame_entity_coalescer(irg);
bool omit_fp = ia32_get_irg_data(irg)->omit_fp;
be_fec_env_t *fec_env = be_new_frame_entity_coalescer(irg);
/* create and coalesce frame entities */
irg_walk_graph(irg, NULL, ia32_collect_frame_entity_nodes, fec_env);
be_assign_entities(fec_env, ia32_set_frame_entity, at_begin);
be_assign_entities(fec_env, ia32_set_frame_entity, omit_fp);
be_free_frame_entity_coalescer(fec_env);
irg_block_walk_graph(irg, NULL, ia32_after_ra_walker, NULL);
introduce_prologue_epilogue(irg);
introduce_prologue_epilogue(irg, omit_fp);
/* fix stack entity offsets */
be_fix_stack_nodes(irg, &ia32_registers[REG_ESP]);
......@@ -1123,8 +1120,7 @@ static void ia32_before_emit(ir_graph *irg)
be_dump(DUMP_RA, irg, "2addr");
/* we might have to rewrite x87 virtual registers */
ia32_irg_data_t const *const irg_data = ia32_get_irg_data(irg);
if (irg_data->do_x87_sim) {
if (ia32_get_irg_data(irg)->do_x87_sim) {
x86_prepare_x87_callbacks_ia32();
const x87_simulator_config_t config = {
.regclass = &ia32_reg_classes[CLASS_ia32_fp],
......@@ -1150,11 +1146,6 @@ static void ia32_before_emit(ir_graph *irg)
*/
static void ia32_select_instructions(ir_graph *irg)
{
struct obstack *obst = be_get_be_obst(irg);
ia32_irg_data_t *irg_data = OALLOCZ(obst, ia32_irg_data_t);
be_birg_from_irg(irg)->isa_link = irg_data;
if (gprof) {
/* Linux gprof implementation needs base pointer */
be_options.omit_fp = 0;
......@@ -1478,6 +1469,9 @@ static bool lower_for_emit(ir_graph *const irg, unsigned *const sp_is_non_ssa)
if (!be_step_first(irg))
return false;
struct obstack *obst = be_get_be_obst(irg);
be_birg_from_irg(irg)->isa_link = OALLOCZ(obst, ia32_irg_data_t);
be_birg_from_irg(irg)->non_ssa_regs = sp_is_non_ssa;
ia32_select_instructions(irg);
......
......@@ -25,6 +25,7 @@
typedef struct ia32_irg_data_t {
bool do_x87_sim; /**< Should simulate x87 register stack. */
bool omit_fp; /**< No frame pointer is used. */
ir_node *noreg_gp; /**< unique NoReg_GP node */
ir_node *noreg_fp; /**< unique NoReg_FP node */
ir_node *noreg_xmm; /**< unique NoReg_XMM node */
......
......@@ -96,6 +96,7 @@ x86_cconv_t *ia32_decide_calling_convention(ir_type const *const function_type,
omit_fp = be_options.omit_fp;
if (omit_fp)
irg_walk_graph(irg, check_omit_fp, NULL, &omit_fp);
ia32_get_irg_data(irg)->omit_fp = omit_fp;
}
mtp_additional_properties mtp
......
......@@ -62,7 +62,7 @@ static char pic_base_label[128];
static ir_label_t exc_label_id;
static bool mark_spill_reload;
static bool sp_relative;
static bool omit_fp;
static int frame_type_size;
static int callframe_offset;
static ir_entity *thunks[N_ia32_gp_REGS];
......@@ -1403,7 +1403,7 @@ static void ia32_emit_node(ir_node *node)
be_emit_node(node);
if (sp_relative) {
if (omit_fp) {
int sp_change = ia32_get_sp_bias(node);
if (sp_change != 0) {
assert(sp_change != SP_BIAS_RESET);
......@@ -1524,7 +1524,7 @@ static void ia32_gen_block(ir_node *block)
{
ia32_emit_block_header(block);
if (sp_relative) {
if (omit_fp) {
ir_graph *irg = get_irn_irg(block);
callframe_offset = 4; /* 4 bytes for the return address */
/* ESP guessing, TODO perform a real ESP simulation */
......@@ -1684,9 +1684,8 @@ void ia32_emit_function(ir_graph *const irg)
NULL);
free(infos);
be_stack_layout_t *const layout = be_get_irg_stack_layout(irg);
sp_relative = layout->sp_relative;
if (layout->sp_relative) {
omit_fp = ia32_get_irg_data(irg)->omit_fp;
if (omit_fp) {
ir_type *frame_type = get_irg_frame_type(irg);
frame_type_size = get_type_size(frame_type);
be_dwarf_callframe_register(&ia32_registers[REG_ESP]);
......
......@@ -435,6 +435,9 @@ static void sparc_generate_code(FILE *output, const char *cup_name)
if (!be_step_first(irg))
continue;
struct obstack *obst = be_get_be_obst(irg);
be_birg_from_irg(irg)->isa_link = OALLOCZ(obst, sparc_irg_data_t);
be_birg_from_irg(irg)->non_ssa_regs = sp_is_non_ssa;
sparc_select_instructions(irg);
......
......@@ -14,11 +14,16 @@
#include <stdbool.h>
#include <stdint.h>
#include "beirg.h"
#include "firm_types.h"
#include "pmap.h"
typedef struct calling_convention_t calling_convention_t;
typedef struct sparc_irg_data_t {
bool omit_fp;
} sparc_irg_data_t;
typedef struct sparc_codegen_config_t {
bool use_fpu;
bool use_cas;
......@@ -58,13 +63,18 @@ static inline bool sparc_is_value_imm_encodeable(int32_t value)
return SPARC_IMMEDIATE_MIN <= value && value <= SPARC_IMMEDIATE_MAX;
}
static inline sparc_irg_data_t *sparc_get_irg_data(ir_graph const *const irg)
{
return (sparc_irg_data_t*)be_birg_from_irg(irg)->isa_link;
}
void sparc_finish_graph(ir_graph *irg);
void sparc_lower_64bit(void);
bool sparc_variadic_fixups(ir_graph *irg, calling_convention_t *cconv);
void sparc_create_stacklayout(ir_graph *irg, calling_convention_t *cconv);
void sparc_adjust_stack_entity_offsets(ir_graph *irg);
void sparc_adjust_stack_entity_offsets(ir_graph *irg, bool omit_fp);
void sparc_fix_stack_bias(ir_graph *irg);
ir_entity *sparc_get_va_start_entity(void);
......
......@@ -178,6 +178,7 @@ calling_convention_t *sparc_decide_calling_convention(ir_type *function_type,
omit_fp = false;
if (omit_fp)
irg_walk_graph(irg, check_omit_fp, NULL, &omit_fp);
sparc_get_irg_data(irg)->omit_fp = omit_fp;
}
mtp_additional_properties mtp
......
......@@ -915,7 +915,7 @@ static int get_real_entity_offset(const ir_node *node, ir_entity *ent)
be_stack_layout_t *layout = be_get_irg_stack_layout(irg);
const int off_ent = be_get_stack_entity_offset(layout, ent, 0);
if (layout->sp_relative) {
if (sparc_get_irg_data(irg)->omit_fp) {
ir_entity *ent_ref = be_get_MemPerm_in_entity(node, 0);
const int off_ref = be_get_stack_entity_offset(layout, ent_ref, 0);
const int delta_ent = off_ent - off_ref;
......@@ -930,11 +930,10 @@ static int get_real_entity_offset(const ir_node *node, ir_entity *ent)
static void memperm_emit_copy(const ir_node *node, ir_entity *in_ent,
ir_entity *out_ent)
{
ir_graph *irg = get_irn_irg(node);
be_stack_layout_t *layout = be_get_irg_stack_layout(irg);
const char *reg = layout->sp_relative ? "sp" : "fp";
const int off_in = get_real_entity_offset(node, in_ent);
const int off_out = get_real_entity_offset(node, out_ent);
ir_graph *irg = get_irn_irg(node);
const char *reg = sparc_get_irg_data(irg)->omit_fp ? "sp" : "fp";
const int off_in = get_real_entity_offset(node, in_ent);
const int off_out = get_real_entity_offset(node, out_ent);
sparc_emitf(node, "ld [%%%s%+d], %%l0", reg, off_in);
sparc_emitf(node, "st %%l0, [%%%s%+d]", reg, off_out);
......@@ -943,11 +942,10 @@ static void memperm_emit_copy(const ir_node *node, ir_entity *in_ent,
static void memperm_emit_swap(const ir_node *node, ir_entity *ent1,
ir_entity *ent2)
{
ir_graph *irg = get_irn_irg(node);
be_stack_layout_t *layout = be_get_irg_stack_layout(irg);
const char *reg = layout->sp_relative ? "sp" : "fp";
const int off1 = get_real_entity_offset(node, ent1);
const int off2 = get_real_entity_offset(node, ent2);
ir_graph *irg = get_irn_irg(node);
const char *reg = sparc_get_irg_data(irg)->omit_fp ? "sp" : "fp";
const int off1 = get_real_entity_offset(node, ent1);
const int off2 = get_real_entity_offset(node, ent2);
sparc_emitf(node, "ld [%%%s%+d], %%l0", reg, off1);
sparc_emitf(node, "ld [%%%s%+d], %%l1", reg, off2);
......
......@@ -131,16 +131,15 @@ static void kill_unused_stacknodes(ir_node *node)
}
}
static void introduce_epilog(ir_node *ret)
static void introduce_epilog(ir_node *ret, bool omit_fp)
{
arch_register_t const *const sp_reg = &sparc_registers[REG_SP];
assert(arch_get_irn_register_req_in(ret, n_sparc_Return_sp) == sp_reg->single_req);
ir_node *const sp = get_irn_n(ret, n_sparc_Return_sp);
ir_node *const block = get_nodes_block(ret);
ir_graph *const irg = get_irn_irg(ret);
be_stack_layout_t *const layout = be_get_irg_stack_layout(irg);
if (!layout->sp_relative) {
ir_node *const sp = get_irn_n(ret, n_sparc_Return_sp);
ir_node *const block = get_nodes_block(ret);
ir_graph *const irg = get_irn_irg(ret);
if (!omit_fp) {
arch_register_t const *const fp_reg = &sparc_registers[REG_FP];
ir_node *const fp = be_get_Start_proj(irg, fp_reg);
ir_node *const new_sp = be_get_Start_proj(irg, sp_reg);
......@@ -158,11 +157,10 @@ static void introduce_epilog(ir_node *ret)
}
}
static void sparc_introduce_prolog_epilog(ir_graph *irg)
static void sparc_introduce_prolog_epilog(ir_graph *irg, bool omit_fp)
{
const arch_register_t *sp_reg = &sparc_registers[REG_SP];
ir_node *start = get_irg_start(irg);
be_stack_layout_t *layout = be_get_irg_stack_layout(irg);
ir_node *block = get_nodes_block(start);
ir_node *initial_sp = be_get_Start_proj(irg, sp_reg);
ir_type *frame_type = get_irg_frame_type(irg);
......@@ -171,10 +169,10 @@ static void sparc_introduce_prolog_epilog(ir_graph *irg)
/* introduce epilog for every return node */
foreach_irn_in(get_irg_end_block(irg), i, ret) {
assert(is_sparc_Return(ret));
introduce_epilog(ret);
introduce_epilog(ret, omit_fp);
}
if (!layout->sp_relative) {
if (!omit_fp) {
ir_node *const save = new_bd_sparc_Save_imm(NULL, block, initial_sp, NULL, -(SPARC_MIN_STACKSIZE + frame_size));
arch_set_irn_register(save, sp_reg);
sched_add_after(start, save);
......@@ -683,16 +681,15 @@ static void fix_constraints_walker(ir_node *block, void *env)
void sparc_finish_graph(ir_graph *irg)
{
be_stack_layout_t *stack_layout = be_get_irg_stack_layout(irg);
bool at_begin = stack_layout->sp_relative;
be_fec_env_t *fec_env = be_new_frame_entity_coalescer(irg);
bool omit_fp = sparc_get_irg_data(irg)->omit_fp;
be_fec_env_t *fec_env = be_new_frame_entity_coalescer(irg);
irg_walk_graph(irg, NULL, sparc_collect_frame_entity_nodes, fec_env);
be_assign_entities(fec_env, sparc_set_frame_entity, at_begin);
be_assign_entities(fec_env, sparc_set_frame_entity, omit_fp);
be_free_frame_entity_coalescer(fec_env);
sparc_adjust_stack_entity_offsets(irg);
sparc_adjust_stack_entity_offsets(irg, omit_fp);
sparc_introduce_prolog_epilog(irg);
sparc_introduce_prolog_epilog(irg, omit_fp);
/* fix stack entity offsets */
be_fix_stack_nodes(irg, &sparc_registers[REG_SP]);
......
......@@ -86,8 +86,7 @@ ir_entity *sparc_get_frame_entity(const ir_node *node)
return NULL;
}
static void process_bias(ir_node *block, bool sp_relative, int bias,
int free_bytes)
static void process_bias(ir_node *block, bool omit_fp, int bias, int free_bytes)
{
mark_Block_block_visited(block);
......@@ -97,7 +96,7 @@ static void process_bias(ir_node *block, bool sp_relative, int bias,
ir_entity *entity = sparc_get_frame_entity(irn);
if (entity != NULL) {
int offset = get_entity_offset(entity);
if (sp_relative)
if (omit_fp)
offset += bias + SPARC_MIN_STACKSIZE;
sparc_set_frame_offset(irn, offset);
}
......@@ -139,7 +138,7 @@ static void process_bias(ir_node *block, bool sp_relative, int bias,
ir_node *succ = get_edge_src_irn(edge);
if (Block_block_visited(succ))
continue;
process_bias(succ, sp_relative, bias, free_bytes);
process_bias(succ, omit_fp, bias, free_bytes);