/* Make additional projs for the caller save registers
and the Keep node which keeps them alive. */
- if (pset_count(caller_save) + n_reg_results > 0) {
+ if (1 || pset_count(caller_save) + n_reg_results > 0) {
const arch_register_t *reg;
ir_node **in, *keep;
- int i, n;
+ int i;
+ int n = 0;
int curr_res_proj
= pn_be_Call_first_res + n_reg_results;
- for (reg = pset_first(caller_save), n = 0; reg; reg = pset_next(caller_save), ++n) {
+ /* also keep the stack pointer */
+ ++n;
+ set_irn_link(curr_sp, (void*) sp);
+ obstack_ptr_grow(obst, curr_sp);
+
+ for (reg = pset_first(caller_save); reg; reg = pset_next(caller_save), ++n) {
ir_node *proj = new_r_Proj(irg, bl, low_call, reg->reg_class->mode,
curr_res_proj);
}
if (! mem_proj) {
- mem_proj = new_r_Proj(irg, bl, low_call, mode_M, pn_Call_M);
+ mem_proj = new_r_Proj(irg, bl, low_call, mode_M, pn_be_Call_M_regular);
keep_alive(mem_proj);
}
obstack_free(&env->obst, nodes);
- /* Keep the last stack state in the block by tying it to Keep node */
- if(curr_sp != env->init_sp) {
+ /* Keep the last stack state in the block by tying it to Keep node,
+ * the proj from calls is already kept */
+ if(curr_sp != env->init_sp
+ && !(is_Proj(curr_sp) && be_is_Call(get_Proj_pred(curr_sp)))) {
nodes[0] = curr_sp;
keep = be_new_Keep(env->isa->sp->reg_class, get_irn_irg(bl),
bl, 1, nodes);