&TEMPLATE_registers[REG_SP], /* stack pointer register */
&TEMPLATE_registers[REG_BP], /* base pointer register */
&TEMPLATE_reg_classes[CLASS_TEMPLATE_gp], /* link pointer register class */
- -1, /* stack direction */
2, /* power of two stack alignment for calls, 2^2 == 4 */
NULL, /* main environment */
7, /* costs for a spill instruction */
&amd64_registers[REG_RSP], /* stack pointer register */
&amd64_registers[REG_RBP], /* base pointer register */
&amd64_reg_classes[CLASS_amd64_gp], /* link pointer register class */
- -1, /* stack direction */
3, /* power of two stack alignment for calls, 2^2 == 4 */
NULL, /* main environment */
7, /* costs for a spill instruction */
layout->param_map = NULL; /* TODO */
layout->initial_offset = 0;
layout->initial_bias = 0;
- layout->stack_dir = -1;
layout->sp_relative = true;
assert(N_FRAME_TYPES == 3);
&arm_registers[REG_SP], /* stack pointer */
&arm_registers[REG_R11], /* base pointer */
&arm_reg_classes[CLASS_arm_gp], /* static link pointer class */
- -1, /* stack direction */
2, /* power of two stack alignment for calls, 2^2 == 4 */
NULL, /* main environment */
7, /* spill costs */
* @param args the stack argument layout type
* @param between the between layout type
* @param locals the method frame type
- * @param stack_dir the stack direction: < 0 decreasing, > 0 increasing addresses
* @param param_map an array mapping method argument positions to the stack argument type
*
* @return the initialized stack layout
*/
static be_stack_layout_t *stack_frame_init(be_stack_layout_t *frame, ir_type *args,
- ir_type *between, ir_type *locals, int stack_dir,
+ ir_type *between, ir_type *locals,
ir_entity *param_map[])
{
frame->arg_type = args;
frame->frame_type = locals;
frame->initial_offset = 0;
frame->initial_bias = 0;
- frame->stack_dir = stack_dir;
frame->order[1] = between;
frame->param_map = param_map;
- if (stack_dir > 0) {
- frame->order[0] = args;
- frame->order[2] = locals;
- } else {
- /* typical decreasing stack: locals have the
- * lowest addresses, arguments the highest */
- frame->order[0] = locals;
- frame->order[2] = args;
- }
+ /* typical decreasing stack: locals have the
+ * lowest addresses, arguments the highest */
+ frame->order[0] = locals;
+ frame->order[2] = args;
return frame;
}
ir_node *curr_mem = get_Call_mem(irn);
ir_node *bl = get_nodes_block(irn);
int stack_size = 0;
- int stack_dir = arch_env->stack_dir;
const arch_register_t *sp = arch_env->sp;
be_abi_call_t *call = be_abi_call_new(sp->reg_class);
ir_mode *mach_mode = sp->reg_class->mode;
* Note: we also have to do this for stack_size == 0, because we may have
* to adjust stack alignment for the call.
*/
- if (stack_dir < 0 && !do_seq && !no_alloc) {
+ if (!do_seq && !no_alloc) {
curr_sp = be_new_IncSP(sp, bl, curr_sp, stack_size, 1);
}
* We must them reverse again if they are pushed (not stored) and the stack
* direction is downwards.
*/
- if (call->flags.bits.left_to_right ^ (do_seq && stack_dir < 0)) {
+ if (call->flags.bits.left_to_right ^ do_seq) {
for (i = 0; i < n_stack_params >> 1; ++i) {
int other = n_stack_params - i - 1;
int tmp = stack_param_idx[i];
ir_type *method_type, ir_type *val_param_tp,
ir_entity ***param_map)
{
- const arch_env_t *arch_env = be_get_irg_arch_env(irg);
int dir = env->call->flags.bits.left_to_right ? 1 : -1;
- int inc = arch_env->stack_dir * dir;
+ int inc = -dir;
int n = get_method_n_params(method_type);
int curr = inc > 0 ? 0 : n - 1;
struct obstack *obst = be_get_be_obst(irg);
bet_type = call->cb->get_between_type(env->cb);
stack_frame_init(stack_layout, arg_type, bet_type,
- get_irg_frame_type(irg), arch_env->stack_dir, param_map);
+ get_irg_frame_type(irg), param_map);
stack_layout->sp_relative = call->flags.bits.try_omit_fp;
/* Count the register params and add them to the number of Projs for the RegParams node */
const arch_register_t *bp; /**< The base pointer register. */
const arch_register_class_t *link_class; /**< The static link pointer
register class. */
- 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 */
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) */
};
static int stack_frame_compute_initial_offset(be_stack_layout_t *frame)
{
- ir_type *base = frame->stack_dir < 0 ? frame->between_type : frame->frame_type;
+ ir_type *base = frame->between_type;
ir_entity *ent = search_ent_with_offset(base, 0);
if (ent == NULL) {
- frame->initial_offset
- = frame->stack_dir < 0 ? get_type_size_bytes(frame->frame_type) : get_type_size_bytes(frame->between_type);
+ frame->initial_offset = get_type_size_bytes(frame->frame_type);
} else {
frame->initial_offset = be_get_stack_entity_offset(frame, ent, 0);
}
&ia32_registers[REG_ESP], /* stack pointer register */
&ia32_registers[REG_EBP], /* base pointer register */
&ia32_reg_classes[CLASS_ia32_gp], /* static link pointer register class */
- -1, /* stack direction */
2, /* power of two stack alignment, 2^2 == 4 */
NULL, /* main environment */
7, /* costs for a spill instruction */
&sparc_registers[REG_SP], /* stack pointer register */
&sparc_registers[REG_FRAME_POINTER],/* base pointer register */
&sparc_reg_classes[CLASS_sparc_gp], /* link pointer register class */
- -1, /* stack direction */
3, /* power of two stack alignment
for calls */
NULL, /* main environment */
layout->arg_type = arg_type;
layout->initial_offset = 0;
layout->initial_bias = 0;
- layout->stack_dir = -1;
layout->sp_relative = cconv->omit_fp;
assert(N_FRAME_TYPES == 3);